
SNS
***


boto.sns
========

boto.sns.connect_to_region(region_name, **kw_params)

   Given a valid region name, return a
   "boto.sns.connection.SNSConnection".

   Type :
      str

   Parameters:
      **region_name** -- The name of the region to connect to.

   Return type:
      "boto.sns.connection.SNSConnection" or "None"

   Returns:
      A connection to the given region, or None if an invalid region
      name is given

boto.sns.regions()

   Get all available regions for the SNS service.

   Return type:
      list

   Returns:
      A list of "boto.regioninfo.RegionInfo" instances

class class boto.sns.SNSConnection(aws_access_key_id=None, aws_secret_access_key=None, is_secure=True, port=None, proxy=None, proxy_port=None, proxy_user=None, proxy_pass=None, debug=0, https_connection_factory=None, region=None, path='/', security_token=None, validate_certs=True)

   APIVersion = '2010-03-31'

   DefaultRegionEndpoint = 'sns.us-east-1.amazonaws.com'

   DefaultRegionName = 'us-east-1'

   add_permission(topic, label, account_ids, actions)

      Adds a statement to a topic's access control policy, granting
      access for the specified AWS accounts to the specified actions.

      Parameters:
         * **topic** (*string*) -- The ARN of the topic.

         * **label** (*string*) -- A unique identifier for the new
           policy statement.

         * **account_ids** (*list of strings*) -- The AWS account ids
           of the users who will be give access to the specified
           actions.

         * **actions** (*list of strings*) -- The actions you want to
           allow for each of the specified principal(s).

   confirm_subscription(topic, token, authenticate_on_unsubscribe=False)

      Get properties of a Topic

      Parameters:
         * **topic** (*string*) -- The ARN of the new topic.

         * **token** (*string*) -- Short-lived token sent to and
           endpoint during the Subscribe operation.

         * **authenticate_on_unsubscribe** (*bool*) -- Optional
           parameter indicating that you wish to disable
           unauthenticated unsubscription of the subscription.

   create_topic(topic)

      Create a new Topic.

      Parameters:
         **topic** (*string*) -- The name of the new topic.

   delete_topic(topic)

      Delete an existing topic

      Parameters:
         **topic** (*string*) -- The ARN of the topic

   get_all_subscriptions(next_token=None)

      Get list of all subscriptions.

      Parameters:
         **next_token** (*string*) -- Token returned by the previous
         call to this method.

   get_all_subscriptions_by_topic(topic, next_token=None)

      Get list of all subscriptions to a specific topic.

      Parameters:
         * **topic** (*string*) -- The ARN of the topic for which you
           wish to find subscriptions.

         * **next_token** (*string*) -- Token returned by the previous
           call to this method.

   get_all_topics(next_token=None)

      Parameters:
         **next_token** (*string*) -- Token returned by the previous
         call to this method.

   get_topic_attributes(topic)

      Get attributes of a Topic

      Parameters:
         **topic** (*string*) -- The ARN of the topic.

   publish(topic, message, subject=None)

      Get properties of a Topic

      Parameters:
         * **topic** (*string*) -- The ARN of the new topic.

         * **message** (*string*) -- The message you want to send to
           the topic. Messages must be UTF-8 encoded strings and be at
           most 4KB in size.

         * **subject** (*string*) -- Optional parameter to be used as
           the "Subject" line of the email notifications.

   remove_permission(topic, label)

      Removes a statement from a topic's access control policy.

      Parameters:
         * **topic** (*string*) -- The ARN of the topic.

         * **label** (*string*) -- A unique identifier for the policy
           statement to be removed.

   set_topic_attributes(topic, attr_name, attr_value)

      Get attributes of a Topic

      Parameters:
         * **topic** (*string*) -- The ARN of the topic.

         * **attr_name** (*string*) -- The name of the attribute you
           want to set. Only a subset of the topic's attributes are
           mutable. Valid values: Policy | DisplayName

         * **attr_value** (*string*) -- The new value for the
           attribute.

   subscribe(topic, protocol, endpoint)

      Subscribe to a Topic.

      Parameters:
         * **topic** (*string*) -- The ARN of the new topic.

         * **protocol** (*string*) -- The protocol used to communicate
           with the subscriber.  Current choices are: email|email-
           json|http|https|sqs

         * **endpoint** (*string*) -- The location of the endpoint for
           the subscriber. * For email, this would be a valid email
           address * For email-json, this would be a valid email
           address * For http, this would be a URL beginning with http
           * For https, this would be a URL beginning with https * For
           sqs, this would be the ARN of an SQS Queue

   subscribe_sqs_queue(topic, queue)

      Subscribe an SQS queue to a topic.

      This is convenience method that handles most of the complexity
      involved in using an SQS queue as an endpoint for an SNS topic.
      To achieve this the following operations are performed:

      * The correct ARN is constructed for the SQS queue and that ARN
        is then subscribed to the topic.

      * A JSON policy document is contructed that grants permission to
        the SNS topic to send messages to the SQS queue.

      * This JSON policy is then associated with the SQS queue using
        the queue's set_attribute method.  If the queue already has a
        policy associated with it, this process will add a Statement
        to that policy.  If no policy exists, a new policy will be
        created.

      Parameters:
         * **topic** (*string*) -- The ARN of the new topic.

         * **queue** (*A boto Queue object*) -- The queue you wish to
           subscribe to the SNS Topic.

   unsubscribe(subscription)

      Allows endpoint owner to delete subscription. Confirmation
      message will be delivered.

      Parameters:
         **subscription** (*string*) -- The ARN of the subscription to
         be deleted.
