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/modules/__pycache__/boto_sqs.cpython-310.pyc
o

�N�g��@s�dZddlZddlZddlZddlZe�e�Z	ddiZ
zddlZddlZe�d��
ej�dZWney;dZYnwdd	�Zd
d�Zddd
�Z					ddd�Zddd�Zddd�Zddd�Z				ddd�ZdS)a�
Connection module for Amazon SQS

.. versionadded:: 2014.7.0

:configuration: 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 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

        sqs.keyid: GKTADJGHEIQSXMKKRBJ08H
        sqs.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs

    A region may also be specified in the configuration:

    .. code-block:: yaml

        sqs.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�list_�list�boto3TFcCs&tjj��}|durtdtd�|S)z-
    Only load if boto3 libraries exist.
    Tzboto3.assign_funcsZsqs)�salt�utilsZversionsZcheck_boto_reqs�	__utils__�__name__)Z
has_boto_reqs�r	�I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_sqs.py�__virtual__Hsrcs6t|t�rtjj�|�}dd���fdd�|��D�S)zC
    Pre-process incoming queue attributes before setting them
    cSst|t�rtjj�|�S|S)N)�
isinstance�dictrr�json�dumps)�valr	r	r
�stringifiedYs
z+_preprocess_attributes.<locals>.stringifiedcsi|]	\}}|�|��qSr	r	)�.0�attrr�rr	r
�
<dictcomp>`sz*_preprocess_attributes.<locals>.<dictcomp>)r�strrrr�loads�items)�
attributesr	rr
�_preprocess_attributesRs
rc
Cs�t||||d�}z|j|d�WddiStjjyG}z&d}|j�di��d�|kr5ddiWYd}~Sd	td
|�iWYd}~Sd}~ww)z�
    Check to see if a queue exists.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_sqs.exists myqueue region=us-east-1
    ��region�key�keyid�profile��	QueueNamez'AWS.SimpleQueueService.NonExistentQueue�ErrorZCode�resultFN�error�boto3.get_errorT)�	_get_conn�
get_queue_url�botocore�
exceptions�ClientError�response�getr)�namerrrr�conn�eZmissing_coder	r	r
�existscs
���r0c
Csvt||||d�}|duri}t|�}z|j||d�WddiStjjy:}zdtd|�iWYd}~Sd}~ww)z�
    Create an SQS queue.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_sqs.create myqueue region=us-east-1
    rN)r!�
Attributesr$r%r#T)r&rZcreate_queuer(r)r*r)r-rrrrrr.r/r	r	r
�createys���r2c
Cspt||||d�}z|j|d�d}|j|d�Wdd	iStjjy7}zdtd|�iWYd}~Sd}~ww)
z�
    Delete an SQS queue.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_sqs.delete myqueue region=us-east-1
    rr �QueueUrl)r3r$r%Nr#T)r&r'Zdelete_queuer(r)r*r)r-rrrrr.�urlr/r	r	r
�delete�s
���r5�c	
s�t||||d�}dd��z|j|d�}|�dg�}d�fdd�|D�iWStjjy@}zd	td
|�iWYd}~Sd}~ww)z�
    Return a list of the names of all visible queues.

    .. versionadded:: 2016.11.0

    CLI Example:

    .. code-block:: bash

        salt myminion boto_sqs.list region=us-east-1
    rcSstj�|�j�d�dS)N�/�)�urllib�parse�urlparse�path�split)Z	queue_urlr	r	r
�extract_name�szlist_.<locals>.extract_name)ZQueueNamePrefixZ	QueueUrlsr#csg|]}�|��qSr	r	)rr4�r>r	r
�
<listcomp>�szlist_.<locals>.<listcomp>r$r%N)r&Zlist_queuesr,r(r)r*r)	�prefixrrrrr.�rZurlsr/r	r?r
r�s��c	
Csxt||||d�}z|j|d�d}|j|dgd�}d|diWStjjy;}zdtd	|�iWYd
}~Sd
}~ww)z�
    Return attributes currently set on an SQS queue.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_sqs.get_attributes myqueue
    rr r3ZAll)r3ZAttributeNamesr#r1r$r%N)r&r'Zget_queue_attributesr(r)r*r)	r-rrrrr.r4rBr/r	r	r
�get_attributes�s
��rCc	
Cszt||||d�}t|�}z|j|d�d}|j||d�Wdd	iStjjy<}zdtd|�iWYd}~Sd}~ww)
z�
    Set attributes on an SQS queue.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_sqs.set_attributes myqueue '{ReceiveMessageWaitTimeSeconds: 20}' region=us-east-1
    rr r3)r3r1r$r%Nr#T)r&rr'Zset_queue_attributesr(r)r*r)	r-rrrrrr.r4r/r	r	r
�set_attributes�s���rD)NNNN)NNNNN)r6NNNN)�__doc__�logging�urllib.parser9Zsalt.utils.jsonrZsalt.utils.versions�	getLoggerr�logZ__func_alias__rr(�setLevel�CRITICALZ	HAS_BOTO3�ImportErrorrrr0r2r5rrCrDr	r	r	r
�<module>sB/
��


�


�