putNotificationConfiguration method

Future<void> putNotificationConfiguration({
  1. required String autoScalingGroupName,
  2. required List<String> notificationTypes,
  3. required String topicARN,
})

Configures an Auto Scaling group to send notifications when specified events take place. Subscribers to the specified topic can have messages delivered to an endpoint such as a web server or an email address.

This configuration overwrites any existing configuration.

For more information, see Getting Amazon SNS notifications when your Auto Scaling group scales in the Amazon EC2 Auto Scaling User Guide.

If you exceed your maximum limit of SNS topics, which is 10 per Auto Scaling group, the call fails.

May throw LimitExceededFault. May throw ResourceContentionFault. May throw ServiceLinkedRoleFailure.

Parameter autoScalingGroupName : The name of the Auto Scaling group.

Parameter notificationTypes : The type of event that causes the notification to be sent. To query the notification types supported by Amazon EC2 Auto Scaling, call the DescribeAutoScalingNotificationTypes API.

Parameter topicARN : The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (Amazon SNS) topic.

Implementation

Future<void> putNotificationConfiguration({
  required String autoScalingGroupName,
  required List<String> notificationTypes,
  required String topicARN,
}) async {
  ArgumentError.checkNotNull(autoScalingGroupName, 'autoScalingGroupName');
  _s.validateStringLength(
    'autoScalingGroupName',
    autoScalingGroupName,
    1,
    255,
    isRequired: true,
  );
  ArgumentError.checkNotNull(notificationTypes, 'notificationTypes');
  ArgumentError.checkNotNull(topicARN, 'topicARN');
  _s.validateStringLength(
    'topicARN',
    topicARN,
    1,
    255,
    isRequired: true,
  );
  final $request = <String, dynamic>{};
  $request['AutoScalingGroupName'] = autoScalingGroupName;
  $request['NotificationTypes'] = notificationTypes;
  $request['TopicARN'] = topicARN;
  await _protocol.send(
    $request,
    action: 'PutNotificationConfiguration',
    version: '2011-01-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['PutNotificationConfigurationType'],
    shapes: shapes,
  );
}