createEventSubscription method
Creates an AWS DMS event notification subscription.
You can specify the type of source (SourceType
) you want to
be notified of, provide a list of AWS DMS source IDs
(SourceIds
) that triggers the events, and provide a list of
event categories (EventCategories
) for events you want to be
notified of. If you specify both the SourceType
and
SourceIds
, such as SourceType =
replication-instance
and SourceIdentifier =
my-replinstance
, you will be notified of all the replication
instance events for the specified source. If you specify a
SourceType
but don't specify a SourceIdentifier
,
you receive notice of the events for that source type for all your AWS DMS
sources. If you don't specify either SourceType
nor
SourceIdentifier
, you will be notified of events generated
from all AWS DMS sources belonging to your customer account.
For more information about AWS DMS events, see Working with Events and Notifications in the AWS Database Migration Service User Guide.
May throw ResourceQuotaExceededFault. May throw ResourceNotFoundFault. May throw ResourceAlreadyExistsFault. May throw SNSInvalidTopicFault. May throw SNSNoAuthorizationFault. May throw KMSAccessDeniedFault. May throw KMSDisabledFault. May throw KMSInvalidStateFault. May throw KMSNotFoundFault. May throw KMSThrottlingFault.
Parameter snsTopicArn
:
The Amazon Resource Name (ARN) of the Amazon SNS topic created for event
notification. The ARN is created by Amazon SNS when you create a topic and
subscribe to it.
Parameter subscriptionName
:
The name of the AWS DMS event notification subscription. This name must be
less than 255 characters.
Parameter enabled
:
A Boolean value; set to true
to activate the subscription, or
set to false
to create the subscription but not activate it.
Parameter eventCategories
:
A list of event categories for a source type that you want to subscribe
to. For more information, see Working
with Events and Notifications in the AWS Database Migration Service
User Guide.
Parameter sourceIds
:
A list of identifiers for which AWS DMS provides notification events.
If you don't specify a value, notifications are provided for all sources.
If you specify multiple values, they must be of the same type. For example, if you specify a database instance ID, then all of the other values must be database instance IDs.
Parameter sourceType
:
The type of AWS DMS resource that generates the events. For example, if
you want to be notified of events generated by a replication instance, you
set this parameter to replication-instance
. If this value
isn't specified, all events are returned.
Valid values: replication-instance
|
replication-task
Parameter tags
:
One or more tags to be assigned to the event subscription.
Implementation
Future<CreateEventSubscriptionResponse> createEventSubscription({
required String snsTopicArn,
required String subscriptionName,
bool? enabled,
List<String>? eventCategories,
List<String>? sourceIds,
String? sourceType,
List<Tag>? tags,
}) async {
ArgumentError.checkNotNull(snsTopicArn, 'snsTopicArn');
ArgumentError.checkNotNull(subscriptionName, 'subscriptionName');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonDMSv20160101.CreateEventSubscription'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'SnsTopicArn': snsTopicArn,
'SubscriptionName': subscriptionName,
if (enabled != null) 'Enabled': enabled,
if (eventCategories != null) 'EventCategories': eventCategories,
if (sourceIds != null) 'SourceIds': sourceIds,
if (sourceType != null) 'SourceType': sourceType,
if (tags != null) 'Tags': tags,
},
);
return CreateEventSubscriptionResponse.fromJson(jsonResponse.body);
}