putDetector method

Future<void> putDetector({
  1. required String detectorId,
  2. required String eventTypeName,
  3. String? description,
  4. List<Tag>? tags,
})

Creates or updates a detector.

May throw ValidationException. May throw InternalServerException. May throw ThrottlingException. May throw AccessDeniedException.

Parameter detectorId : The detector ID.

Parameter eventTypeName : The name of the event type.

Parameter description : The description of the detector.

Parameter tags : A collection of key and value pairs.

Implementation

Future<void> putDetector({
  required String detectorId,
  required String eventTypeName,
  String? description,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(detectorId, 'detectorId');
  _s.validateStringLength(
    'detectorId',
    detectorId,
    1,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(eventTypeName, 'eventTypeName');
  _s.validateStringLength(
    'eventTypeName',
    eventTypeName,
    1,
    64,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    1,
    128,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSHawksNestServiceFacade.PutDetector'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'detectorId': detectorId,
      'eventTypeName': eventTypeName,
      if (description != null) 'description': description,
      if (tags != null) 'tags': tags,
    },
  );
}