HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/boto_sqs.cpython-310.pyc
o

�N�g��@sXdZddlZddlZddlZe�e�Zdd�Z					d	dd�Z					d
dd�Z
dS)a�
Manage SQS Queues

.. versionadded:: 2014.7.0

Create and destroy SQS queues. Be aware that this interacts with Amazon's
services, and so may incur charges.

This module uses ``boto``, which can be installed via package, or pip.

This module accepts explicit SQS 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 `here
<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 file or
in the minion's config file:

.. code-block:: yaml

    sqs.keyid: GKTADJGHEIQSXMKKRBJ08H
    sqs.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs

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

.. code-block:: yaml

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

.. code-block:: yaml

    myqueue:
        boto_sqs.present:
            - region: us-east-1
            - keyid: GKTADJGHEIQSXMKKRBJ08H
            - key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
            - attributes:
                ReceiveMessageWaitTimeSeconds: 20

    # Using a profile from pillars
    myqueue:
        boto_sqs.present:
            - region: us-east-1
            - profile: mysqsprofile

    # Passing in a profile
    myqueue:
        boto_sqs.present:
            - region: us-east-1
            - profile:
                keyid: GKTADJGHEIQSXMKKRBJ08H
                key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
�NcCsdtvrdSdS)z)
    Only load if boto is available.
    �boto_sqs.existsZboto_sqs)Fz#boto_sqs module could not be loaded)�__salt__�rr�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/boto_sqs.py�__virtual__DsrcCs*|dgid�}td|||||d�}d|vr%d|d<|d�|d�|S|dr5|d�d	|�d
��nXtdrQd|d<|d�d	|�d
��d|d�|d<|Std||||||d�}d|vrtd|d<|d�d�||d��|S|d�d	|�d��d|dd<||dd<|S|s�|Std|||||d�}d|vr�d|d<|d�d�|d��|S|d}i}	|��D]Q\}
}|�|
d�}|
dkr�t|t�r�tj	j
�|�}t|t�r�tj	j
�|�}||kr�t�
d||�tj	j
j|dd�|	|
<q�t|�t|�k�r
t�
d||�||	|
<q�d�|	�}
|	�s|d�d�|S|��}|�|	�dd�}d �t�||��d�||��d���}td�r]d|d<|d�d!�|
|��d"d#|ii|d<|Std$||	||||d�}d|v�r�d|d<|d�d%�|d��|S|d�d&|
�d'��d#|i|dd"<|S)(a�
    Ensure the SQS queue exists.

    name
        Name of the SQS queue.

    attributes
        A dict of key/value SQS attributes.

    region
        Region to connect to.

    key
        Secret key to be used.

    keyid
        Access key to be used.

    profile
        A dict with region, key and keyid, or a pillar key (string)
        that contains a dict with region, key and keyid.
    T��name�result�comment�changesr��region�key�keyid�profile�errorFr	r
�
SQS queue z	 present.�testNz is set to be created.��old�newrzboto_sqs.create)�
attributesr
rrrz!Failed to create SQS queue {}: {}z	 created.rrzboto_sqs.get_attributesz"Failed to get queue attributes: {}�PolicyzPolicies differ:
%s
%s)�	sort_keyszAttributes differ:
%s
%sz, z'Queue attributes already set correctly.cSstdd�}td|d|d�S)z>
        Safely dump YAML using a readable flow style
        zyaml.get_dumperZIndentedSafeOrderedDumperz	yaml.dumpF)Zdefault_flow_styleZDumper)Z	__utils__)ZattrsZdumperrrr�_yaml_safe_dump�sz present.<locals>._yaml_safe_dump�z%Attribute(s) {} set to be updated:
{}r�diffzboto_sqs.set_attributesz"Failed to set queue attributes: {}zUpdated SQS queue attribute(s) �.)r�append�__opts__�format�items�get�
isinstance�str�salt�utils�json�loads�log�debug�dumps�join�copy�update�difflibZunified_diff�
splitlines)rrr
rrr�ret�rZcurrent_attributesZattrs_to_set�attr�valZ_valZ
attr_namesZfinal_attributesrZattributes_diffrrr�presentMs���
�����

��

��
���
�
�r5cCs�|ddid�}td|||||d�}d|vr$d|d<t|d�|d	<|S|ds2d
�||�|d	<|StdrKd|d<d
|�d�|d	<|dd�|d<|Std|||||d�}d|vrhd|d<t|d�|d	<|Sd
|�d�|d	<||dd<d|dd<|S)a_
    Ensure the named sqs queue is deleted.

    name
        Name of the SQS queue.

    region
        Region to connect to.

    key
        Secret key to be used.

    keyid
        Access key to be used.

    profile
        A dict with region, key and keyid, or a pillar key (string)
        that contains a dict with region, key and keyid.
    TrrrrrFr	r
z"SQS queue {} does not exist in {}.rNrz is set to be removed.rrzboto_sqs.deletez
 was deleted.rr)rr$r r)rr
rrrr1r2rrr�absent�sL���r6)NNNNN)NNNN)�__doc__r/�loggingZsalt.utils.jsonr%�	getLogger�__name__r)rr5r6rrrr�<module>s$;

�-�