%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/states/ |
Current File : //lib/python2.7/site-packages/salt/states/boto_iot.pyo |
� ���^c @@ sD d Z d d l m Z m Z m Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z e j e � Z d � Z d d d d d � Z d d d d d � Z d d d d d � Z d d d d d � Z d d d d d � Z d d d d d � Z d e d d d d d � Z d d d d d � Z d S( ur Manage IoT Objects ================== .. versionadded:: 2016.3.0 Create and destroy IoT objects. Be aware that this interacts with Amazon's services, and so may incur charges. :depends: - boto - boto3 The dependencies listed above 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 vpc.keyid: GKTADJGHEIQSXMKKRBJ08H vpc.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 policy exists: boto_iot.policy_present: - policyName: mypolicy - policyDocument: Version: "2012-10-17" Statement: Action: - iot:Publish Resource: - "*" Effect: "Allow" - region: us-east-1 - keyid: GKTADJGHEIQSXMKKRBJ08H - key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs Ensure topic rule exists: boto_iot.topic_rule_present: - ruleName: myrule - sql: "SELECT * FROM 'iot/test'" - description: 'test rule' - ruleDisabled: false - actions: - lambda: functionArn: "arn:aws:us-east-1:1234:function/functionname" - region: us-east-1 - keyid: GKTADJGHEIQSXMKKRBJ08H - key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs i ( t absolute_importt print_functiont unicode_literalsN( t sixc C@ s d t k r d St S( u) Only load if boto is available. u boto_iot.policy_existsu boto_iot( t __salt__t False( ( ( s8 /usr/lib/python2.7/site-packages/salt/states/boto_iot.pyt __virtual__Z s c C@ s� i | d 6t d 6d d 6i d 6} t d d | d | d | d | d | � } d | k r� t | d <d j | d d � | d <| S| j d � r� t | d <d j | � | d <| St d r� d j | � | d <d | d <| St d d | d | d | d | d | d | d | � } | j d � sLt | d <d j | d d � | d <| St d d | d | d | d | d | � } i d d 6| d d <| | d d <d j | � | d <| S( u[ Ensure thing type exists. .. versionadded:: 2016.11.0 name The name of the state definition thingTypeName Name of the thing type thingTypeDescription Description of the thing type searchableAttributesList List of string attributes that are searchable for the thing type region Region to connect to. key Secret key to be used. keyid Access key to be used profile A dict with region, key, keyid, or a pillar key (string) that contains a dict with region, key, and keyid u nameu resultu u commentu changesu boto_iot.thing_type_existst thingTypeNamet regiont keyt keyidt profileu erroru! Failed to create thing type: {0}.u messageu existsu- Thing type with given name {0} already existsu testu$ Thing type {0} is set to be created.u boto_iot.create_thing_typet thingTypeDescriptiont searchableAttributesListu createdu boto_iot.describe_thing_typeu thing_typeu oldu newu Thing Type {0} created.N( t TrueR R t formatt gett __opts__t None( t nameR R R R R R R t rett rt _describe( ( s8 /usr/lib/python2.7/site-packages/salt/states/boto_iot.pyt thing_type_presenta sH # c C@ s� i | d 6t d 6d d 6i d 6} t d d | d | d | d | d | � } d | k r� t | d <d j | d d � | d <| S| r� | d r� d j | � | d <| S| d } | j d � } | j d t � } t d r| r� d } n d } d j | | � | d <d&