%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/states/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/states/boto_cognitoidentity.pyo

�
���^c
@@s�dZddlmZmZmZddlZddlmZeje	�Z
d�Zd�Zd�Z
eddddddddd�	Zeddddd	�ZdS(
u�
Manage CognitoIdentity Functions
================================

.. versionadded:: 2016.11.0

Create and destroy CognitoIdentity identity pools. 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

    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 function exists:
        boto_cognitoidentity.pool_present:
            - PoolName: my_identity_pool
            - region: us-east-1
            - keyid: GKTADJGHEIQSXMKKRBJ08H
            - key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs

i(tabsolute_importtprint_functiontunicode_literalsN(tstring_typescC@sdtkrdStS(u)
    Only load if boto is available.
    u,boto_cognitoidentity.describe_identity_poolsuboto_cognitoidentity(t__salt__tFalse(((sD/usr/lib/python2.7/site-packages/salt/states/boto_cognitoidentity.pyt__virtual__;scC@s�d}|dkr|St|t�r�|tkr>t|}ntjdi�}||kri||}n|tkr�t|}q�nt||�r�|}nt||�s�d}n|S(u�
    Helper function to retrieve objtype from pillars if objname
    is string_types, used for SupportedLoginProviders and
    OpenIdConnectProviderARNs.
    umasterN(tNonet
isinstanceRt__opts__t
__pillar__tget(tobjnametobjtypetrettmaster_opts((sD/usr/lib/python2.7/site-packages/salt/states/boto_cognitoidentity.pyt_get_objectBs 

		c	C@s�tdddd||�}|jd�rvt|d<dj|djd|d��}d	j|d
|�|d
<dS|jd�d
jdi�}tdd|d|d||�}|jd�st|d<dj|djd|d��}d	j|d
|�|d
<dS|jd�}||kr�|ds[t�|dd<t�|dd<n||ddd<|jd�|ddd<d	j|d
d�|d
<nd	j|d
d�|d
<dS(u?
    Helper function to set the Roles to the identity pool
    u,boto_cognitoidentity.get_identity_pool_rolestIdentityPoolNameutIdentityPoolIduerroruresultu/Failed to get existing identity pool roles: {0}umessageu{0}
{1}ucommentNuidentity_pool_rolesiuRolesu,boto_cognitoidentity.set_identity_pool_rolestAuthenticatedRoletUnauthenticatedRoleusetuFailed to set roles: {0}urolesuchangesuoldunewuidentity pool roles updated.u'identity pool roles is already current.(RRRtformattdict(	RRRRtconn_paramstrtfailure_commenttexisting_identity_pool_roletupdated_identity_pool_role((sD/usr/lib/python2.7/site-packages/salt/states/boto_cognitoidentity.pyt
_role_present]s<	
	

cC@s|i|d6td6dd6id6}td|d|	d|
d	|�}
td
d||
�}|jd�r�t|d<d
j|dd�|d<|S|jd�}|r�t|�dkr�t|d<dj|�|d<|S|d)kr�d)n|d}|d)krd)n|jd�}tdrf|d)krBdj|�|d<ndj||�|d<d)|d<|St	|t�}t	|t
�}td|d|d|d|d|�}|j|
�d)}|d)krXtd|�}|jd�r |jd�}|jd�}dj||�|d<q�t|d<dj|djd|d��|d<|Sn�||d<|jd d)�td!|�}|jd"�r�|jd�}d#j||�|d<n;t|d<d$j|||djd|d��|d<|S||krXt�|dd%<t�|dd&<d'j|�}||dd%|<||dd&|<n
d(|d<t
|||||
�|S(*u�
    Ensure Cognito Identity Pool exists.

    name
        The name of the state definition

    IdentityPoolName
        Name of the Cognito Identity Pool

    AuthenticatedRole
        An IAM role name or ARN that will be associated with temporary AWS
        credentials for an authenticated cognito identity.

    AllowUnauthenticatedIdentities
        Whether to allow anonymous user identities

    UnauthenticatedRole
        An IAM role name or ARN that will be associated with anonymous
        user identities

    SupportedLoginProviders
        A dictionary or pillar that contains key:value pairs mapping provider
        names to provider app IDs.

    DeveloperProviderName
        A string which is the domain by which Cognito will refer to your users.
        This name acts as a placeholder that allows your backend and the Cognito
        service to communicate about the developer provider.  Once you have set a
        developer provider name, you cannot change it.  Please take care in setting
        this parameter.

    OpenIdConnectProviderARNs
        A list or pillar name that contains a list of OpenID Connect provider ARNs.

    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.
    unameuresultuucommentuchangestregiontkeytkeyidtprofileu,boto_cognitoidentity.describe_identity_poolsRuerroru%Failed to describe identity pools {0}umessageuidentity_poolsiuxMore than one identity pool for the given name matched Cannot execute pool_present function.
Matched Identity Pools:
{0}iuIdentityPoolIdutestu.A new identity pool named {0} will be created.u?An existing identity pool named {0} with id {1}will be updated.tAllowUnauthenticatedIdentitiestSupportedLoginProviderstDeveloperProviderNametOpenIdConnectProviderARNsu)boto_cognitoidentity.create_identity_poolucreatedu
identity_poolu5A new identity pool with name {0}, id {1} is created.u&Failed to add a new identity pool: {0}uIdentityPoolNameu)boto_cognitoidentity.update_identity_pooluupdatedu8Existing identity pool with name {0}, id {1} is updated.u7Failed to update an existing identity pool {0} {1}: {2}uoldunewuIdentity Pool Name {0}u+Identity Pool state is current, no changes.N(tTrueRRRRRtlenRR	RtlisttupdatetpopR(tnameRRR!RR"R#R$RRRR RRRtidentity_poolstexisting_identity_poolRtrequest_paramstupdated_identity_poolt
change_key((sD/usr/lib/python2.7/site-packages/salt/states/boto_cognitoidentity.pytpool_present�s�8

!
	


!


	

!

!
c	C@s�i|d6td6dd6id6}td|d|d|d	|�}td
d||�}	|	jd�r�t|d<d
j|	dd�|d<|S|	jd�}
|
d kr�t|d<dj|�|d<|S|rt|
�dkrt|d<dj|
�|d<|Stdr2dj|
�|d<d |d<|Sxd|
D]\}|jd�}tdddd||�}	|	jd�r�t|d<dj||	djd|	d��}
dj|d|
�|d<|S|	jd�r^|dst�|dd<t�|dd<ndj|�}||dd|<d |dd|<dj|ddj|��|d<q9t|d<dj|�}
dj|d|
�|d<|Sq9W|S(!u�
    Ensure cognito identity pool with passed properties is absent.

    name
        The name of the state definition.

    IdentityPoolName
        Name of the Cognito Identity Pool.  Please note that this may
        match multiple pools with the same given name, in which case,
        all will be removed.

    RemoveAllMatched
        If True, all identity pools with the matching IdentityPoolName
        will be removed.  If False and there are more than one identity pool
        with the matching IdentityPoolName, no action will be taken.  If False
        and there is only one identity pool with the matching IdentityPoolName,
        the identity pool will be removed.

    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.
    unameuresultuucommentuchangesRRRR u,boto_cognitoidentity.describe_identity_poolsRuerroru%Failed to describe identity pools {0}umessageuidentity_poolsu0No matching identity pool for the given name {0}iuvMore than one identity pool for the given name matched and RemoveAllMatched flag is False.
Matched Identity Pools:
{0}utestu9The following matched identity pools will be deleted.
{0}uIdentityPoolIdu*boto_cognitoidentity.delete_identity_poolsRu'Failed to delete identity pool {0}: {1}u{0}
{1}udeleteduoldunewuIdentity Pool Id {0}u{0} deletedu2Identity Pool Id {0} not deleted, returned count 0N(	R%RRRRRRR&R	(R*RtRemoveAllMatchedRRRR RRRR+t
identity_poolRRR/((sD/usr/lib/python2.7/site-packages/salt/states/boto_cognitoidentity.pytpool_absentsd"

!
	







	
 
&
(t__doc__t
__future__RRRtloggingtsalt.ext.sixRt	getLoggert__name__tlogRRRRRR0R3(((sD/usr/lib/python2.7/site-packages/salt/states/boto_cognitoidentity.pyt<module>/s			,�

Zerion Mini Shell 1.0