topic#

State module for managing SNS Topics.

async idem_aws.states.aws.sns.topic.present(hub, ctx, name: str, resource_id: str = None, attributes: Dict[str, str] = None, tags: Dict[str, Any] = None) Dict[str, Any][source]#

Creates a topic to which notifications can be published.

Users can create at most 100,000 standard topics (at most 1,000 FIFO topics). For more information, see Creating an Amazon SNS topic in the Amazon SNS Developer Guide. 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.

Parameters:
  • name (str) – The idem name for the resource

  • resource_id (str, Optional) – The AWS resource identifier, here it is resource arn

  • attributes (dict, Optional) – Attributes of topic

  • tags (dict or list, Optional) –

    Dict in the format of {tag-key: tag-value} or list of tags in the format of [{"Key": tag-key, "Value": tag-value}] to associate with the topic. Each tag consists of a key name and an associated value. Defaults to None.

    • Key (str):

      The key of the tag. Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with aws:.

    • Value(str, Optional):

      The value of the tag. Constraints: Tag values are case-sensitive and accept a maximum of 256 Unicode characters.

Request Syntax:
[topic-name]:
  aws.sns.topic.present:
    - resource_id: 'string'
    - attributes: 'Dict'
    - tags:
      - Key: 'string'
        Value: 'string'
Returns:

dict[str, Any]

Examples

new-topic:
  aws.sns.topic.present:
    - attributes:
        DeliveryPolicy: '{"http":{"defaultHealthyRetryPolicy":{"minDelayTarget":10,"maxDelayTarget":30,"numRetries":10,"numMaxDelayRetries":7,"numNoDelayRetries":0,"numMinDelayRetries":3,"backoffFunction":"linear"}}}'
    - tags:
       - Key: Name
         Value: new-topic
async idem_aws.states.aws.sns.topic.absent(hub, ctx, name: str, resource_id: str = None) Dict[str, Any][source]#

Deletes a topic and all its subscriptions.

Deleting a topic might prevent some messages previously sent to the topic from being delivered to subscribers. This action is idempotent, so deleting a topic that does not exist does not result in an error.

Parameters:
  • name (str) – The name of the state.

  • resource_id (str, Optional) – The AWS resource identifier, here it is resource arn

Request Syntax:
[topic-name]:
  aws.sns.topic.absent:
    - resource_id: 'string'
Returns:

dict[str, Any]

Examples

test-topic:
  aws.sns.topic.absent:
    - resource_id: arn:aws:sns:eu-west-3:537227425989:test-topic
async idem_aws.states.aws.sns.topic.describe(hub, ctx) Dict[str, Dict[str, Any]][source]#

Describe the resource in a way that can be recreated/managed with the corresponding “present” function.

Returns a list of the requester’s topics. Each call returns a limited list of topics, up to 100. If there are more topics, a NextToken is also returned. Use the NextToken parameter in a new ListTopics call to get further results. This action is throttled at 30 transactions per second (TPS).

Returns:

dict[str, Any]

Examples

$ idem describe aws.sns.topic