subscribe_to_event(
resource_arn: Arn,
event: InspectorEvent,
topic_arn: Arn,
*,
config_overrides: Optional[AsyncInspectorClientConfig] = None,
) -> None
Enables the process of sending Amazon Simple Notification Service (SNS) notifications about a specified event to a specified SNS topic.
Parameters:
-
resource_arn
(Arn)
–
The ARN of the assessment template that is used during the event for which you want to receive SNS notifications.
-
event
(InspectorEvent)
–
The event for which you want to receive SNS notifications.
-
topic_arn
(Arn)
–
The ARN of the SNS topic to which the SNS notifications are sent.
Raises:
Examples:
Subscribe to event
Enables the process of sending Amazon Simple Notification Service (SNS) notifications about a specified event to a specified SNS topic.
>>> await client.subscribe_to_event(resource_arn='arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-7sbz2Kz0', event='ASSESSMENT_RUN_COMPLETED', topic_arn='arn:aws:sns:us-west-2:123456789012:exampletopic')
Source code in docs_src/capo_inspector/_services/async_inspector.py
| async def subscribe_to_event(
self,
resource_arn: "capo_inspector.types.arn.Arn",
event: "capo_inspector.types.inspector_event.InspectorEvent",
topic_arn: "capo_inspector.types.arn.Arn",
*,
config_overrides: Optional[AsyncInspectorClientConfig] = None,
) -> None:
"""<p>Enables the process of sending Amazon Simple Notification Service (SNS) notifications about a specified event to a specified SNS topic.</p>
Args:
resource_arn: <p>The ARN of the assessment template that is used during the event for which you want to receive SNS notifications.</p>
event: <p>The event for which you want to receive SNS notifications.</p>
topic_arn: <p>The ARN of the SNS topic to which the SNS notifications are sent.</p>
Raises:
capo_inspector.errors.access_denied_exception.AccessDeniedException: <p>You do not have required permissions to access the requested resource.</p>
capo_inspector.errors.internal_exception.InternalException: <p>Internal server error.</p>
capo_inspector.errors.invalid_input_exception.InvalidInputException: <p>The request was rejected because an invalid or out-of-range value was supplied for an input parameter.</p>
capo_inspector.errors.limit_exceeded_exception.LimitExceededException: <p>The request was rejected because it attempted to create resources beyond the current AWS account limits. The error code describes the limit exceeded.</p>
capo_inspector.errors.no_such_entity_exception.NoSuchEntityException: <p>The request was rejected because it referenced an entity that does not exist. The error code describes the entity.</p>
capo_inspector.errors.service_temporarily_unavailable_exception.ServiceTemporarilyUnavailableException: <p>The serice is temporary unavailable.</p>
capo_inspector.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
Subscribe to event
Enables the process of sending Amazon Simple Notification Service (SNS) notifications about a specified event to a specified SNS topic.
>>> await client.subscribe_to_event(resource_arn='arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-7sbz2Kz0', event='ASSESSMENT_RUN_COMPLETED', topic_arn='arn:aws:sns:us-west-2:123456789012:exampletopic')
"""
async def _handler(
req: "AsyncOperationRequest[capo_inspector.types.subscribe_to_event_request.SubscribeToEventRequest]",
) -> AsyncOperationResponse[None]:
import capo_inspector._operations.inspector_service.subscribe_to_event
(
output,
http_response,
) = await capo_inspector._operations.inspector_service.subscribe_to_event.async_subscribe_to_event(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("SubscribeToEvent")
)
input_: capo_inspector.types.subscribe_to_event_request.SubscribeToEventRequest = {
"resource_arn": resource_arn,
"event": event,
"topic_arn": topic_arn,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|