File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/boto_iot.cpython-310.pyc
Back
o ;j�h � @ s� d Z ddlZddlZddlZddlZddlZe�e�Z z!ddl Z ddlZddlm Z ddlmZ e�d��ej� dZW n eyG dZY nw dd � Zd d� Zd>dd �Zd>dd�Z d>dd�Z d?dd�Zd>dd�Zd>dd�Z d>dd�Zd>dd�Zd>dd�Z d>dd�Z d?d d!�Z! d>d"d#�Z" d>d$d%�Z#d>d&d'�Z$d>d(d)�Z% d>d*d+�Z&d>d,d-�Z' d>d.d/�Z( d>d0d1�Z)d>d2d3�Z* d?d4d5�Z+ d?d6d7�Z,d>d8d9�Z-d>d:d;�Z. d@d<d=�Z/dS )Aa, Connection module for Amazon IoT .. 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 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 iot.keyid: GKTADJGHEIQSXMKKRBJ08H iot.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs A region may also be specified in the configuration: .. code-block:: yaml iot.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 � N)�__version__)�ClientError�boto3TFc C s t jjjddd�S )zg Only load if boto libraries exist and if boto libraries are greater than a given version. z1.2.1z1.4.41)Z boto3_verZbotocore_ver)�salt�utilsZversionsZcheck_boto_reqs� r r �I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_iot.py�__virtual__P s r c C s t rtd td� d S d S )Nzboto3.assign_funcsZiot)�HAS_BOTO� __utils__�__name__)�optsr r r �__init__[ s �r c C s� zt ||||d�}|j| d�}|�d�rddiW S ddiW S tyO } z&td |�}|j�di ��d �d krAddiW Y d}~S d|iW Y d}~S d}~ww ) aI Given a thing type name, check to see if the given thing type exists Returns True if the given thing type exists and returns False if the given thing type does not exist. .. versionadded:: 2016.11.0 CLI Example: .. code-block:: bash salt myminion boto_iot.thing_type_exists mythingtype ��region�key�keyid�profile�� thingTypeNamer �existsTF�boto3.get_error�Error�Code�ResourceNotFoundExceptionN�error)� _get_conn�describe_thing_type�getr r �response) r r r r r �conn�res�e�errr r r �thing_type_exists` s ��r$ c C s� z>t ||||d�}|j| d�}|r:|�dd� |�d�}|r5dD ]}|�|�} | r4t| tj�r4| � ||<