create_event_subscription
¶
create_event_subscription(
*,
config_overrides: Optional[DocDBClientConfig] = None,
subscription_name: Optional[String] = None,
sns_topic_arn: Optional[String] = None,
source_type: Optional[String] = None,
event_categories: Optional[EventCategoriesList] = None,
source_ids: Optional[SourceIdsList] = None,
enabled: Optional[BooleanOptional] = None,
tags: Optional[TagList] = None,
) -> CreateEventSubscriptionResult
Creates an Amazon DocumentDB event notification subscription. This action requires a topic Amazon Resource Name (ARN) created by using the Amazon DocumentDB console, the Amazon SNS console, or the Amazon SNS API. To obtain an ARN with Amazon SNS, you must create a topic in Amazon SNS and subscribe to the topic. The ARN is displayed in the Amazon SNS console.
You can specify the type of source (SourceType) that you want to be notified of. You can also provide a list of Amazon DocumentDB sources (SourceIds) that trigger the events, and you can provide a list of event categories (EventCategories) for events that you want to be notified of. For example, you can specify SourceType = db-instance, SourceIds = mydbinstance1, mydbinstance2 and EventCategories = Availability, Backup.
If you specify both the SourceType and SourceIds (such as SourceType = db-instance and SourceIdentifier = myDBInstance1), you are notified of all the db-instance events for the specified source. If you specify a SourceType but do not specify a SourceIdentifier, you receive notice of the events for that source type for all your Amazon DocumentDB sources. If you do not specify either the SourceType or the SourceIdentifier, you are notified of events generated from all Amazon DocumentDB sources belonging to your customer account.
Parameters:
-
subscription_name(Optional[String], default:None) –The name of the subscription.
Constraints: The name must be fewer than 255 characters.
-
sns_topic_arn(Optional[String], default:None) –The Amazon Resource Name (ARN) of the SNS topic created for event notification. Amazon SNS creates the ARN 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 an instance, you would set this parameter to
db-instance. If this value is not specified, all events are returned.Valid values:
db-instance,db-cluster,db-parameter-group,db-security-group,db-cluster-snapshot -
event_categories(Optional[EventCategoriesList], default:None) –A list of event categories for a
SourceTypethat you want to subscribe to. -
source_ids(Optional[SourceIdsList], default:None) –The list of identifiers of the event sources for which events are returned. If not specified, then all sources are included in the response. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it can't end with a hyphen or contain two consecutive hyphens.
Constraints:
-
If
SourceIdsare provided,SourceTypemust also be provided. -
If the source type is an instance, a
DBInstanceIdentifiermust be provided. -
If the source type is a security group, a
DBSecurityGroupNamemust be provided. -
If the source type is a parameter group, a
DBParameterGroupNamemust be provided. -
If the source type is a snapshot, a
DBSnapshotIdentifiermust be provided.
-
-
enabled(Optional[BooleanOptional], default:None) –A Boolean value; set to
trueto activate the subscription, set tofalseto create the subscription but not active it. -
tags(Optional[TagList], default:None) –The tags to be assigned to the event subscription.
Raises:
-
EventSubscriptionQuotaExceededFault–You have reached the maximum number of event subscriptions.
-
SNSInvalidTopicFault–Amazon SNS has responded that there is a problem with the specified topic.
-
SNSNoAuthorizationFault–You do not have permission to publish to the SNS topic Amazon Resource Name (ARN).
-
SNSTopicArnNotFoundFault–The SNS topic Amazon Resource Name (ARN) does not exist.
-
SourceNotFoundFault–The requested source could not be found.
-
SubscriptionAlreadyExistFault–The provided subscription name already exists.
-
SubscriptionCategoryNotFoundFault–The provided category does not exist.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_docdb/_services/doc_db.py
1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 | |