%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/boto_sns.pyc

�
���^c@@s}dZddlmZmZmZddlZddlZeje	�Z
y;ddlZddlZejd�j
ej�eZWnek
r�eZnXd�Zddddd�Zddddd�Zddddd�Zddddd	�Zddddd
�Zddddd�Zddddd�Zddddd
�Zddd�Zd�Zd�Zd�Z dS(u�
Connection module for Amazon SNS

:configuration: This module accepts explicit sns credentials but can also
    utilize IAM roles assigned to the instance through Instance Profiles. Dynamic
    credentials are then automatically obtained from AWS API and no further
    configuration is necessary. More Information available at:

    .. code-block:: text

        http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html

    If IAM roles are not used you need to specify them either in a pillar or
    in the minion's config file:

    .. code-block:: yaml

        sns.keyid: GKTADJGHEIQSXMKKRBJ08H
        sns.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs

    A region may also be specified in the configuration:

    .. code-block:: yaml

        sns.region: us-east-1

    If a region is not specified, the default is us-east-1.

    It's also possible to specify key, keyid and region via a profile, either
    as a passed in dict, or as a string to pull from pillars or minion config:

    .. code-block:: yaml

        myprofile:
            keyid: GKTADJGHEIQSXMKKRBJ08H
            key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
            region: us-east-1

:depends: boto
i(tabsolute_importtprint_functiontunicode_literalsNubotocC@sBtjjjdt�}|tkr>tdtddt�n|S(u,
    Only load if boto libraries exist.
    tcheck_boto3uboto.assign_funcsusnstpack(	tsalttutilstversionstcheck_boto_reqstFalsetTruet	__utils__t__name__t__salt__(t
has_boto_reqs((s9/usr/lib/python2.7/site-packages/salt/modules/boto_sns.pyt__virtual__Bs
	c		C@s�t�}yt|SWntk
r(nXtd|d|d|d|�}it|<|j�}xC|dddD]/}|djd	�d
}|dt||<qsWt|S(un
    Returns a list of the all topics..

    CLI example::

        salt myminion boto_sns.get_all_topics
    tregiontkeytkeyidtprofileuListTopicsResponseuListTopicsResultuTopicsuTopicArnu:i����(t_cache_get_keyt__context__tKeyErrort	_get_conntget_all_topicstsplit(	RRRRt	cache_keytconnttopicsttt
short_name((s9/usr/lib/python2.7/site-packages/salt/modules/boto_sns.pyRNs	
!
c	C@s`td|d|d|d|�}|jd�rF|t|j��kS|t|j��kSdS(u�
    Check to see if an SNS topic exists.

    CLI example::

        salt myminion boto_sns.exists mytopic region=us-east-1
    RRRRuarn:aws:sns:N(Rt
startswithtlisttvaluestkeys(tnameRRRRR((s9/usr/lib/python2.7/site-packages/salt/modules/boto_sns.pytexistsfs
	c	C@sItd|d|d|d|�}|j|�tjd|�t�tS(u�
    Create an SNS topic.

    CLI example to create a topic::

        salt myminion boto_sns.create mytopic region=us-east-1
    RRRRuCreated SNS topic %s(Rtcreate_topictlogtinfot_invalidate_cacheR
(R#RRRRR((s9/usr/lib/python2.7/site-packages/salt/modules/boto_sns.pytcreatevs
!
c	C@s[td|d|d|d|�}|jt|||||��tjd|�t�tS(u�
    Delete an SNS topic.

    CLI example to delete a topic::

        salt myminion boto_sns.delete mytopic region=us-east-1
    RRRRuDeleted SNS topic %s(Rtdelete_topictget_arnR&R'R(R
(R#RRRRR((s9/usr/lib/python2.7/site-packages/salt/modules/boto_sns.pytdelete�s
!c	C@s�t|�}yt|SWntk
r+nXtd|d|d|d|�}|jt|||||��}|dddt|<t|S(u�
    Get list of all subscriptions to a specific topic.

    CLI example to delete a topic::

        salt myminion boto_sns.get_all_subscriptions_by_topic mytopic region=us-east-1
    RRRRu ListSubscriptionsByTopicResponseuListSubscriptionsByTopicResultu
Subscriptions(t_subscriptions_cache_keyRRRtget_all_subscriptions_by_topicR+(R#RRRRRRtret((s9/usr/lib/python2.7/site-packages/salt/modules/boto_sns.pyR.�s
!!c	C@s�td|d|d|d|�}|jt|||||�||�tjd|||�ytt|�=Wntk
r�nXtS(u�
    Subscribe to a Topic.

    CLI example to delete a topic::

        salt myminion boto_sns.subscribe mytopic https https://www.example.com/sns-endpoint region=us-east-1
    RRRRuSubscribe %s %s to %s topic(	Rt	subscribeR+R&R'RR-RR
(ttopictprotocoltendpointRRRRR((s9/usr/lib/python2.7/site-packages/salt/modules/boto_sns.pyR0�s!%
c	C@s�td|d|d|d|�}|jd�tkr:tSy$|j|�tjd||�Wn'tk
r�}tjddt�tSXt	j
t|�d	�tSd	S(
u�
    Unsubscribe a specific SubscriptionArn of a topic.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_sns.unsubscribe my_topic my_subscription_arn region=us-east-1

    .. versionadded:: 2016.11.0
    RRRRuarn:aws:sns:uUnsubscribe %s to %s topicuUnsubscribe Errortexc_infoN(
RRR	tunsubscribeR&R't	ExceptionterrorR
RtpopR-tNone(R1tsubscription_arnRRRRRte((s9/usr/lib/python2.7/site-packages/salt/modules/boto_sns.pyR5�s!
c	C@sT|jd�r|Stdd|d|d|d|�}djt||�||�S(uy
    Returns the full ARN for a given topic name.

    CLI example::

        salt myminion boto_sns.get_arn mytopic
    uarn:aws:sns:uboto_iam.get_account_idRRRRuarn:aws:sns:{0}:{1}:{2}(RR
tformatt_get_region(R#RRRRt
account_id((s9/usr/lib/python2.7/site-packages/salt/modules/boto_sns.pyR+�s
cC@s�|rd|kr|dS|rVtd|�rVtd|�}|jdd�}n|r�tdd�r�tdd�}n|s�d}n|S(Nuregionu
config.optionu
sns.regionu	us-east-1(R
tgetR9(RRt_profile((s9/usr/lib/python2.7/site-packages/salt/modules/boto_sns.pyR=�s	cC@sdjt�|�S(Nu{0}_{1}_subscriptions(R<R(R#((s9/usr/lib/python2.7/site-packages/salt/modules/boto_sns.pyR-�scC@s&ytt�=Wntk
r!nXdS(N(RRR(((s9/usr/lib/python2.7/site-packages/salt/modules/boto_sns.pyR(�s
cC@sdS(Nuboto_sns.topics_cache((((s9/usr/lib/python2.7/site-packages/salt/modules/boto_sns.pyRs(!t__doc__t
__future__RRRtloggingtsalt.utils.versionsRt	getLoggerRR&tbototboto.snstsetLeveltCRITICALR
tHAS_BOTOtImportErrorR	RR9RR$R)R,R.R0R5R+R=R-R(R(((s9/usr/lib/python2.7/site-packages/salt/modules/boto_sns.pyt<module>)s0


	
		

Zerion Mini Shell 1.0