%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_lambda.pyo

�
���^c@@s8dZddlmZmZmZddlZddlZddlZddlm	Z	ddl
ZddlZddl
ZddlZddlmZddlmZeje�ZytddlZddlZddlmZddlmZejd	�jej�ejd
�jej�eZ Wne!k
rBe"Z nXd�Z#d�Z$ddddd
�Z&ddddd�Z'ddddd�Z(d�Z)ddddd�Z*ddddddde"e"dddddddd�Z+dddddd�Z,ddddd�Z-dddddddddde"ddd�
Z.dddde"ddddd�	Z/dddddddd�Z0dddddd�Z1dddddd�Z2ddddd�Z3ddddd�Z4dddddd �Z5ddddd!�Z6dddddd"�Z7ddddd#�Z8ddddd$�Z9ddddddd%�Z:ed&ddddd'�Z;ddddd(�Z<dddddddd)�Z=dddddddd*�Z>dddddddd+�Z?dddddddd,�Z@dddddddd-�ZAdS(.u�
Connection module for Amazon Lambda

.. versionadded:: 2016.3.0

:depends:

- boto
- boto3

The dependencies listed above can be installed via package or pip.

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

.. code-block:: yaml

    lambda.keyid: GKTADJGHEIQSXMKKRBJ08H
    lambda.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs

A region may also be specified in the configuration:

.. code-block:: yaml

    lambda.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

.. versionchanged:: 2015.8.0
    All methods now return a dictionary. Create and delete methods return:

    .. code-block:: yaml

        created: true

    or

    .. code-block:: yaml

        created: false
        error:
          message: error message

    Request methods (e.g., `describe_function`) return:

    .. code-block:: yaml

        function:
          - {...}
          - {...}

    or

    .. code-block:: yaml

        error:
          message: error message

i(tabsolute_importtprint_functiontunicode_literalsN(tsix(tSaltInvocationError(trange(tClientError(t__version__ubotouboto3cC@s"tjjjdddddd�S(ug
    Only load if boto libraries exist and if boto libraries are greater than
    a given version.
    tboto_veru2.8.0t	boto3_veru1.2.5tbotocore_veru1.5.2(tsalttutilstversionstcheck_boto_reqs(((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyt__virtual__ts	cC@s1tjjjt�tr-tdtd�ndS(Nuboto3.assign_funcsulambda(RRtcompattpack_dundert__name__tHAS_BOTOt	__utils__(topts((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyt__init__�sc	C@sltd|d|d|d|�}xDtd|j�D]/}x&|dD]}|d|krF|SqFWq5WdS(	uK
    Given function name, find and return matching Lambda information.
    tregiontkeytkeyidtprofileuboto3.paged_callu	FunctionsuFunctionNameN(t	_get_connRtlist_functionstNone(tnameRRRRtconntfuncstfunc((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyt_find_function�s!c
C@sey9t|d|d|d|d|�}it|�d6SWn%tk
r`}itd|�d6SXdS(	u&
    Given a function name, check to see if the given function name exists.

    Returns True if the given function exists and returns False if the given
    function does not exist.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lambda.function_exists myfunction

    RRRRuexistsuboto3.get_erroruerrorN(R"tboolRR(tFunctionNameRRRRR!te((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pytfunction_exists�s	c	C@s||jd�r|Stdd|d|d|d|�}|rWd|krW|d}n|dkrld}nd	j||�S(
Nuarn:aws:iam:uboto_iam.get_account_idRRRRuregionu	us-east-1uarn:aws:iam::{0}:role/{1}(t
startswitht__salt__Rtformat(RRRRRt
account_id((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyt
_get_role_arn�s

	cC@s/tjjj|d��}|j�SWdQXdS(Nurb(RRtfilestfopentread(tinfiletf((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyt	_filedata�sc
C@s"t|tj�r*tjjj|�}n|s4dSt|t�sRt	d��ng|j
dg�D]:}tdd|d|d|d|d|�jd	�^qe}g|j
d
g�D].}td|d|d|d|d|�^q�}|j
dg�j|�|j
d
g�j|�|S(NuVpcConfig must be a dict.uSubnetNamesuboto_vpc.get_resource_idusubnetRRRRuiduSecurityGroupNamesuboto_secgroup.get_group_idu	SubnetIdsuSecurityGroupIds(t
isinstanceRtstring_typesRRtjsontloadsRtdictRtpopR(tgett
setdefaulttextend(tconfRRRRtstsnstsgs((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyt_resolve_vpcconfig�sPDuii�icC@s�t|d|d|d|d|�}yEtd|d|d|d|�}|r�|s`|s`|rotd��nit|�d6}nD|s�|r�td��ni|d6|d6}|r�||d	<ni}|d%k	rt|d|d|d|d|�|d
<n|d%k	r||d<n|r.|
}nd}x�t|d
d�D]�}yI|jd|d|d|d|d|d|d|	d|
d||�	}Wn�tk
r}|dkr|j	j
di�j
d�dkrtjd�t
jd|
|tjd
d�d�qGq�qGXPqGW|rPtjd|d�itd 6|dd!6Stjd"�itd 6SWn,tk
r�}itd 6td#|�d$6SXd%S(&u�
    .. versionadded:: 2017.7.0

    Given a valid config, create a function.

    Environment
        The parent object that contains your environment's configuration
        settings. This is a dictionary of the form:

        .. code-block:: python

            {
                'Variables': {
                    'VariableName': 'VariableValue'
                }
            }

    Returns ``{'created': True}`` if the function was created and ``{created:
    False}`` if the function was not created.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lamba.create_function my_function python2.7 my_role my_file.my_function my_function.zip

    RRRRuIEither ZipFile must be specified, or S3Bucket and S3Key must be provided.uZipFileuS3BucketuS3KeyuS3ObjectVersionu	VpcConfiguEnvironmentiii����R$tRuntimetRoletHandlertCodetDescriptiontTimeoutt
MemorySizetPublishuErroruCodeuInvalidParameterValueExceptionuEFunction not created but IAM role may not have propagated, will retryii�u%The newly created function name is %suFunctionNameucreatedunameuFunction was not createduboto3.get_erroruerrorN(R+RRR1RR?Rtcreate_functionRtresponseR8tlogtinfottimetsleeptrandomtrandinttTruetwarningtFalseR(R$R@RARBtZipFiletS3BuckettS3KeytS3ObjectVersionRDRERFRGtWaitForRoletRoleRetriesRRRRt	VpcConfigtEnvironmenttrole_arnRtcodetkwargst
retrycounttretryR!R%((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyRH�sZ"!

+
	!0
c	C@s�y_td|d|d|d|�}|rC|jd|d|�n|jd|�itd6SWn,tk
r�}itd6td|�d	6SXd
S(u0
    Given a function name and optional version qualifier, delete it.

    Returns {deleted: true} if the function was deleted and returns
    {deleted: false} if the function was not deleted.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lambda.delete_function myfunction

    RRRRR$t	Qualifierudeleteduboto3.get_erroruerrorN(Rtdelete_functionRPRRRR(R$R`RRRRRR%((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyRa/s!	c	
C@s�yrt|d|d|d|d|�}|rfd}itg|D]}||j|�f^q@�d6Sidd6SWn%tk
r�}itd|�d6SXdS(u�
    Given a function name describe its properties.

    Returns a dictionary of interesting properties.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lambda.describe_function myfunction

    RRRRuFunctionNameuRuntimeuRoleuHandleru
CodeSha256uCodeSizeuDescriptionuTimeoutu
MemorySizeuFunctionArnuLastModifiedu	VpcConfiguEnvironmentufunctionuboto3.get_erroruerrorN(
uFunctionNameuRuntimeuRoleuHandleru
CodeSha256uCodeSizeuDescriptionuTimeoutu
MemorySizeuFunctionArnuLastModifiedu	VpcConfiguEnvironment(R"R6R8RRR(	R$RRRRR!tkeystkR%((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pytdescribe_functionJs	3c
C@sItd|�}i|d6|d6|d6|d6|
d6|
d6}td|d	|d
|d|	�}x0tj|�D]\}}|rp|||<qpqpW|r�t|||||	�|d<n|
r�t|
d|d	|d
|d|	�|d<ny-|r�|}nd
}x�t|dd�D]�}y|j|�}Wn�tk
r�}|d
kr�|j	j
di�j
d�dkr�tjd�t
jd||tjdd�d�qq��qXPqW|r�d"}itd6tg|D]}||j
|�f^q��d6Stjd�itd6SWn,tk
rD}itd6td|�d 6SXd!S(#u�
    .. versionadded:: 2017.7.0

    Update the named lambda function to the configuration.

    Environment
        The parent object that contains your environment's configuration
        settings. This is a dictionary of the form:

        .. code-block:: python

            {
                'Variables': {
                    'VariableName': 'VariableValue'
                }
            }

    Returns ``{'updated': True}`` if the function was updated, and
    ``{'updated': False}`` if the function was not updated.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lamba.update_function_config my_function my_role my_file.my_function "my lambda function"

    R$uHandleruDescriptionuTimeoutu
MemorySizeu	VpcConfiguEnvironmentRRRRuRoleiii����uErroruCodeuInvalidParameterValueExceptionuEFunction not updated but IAM role may not have propagated, will retryii�uFunctionNameuRuntimeu
CodeSha256uCodeSizeuFunctionArnuLastModifieduupdatedufunctionuFunction was not updateduboto3.get_erroruerrorN(
uFunctionNameuRuntimeuRoleuHandleru
CodeSha256uCodeSizeuDescriptionuTimeoutu
MemorySizeuFunctionArnuLastModifiedu	VpcConfiguEnvironment(R6RRt	iteritemsR+R?Rtupdate_function_configurationRRIR8RJRKRLRMRNRORPRQRRR(R$RARBRDRERFRRRRRYRWRXRZtargstoptionsRtvaltvarR^R_trR%RbRc((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pytupdate_function_configgsP!

!+	0:
c
C@sctd|d|d|d|	�}
y|rr|s<|s<|rKtd��n|
jd|dt|�d|�}n_|s�|r�td��ni|d	6|d
6}|r�||d<n|
jd|d||�}|rd}
itd6tg|
D]}||j|�f^q��d6Stjd�it	d6SWn,t
k
r^}it	d6td|�d6SXdS( u=
    Upload the given code to the named lambda function.

    Returns {updated: true} if the function was updated and returns
    {updated: False} if the function was not updated.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lamba.update_function_code my_function ZipFile=function.zip

    RRRRuIEither ZipFile must be specified, or S3Bucket and S3Key must be provided.R$RSRGuS3BucketuS3KeyuS3ObjectVersionuFunctionNameuRuntimeuRoleuHandleru
CodeSha256uCodeSizeuDescriptionuTimeoutu
MemorySizeuFunctionArnuLastModifiedu	VpcConfiguEnvironmentuupdatedufunctionuFunction was not updateduboto3.get_erroruerrorN(
uFunctionNameuRuntimeuRoleuHandleru
CodeSha256uCodeSizeuDescriptionuTimeoutu
MemorySizeuFunctionArnuLastModifiedu	VpcConfiguEnvironment(RRtupdate_function_codeR1RPR6R8RJRQRRRR(R$RSRTRURVRGRRRRRRkRgRbRcR%((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyRm�s4!

:
c
C@s�y�td|d|d|	d|
�}i}x;dD]3}t�|dk	r1tt�|�||<q1q1W|jd|d	|d
|dt|�|�itd6SWn,tk
r�}
itd6td
|
�d6SXdS(u�
    Add a permission to a lambda function.

    Returns {added: true} if the permission was added and returns
    {added: False} if the permission was not added.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lamba.add_permission my_function my_id "lambda:*" \
                           s3.amazonaws.com aws:arn::::bucket-name \
                           aws-account-id

    RRRRu	SourceArnu
SourceAccountu	QualifierR$tStatementIdtActiont	Principaluupdateduboto3.get_erroruerrorN(u	SourceArnu
SourceAccountu	Qualifier(	RtlocalsRtstrtadd_permissionRPRRRR(R$RnRoRpt	SourceArnt
SourceAccountR`RRRRRR]R%((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyRs�s!
c
	C@s�yhtd|d|d|d|�}i}|dk	rC||d<n|jd|d||�itd6SWn,tk
r�}	itd6td	|	�d
6SXdS(u'
    Remove a permission from a lambda function.

    Returns {removed: true} if the permission was removed and returns
    {removed: False} if the permission was not removed.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lamba.remove_permission my_function my_id

    RRRRu	QualifierR$Rnuupdateduboto3.get_erroruerrorN(RRtremove_permissionRPRRRR(
R$RnR`RRRRRR]R%((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyRvs!
c	C@sy�td|d|d|d|�}i}|dk	rC||d<n|jd||�}|jdi�}t|tj�r�tjj	j
|�}n|dkr�i}ni}	x�|jdg�D]�}
|
jd	i�}|
jd
i�}d|kr|djd�d
}n|jd�}i|
jd�d6|d
6}
d|krd|djd�|
d<nd|kr�|djd�|
d<n|
|	|
jd�<q�Wi|	d6SWnatk
r}t
d|�}|jjdi�jd�dkr�idd6Sidd6|d6SXdS(u�
    Get resource permissions for the given lambda function

    Returns dictionary of permissions, by statement ID

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lamba.get_permissions my_function

        permissions: {...}
    RRRRu	QualifierR$uPolicyu	Statementu	Conditionu	PrincipaluAWSu:iuServiceuActionuArnLikeu
AWS:SourceArnu	SourceArnuStringEqualsuAWS:SourceAccountu
SourceAccountuSidupermissionsuboto3.get_erroruErroruCodeuResourceNotFoundExceptionuerrorN(RRt
get_policyR8R2RR3RRR4R5tsplitRRRI(R$R`RRRRRR]tpolicytpermissionst	statementt	conditiont	principalt
permissionR%terr((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pytget_permissions'sF!
		
$c	C@sWtd|d|d|d|�}g}x)td|j�D]}||d7}q;W|S(u�
    List all Lambda functions visible in the current scope.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lambda.list_functions

    RRRRuboto3.paged_callu	Functions(RRR(RRRRRtretR ((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyR`s
!c		C@s�y�td|d|d|d|�}g}x2td|jd|�D]}|j|d�qDWt|�s{tjd�ni|d6SWn%tk
r�}itd	|�d
6SXdS(u�
    List the versions available for the given function.

    Returns list of function versions

    CLI Example:

    .. code-block:: yaml

        versions:
          - {...}
          - {...}

    RRRRuboto3.paged_callR$uVersionsuNo versions founduboto3.get_erroruerrorN(RRtlist_versions_by_functionR:R#RJRQR(	R$RRRRRtversR�R%((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pytlist_function_versionsss!
c	C@s�y�td|d|d|d|�}|jd|d|d|d|�}	|	rxtjd	|	d
�itd6|	d
d6Stjd
�itd6SWn,tk
r�}
itd6td|
�d6SXdS(u7
    Given a valid config, create an alias to a function.

    Returns {created: true} if the alias was created and returns
    {created: False} if the alias was not created.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lamba.create_alias my_function my_alias $LATEST "An alias"

    RRRRR$tNametFunctionVersionRDu"The newly created alias name is %suNameucreatedunameuAlias was not createduboto3.get_erroruerrorN(	Rtcreate_aliasRJRKRPRQRRRR(R$R�R�RDRRRRRtaliasR%((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyR��s!
c	C@syyFtd|d|d|d|�}|jd|d|�itd6SWn,tk
rt}itd6td|�d	6SXd
S(u&
    Given a function name and alias name, delete the alias.

    Returns {deleted: true} if the alias was deleted and returns
    {deleted: false} if the alias was not deleted.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lambda.delete_alias myfunction myalias

    RRRRR$R�udeleteduboto3.get_erroruerrorN(Rtdelete_aliasRPRRRR(R$R�RRRRRR%((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyR��s!c	C@s�td|d|d|d|�}i|d6}|rA||d<nxLtd|j|�D]4}	x+|	jd�D]}
|
d	|krn|
SqnWqXWd
S(uY
    Given function name and alias name, find and return matching alias information.
    RRRRuFunctionNameuFunctionVersionuboto3.paged_calluAliasesuNameN(RRtlist_aliasesR8R(R$R�R�RRRRRRgtaliasesR�((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyt_find_alias�s!

cC@shy<t||d|d|d|d|�}it|�d6SWn%tk
rc}itd|�d6SXdS(	u,
    Given a function name and alias name, check to see if the given alias exists.

    Returns True if the given alias exists and returns False if the given
    alias does not exist.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lambda.alias_exists myfunction myalias

    RRRRuexistsuboto3.get_erroruerrorN(R�R#RR(R$R�RRRRR�R%((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pytalias_exists�sc
C@s�yut||d|d|d|d|�}|rid
}itg|D]}||j|�f^qC�d	6Sidd	6SWn%tk
r�}	itd
|	�d6SXdS(u�
    Given a function name and alias name describe the properties of the alias.

    Returns a dictionary of interesting properties.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lambda.describe_alias myalias

    RRRRuAliasArnuNameuFunctionVersionuDescriptionualiasuboto3.get_erroruerrorN(uAliasArnuNameuFunctionVersionuDescription(R�R6R8RRR(
R$R�RRRRR�RbRcR%((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pytdescribe_alias�s3c	C@s�y�td|d|d|d|�}i}	|r=||	d<n|rP||	d<n|jd|d||	�}
|
r�d}itd
6tg|D]}||
j|�f^q��d6Stjd�itd
6SWn,tk
r�}
itd
6t	d|
�d6SXdS(u"
    Update the named alias to the configuration.

    Returns {updated: true} if the alias was updated and returns
    {updated: False} if the alias was not updated.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lamba.update_alias my_lambda my_alias $LATEST

    RRRRuFunctionVersionuDescriptionR$R�uNameuupdatedualiasuAlias was not updateducreateduboto3.get_erroruerrorN(uNameuFunctionVersionuDescription(
Rtupdate_aliasRPR6R8RJRQRRRR(R$R�R�RDRRRRRRgRkRbRcR%((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyR�s!

:
idc	C@s�y�td|d|d|d|�}	|	jd|d|d|d|d	|�}
|
r~tjd
|
d�itd6|
dd
6Stjd�itd6SWn,tk
r�}itd6td|�d6SXdS(u
    Identifies a stream as an event source for a Lambda function. It can be
    either an Amazon Kinesis stream or an Amazon DynamoDB stream. AWS Lambda
    invokes the specified function when records are posted to the stream.

    Returns {created: true} if the event source mapping was created and returns
    {created: False} if the event source mapping was not created.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lamba.create_event_source_mapping arn::::eventsource myfunction LATEST

    RRRRtEventSourceArnR$tEnabledt	BatchSizetStartingPositionu/The newly created event source mapping ID is %suUUIDucreateduidu$Event source mapping was not createduboto3.get_erroruerrorN(	Rtcreate_event_source_mappingRJRKRPRQRRRR(R�R$R�R�R�RRRRRtobjR%((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyR�.s!	
c	C@s�td|d|d|d|�}y`g}xOtd|jd|d|�D].}|jg|dD]}	|	d	^qa�qJW|SWn%tk
r�}
itd
|
�d6SXdS(
u�
    Given an event source and function name, return a list of mapping IDs

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lambda.get_event_source_mapping_ids arn:::: myfunction

    RRRRuboto3.paged_callR�R$uEventSourceMappingsuUUIDuboto3.get_erroruerrorN(RRtlist_event_source_mappingsR:R(R�R$RRRRRtmappingstmapstmappingR%((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pytget_event_source_mapping_idsRs
!
	#cC@st|r(|s|r!td��n|gS|s6|rEtd��ntd|d|d|d|d|d|�SdS(NuSEither UUID must be specified, or EventSourceArn and FunctionName must be provided.R�R$RRRR(RR�(tUUIDR�R$RRRR((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyt_get_idslsc	C@s�t|d|d|�}yQtd|d|d|d|�}x|D]}	|jd|	�qCWitd6SWn,tk
r�}
itd6td	|
�d
6SXdS(u�
    Given an event source mapping ID or an event source ARN and FunctionName,
    delete the event source mapping

    Returns {deleted: true} if the mapping was deleted and returns
    {deleted: false} if the mapping was not deleted.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lambda.delete_event_source_mapping 260c423d-e8b5-4443-8d6a-5e91b9ecd0fa

    R�R$RRRRR�udeleteduboto3.get_erroruerrorN(R�Rtdelete_event_source_mappingRPRRRR(R�R�R$RRRRtidsRtidR%((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyR�|s	!
cC@s]td|d|d|d|d|d|d|�}d|krC|Sit|jd	��d
6S(uN
    Given an event source mapping ID or an event source ARN and FunctionName,
    check whether the mapping exists.

    Returns True if the given alias exists and returns False if the given
    alias does not exist.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lambda.alias_exists myfunction myalias

    R�R�R$RRRRuerroruevent_source_mappinguexists(tdescribe_event_source_mappingR#R8(R�R�R$RRRRtdesc((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pytevent_source_mapping_exists�sc
	C@s�t|d|d|�}t|�dkr5idd6S|d}y�td|d|d|d	|�}|jd
|�}	|	r�d}
itg|
D]}||	j|�f^q��d6Sidd6SWn%tk
r�}itd|�d6SXdS(u,
    Given an event source mapping ID or an event source ARN and FunctionName,
    obtain the current settings of that mapping.

    Returns a dictionary of interesting properties.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lambda.describe_event_source_mapping uuid

    R�R$iuevent_source_mappingiRRRRR�uUUIDu	BatchSizeuEventSourceArnuFunctionArnuLastModifieduLastProcessingResultuStateuStateTransitionReasonuboto3.get_erroruerrorN(uUUIDu	BatchSizeuEventSourceArnuFunctionArnuLastModifieduLastProcessingResultuStateuStateTransitionReason(	R�tlenRRtget_event_source_mappingR6R8RR(
R�R�R$RRRRR�RR�RbRcR%((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyR��s 	
!3c	C@sy�td|d|d|d|�}i}	|dk	rC||	d<n|dk	r\||	d<n|dk	ru||	d<n|jd||	�}
|
r�d}itd6tg|D]}||
j|�f^q��d6Stjd�itd6SWn,t	k
r}
itd6t
d|
�d6SXdS(u@
    Update the event source mapping identified by the UUID.

    Returns {updated: true} if the alias was updated and returns
    {updated: False} if the alias was not updated.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lamba.update_event_source_mapping uuid FunctionName=new_function

    RRRRuFunctionNameuEnabledu	BatchSizeR�uUUIDuEventSourceArnuFunctionArnuLastModifieduLastProcessingResultuStateuStateTransitionReasonuupdateduevent_source_mappinguMapping was not updateducreateduboto3.get_erroruerrorN(uUUIDu	BatchSizeuEventSourceArnuFunctionArnuLastModifieduLastProcessingResultuStateuStateTransitionReason(RRtupdate_event_source_mappingRPR6R8RJRQRRRR(R�R$R�R�RRRRRRgRkRbRcR%((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyR��s&!


:
(Bt__doc__t
__future__RRRtloggingRLRNtsalt.extRtsalt.utils.compatRtsalt.utils.filestsalt.utils.jsontsalt.utils.versionstsalt.exceptionsRtsalt.ext.six.movesRt	getLoggerRRJtbototboto3tbotocore.exceptionsRtbotocoreRtfound_botocore_versiontsetLeveltCRITICALRPRtImportErrorRRRRRR"R&R+R1R?RHRaRdRlRmRsRvR�RR�R�R�R�R�R�R�R�R�R�R�R�R�R�(((s</usr/lib/python2.7/site-packages/salt/modules/boto_lambda.pyt<module>Ms�


		
		W		M	08"#		$	

Zerion Mini Shell 1.0