list_event_subscriptions

Inspector.Client.list_event_subscriptions(**kwargs)

Lists all the event subscriptions for the assessment template that is specified by the ARN of the assessment template. For more information, see SubscribeToEvent and UnsubscribeFromEvent.

See also: AWS API Documentation

Request Syntax

response = client.list_event_subscriptions(
    resourceArn='string',
    nextToken='string',
    maxResults=123
)
Parameters
  • resourceArn (string) -- The ARN of the assessment template for which you want to list the existing event subscriptions.
  • nextToken (string) -- You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the ListEventSubscriptions action. Subsequent calls to the action fill nextToken in the request with the value of NextToken from the previous response to continue listing data.
  • maxResults (integer) -- You can use this parameter to indicate the maximum number of items you want in the response. The default value is 10. The maximum value is 500.
Return type

dict

Returns

Response Syntax

{
    'subscriptions': [
        {
            'resourceArn': 'string',
            'topicArn': 'string',
            'eventSubscriptions': [
                {
                    'event': 'ASSESSMENT_RUN_STARTED'|'ASSESSMENT_RUN_COMPLETED'|'ASSESSMENT_RUN_STATE_CHANGED'|'FINDING_REPORTED'|'OTHER',
                    'subscribedAt': datetime(2015, 1, 1)
                },
            ]
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • subscriptions (list) --

      Details of the returned event subscriptions.

      • (dict) --

        This data type is used as a response element in the ListEventSubscriptions action.

        • resourceArn (string) --

          The ARN of the assessment template that is used during the event for which the SNS notification is sent.

        • topicArn (string) --

          The ARN of the Amazon Simple Notification Service (SNS) topic to which the SNS notifications are sent.

        • eventSubscriptions (list) --

          The list of existing event subscriptions.

          • (dict) --

            This data type is used in the Subscription data type.

            • event (string) --

              The event for which Amazon Simple Notification Service (SNS) notifications are sent.

            • subscribedAt (datetime) --

              The time at which SubscribeToEvent is called.

    • nextToken (string) --

      When a response is generated, if there is more data to be listed, this parameter is present in the response and contains the value to use for the nextToken parameter in a subsequent pagination request. If there is no more data to be listed, this parameter is set to null.

Exceptions

  • Inspector.Client.exceptions.InternalException
  • Inspector.Client.exceptions.InvalidInputException
  • Inspector.Client.exceptions.AccessDeniedException
  • Inspector.Client.exceptions.NoSuchEntityException

Examples

Lists all the event subscriptions for the assessment template that is specified by the ARN of the assessment template.

response = client.list_event_subscriptions(
    maxResults=123,
    resourceArn='arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-7sbz2Kz0',
)

print(response)

Expected Output:

{
    'nextToken': '1',
    'subscriptions': [
        {
            'eventSubscriptions': [
                {
                    'event': 'ASSESSMENT_RUN_COMPLETED',
                    'subscribedAt': datetime(2016, 3, 31, 20, 17, 20, 3, 91, 0),
                },
            ],
            'resourceArn': 'arn:aws:inspector:us-west-2:123456789012:target/0-nvgVhaxX/template/0-7sbz2Kz0',
            'topicArn': 'arn:aws:sns:us-west-2:123456789012:exampletopic',
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}