subscription#

State module for managing SNS subscription.

async idem_aws.states.aws.sns.subscription.present(hub, ctx, name: str, topic_arn: str, protocol: str, endpoint: str, resource_id: str = None, attributes: Dict[str, str] = None, return_subscription_arn: bool = None) Dict[str, Any][source]#

Creates a new endpoint subscription to a topic.

If the endpoint type is HTTP/S or email, or if the endpoint and the topic are not in the same Amazon Web Services account, For http and email protocols the endpoint owner must run the ConfirmSubscription action to confirm the subscription.

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

  • topic_arn (str) – The ARN of the topic to which the subscription should be added

  • protocol (str) – The protocol that you want to use.Supported protocols are:http,https,email,email-json,sms,sqs,application, lambda,firehose

  • endpoint (str) – The endpoint that you want to receive notifications.Endpoints vary by protocol

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

  • attributes (dict, Optional) – Attributes of the subscription

  • return_subscription_arn (bool, Optional) – A bool value to specify if the subscription_arn should be return after creation.By default,it is false i.e. subscription_arn is not returned.

Returns:

dict[str, Any]

Examples

subscription-name:
  aws.sns.subscription.present:
    - topic_arn: arn:aws:sns:eu-west-3:537227425989:test-topic
    - protocol: sms
    - endpoint: "+911234567890"
    - attributes:
        DeliveryPolicy: '{"healthyRetryPolicy": {"minDelayTarget": 10,"maxDelayTarget": 30,"numRetries": 10,"numMaxDelayRetries": 7,"numNoDelayRetries": 0,"numMinDelayRetries": 3,"backoffFunction": "linear"},"sicklyRetryPolicy": null,"throttlePolicy": null,"guaranteed": false}'
        FilterPolicy: '{"pets": ["dog", "cat"]}'
    - return_subscription_arn: True
async idem_aws.states.aws.sns.subscription.absent(hub, ctx, name: str, resource_id: str = None) Dict[str, Any][source]#

Deletes the specified subscription.

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 i.e. resource arn

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

dict[str, Any]

Examples

test-subscription:
  aws.sns.subscription.absent:
  - resource_id: arn:aws:sns:eu-west-3:537227425989:test-topic:9c0fd640-7fc6-4888-bc08-f0a497a6237f
async idem_aws.states.aws.sns.subscription.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.

Describes list of all the subscriptions present in all topics.

Returns:

dict[str, Any]

Examples

$ idem describe aws.sns.subscription