putNotificationConfiguration method
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 Amazon SNS notification options for Amazon EC2 Auto Scaling 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 SNS topic.
Implementation
Future<void> putNotificationConfiguration({
required String autoScalingGroupName,
required List<String> notificationTypes,
required String topicARN,
}) async {
final $request = <String, String>{
'AutoScalingGroupName': autoScalingGroupName,
if (notificationTypes.isEmpty)
'NotificationTypes': ''
else
for (var i1 = 0; i1 < notificationTypes.length; i1++)
'NotificationTypes.member.${i1 + 1}': notificationTypes[i1],
'TopicARN': topicARN,
};
await _protocol.send(
$request,
action: 'PutNotificationConfiguration',
version: '2011-01-01',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
);
}