modifyEventSubscription method

Future<ModifyEventSubscriptionResult> modifyEventSubscription({
  1. required String subscriptionName,
  2. bool? enabled,
  3. List<String>? eventCategories,
  4. String? snsTopicArn,
  5. String? sourceType,
})

Modifies an existing RDS event notification subscription. You can't modify the source identifiers using this call. To change source identifiers for a subscription, use the AddSourceIdentifierToSubscription and RemoveSourceIdentifierFromSubscription calls.

You can see a list of the event categories for a given source type (SourceType) in Events in the Amazon RDS User Guide or by using the DescribeEventCategories operation.

May throw EventSubscriptionQuotaExceededFault. May throw SNSInvalidTopicFault. May throw SNSNoAuthorizationFault. May throw SNSTopicArnNotFoundFault. May throw SubscriptionCategoryNotFoundFault. May throw SubscriptionNotFoundFault.

Parameter subscriptionName : The name of the RDS event notification subscription.

Parameter enabled : Specifies whether to activate the subscription.

Parameter eventCategories : A list of event categories for a source type (SourceType) that you want to subscribe to. You can see a list of the categories for a given source type in Events in the Amazon RDS User Guide or by using the DescribeEventCategories operation.

Parameter snsTopicArn : The Amazon Resource Name (ARN) of the SNS topic created for event notification. The ARN is created by Amazon SNS when you create a topic and subscribe to it.

Parameter sourceType : The type of source that is generating the events. For example, if you want to be notified of events generated by a DB instance, you would set this parameter to db-instance. For RDS Proxy events, specify db-proxy. If this value isn't specified, all events are returned.

Valid Values: db-instance | db-cluster | db-parameter-group | db-security-group | db-snapshot | db-cluster-snapshot | db-proxy | zero-etl | custom-engine-version | blue-green-deployment

Implementation

Future<ModifyEventSubscriptionResult> modifyEventSubscription({
  required String subscriptionName,
  bool? enabled,
  List<String>? eventCategories,
  String? snsTopicArn,
  String? sourceType,
}) async {
  final $request = <String, String>{
    'SubscriptionName': subscriptionName,
    if (enabled != null) 'Enabled': enabled.toString(),
    if (eventCategories != null)
      if (eventCategories.isEmpty)
        'EventCategories': ''
      else
        for (var i1 = 0; i1 < eventCategories.length; i1++)
          'EventCategories.EventCategory.${i1 + 1}': eventCategories[i1],
    if (snsTopicArn != null) 'SnsTopicArn': snsTopicArn,
    if (sourceType != null) 'SourceType': sourceType,
  };
  final $result = await _protocol.send(
    $request,
    action: 'ModifyEventSubscription',
    version: '2014-10-31',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'ModifyEventSubscriptionResult',
  );
  return ModifyEventSubscriptionResult.fromXml($result);
}