403Webshell
Server IP : 198.38.94.13  /  Your IP : 216.73.217.33
Web Server : Apache
System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : revivere ( 1140)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/boto3_sns.cpython-310.pyc
o

;j�3�@sdZddlZddlZe�e�ZzddlZddlZddl	Z	e�d��
ej�dZWne
y3dZYnwdd�Zd"dd	�Zd"d
d�Zd"dd
�Zd"dd�Zd"dd�Zd"dd�Z				d"dd�Z	d"dd�Zd"dd�Z	d"dd�Z				d"dd�Z	d"dd�Zd"d d!�ZdS)#a�
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: boto3
�N�boto3TFcCs&tjj��}|durtdtd�|S)z,
    Only load if boto libraries exist.
    Tzboto3.assign_funcsZsns)�salt�utilsZversionsZcheck_boto_reqsZ	__utils__�__name__)Z
has_boto_reqs�r�J/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto3_sns.py�__virtual__AsrcCspt||||d�}i}d}|dur6|j|d�}|�dd�}t�d|�}|D]
}	|	�d�d}
|	||
<q$|dus|S)	z�
    Returns a list of the requester's topics

    CLI Example:

    .. code-block:: bash

        salt myminion boto3_sns.list_topics
    ��region�key�keyid�profile�N��	NextTokenrzTopics[*].TopicArn�:���)�	_get_conn�list_topics�get�jmespath�search�split)r
rrr
�conn�resr�retZarns�tZ
short_namerrrrKs

�rcCs�t||||d�}i}|��D];\}}|||fvrId|i}t|||||d�|d<t|||||d�|d<|dD]}	|	d}
|
�d�sHt�d|
�q6q6q|S)z�
    Returns details about a specific SNS topic, specified by name or ARN.

    CLI Example:

    .. code-block:: bash

        salt my_favorite_client boto3_sns.describe_topic a_sns_topic_of_my_choice
    r	�TopicArn�
Subscriptions�
Attributes�SubscriptionArn�arn:aws:sns:z+Subscription with invalid ARN %s skipped...)r�items�list_subscriptions_by_topic�get_topic_attributes�
startswith�log�debug)�namer
rrr
�topicsrZtopicZarn�subZsub_arnrrr�describe_topicbs&


�

�
��r+cCs(t||||d�}|t|���t|�vS)z�
    Check to see if an SNS topic exists.

    CLI Example:

    .. code-block:: bash

        salt myminion boto3_sns.topic_exists mytopic region=us-east-1
    r	)r�list�values)r(r
rrr
r)rrr�topic_exists�s
r.c
Cs�t||||d�}z|j|d�}t�d||d�|dWStjjy8}zt�d||�WYd}~dSd}~wtyGt�d|�YdSw)z�
    Create an SNS topic.

    CLI Example:

    .. code-block:: bash

        salt myminion boto3_sns.create_topic mytopic region=us-east-1
    r	)�Namez SNS topic %s created with ARN %srz!Failed to create SNS topic %s: %sNzFailed to create SNS topic %s)	r�create_topicr&�info�botocore�
exceptions�ClientError�error�KeyError)r/r
rrr
rr�errrr0�s

��r0c
Csht||||d�}z|j|d�t�d|�WdStjjy3}zt�dt|�WYd}~dSd}~ww)z�
    Delete an SNS topic.

    CLI Example:

    .. code-block:: bash

        salt myminion boto3_sns.delete_topic mytopic region=us-east-1
    r	�rzSNS topic %s deletedTz!Failed to delete SNS topic %s: %sNF)	r�delete_topicr&r1r2r3r4r5r(�rr
rrr
rr7rrrr9�s
��r9c
Cs^t||||d�}z
|j|d��d�WStjjy.}zt�d||�WYd}~dSd}~ww)a
    Returns all of the properties of a topic.  Topic properties returned might differ based on the
    authorization of the user.

    CLI Example:

    .. code-block:: bash

        salt myminion boto3_sns.get_topic_attributes someTopic region=us-west-1
    r	r8rz0Failed to garner attributes for SNS topic %s: %sN)rr$rr2r3r4r&r5r:rrrr$�s��r$c	
C�tt||||d�}z|j|||d�t�d|||�WdStjjy9}zt�d||||�WYd}~dSd}~ww)z�
    Set an attribute of a topic to a new value.

    CLI Example:

    .. code-block:: bash

        salt myminion boto3_sns.set_topic_attributes someTopic DisplayName myDisplayNameValue
    r	)r�
AttributeName�AttributeValuez#Set attribute %s=%s on SNS topic %sTz2Failed to set attribute %s=%s for SNS topic %s: %sNF)r�set_topic_attributesr&r'r2r3r4r5)	rr<r=r
rrr
rr7rrrr>��2�����r>c
Cs�t||||d�}d}g}z%|dur/|j||d�}|�dd�}|�dg�}	||	7}|dusW|SW|StjjyM}
zt�d||
�WYd}
~
dSd}
~
ww)z�
    Returns a list of the subscriptions to a specific topic

    CLI Example:

    .. code-block:: bash

        salt myminion boto3_sns.list_subscriptions_by_topic mytopic region=us-east-1
    r	rN)rrrrz1Failed to list subscriptions for SNS topic %s: %s)rr#rr2r3r4r&r5)rr
rrr
rrrr�subsr7rrrr#�s(�
�
�
���r#c

Cs�t||||d�}d}g}z$|dur.|j|d�}|�dd�}|�dg�}||7}|dusW|SW|StjjyK}	z
t�d|	�WYd}	~	dSd}	~	ww)z�
    Returns a list of the requester's topics

    CLI Example:

    .. code-block:: bash

        salt myminion boto3_sns.list_subscriptions region=us-east-1
    r	rNrrrz$Failed to list SNS subscriptions: %s)r�list_subscriptionsrr2r3r4r&r5)
r
rrr
rrrrr@r7rrrrAs$

�����rAc
Cs~t||||d�}z|j|d�}|dWStjjy/}zt�d||�WYd}~dSd}~wty>t�d|�YdSw)z�
    Returns all of the properties of a subscription.

    CLI Example:

    .. code-block:: bash

        salt myminion boto3_sns.get_subscription_attributes somesubscription region=us-west-1
    r	�r rz5Failed to list attributes for SNS subscription %s: %sNz1Failed to list attributes for SNS subscription %s)r�get_subscription_attributesr2r3r4r&r5r6)r r
rrr
rrr7rrrrC/s
���rCc	
Cr;)z�
    Set an attribute of a subscription to a new value.

    CLI Example:

    .. code-block:: bash

        salt myminion boto3_sns.set_subscription_attributes someSubscription RawMessageDelivery jsonStringValue
    r	)r r<r=z*Set attribute %s=%s on SNS subscription %sTz9Failed to set attribute %s=%s for SNS subscription %s: %sNF)r�set_subscription_attributesr&r'r2r3r4r5)	r r<r=r
rrr
rr7rrrrDIr?rDc

Cs�t||||d�}z|j|||d�}t�d||||d�|dWStjjy<}	zt�d||	�WYd}	~	dSd}	~	wtyKt�d|�YdSw)z�
    Subscribe to a Topic.

    CLI Example:

    .. code-block:: bash

        salt myminion boto3_sns.subscribe mytopic https https://www.example.com/sns-endpoint
    r	)r�Protocol�Endpointz4Subscribed %s %s to topic %s with SubscriptionArn %sr z1Failed to create subscription to SNS topic %s: %sNz-Failed to create subscription to SNS topic %s)	r�	subscriber&r1r2r3r4r5r6)
rrErFr
rrr
rrr7rrrrGts&�
��rGc

s���d�s
t�d��dSt||||d�}�fdd�|D�}|s(t�d��dS|d	d
}t||||d�}z|j�d�t�d�|�WdStjj	yb}	zt�d
�|	�WYd}	~	dSd}	~	ww)z�
    Unsubscribe a specific SubscriptionArn of a topic.

    CLI Example:

    .. code-block:: bash

        salt myminion boto3_sns.unsubscribe my_subscription_arn region=us-east-1
    r!z�Invalid subscription ARN `%s` passed - likely a PendingConfirmaton or such.  Skipping unsubscribe attempt as it would almost certainly fail...Tr	csg|]}|�d��kr|�qSrB)r)�.0�srBrr�
<listcomp>�szunsubscribe.<locals>.<listcomp>zSubscription ARN %s not foundFrrrBz)Deleted subscription %s from SNS topic %sz$Failed to delete subscription %s: %sN)
r%r&r1rAr5r�unsubscriber2r3r4)
r r
rrr
r@r*rrr7rrBrrK�s,

���rK)NNNN)�__doc__�loggingZsalt.utils.versionsr�	getLoggerrr&rr2r�setLevel�CRITICALZHAS_BOTO�ImportErrorrrr+r.r0r9r$r>r#rArCrDrGrKrrrr�<module>sL-
�



 



�,
�

�
�,
�

Youez - 2016 - github.com/yon3zu
LinuXploit