Associates a directory with an Amazon SNS topic. This establishes the directory as a publisher to the specified Amazon SNS topic. You can then receive email or text (SMS) messages when the status of your directory changes. You get notified if your directory goes from an Active status to an Impaired or Inoperable status. You also receive a notification when the directory returns to an Active status.
Parameters:
-
directory_id
(DirectoryId)
–
The Directory ID that will publish status messages to the Amazon SNS topic.
-
topic_name
(TopicName)
–
The Amazon SNS topic name to which the directory will publish status messages. This Amazon SNS topic must be in the same region as the specified Directory ID.
Raises:
Examples:
To register an event topic
The following example associates a directory with an SNS topic.
>>> client.register_event_topic(directory_id='d-92654abfed', topic_name='snstopicexample')
Source code in docs_src/capo_directory_service/_services/directory_service.py
| def register_event_topic(
self,
directory_id: "capo_directory_service.types.directory_id.DirectoryId",
topic_name: "capo_directory_service.types.topic_name.TopicName",
*,
config_overrides: Optional[DirectoryServiceClientConfig] = None,
) -> "capo_directory_service.types.register_event_topic_result.RegisterEventTopicResult":
"""<p>Associates a directory with an Amazon SNS topic. This establishes the directory as a publisher to the specified Amazon SNS topic. You can then receive email or text (SMS) messages when the status of your directory changes. You get notified if your directory goes from an Active status to an Impaired or Inoperable status. You also receive a notification when the directory returns to an Active status.</p>
Args:
directory_id: <p>The Directory ID that will publish status messages to the Amazon SNS topic.</p>
topic_name: <p>The Amazon SNS topic name to which the directory will publish status messages. This Amazon SNS topic must be in the same region as the specified Directory ID.</p>
Raises:
capo_directory_service.errors.client_exception.ClientException: <p>A client exception has occurred.</p>
capo_directory_service.errors.entity_does_not_exist_exception.EntityDoesNotExistException: <p>The specified entity could not be found.</p>
capo_directory_service.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more parameters are not valid.</p>
capo_directory_service.errors.service_exception.ServiceException: <p>An exception has occurred in Directory Service.</p>
capo_directory_service.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To register an event topic
The following example associates a directory with an SNS topic.
>>> client.register_event_topic(directory_id='d-92654abfed', topic_name='snstopicexample')
"""
def _handler(
req: "OperationRequest[capo_directory_service.types.register_event_topic_request.RegisterEventTopicRequest]",
) -> OperationResponse[
"capo_directory_service.types.register_event_topic_result.RegisterEventTopicResult"
]:
import capo_directory_service._operations.directory_service_20150416.register_event_topic
output, http_response = (
capo_directory_service._operations.directory_service_20150416.register_event_topic.register_event_topic(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("RegisterEventTopic")
)
input_: capo_directory_service.types.register_event_topic_request.RegisterEventTopicRequest = {
"directory_id": directory_id,
"topic_name": topic_name,
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|