File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/boto_cognitoidentity.cpython-310.pyc
Back
o ;j�: � @ s2 d Z ddlZddlZddlZe�e�Zz$ddlZddl Z ddl mZ e�d��ej � e�d��ej � dZW n eyB dZY nw dd � Zd d� Zdd � Z ddd�Z ddd�Z ddd�Z ddd�Zdd� Z ddd�Z ddd�ZdS ) a Connection module for Amazon CognitoIdentity .. versionadded:: 2016.11.0 :configuration: This module accepts explicit CognitoIdentity credentials but can also utilize IAM roles assigned to the instance trough 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 cognitoidentity.keyid: GKTADJGHEIQSXMKKRBJ08H cognitoidentity.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs A region may also be specified in the configuration: .. code-block:: yaml cognitoidentity.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, delete, set, and update methods return: .. code-block:: yaml created: true or .. code-block:: yaml created: false error: message: error message Request methods (e.g., `describe_identity_pools`) return: .. code-block:: yaml identity_pools: - {...} - {...} or .. code-block:: yaml error: message: error message :depends: boto3 � N)�ClientError�boto�boto3TFc C s t jjjddd�S )zg Only load if boto libraries exist and if boto libraries are greater than a given version. z2.8.0z1.2.1)Zboto_verZ boto3_ver)�salt�utilsZversionsZcheck_boto_reqs� r r �U/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_cognitoidentity.py�__virtual__i s r c C s t rtd td� d S d S )Nzboto3.assign_funcszcognito-identity)�HAS_BOTO� __utils__�__name__)�optsr r r �__init__t s �r c C sb g }|du r*t d |jdddd�D ]}|d D ]}|d | kr&|�|d � qq|S |�|� |S ) z� Given identity pool name (or optionally a pool_id and name will be ignored), find and return list of matching identity pool id's. Nzboto3.paged_callZ NextToken� )Zmarker_flagZ marker_argZ MaxResultsZ IdentityPools�IdentityPoolName�IdentityPoolId)r Zlist_identity_pools�append)�name�pool_id�conn�idsZpools�poolr r r �_find_identity_pool_idsy s ��� �r c C � t ||||d�}z*t| ||�}|r.g }|D ]} |j| d�} | �dd� |�| � qd|iW S ddiW S tyL } zdtd |�iW Y d}~S d}~ww )a� Given an identity pool name, (optionally if an identity pool id is given, the given name will be ignored) Returns a list of matched identity pool name's pool properties CLI Example: .. code-block:: bash salt myminion boto_cognitoidentity.describe_identity_pools my_id_pool_name salt myminion boto_cognitoidentity.describe_identity_pools '' IdentityPoolId=my_id_pool_id ��region�key�keyid�profile�r �ResponseMetadataN�identity_pools�error�boto3.get_error)� _get_connr Zdescribe_identity_pool�popr r r �r r r r r r r r �resultsr �response�er r r �describe_identity_pools� � ��r* c C s� |du rt � n|}|du rt� n|}t||||d�} z"t | |||d�} |r)|| d<