Skip to content

modify_event_subscription

modify_event_subscription(
    *,
    config_overrides: Optional[RDSClientConfig] = None,
    subscription_name: Optional[String] = None,
    sns_topic_arn: Optional[String] = None,
    source_type: Optional[String] = None,
    event_categories: Optional[EventCategoriesList] = None,
    enabled: Optional[BooleanOptional] = None,
) -> ModifyEventSubscriptionResult

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.

Parameters:

  • subscription_name (Optional[String], default: None ) –

    The name of the RDS event notification subscription.

  • sns_topic_arn (Optional[String], default: None ) –

    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.

  • source_type (Optional[String], default: None ) –

    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

  • event_categories (Optional[EventCategoriesList], default: None ) –

    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.

  • enabled (Optional[BooleanOptional], default: None ) –

    Specifies whether to activate the subscription.

Raises:

Examples:

To modify an event subscription The following example turns off the specified event subscription, so that it no longer publishes notifications to the specified Amazon Simple Notification Service topic.

>>> client.modify_event_subscription(subscription_name='my-instance-events', enabled=False)
Source code in docs_src/capo_rds/_services/rds.py
def modify_event_subscription(
    self,
    *,
    config_overrides: Optional[RDSClientConfig] = None,
    subscription_name: Optional["capo_rds.types.string.String"] = None,
    sns_topic_arn: Optional["capo_rds.types.string.String"] = None,
    source_type: Optional["capo_rds.types.string.String"] = None,
    event_categories: Optional[
        "capo_rds.types.event_categories_list.EventCategoriesList"
    ] = None,
    enabled: Optional["capo_rds.types.boolean_optional.BooleanOptional"] = None,
) -> (
    "capo_rds.types.modify_event_subscription_result.ModifyEventSubscriptionResult"
):
    """<p>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 <code>AddSourceIdentifierToSubscription</code> and <code>RemoveSourceIdentifierFromSubscription</code> calls.</p> <p>You can see a list of the event categories for a given source type (<code>SourceType</code>) in <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.html">Events</a> in the <i>Amazon RDS User Guide</i> or by using the <code>DescribeEventCategories</code> operation.</p>

    Args:
        subscription_name: <p>The name of the RDS event notification subscription.</p>
        sns_topic_arn: <p>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.</p>
        source_type: <p>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 <code>db-proxy</code>. If this value isn't specified, all events are returned.</p> <p>Valid Values:<code> 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 </code> </p>
        event_categories: <p>A list of event categories for a source type (<code>SourceType</code>) that you want to subscribe to. You can see a list of the categories for a given source type in <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.html">Events</a> in the <i>Amazon RDS User Guide</i> or by using the <code>DescribeEventCategories</code> operation.</p>
        enabled: <p>Specifies whether to activate the subscription.</p>

    Raises:
        capo_rds.errors.event_subscription_quota_exceeded_fault.EventSubscriptionQuotaExceededFault: <p>You have reached the maximum number of event subscriptions.</p>
        capo_rds.errors.sns_invalid_topic_fault.SNSInvalidTopicFault: <p>SNS has responded that there is a problem with the SNS topic specified.</p>
        capo_rds.errors.sns_no_authorization_fault.SNSNoAuthorizationFault: <p>You do not have permission to publish to the SNS topic ARN.</p>
        capo_rds.errors.sns_topic_arn_not_found_fault.SNSTopicArnNotFoundFault: <p>The SNS topic ARN does not exist.</p>
        capo_rds.errors.subscription_category_not_found_fault.SubscriptionCategoryNotFoundFault: <p>The supplied category does not exist.</p>
        capo_rds.errors.subscription_not_found_fault.SubscriptionNotFoundFault: <p>The subscription name does not exist.</p>
        capo_rds.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To modify an event subscription
        The following example turns off the specified event subscription, so that it no longer publishes notifications to the specified Amazon Simple Notification Service topic.

        >>> client.modify_event_subscription(subscription_name='my-instance-events', enabled=False)
    """

    def _handler(
        req: "OperationRequest[capo_rds.types.modify_event_subscription_message.ModifyEventSubscriptionMessage]",
    ) -> OperationResponse[
        "capo_rds.types.modify_event_subscription_result.ModifyEventSubscriptionResult"
    ]:
        import capo_rds._operations.amazon_rd_sv19.modify_event_subscription

        output, http_response = (
            capo_rds._operations.amazon_rd_sv19.modify_event_subscription.modify_event_subscription(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ModifyEventSubscription")
    )
    input_: capo_rds.types.modify_event_subscription_message.ModifyEventSubscriptionMessage = {}
    if subscription_name is not None:
        input_["subscription_name"] = subscription_name
    if sns_topic_arn is not None:
        input_["sns_topic_arn"] = sns_topic_arn
    if source_type is not None:
        input_["source_type"] = source_type
    if event_categories is not None:
        input_["event_categories"] = event_categories
    if enabled is not None:
        input_["enabled"] = enabled

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output