%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/aws_sqs.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddl	m
Z
eje�Z
dZd�Zd�Zd�Zd	ddd
�Zddd�Zddd�Zddd
�Zddd�Zddd�Zd�ZdS(u.
Support for the Amazon Simple Queue Service.
i(tabsolute_importtprint_functiontunicode_literalsN(tsixu
--output jsoncC@s#tjjjd�rtStdfS(Nuawsu=The module aws_sqs could not be loaded: aws command not found(tsalttutilstpathtwhichtTruetFalse(((s8/usr/lib/python2.7/site-packages/salt/modules/aws_sqs.pyt__virtual__scC@sdjd|�S(u%
    Return the region argument.
    u
 --region {r}tr(tformat(tregion((s8/usr/lib/python2.7/site-packages/salt/modules/aws_sqs.pyt_regionsc	K@s�|jdd�}|r%||d<n|jdd�}|rJ||d<ngtj|�D]\}}dj||�^qZ}	djd|dd	j|	�d
t|�dt�}td|d
|dt	�}
|
r�t
jjj
|
�SdS(u�
    Runs the given command against AWS.
    cmd
        Command to run
    region
        Region to execute cmd in
    opts
        Pass in from salt
    user
        Pass in from salt
    kwargs
        Key-value arguments to pass to the command
    u
receipthandleureceipt-handleunumumax-number-of-messagesu--{0} "{1}"u#aws sqs {cmd} {args} {region} {out}tcmdtargsu R
toutucmd.runtrunastpython_shelluN(tpoptNoneRt	iteritemsRtjoinRt_OUTPUTt__salt__R	RRtjsontloads(RR
toptstusertkwargst
receipthandletnumtktvt_formatted_argstrtn((s8/usr/lib/python2.7/site-packages/salt/modules/aws_sqs.pyt_run_aws"s

4		ic		C@s�idd6}t|||�}t|�}||krKtjd|�|Std|||d||d|�}|d|d<|S(uU
    Receive one or more messages from a queue in a region

    queue
        The name of the queue to receive messages from

    region
        Region where SQS queues exists

    num : 1
        The max number of messages to receive

    opts : None
        Any additional options to add to the command line

    user : None
        Run as a user other than what the minion runs as

    CLI Example:

    .. code-block:: bash

        salt '*' aws_sqs.receive_message <sqs queue> <region>
        salt '*' aws_sqs.receive_message <sqs queue> <region> num=10

    .. versionadded:: 2014.7.0

    uMessagesu"%s" queue does not exist.ureceive-messagetqueueR N(Rtlist_queuest_parse_queue_listtlogtinfoR%(	R&R
R RRtrettqueuesturl_mapR((s8/usr/lib/python2.7/site-packages/salt/modules/aws_sqs.pytreceive_messageGs
	c
C@sgt|||�}t|�}||kr>tjd|�tStd|||d|d||�}tS(u�
    Delete one or more messages from a queue in a region

    queue
        The name of the queue to delete messages from

    region
        Region where SQS queues exists

    receipthandle
        The ReceiptHandle of the message to delete. The ReceiptHandle
        is obtained in the return from receive_message

    opts : None
        Any additional options to add to the command line

    user : None
        Run as a user other than what the minion runs as

    CLI Example:

    .. code-block:: bash

        salt '*' aws_sqs.delete_message <sqs queue> <region> receipthandle='<sqs ReceiptHandle>'

    .. versionadded:: 2014.7.0

    u"%s" queue does not exist.udelete-messageRR&(R'R(R)R*R	R%R(R&R
RRRR,R-R((s8/usr/lib/python2.7/site-packages/salt/modules/aws_sqs.pytdelete_messagesscC@s1td|||�}idd6|dd6}|S(u=
    List the queues in the selected region.

    region
        Region to list SQS queues for

    opts : None
        Any additional options to add to the command line

    user : None
        Run hg as a user other than what the minion runs as

    CLI Example:

        salt '*' aws_sqs.list_queues <region>

    ulist-queuesiuretcodeu	QueueUrlsustdout(R%(R
RRRR+((s8/usr/lib/python2.7/site-packages/salt/modules/aws_sqs.pyR'�s
c	C@sQi|d6}tdd|d|d||�}idd6|dd	6d
d6}|S(u
    Creates a queue with the correct name.

    name
        Name of the SQS queue to create

    region
        Region to create the SQS queue in

    opts : None
        Any additional options to add to the command line

    user : None
        Run hg as a user other than what the minion runs as

    CLI Example:

        salt '*' aws_sqs.create_queue <sqs queue> <region>

    u
queue-nameucreate-queueR
RRiuretcodeuQueueUrlustdoutuustderr(R%(tnameR
RRtcreateRR+((s8/usr/lib/python2.7/site-packages/salt/modules/aws_sqs.pytcreate_queue�s

c
	C@s�t|||�}t|�}tjt�}|jdtj|��||kr�i||d6}tdd|d|d||�}t	}	d}
dj
|�}nd}d	}
t}	i|	r�d
ndd6|d
6|
d6}|S(u�
    Deletes a queue in the region.

    name
        Name of the SQS queue to deletes
    region
        Name of the region to delete the queue from

    opts : None
        Any additional options to add to the command line

    user : None
        Run hg as a user other than what the minion runs as

    CLI Example:

        salt '*' aws_sqs.delete_queue <sqs queue> <region>

    umap u	queue-urludelete-queueR
RRuu{0} deletedu
Delete failediiuretcodeustdoutustderr(R'R(tloggingt	getLoggert__name__tdebugRt	text_typeR%RRR	(
R0R
RRR,R-tloggertdeleteR$tsuccessterrRR+((s8/usr/lib/python2.7/site-packages/salt/modules/aws_sqs.pytdelete_queue�s.	
cC@s"t|||�}|t|�kS(u�
    Returns True or False on whether the queue exists in the region

    name
        Name of the SQS queue to search for

    region
        Name of the region to search for the queue in

    opts : None
        Any additional options to add to the command line

    user : None
        Run hg as a user other than what the minion runs as

    CLI Example:

        salt '*' aws_sqs.queue_exists <sqs queue> <region>

    (R'R((R0R
RRtoutput((s8/usr/lib/python2.7/site-packages/salt/modules/aws_sqs.pytqueue_existsscC@std�|dD��}|S(u6
    Parse the queue to get a dict of name -> URL
    cs@s(|]}|jd�d|fVqdS(u/i����N(tsplit(t.0tq((s8/usr/lib/python2.7/site-packages/salt/modules/aws_sqs.pys	<genexpr>*sustdout(tdict(tlist_outputR,((s8/usr/lib/python2.7/site-packages/salt/modules/aws_sqs.pyR(&s(t__doc__t
__future__RRRR3tsalt.utils.jsonRtsalt.utils.pathtsalt.extRR4R5R)RR
RR%RR.R/R'R2R<R>R((((s8/usr/lib/python2.7/site-packages/salt/modules/aws_sqs.pyt<module>s"			%,(#3

Zerion Mini Shell 1.0