Metadata-Version: 2.1
Name: aws-cdk.aws-sns
Version: 1.44.0
Summary: CDK Constructs for AWS SNS
Home-page: https://github.com/aws/aws-cdk
Author: Amazon Web Services
License: Apache-2.0
Project-URL: Source, https://github.com/aws/aws-cdk.git
Description: ## Amazon Simple Notification Service Construct Library
        
        <!--BEGIN STABILITY BANNER-->---
        
        
        ![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)
        
        ![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge)
        
        ---
        <!--END STABILITY BANNER-->
        
        Add an SNS Topic to your stack:
        
        ```python
        # Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
        import aws_cdk.aws_sns as sns
        
        topic = sns.Topic(self, "Topic",
            display_name="Customer subscription topic"
        )
        ```
        
        ### Subscriptions
        
        Various subscriptions can be added to the topic by calling the
        `.addSubscription(...)` method on the topic. It accepts a *subscription* object,
        default implementations of which can be found in the
        `@aws-cdk/aws-sns-subscriptions` package:
        
        Add an HTTPS Subscription to your topic:
        
        ```python
        # Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
        import aws_cdk.aws_sns_subscriptions as subs
        
        my_topic = sns.Topic(self, "MyTopic")
        
        my_topic.add_subscription(subs.UrlSubscription("https://foobar.com/"))
        ```
        
        Subscribe a queue to the topic:
        
        ```python
        # Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
        my_topic.add_subscription(subs.SqsSubscription(queue))
        ```
        
        Note that subscriptions of queues in different accounts need to be manually confirmed by
        reading the initial message from the queue and visiting the link found in it.
        
        #### Filter policy
        
        A filter policy can be specified when subscribing an endpoint to a topic.
        
        Example with a Lambda subscription:
        
        ```python
        # Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
        my_topic = sns.Topic(self, "MyTopic")
        fn = lambda.Function(self, "Function", ...)
        
        # Lambda should receive only message matching the following conditions on attributes:
        # color: 'red' or 'orange' or begins with 'bl'
        # size: anything but 'small' or 'medium'
        # price: between 100 and 200 or greater than 300
        # store: attribute must be present
        topic.add_subscription(subs.LambdaSubscription(fn,
            filter_policy={
                "color": sns.SubscriptionFilter.string_filter(
                    whitelist=["red", "orange"],
                    match_prefixes=["bl"]
                ),
                "size": sns.SubscriptionFilter.string_filter(
                    blacklist=["small", "medium"]
                ),
                "price": sns.SubscriptionFilter.numeric_filter(
                    between={"start": 100, "stop": 200},
                    greater_than=300
                ),
                "store": sns.SubscriptionFilter.exists_filter()
            }
        ))
        ```
        
        ### DLQ setup for SNS Subscription
        
        CDK can attach provided Queue as DLQ for your SNS subscription.
        See the [SNS DLQ configuration docs](https://docs.aws.amazon.com/sns/latest/dg/sns-configure-dead-letter-queue.html) for more information about this feature.
        
        Example of usage with user provided DLQ.
        
        ```python
        # Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
        topic = sns.Topic(stack, "Topic")
        dl_queue = Queue(stack, "DeadLetterQueue",
            queue_name="MySubscription_DLQ",
            retention_period=cdk.Duration.days(14)
        )
        
        sns.Subscription(stack, "Subscription",
            endpoint="endpoint",
            protocol=sns.SubscriptionProtocol.LAMBDA,
            topic=topic,
            dead_letter_queue=dl_queue
        )
        ```
        
        ### CloudWatch Event Rule Target
        
        SNS topics can be used as targets for CloudWatch event rules.
        
        Use the `@aws-cdk/aws-events-targets.SnsTopic`:
        
        ```python
        # Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
        import aws_cdk.aws_events_targets as targets
        
        code_commit_repository.on_commit(targets.SnsTopic(my_topic))
        ```
        
        This will result in adding a target to the event rule and will also modify the
        topic resource policy to allow CloudWatch events to publish to the topic.
        
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: JavaScript
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Typing :: Typed
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved
Requires-Python: >=3.6
Description-Content-Type: text/markdown
