Amazon Simple Notification Service

2019/04/26 - Amazon Simple Notification Service - 3 new1 updated api methods

Changes  Update sns client to latest version

TagResource (new) Link ¶

Add tags to the specified Amazon SNS topic. For an overview, see Amazon SNS Tags in the Amazon SNS Developer Guide.

When you use topic tags, keep the following guidelines in mind:

  • Adding more than 50 tags to a topic isn't recommended.

  • Tags don't have any semantic meaning. Amazon SNS interprets tags as character strings.

  • Tags are case-sensitive.

  • A new tag with a key identical to that of an existing tag overwrites the existing tag.

  • Tagging actions are limited to 10 TPS per AWS account. If your application requires a higher throughput, file a technical support request.

For a full list of tag restrictions, see Limits Related to Topics in the Amazon SNS Developer Guide.

See also: AWS API Documentation

Request Syntax

client.tag_resource(
    ResourceArn='string',
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
type ResourceArn:

string

param ResourceArn:

[REQUIRED]

The ARN of the topic to which to add tags.

type Tags:

list

param Tags:

[REQUIRED]

The tags to be added to the specified topic. A tag consists of a required key and an optional value.

  • (dict) --

    The list of tags to be added to the specified topic.

    • Key (string) -- [REQUIRED]

      The required key portion of the tag.

    • Value (string) -- [REQUIRED]

      The optional value portion of the tag.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

ListTagsForResource (new) Link ¶

List all tags added to the specified Amazon SNS topic. For an overview, see Amazon SNS Tags in the Amazon Simple Notification Service Developer Guide.

See also: AWS API Documentation

Request Syntax

client.list_tags_for_resource(
    ResourceArn='string'
)
type ResourceArn:

string

param ResourceArn:

[REQUIRED]

The ARN of the topic for which to list tags.

rtype:

dict

returns:

Response Syntax

{
    'Tags': [
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • Tags (list) --

      The tags associated with the specified topic.

      • (dict) --

        The list of tags to be added to the specified topic.

        • Key (string) --

          The required key portion of the tag.

        • Value (string) --

          The optional value portion of the tag.

UntagResource (new) Link ¶

Remove tags from the specified Amazon SNS topic. For an overview, see Amazon SNS Tags in the Amazon SNS Developer Guide.

See also: AWS API Documentation

Request Syntax

client.untag_resource(
    ResourceArn='string',
    TagKeys=[
        'string',
    ]
)
type ResourceArn:

string

param ResourceArn:

[REQUIRED]

The ARN of the topic from which to remove tags.

type TagKeys:

list

param TagKeys:

[REQUIRED]

The list of tag keys to remove from the specified topic.

  • (string) --

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

CreateTopic (updated) Link ¶
Changes (request)
{'Tags': [{'Key': 'string', 'Value': 'string'}]}

Creates a topic to which notifications can be published. Users can create at most 100,000 topics. For more information, see https://aws.amazon.com/sns. This action is idempotent, so if the requester already owns a topic with the specified name, that topic's ARN is returned without creating a new topic.

See also: AWS API Documentation

Request Syntax

client.create_topic(
    Name='string',
    Attributes={
        'string': 'string'
    },
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
type Name:

string

param Name:

[REQUIRED]

The name of the topic you want to create.

Constraints: Topic names must be made up of only uppercase and lowercase ASCII letters, numbers, underscores, and hyphens, and must be between 1 and 256 characters long.

type Attributes:

dict

param Attributes:

A map of attributes with their corresponding values.

The following lists the names, descriptions, and values of the special request parameters that the CreateTopic action uses:

  • DeliveryPolicy – The policy that defines how Amazon SNS retries failed deliveries to HTTP/S endpoints.

  • DisplayName – The display name to use for a topic with SMS subscriptions.

  • Policy – The policy that defines who can access your topic. By default, only the topic owner can publish or subscribe to the topic.

The following attribute applies only to server-side-encryption:

  • KmsMasterKeyId - The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a custom CMK. For more information, see Key Terms. For more examples, see KeyId in the AWS Key Management Service API Reference.

  • (string) --

    • (string) --

type Tags:

list

param Tags:

The list of tags to add to a new topic.

  • (dict) --

    The list of tags to be added to the specified topic.

    • Key (string) -- [REQUIRED]

      The required key portion of the tag.

    • Value (string) -- [REQUIRED]

      The optional value portion of the tag.

rtype:

dict

returns:

Response Syntax

{
    'TopicArn': 'string'
}

Response Structure

  • (dict) --

    Response from CreateTopic action.

    • TopicArn (string) --

      The Amazon Resource Name (ARN) assigned to the created topic.