%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/states/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/states/boto_cloudwatch_event.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddl	m
Z
eje�Z
d�Zdddddddddddd�Zdddddd�ZdS(u�
Manage CloudTrail Objects
=========================

.. versionadded:: 2016.11.0

Create and destroy CloudWatch event rules. Be aware that this interacts with Amazon's services,
and so may incur charges.

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

This module accepts explicit vpc 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

    cloudwatch_event.keyid: GKTADJGHEIQSXMKKRBJ08H
    cloudwatch_event.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

    Ensure event rule exists:
        boto_cloudwatch_event.present:
            - Name: mytrail
            - ScheduleExpression: 'rate(120 minutes)'
            - State: 'DISABLED'
            - Targets:
              - Id: "target1"
                Arn: "arn:aws:lambda:us-west-1:124456715622:function:my_function"
                Input: '{"arbitrary": "json"}'
            - region: us-east-1
            - keyid: GKTADJGHEIQSXMKKRBJ08H
            - key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs

i(tabsolute_importtprint_functiontunicode_literalsN(tsixcC@sdtkrdStS(u)
    Only load if boto is available.
    uboto_cloudwatch_event.existsuboto_cloudwatch_event(t__salt__tFalse(((sE/usr/lib/python2.7/site-packages/salt/states/boto_cloudwatch_event.pyt__virtual__EscC@s,i|d6td6dd6id6}|r.|n|}t|tj�r^tjjj|�}n|d0krsg}nt	dd|d|d	|	d
|
d|�}
d|
kr�t
|d<d
j|
dd�|d<|S|
jd�s�t
dr
dj|�|d<d0|d<|St	dd|d|d|d|d|d|d|d	|	d
|
d|�
}
|
jd�s�t
|d<d
j|
dd�|d<|St	d|d|d	|	d
|
d|�}d|kr�t
|d<d
j|dd�|d<i|d<|Sid0d6|dd<||dd<dj|�|d<t|�r�t	dd|d |d|d	|	d
|
d|�}
d|
kr�t
|d<d
j|
dd�|d<i|d<|S||dddd!<n|Stjj|dd"j|�g�|d<i|d<t	dd|d|d	|	d
|
d|�}d|krat
|d<d#j|dd�|d<i|d<|S|jd�}t	d$d|d|d	|	d
|
d|�}
d|
kr�t
|d<d#j|
dd�|d<i|d<|S|
jd%g�|d!<t
}id&d&6d'd'6d(d(6d)d)6d*d*6d!d!6}x|tj|�D]k\}}||t�|kr6t}t�||djdi�|<|||djdi�|<q6q6W|r(t
dr�d+j|�}||d<d0|d<|Stjj|dd,g�|d<t	dd|d|d|d|d|d|d|d	|	d
|
d|�
}
|
jd�s�t
|d<d#j|
dd�|d<i|d<|S|d!|kr(g|d!D]}|jd-�^q�}tj|�t|�r�xW|D]O}|jd-d0�}|d0k	r�||kr�|j|�}|j|�q�q�Wt	dd|d |d|d	|	d
|
d|�}
d|
kr�t
|d<d#j|
dd�|d<i|d<|Snt|�r%t	d.d|d/|d|d	|	d
|
d|�}
d|
kr"t
|d<d#j|
dd�|d<i|d<|Sq%q(n|S(1u�
    Ensure trail exists.

    name
        The name of the state definition

    Name
        Name of the event rule.  Defaults to the value of the 'name' param if
        not provided.

    ScheduleExpression
        The scheduling expression. For example, ``cron(0 20 * * ? *)``,
        "rate(5 minutes)"

    EventPattern
        The event pattern.

    Description
        A description of the rule

    State
        Indicates whether the rule is ENABLED or DISABLED.

    RoleArn
        The Amazon Resource Name (ARN) of the IAM role associated with the
        rule.

    Targets
        A list of rresources to be invoked when the rule is triggered.

    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.
    unameuresultuucommentuchangesuboto_cloudwatch_event.existstNametregiontkeytkeyidtprofileuerroru!Failed to create event rule: {0}.umessageuexistsutestu/CloudWatch event rule {0} is set to be created.u&boto_cloudwatch_event.create_or_updatetScheduleExpressiontEventPatterntDescriptiontRoleArntStateucreateduboto_cloudwatch_event.describeuruleuoldunewuCloudTrail {0} created.u!boto_cloudwatch_event.put_targetstRuletTargetsuTargetsu%CloudWatch event rule {0} is present.u!Failed to update event rule: {0}.u"boto_cloudwatch_event.list_targetsutargetsuScheduleExpressionuEventPatternuDescriptionuRoleArnuStateu-CloudWatch event rule {0} set to be modified.u$CloudWatch event rule to be modifieduIdu$boto_cloudwatch_event.remove_targetstIdsN(tTruet
isinstanceRtstring_typestsalttutilstjsontloadstNoneRRtformattgett__opts__tbooltostlineseptjoint	iteritemstlocalst
setdefaulttlogterrortindextpop(tnameRRR
RRRRRR	R
Rtrettrt	_describetneed_updatet	rule_varstinvartoutvartmsgtitremovesttargetttidtix((sE/usr/lib/python2.7/site-packages/salt/states/boto_cloudwatch_event.pytpresentLs3

	








)






!%


 

&






c
C@s�i|d6td6dd6id6}|r.|n|}td|d|d|d	|d
|�}d|kr�t|d<dj|dd
�|d<|S|r�|dr�dj|�|d<|Stdr�dj|�|d<d|d<|Stdd|d|d|d	|d
|�}|jd�sGt|d<dj|dd
�|d<|Sg|dD]}|jd�^qR}	t|	�rtdd|d|	d|d|d	|d
|�}d|kr�t|d<dj|dd
�|d<|S|jd�rt|d<dj|d�|d<|Sntd|d|d|d	|d
|�}|dsqt|d<dj|dd
�|d<|Si|d6|dd<idd6|dd<dj|�|d<|S( u�
    Ensure CloudWatch event rule with passed properties is absent.

    name
        The name of the state definition.

    Name
        Name of the event rule.  Defaults to the value of the 'name' param if
        not provided.

    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.
    unameuresultuucommentuchangesuboto_cloudwatch_event.existsRR	R
Ruerroru!Failed to delete event rule: {0}.umessageuexistsu)CloudWatch event rule {0} does not exist.utestu/CloudWatch event rule {0} is set to be removed.u"boto_cloudwatch_event.list_targetsRutargetsuIdu$boto_cloudwatch_event.remove_targetsRufailuresuboto_cloudwatch_event.deleteudeleteduruleuoldunewu"CloudWatch event rule {0} deleted.N(RRRRRRRR(
R*RRR	R
RR+R,tttids((sE/usr/lib/python2.7/site-packages/salt/states/boto_cloudwatch_event.pytabsentsb






&




(t__doc__t
__future__RRRtloggingR tsalt.utils.jsonRtsalt.extRt	getLoggert__name__R&RRR8R;(((sE/usr/lib/python2.7/site-packages/salt/states/boto_cloudwatch_event.pyt<module>5s 	�

Zerion Mini Shell 1.0