subscribeToEvent method

Future<void> subscribeToEvent({
  1. required InspectorEvent event,
  2. required String resourceArn,
  3. required String topicArn,
})

Enables the process of sending Amazon Simple Notification Service (SNS) notifications about a specified event to a specified SNS topic.

May throw InternalException. May throw InvalidInputException. May throw LimitExceededException. May throw AccessDeniedException. May throw NoSuchEntityException. May throw ServiceTemporarilyUnavailableException.

Parameter event : The event for which you want to receive SNS notifications.

Parameter resourceArn : The ARN of the assessment template that is used during the event for which you want to receive SNS notifications.

Parameter topicArn : The ARN of the SNS topic to which the SNS notifications are sent.

Implementation

Future<void> subscribeToEvent({
  required InspectorEvent event,
  required String resourceArn,
  required String topicArn,
}) async {
  ArgumentError.checkNotNull(event, 'event');
  ArgumentError.checkNotNull(resourceArn, 'resourceArn');
  _s.validateStringLength(
    'resourceArn',
    resourceArn,
    1,
    300,
    isRequired: true,
  );
  ArgumentError.checkNotNull(topicArn, 'topicArn');
  _s.validateStringLength(
    'topicArn',
    topicArn,
    1,
    300,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'InspectorService.SubscribeToEvent'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'event': event.toValue(),
      'resourceArn': resourceArn,
      'topicArn': topicArn,
    },
  );
}