U
    W+d                    @   s   d dl Z d dlZ d dlmZmZ d dlmZ d dlmZ d dl	m
Z
 dddgid	d
gdgidddgid	d
gdgidZeed ZG dd de
ZdS )    N)jsonsix)	ResultSet)
SummaryMap)AWSQueryConnectionZ	StatementZServicezec2.amazonaws.comZAllowzsts:AssumeRole)Z	PrincipalZEffectActionzec2.amazonaws.com.cn)defaultamazonaws.com.cnr   c                       sZ  e Zd ZdZdƇ fdd	Zd	d
 ZdddZdddZdddZdddZ	dd Z
dddZdd Zdd Zdd Zddd Zd!d" Zd#d$ Zdd%d&Zdd'd(Zd)d* Zdd+d,Zdd-d.Zdd/d0Zd1d2 Zd3d4 Zd5d6 Zdd7d8Zdd9d:Zdd;d<Zdd=d>Zdd?d@ZddAdBZ ddCdDZ!ddEdFZ"ddGdHZ#ddIdJZ$e$Z%ddKdLZ&ddMdNZ'dOdP Z(dQdR Z)ddSdTZ*dUdV Z+dWdX Z,dYdZ Z-d[d\ Z.d]d^ Z/d_d` Z0dadb Z1dcdd Z2dedf Z3dgdh Z4ddjdkZ5dldm Z6dndo Z7ddpdqZ8ddrdsZ9ddtduZ:dvdw Z;dxdy Z<dzd{ Z=d|d} Z>d~d Z?dd Z@dddZAdddZBdddZCdddZDdd ZEdd ZFdd ZGdd ZHdd ZIdd ZJdd ZKdd ZLdd ZMdd ZNdd ZOdd ZPdd ZQdddZRdddZSdddZTdd ZUdd ZVdd ZWdd ZXdddZYdddZZdd Z[dddZ\dd Z]dd Z^dd Z_dd Z`ddÄ Zaddń Zb  ZcS )IAMConnectionz
2010-05-08NTiam.amazonaws.comr   /c                    s2   t t| j|||||||||	|
|||||d d S )N)validate_certsprofile_name)superr
   __init__)selfZaws_access_key_idZaws_secret_access_keyZ	is_secureportproxyZ
proxy_portZ
proxy_userZ
proxy_passhostdebugZhttps_connection_factorypathZsecurity_tokenr   r   	__class__ 7/tmp/pip-unpacked-wheel-dlxw5sjy/boto/iam/connection.pyr   =   s            zIAMConnection.__init__c                 C   s   dgS )Nzhmac-v4r   r   r   r   r   _required_auth_capabilityK   s    z'IAMConnection._required_auth_capabilityPOSTSetc                 C   s   |s| }|  ||||}| }tj| |jdkrl|rftjj|dd}	tj|	|}
|
	| |	S i S n:tj
d|j|jf  tj
d|  | |j|j|dS )zQ
        Utility method to handle calls to IAM and parsing of responses.
           T)list_markerZpythonize_namez%s %sz%sN)Zmake_requestreadbotologr   statusZjsonresponseElementZ
XmlHandlerparseerrorreasonResponseError)r   actionparamsr   parentverbr    responsebodyehr   r   r   get_responseN   s"    

zIAMConnection.get_responsec                 C   s8   i }|r||d< |r||d< |r(||d< | j d|ddS )a  
        List the groups that have the specified path prefix.

        :type path_prefix: string
        :param path_prefix: If provided, only groups whose paths match
            the provided prefix will be returned.

        :type marker: string
        :param marker: Use this only when paginating results and only
            in follow-up request after you've received a response
            where the results are truncated.  Set this to the value of
            the Marker element in the response you just received.

        :type max_items: int
        :param max_items: Use this only when paginating results to indicate
            the maximum number of groups you want in the response.
        
PathPrefixMarkerMaxItemsZ
ListGroupsGroupsr    r2   r   path_prefixmarker	max_itemsr+   r   r   r   get_all_groupsl   s    zIAMConnection.get_all_groupsc                 C   s0   d|i}|r||d< |r ||d< | j d|ddS )a  
        Return a list of users that are in the specified group.

        :type group_name: string
        :param group_name: The name of the group whose information should
                           be returned.
        :type marker: string
        :param marker: Use this only when paginating results and only
            in follow-up request after you've received a response
            where the results are truncated.  Set this to the value of
            the Marker element in the response you just received.

        :type max_items: int
        :param max_items: Use this only when paginating results to indicate
            the maximum number of groups you want in the response.
        	GroupNamer4   r5   ZGetGroupUsersr7   r8   r   
group_namer;   r<   r+   r   r   r   	get_group   s    zIAMConnection.get_groupc                 C   s   ||d}|  d|S )z
        Create a group.

        :type group_name: string
        :param group_name: The name of the new group

        :type path: string
        :param path: The path to the group (Optional).  Defaults to /.

        )r>   PathZCreateGroupr8   )r   rA   r   r+   r   r   r   create_group   s    zIAMConnection.create_groupc                 C   s   d|i}|  d|S )z
        Delete a group. The group must not contain any Users or
        have any attached policies

        :type group_name: string
        :param group_name: The name of the group to delete.

        r>   ZDeleteGroupr8   )r   rA   r+   r   r   r   delete_group   s    	zIAMConnection.delete_groupc                 C   s,   d|i}|r||d< |r ||d< |  d|S )a  
        Updates name and/or path of the specified group.

        :type group_name: string
        :param group_name: The name of the new group

        :type new_group_name: string
        :param new_group_name: If provided, the name of the group will be
            changed to this name.

        :type new_path: string
        :param new_path: If provided, the path of the group will be
            changed to this path.

        r>   ZNewGroupNameNewPathZUpdateGroupr8   )r   rA   Znew_group_namenew_pathr+   r   r   r   update_group   s    zIAMConnection.update_groupc                 C   s   ||d}|  d|S )z
        Add a user to a group

        :type group_name: string
        :param group_name: The name of the group

        :type user_name: string
        :param user_name: The to be added to the group.

        r>   UserNameZAddUserToGroupr8   r   rA   	user_namer+   r   r   r   add_user_to_group   s    zIAMConnection.add_user_to_groupc                 C   s   ||d}|  d|S )z
        Remove a user from a group.

        :type group_name: string
        :param group_name: The name of the group

        :type user_name: string
        :param user_name: The user to remove from the group.

        rI   ZRemoveUserFromGroupr8   rK   r   r   r   remove_user_from_group   s    z$IAMConnection.remove_user_from_groupc                 C   s   |||d}| j d|ddS )az  
        Adds or updates the specified policy document for the specified group.

        :type group_name: string
        :param group_name: The name of the group the policy is associated with.

        :type policy_name: string
        :param policy_name: The policy document to get.

        :type policy_json: string
        :param policy_json: The policy document.

        )r>   
PolicyNamePolicyDocumentZPutGroupPolicyr   r-   r8   )r   rA   policy_namepolicy_jsonr+   r   r   r   put_group_policy   s
    zIAMConnection.put_group_policyc                 C   s0   d|i}|r||d< |r ||d< | j d|ddS )a  
        List the names of the policies associated with the specified group.

        :type group_name: string
        :param group_name: The name of the group the policy is associated with.

        :type marker: string
        :param marker: Use this only when paginating results and only
            in follow-up request after you've received a response
            where the results are truncated.  Set this to the value of
            the Marker element in the response you just received.

        :type max_items: int
        :param max_items: Use this only when paginating results to indicate
            the maximum number of groups you want in the response.
        r>   r4   r5   ZListGroupPoliciesPolicyNamesr7   r8   r@   r   r   r   get_all_group_policies  s    z$IAMConnection.get_all_group_policiesc                 C   s   ||d}| j d|ddS )a   
        Retrieves the specified policy document for the specified group.

        :type group_name: string
        :param group_name: The name of the group the policy is associated with.

        :type policy_name: string
        :param policy_name: The policy document to get.

        r>   rO   ZGetGroupPolicyr   rQ   r8   r   rA   rR   r+   r   r   r   get_group_policy  s    zIAMConnection.get_group_policyc                 C   s   ||d}| j d|ddS )a!  
        Deletes the specified policy document for the specified group.

        :type group_name: string
        :param group_name: The name of the group the policy is associated with.

        :type policy_name: string
        :param policy_name: The policy document to delete.

        rW   ZDeleteGroupPolicyr   rQ   r8   rX   r   r   r   delete_group_policy+  s    z!IAMConnection.delete_group_policyc                 C   s0   d|i}|r||d< |r ||d< | j d|ddS )a  
        List the users that have the specified path prefix.

        :type path_prefix: string
        :param path_prefix: If provided, only users whose paths match
            the provided prefix will be returned.

        :type marker: string
        :param marker: Use this only when paginating results and only
            in follow-up request after you've received a response
            where the results are truncated.  Set this to the value of
            the Marker element in the response you just received.

        :type max_items: int
        :param max_items: Use this only when paginating results to indicate
            the maximum number of groups you want in the response.
        r3   r4   r5   Z	ListUsersr?   r7   r8   r9   r   r   r   get_all_users:  s    zIAMConnection.get_all_usersc                 C   s   ||d}|  d|S )z
        Create a user.

        :type user_name: string
        :param user_name: The name of the new user

        :type path: string
        :param path: The path in which the user will be created.
            Defaults to /.

        )rJ   rC   Z
CreateUserr8   )r   rL   r   r+   r   r   r   create_userW  s    zIAMConnection.create_userc                 C   s   d|i}|  d|S )a8  
        Delete a user including the user's path, GUID and ARN.

        If the user_name is not specified, the user_name is determined
        implicitly based on the AWS Access Key ID used to sign the request.

        :type user_name: string
        :param user_name: The name of the user to delete.

        rJ   Z
DeleteUserr8   r   rL   r+   r   r   r   delete_userg  s    zIAMConnection.delete_userc                 C   s   i }|r||d< |  d|S )ap  
        Retrieve information about the specified user.

        If the user_name is not specified, the user_name is determined
        implicitly based on the AWS Access Key ID used to sign the request.

        :type user_name: string
        :param user_name: The name of the user to retrieve.
            If not specified, defaults to user making request.
        rJ   ZGetUserr8   r]   r   r   r   get_useru  s    zIAMConnection.get_userc                 C   s,   d|i}|r||d< |r ||d< |  d|S )a  
        Updates name and/or path of the specified user.

        :type user_name: string
        :param user_name: The name of the user

        :type new_user_name: string
        :param new_user_name: If provided, the username of the user will be
            changed to this username.

        :type new_path: string
        :param new_path: If provided, the path of the user will be
            changed to this path.

        rJ   ZNewUserNamerF   Z
UpdateUserr8   )r   rL   Znew_user_namerG   r+   r   r   r   update_user  s    zIAMConnection.update_userc                 C   s0   d|i}|r||d< |r ||d< | j d|ddS )a  
        List the names of the policies associated with the specified user.

        :type user_name: string
        :param user_name: The name of the user the policy is associated with.

        :type marker: string
        :param marker: Use this only when paginating results and only
            in follow-up request after you've received a response
            where the results are truncated.  Set this to the value of
            the Marker element in the response you just received.

        :type max_items: int
        :param max_items: Use this only when paginating results to indicate
            the maximum number of groups you want in the response.
        rJ   r4   r5   ZListUserPoliciesrU   r7   r8   r   rL   r;   r<   r+   r   r   r   get_all_user_policies  s    z#IAMConnection.get_all_user_policiesc                 C   s   |||d}| j d|ddS )av  
        Adds or updates the specified policy document for the specified user.

        :type user_name: string
        :param user_name: The name of the user the policy is associated with.

        :type policy_name: string
        :param policy_name: The policy document to get.

        :type policy_json: string
        :param policy_json: The policy document.

        )rJ   rO   rP   ZPutUserPolicyr   rQ   r8   )r   rL   rR   rS   r+   r   r   r   put_user_policy  s
    zIAMConnection.put_user_policyc                 C   s   ||d}| j d|ddS )a  
        Retrieves the specified policy document for the specified user.

        :type user_name: string
        :param user_name: The name of the user the policy is associated with.

        :type policy_name: string
        :param policy_name: The policy document to get.

        rJ   rO   ZGetUserPolicyr   rQ   r8   r   rL   rR   r+   r   r   r   get_user_policy  s    zIAMConnection.get_user_policyc                 C   s   ||d}| j d|ddS )a  
        Deletes the specified policy document for the specified user.

        :type user_name: string
        :param user_name: The name of the user the policy is associated with.

        :type policy_name: string
        :param policy_name: The policy document to delete.

        rd   ZDeleteUserPolicyr   rQ   r8   re   r   r   r   delete_user_policy  s    z IAMConnection.delete_user_policyc                 C   s0   d|i}|r||d< |r ||d< | j d|ddS )a  
        List the groups that a specified user belongs to.

        :type user_name: string
        :param user_name: The name of the user to list groups for.

        :type marker: string
        :param marker: Use this only when paginating results and only
            in follow-up request after you've received a response
            where the results are truncated.  Set this to the value of
            the Marker element in the response you just received.

        :type max_items: int
        :param max_items: Use this only when paginating results to indicate
            the maximum number of groups you want in the response.
        rJ   r4   r5   ZListGroupsForUserr6   r7   r8   ra   r   r   r   get_groups_for_user  s    z!IAMConnection.get_groups_for_userc                 C   s0   d|i}|r||d< |r ||d< | j d|ddS )aq  
        Get all access keys associated with an account.

        :type user_name: string
        :param user_name: The username of the user

        :type marker: string
        :param marker: Use this only when paginating results and only
            in follow-up request after you've received a response
            where the results are truncated.  Set this to the value of
            the Marker element in the response you just received.

        :type max_items: int
        :param max_items: Use this only when paginating results to indicate
            the maximum number of groups you want in the response.
        rJ   r4   r5   ZListAccessKeysZAccessKeyMetadatar7   r8   ra   r   r   r   get_all_access_keys  s    z!IAMConnection.get_all_access_keysc                 C   s   d|i}|  d|S )a  
        Create a new AWS Secret Access Key and corresponding AWS Access Key ID
        for the specified user.  The default status for new keys is Active

        If the user_name is not specified, the user_name is determined
        implicitly based on the AWS Access Key ID used to sign the request.

        :type user_name: string
        :param user_name: The username of the user

        rJ   ZCreateAccessKeyr8   r]   r   r   r   create_access_key  s    zIAMConnection.create_access_keyc                 C   s"   ||d}|r||d< |  d|S )aj  
        Changes the status of the specified access key from Active to Inactive
        or vice versa.  This action can be used to disable a user's key as
        part of a key rotation workflow.

        If the user_name is not specified, the user_name is determined
        implicitly based on the AWS Access Key ID used to sign the request.

        :type access_key_id: string
        :param access_key_id: The ID of the access key.

        :type status: string
        :param status: Either Active or Inactive.

        :type user_name: string
        :param user_name: The username of user (optional).

        )AccessKeyIdStatusrJ   ZUpdateAccessKeyr8   )r   access_key_idr$   rL   r+   r   r   r   update_access_key+  s    zIAMConnection.update_access_keyc                 C   s    d|i}|r||d< |  d|S )a  
        Delete an access key associated with a user.

        If the user_name is not specified, it is determined implicitly based
        on the AWS Access Key ID used to sign the request.

        :type access_key_id: string
        :param access_key_id: The ID of the access key to be deleted.

        :type user_name: string
        :param user_name: The username of the user

        rk   rJ   ZDeleteAccessKeyr8   )r   rm   rL   r+   r   r   r   delete_access_keyD  s    zIAMConnection.delete_access_keyc                 C   s8   i }|r||d< |r||d< |r(||d< | j d|ddS )a  
        Get all signing certificates associated with an account.

        If the user_name is not specified, it is determined implicitly based
        on the AWS Access Key ID used to sign the request.

        :type marker: string
        :param marker: Use this only when paginating results and only
            in follow-up request after you've received a response
            where the results are truncated.  Set this to the value of
            the Marker element in the response you just received.

        :type max_items: int
        :param max_items: Use this only when paginating results to indicate
            the maximum number of groups you want in the response.

        :type user_name: string
        :param user_name: The username of the user

        r4   r5   rJ   ZListSigningCertificatesZCertificatesr7   r8   )r   r;   r<   rL   r+   r   r   r   get_all_signing_certs[  s     z#IAMConnection.get_all_signing_certsc                 C   s"   ||d}|r||d< |  d|S )a  
        Change the status of the specified signing certificate from
        Active to Inactive or vice versa.

        If the user_name is not specified, it is determined implicitly based
        on the AWS Access Key ID used to sign the request.

        :type cert_id: string
        :param cert_id: The ID of the signing certificate

        :type status: string
        :param status: Either Active or Inactive.

        :type user_name: string
        :param user_name: The username of the user
        )CertificateIdrl   rJ   ZUpdateSigningCertificater8   )r   cert_idr$   rL   r+   r   r   r   update_signing_cert{  s    z!IAMConnection.update_signing_certc                 C   s$   d|i}|r||d< | j d|ddS )a  
        Uploads an X.509 signing certificate and associates it with
        the specified user.

        If the user_name is not specified, it is determined implicitly based
        on the AWS Access Key ID used to sign the request.

        :type cert_body: string
        :param cert_body: The body of the signing certificate.

        :type user_name: string
        :param user_name: The username of the user

        CertificateBodyrJ   ZUploadSigningCertificater   rQ   r8   )r   	cert_bodyrL   r+   r   r   r   upload_signing_cert  s    z!IAMConnection.upload_signing_certc                 C   s    d|i}|r||d< |  d|S )av  
        Delete a signing certificate associated with a user.

        If the user_name is not specified, it is determined implicitly based
        on the AWS Access Key ID used to sign the request.

        :type user_name: string
        :param user_name: The username of the user

        :type cert_id: string
        :param cert_id: The ID of the certificate.

        rq   rJ   ZDeleteSigningCertificater8   )r   rr   rL   r+   r   r   r   delete_signing_cert  s    z!IAMConnection.delete_signing_certc                 C   s8   i }|r||d< |r||d< |r(||d< | j d|ddS )a  
        Lists the server certificates that have the specified path prefix.
        If none exist, the action returns an empty list.

        :type path_prefix: string
        :param path_prefix: If provided, only certificates whose paths match
            the provided prefix will be returned.

        :type marker: string
        :param marker: Use this only when paginating results and only
            in follow-up request after you've received a response
            where the results are truncated.  Set this to the value of
            the Marker element in the response you just received.

        :type max_items: int
        :param max_items: Use this only when paginating results to indicate
            the maximum number of groups you want in the response.

        r3   r4   r5   ZListServerCertificatesZServerCertificateMetadataListr7   r8   r9   r   r   r   list_server_certs  s    zIAMConnection.list_server_certsc                 C   s,   d|i}|r||d< |r ||d< |  d|S )a<  
        Updates the name and/or the path of the specified server certificate.

        :type cert_name: string
        :param cert_name: The name of the server certificate that you want
            to update.

        :type new_cert_name: string
        :param new_cert_name: The new name for the server certificate.
            Include this only if you are updating the
            server certificate's name.

        :type new_path: string
        :param new_path: If provided, the path of the certificate will be
                         changed to this path.
        ServerCertificateNameZNewServerCertificateNamerF   ZUpdateServerCertificater8   )r   	cert_nameZnew_cert_namerG   r+   r   r   r   update_server_cert  s    z IAMConnection.update_server_certc                 C   s4   |||d}|r||d< |r$||d< | j d|ddS )a  
        Uploads a server certificate entity for the AWS Account.
        The server certificate entity includes a public key certificate,
        a private key, and an optional certificate chain, which should
        all be PEM-encoded.

        :type cert_name: string
        :param cert_name: The name for the server certificate. Do not
            include the path in this value.

        :type cert_body: string
        :param cert_body: The contents of the public key certificate
            in PEM-encoded format.

        :type private_key: string
        :param private_key: The contents of the private key in
            PEM-encoded format.

        :type cert_chain: string
        :param cert_chain: The contents of the certificate chain. This
            is typically a concatenation of the PEM-encoded
            public key certificates of the chain.

        :type path: string
        :param path: The path for the server certificate.
        )ry   rt   Z
PrivateKeyZCertificateChainrC   ZUploadServerCertificater   rQ   r8   )r   rz   ru   Zprivate_keyZ
cert_chainr   r+   r   r   r   upload_server_cert  s    z IAMConnection.upload_server_certc                 C   s   d|i}|  d|S )z
        Retrieves information about the specified server certificate.

        :type cert_name: string
        :param cert_name: The name of the server certificate you want
            to retrieve information about.

        ry   ZGetServerCertificater8   r   rz   r+   r   r   r   get_server_certificate!  s    	z$IAMConnection.get_server_certificatec                 C   s   d|i}|  d|S )z
        Delete the specified server certificate.

        :type cert_name: string
        :param cert_name: The name of the server certificate you want
            to delete.

        ry   ZDeleteServerCertificater8   r}   r   r   r   delete_server_cert-  s    	z IAMConnection.delete_server_certc                 C   s0   d|i}|r||d< |r ||d< | j d|ddS )ar  
        Get all MFA devices associated with an account.

        :type user_name: string
        :param user_name: The username of the user

        :type marker: string
        :param marker: Use this only when paginating results and only
            in follow-up request after you've received a response
            where the results are truncated.  Set this to the value of
            the Marker element in the response you just received.

        :type max_items: int
        :param max_items: Use this only when paginating results to indicate
            the maximum number of groups you want in the response.

        rJ   r4   r5   ZListMFADevicesZ
MFADevicesr7   r8   ra   r   r   r   get_all_mfa_devices=  s     z!IAMConnection.get_all_mfa_devicesc                 C   s   ||||d}|  d|S )a5  
        Enables the specified MFA device and associates it with the
        specified user.

        :type user_name: string
        :param user_name: The username of the user

        :type serial_number: string
        :param serial_number: The serial number which uniquely identifies
            the MFA device.

        :type auth_code_1: string
        :param auth_code_1: An authentication code emitted by the device.

        :type auth_code_2: string
        :param auth_code_2: A subsequent authentication code emitted
            by the device.

        rJ   SerialNumberZAuthenticationCode1ZAuthenticationCode2ZEnableMFADevicer8   r   rL   serial_numberZauth_code_1Zauth_code_2r+   r   r   r   enable_mfa_deviceW  s    zIAMConnection.enable_mfa_devicec                 C   s   ||d}|  d|S )aM  
        Deactivates the specified MFA device and removes it from
        association with the user.

        :type user_name: string
        :param user_name: The username of the user

        :type serial_number: string
        :param serial_number: The serial number which uniquely identifies
            the MFA device.

        )rJ   r   ZDeactivateMFADevicer8   )r   rL   r   r+   r   r   r   deactivate_mfa_devicer  s    z#IAMConnection.deactivate_mfa_devicec                 C   s   ||||d}|  d|S )a  
        Syncronizes the specified MFA device with the AWS servers.

        :type user_name: string
        :param user_name: The username of the user

        :type serial_number: string
        :param serial_number: The serial number which uniquely identifies
            the MFA device.

        :type auth_code_1: string
        :param auth_code_1: An authentication code emitted by the device.

        :type auth_code_2: string
        :param auth_code_2: A subsequent authentication code emitted
            by the device.

        r   ZResyncMFADevicer8   r   r   r   r   resync_mfa_device  s    zIAMConnection.resync_mfa_devicec                 C   s   d|i}|  d|S )z
        Retrieves the login profile for the specified user.

        :type user_name: string
        :param user_name: The username of the user

        rJ   ZGetLoginProfiler8   r]   r   r   r   get_login_profiles  s    z IAMConnection.get_login_profilesc                 C   s   ||d}|  d|S )aB  
        Creates a login profile for the specified user, give the user the
        ability to access AWS services and the AWS Management Console.

        :type user_name: string
        :param user_name: The name of the user

        :type password: string
        :param password: The new password for the user

        rJ   ZPasswordZCreateLoginProfiler8   r   rL   passwordr+   r   r   r   create_login_profile  s    z"IAMConnection.create_login_profilec                 C   s   d|i}|  d|S )z
        Deletes the login profile associated with the specified user.

        :type user_name: string
        :param user_name: The name of the user to delete.

        rJ   ZDeleteLoginProfiler8   r]   r   r   r   delete_login_profile  s    z"IAMConnection.delete_login_profilec                 C   s   ||d}|  d|S )z
        Resets the password associated with the user's login profile.

        :type user_name: string
        :param user_name: The name of the user

        :type password: string
        :param password: The new password for the user

        r   ZUpdateLoginProfiler8   r   r   r   r   update_login_profile  s    z"IAMConnection.update_login_profilec                 C   s   d|i}|  d|S )z
        Creates a new alias for the AWS account.

        For more information on account id aliases, please see
        http://goo.gl/ToB7G

        :type alias: string
        :param alias: The alias to attach to the account.
        AccountAliasZCreateAccountAliasr8   r   aliasr+   r   r   r   create_account_alias  s    
z"IAMConnection.create_account_aliasc                 C   s   d|i}|  d|S )z
        Deletes an alias for the AWS account.

        For more information on account id aliases, please see
        http://goo.gl/ToB7G

        :type alias: string
        :param alias: The alias to remove from the account.
        r   ZDeleteAccountAliasr8   r   r   r   r   delete_account_alias  s    
z"IAMConnection.delete_account_aliasc                 C   s   | j di ddS )  
        Get the alias for the current account.

        This is referred to in the docs as list_account_aliases,
        but it seems you can only have one account alias currently.

        For more information on account id aliases, please see
        http://goo.gl/ToB7G
        ZListAccountAliasesZAccountAliasesr7   r8   r   r   r   r   get_account_alias  s    
zIAMConnection.get_account_aliasec2c                 C   s   |   }|std|di }|di }|dg }t|sHtd|d }| jdkrfd||f S | jdr~d	||f S d
||f S dS )z
        Get the URL where IAM users can use their login profile to sign in
        to this account's console.

        :type service: string
        :param service: Default service to go to in the console.
        zTNo alias associated with this account.  Please use iam.create_account_alias() first.Zlist_account_aliases_responseZlist_account_aliases_resultZaccount_aliasesr   ziam.us-gov.amazonaws.comz1https://%s.signin.amazonaws-us-gov.com/console/%sr	   z)https://%s.signin.amazonaws.cn/console/%sz+https://%s.signin.aws.amazon.com/console/%sN)r   	Exceptiongetlenr   endswith)r   Zservicer   respresultaliasesr   r   r   get_signin_url  s.    
zIAMConnection.get_signin_urlc                 C   s   |  di tS )r   ZGetAccountSummary)Z
get_objectr   r   r   r   r   get_account_summary$  s    
z!IAMConnection.get_account_summaryc                 C   s   |  d||dS )a  
        Adds the specified role to the specified instance profile.

        :type instance_profile_name: string
        :param instance_profile_name: Name of the instance profile to update.

        :type role_name: string
        :param role_name: Name of the role to add.
        ZAddRoleToInstanceProfileInstanceProfileNameRoleNamer8   r   instance_profile_name	role_namer   r   r   add_role_to_instance_profile4  s
    
z*IAMConnection.add_role_to_instance_profilec                 C   s$   d|i}|dk	r||d< |  d|S )z
        Creates a new instance profile.

        :type instance_profile_name: string
        :param instance_profile_name: Name of the instance profile to create.

        :type path: string
        :param path: The path to the instance profile.
        r   NrC   ZCreateInstanceProfiler8   )r   r   r   r+   r   r   r   create_instance_profileB  s    
z%IAMConnection.create_instance_profilec                 C   sf   |d k	rt |tjr\|S nBt D ],\}}|dkr4q"| jr"| j|r"|} qPq"|s\td }t|S )Nr   )	
isinstancer   string_typesDEFAULT_POLICY_DOCUMENTSitemsr   r   r   dumps)r   assume_role_policy_documenttldpolicyr   r   r   _build_policyQ  s    zIAMConnection._build_policyc                 C   s,   ||  |d}|dk	r ||d< | d|S )aQ  
        Creates a new role for your AWS account.

        The policy grants permission to an EC2 instance to assume the role.
        The policy is URL-encoded according to RFC 3986. Currently, only EC2
        instances can assume roles.

        :type role_name: string
        :param role_name: Name of the role to create.

        :type assume_role_policy_document: ``string`` or ``dict``
        :param assume_role_policy_document: The policy that grants an entity
            permission to assume the role.

        :type path: string
        :param path: The path to the role.
        )r   ZAssumeRolePolicyDocumentNrC   Z
CreateRole)r   r2   )r   r   r   r   r+   r   r   r   create_rolei  s    zIAMConnection.create_rolec                 C   s   |  dd|iS )z
        Deletes the specified instance profile. The instance profile must not
        have an associated role.

        :type instance_profile_name: string
        :param instance_profile_name: Name of the instance profile to delete.
        ZDeleteInstanceProfiler   r8   r   r   r   r   r   delete_instance_profile  s    z%IAMConnection.delete_instance_profilec                 C   s   |  dd|iS )z
        Deletes the specified role. The role must not have any policies
        attached.

        :type role_name: string
        :param role_name: Name of the role to delete.
        Z
DeleteRoler   r8   r   r   r   r   r   delete_role  s    zIAMConnection.delete_rolec                 C   s   |  d||dS )a  
        Deletes the specified policy associated with the specified role.

        :type role_name: string
        :param role_name: Name of the role associated with the policy.

        :type policy_name: string
        :param policy_name: Name of the policy to delete.
        ZDeleteRolePolicyr   rO   r8   r   r   rR   r   r   r   delete_role_policy  s    
z IAMConnection.delete_role_policyc                 C   s   |  dd|iS )a'  
        Retrieves information about the specified instance profile, including
        the instance profile's path, GUID, ARN, and role.

        :type instance_profile_name: string
        :param instance_profile_name: Name of the instance profile to get
            information about.
        ZGetInstanceProfiler   r8   r   r   r   r   get_instance_profile  s    	z"IAMConnection.get_instance_profilec                 C   s   |  dd|iS )a  
        Retrieves information about the specified role, including the role's
        path, GUID, ARN, and the policy granting permission to EC2 to assume
        the role.

        :type role_name: string
        :param role_name: Name of the role associated with the policy.
        ZGetRoler   r8   r   r   r   r   get_role  s    	zIAMConnection.get_rolec                 C   s   |  d||dS )a  
        Retrieves the specified policy document for the specified role.

        :type role_name: string
        :param role_name: Name of the role associated with the policy.

        :type policy_name: string
        :param policy_name: Name of the policy to get.
        ZGetRolePolicyr   r8   r   r   r   r   get_role_policy  s
    
zIAMConnection.get_role_policyc                 C   sD   i }|dk	r||d< |dk	r$||d< |dk	r4||d< | j d|ddS )a  
        Lists the instance profiles that have the specified path prefix. If
        there are none, the action returns an empty list.

        :type path_prefix: string
        :param path_prefix: The path prefix for filtering the results. For
            example: /application_abc/component_xyz/, which would get all
            instance profiles whose path starts with
            /application_abc/component_xyz/.

        :type marker: string
        :param marker: Use this parameter only when paginating results, and
            only in a subsequent request after you've received a response
            where the results are truncated. Set it to the value of the
            Marker element in the response you just received.

        :type max_items: int
        :param max_items: Use this parameter only when paginating results to
            indicate the maximum number of user names you want in the response.
        Nr3   r4   r5   ZListInstanceProfilesInstanceProfilesr7   r8   r9   r   r   r   list_instance_profiles  s    z$IAMConnection.list_instance_profilesc                 C   s8   d|i}|dk	r||d< |dk	r(||d< | j d|ddS )a  
        Lists the instance profiles that have the specified associated role. If
        there are none, the action returns an empty list.

        :type role_name: string
        :param role_name: The name of the role to list instance profiles for.

        :type marker: string
        :param marker: Use this parameter only when paginating results, and
            only in a subsequent request after you've received a response
            where the results are truncated. Set it to the value of the
            Marker element in the response you just received.

        :type max_items: int
        :param max_items: Use this parameter only when paginating results to
            indicate the maximum number of user names you want in the response.
        r   Nr4   r5   ZListInstanceProfilesForRoler   r7   r8   r   r   r;   r<   r+   r   r   r   list_instance_profiles_for_role  s    z-IAMConnection.list_instance_profiles_for_rolec                 C   s8   d|i}|dk	r||d< |dk	r(||d< | j d|ddS )a  
        Lists the names of the policies associated with the specified role. If
        there are none, the action returns an empty list.

        :type role_name: string
        :param role_name: The name of the role to list policies for.

        :type marker: string
        :param marker: Use this parameter only when paginating results, and
            only in a subsequent request after you've received a response
            where the results are truncated. Set it to the value of the
            marker element in the response you just received.

        :type max_items: int
        :param max_items: Use this parameter only when paginating results to
            indicate the maximum number of user names you want in the response.
        r   Nr4   r5   ZListRolePoliciesrU   r7   r8   r   r   r   r   list_role_policies
  s    z IAMConnection.list_role_policiesc                 C   sD   i }|dk	r||d< |dk	r$||d< |dk	r4||d< | j d|ddS )a  
        Lists the roles that have the specified path prefix. If there are none,
        the action returns an empty list.

        :type path_prefix: string
        :param path_prefix: The path prefix for filtering the results.

        :type marker: string
        :param marker: Use this parameter only when paginating results, and
            only in a subsequent request after you've received a response
            where the results are truncated. Set it to the value of the
            marker element in the response you just received.

        :type max_items: int
        :param max_items: Use this parameter only when paginating results to
            indicate the maximum number of user names you want in the response.
        Nr3   r4   r5   Z	ListRolesZRolesr7   r8   r9   r   r   r   
list_roles$  s    zIAMConnection.list_rolesc                 C   s   |  d|||dS )a{  
        Adds (or updates) a policy document associated with the specified role.

        :type role_name: string
        :param role_name: Name of the role to associate the policy with.

        :type policy_name: string
        :param policy_name: Name of the policy document.

        :type policy_document: string
        :param policy_document: The policy document.
        ZPutRolePolicy)r   rO   rP   r8   )r   r   rR   policy_documentr   r   r   put_role_policy?  s    zIAMConnection.put_role_policyc                 C   s   |  d||dS )a#  
        Removes the specified role from the specified instance profile.

        :type instance_profile_name: string
        :param instance_profile_name: Name of the instance profile to update.

        :type role_name: string
        :param role_name: Name of the role to remove.
        ZRemoveRoleFromInstanceProfiler   r8   r   r   r   r   !remove_role_from_instance_profileQ  s
    z/IAMConnection.remove_role_from_instance_profilec                 C   s   |  d||dS )a  
        Updates the policy that grants an entity permission to assume a role.
        Currently, only an Amazon EC2 instance can assume a role.

        :type role_name: string
        :param role_name: Name of the role to update.

        :type policy_document: string
        :param policy_document: The policy that grants an entity permission to
            assume the role.
        ZUpdateAssumeRolePolicy)r   rP   r8   )r   r   r   r   r   r   update_assume_role_policy`  s
    z'IAMConnection.update_assume_role_policyc                 C   s   ||d}|  d|S )a  
        Creates an IAM entity to describe an identity provider (IdP)
        that supports SAML 2.0.

        The SAML provider that you create with this operation can be
        used as a principal in a role's trust policy to establish a
        trust relationship between AWS and a SAML identity provider.
        You can create an IAM role that supports Web-based single
        sign-on (SSO) to the AWS Management Console or one that
        supports API access to AWS.

        When you create the SAML provider, you upload an a SAML
        metadata document that you get from your IdP and that includes
        the issuer's name, expiration information, and keys that can
        be used to validate the SAML authentication response
        (assertions) that are received from the IdP. You must generate
        the metadata document using the identity management software
        that is used as your organization's IdP.
        This operation requires `Signature Version 4`_.
        For more information, see `Giving Console Access Using SAML`_
        and `Creating Temporary Security Credentials for SAML
        Federation`_ in the Using Temporary Credentials guide.

        :type saml_metadata_document: string
        :param saml_metadata_document: An XML document generated by an identity
            provider (IdP) that supports SAML 2.0. The document includes the
            issuer's name, expiration information, and keys that can be used to
            validate the SAML authentication response (assertions) that are
            received from the IdP. You must generate the metadata document
            using the identity management software that is used as your
            organization's IdP.
        For more information, see `Creating Temporary Security Credentials for
            SAML Federation`_ in the Using Temporary Security Credentials
            guide.

        :type name: string
        :param name: The name of the provider to create.

        )SAMLMetadataDocumentNameZCreateSAMLProviderr8   )r   saml_metadata_documentnamer+   r   r   r   create_saml_providerp  s    )z"IAMConnection.create_saml_providerc                 C   s   | j di ddS )zr
        Lists the SAML providers in the account.
        This operation requires `Signature Version 4`_.
        ZListSAMLProvidersZSAMLProviderListr7   r8   r   r   r   r   list_saml_providers  s    z!IAMConnection.list_saml_providersc                 C   s   d|i}|  d|S )aZ  
        Returns the SAML provider metadocument that was uploaded when
        the provider was created or updated.
        This operation requires `Signature Version 4`_.

        :type saml_provider_arn: string
        :param saml_provider_arn: The Amazon Resource Name (ARN) of the SAML
            provider to get information about.

        SAMLProviderArnZGetSAMLProviderr8   r   saml_provider_arnr+   r   r   r   get_saml_provider  s    zIAMConnection.get_saml_providerc                 C   s   ||d}|  d|S )a7  
        Updates the metadata document for an existing SAML provider.
        This operation requires `Signature Version 4`_.

        :type saml_provider_arn: string
        :param saml_provider_arn: The Amazon Resource Name (ARN) of the SAML
            provider to update.

        :type saml_metadata_document: string
        :param saml_metadata_document: An XML document generated by an identity
            provider (IdP) that supports SAML 2.0. The document includes the
            issuer's name, expiration information, and keys that can be used to
            validate the SAML authentication response (assertions) that are
            received from the IdP. You must generate the metadata document
            using the identity management software that is used as your
            organization's IdP.

        )r   r   ZUpdateSAMLProviderr8   )r   r   r   r+   r   r   r   update_saml_provider  s    z"IAMConnection.update_saml_providerc                 C   s   d|i}|  d|S )a  
        Deletes a SAML provider.

        Deleting the provider does not update any roles that reference
        the SAML provider as a principal in their trust policies. Any
        attempt to assume a role that references a SAML provider that
        has been deleted will fail.
        This operation requires `Signature Version 4`_.

        :type saml_provider_arn: string
        :param saml_provider_arn: The Amazon Resource Name (ARN) of the SAML
            provider to delete.

        r   ZDeleteSAMLProviderr8   r   r   r   r   delete_saml_provider  s    z"IAMConnection.delete_saml_providerc                 C   s   i }|  d|S )z
        Generates a credential report for an account

        A new credential report can only be generated every 4 hours. If one
        hasn't been generated in the last 4 hours then get_credential_report
        will error when called
        ZGenerateCredentialReportr8   r   r+   r   r   r   generate_credential_report  s    z(IAMConnection.generate_credential_reportc                 C   s   i }|  d|S )z
        Retrieves a credential report for an account

        A report must have been generated in the last 4 hours to succeed.
        The report is returned as a base64 encoded blob within the response.
        ZGetCredentialReportr8   r   r   r   r   get_credential_report  s    z#IAMConnection.get_credential_reportc                 C   s   ||d}|  d|S )a  
        Creates a new virtual MFA device for the AWS account.

        After creating the virtual MFA, use enable-mfa-device to
        attach the MFA device to an IAM user.

        :type path: string
        :param path: The path for the virtual MFA device.

        :type device_name: string
        :param device_name: The name of the virtual MFA device.
            Used with path to uniquely identify a virtual MFA device.

        )rC   ZVirtualMFADeviceNameZCreateVirtualMFADevicer8   )r   r   Zdevice_namer+   r   r   r   create_virtual_mfa_device  s    z'IAMConnection.create_virtual_mfa_devicec                 C   s   i }|  d|S )zB
        Returns the password policy for the AWS account.
        ZGetAccountPasswordPolicyr8   r   r   r   r   get_account_password_policy  s    z)IAMConnection.get_account_password_policyc                 C   s   i }|  d|S )zO
        Delete the password policy currently set for the AWS account.
        ZDeleteAccountPasswordPolicyr8   r   r   r   r   delete_account_password_policy  s    z,IAMConnection.delete_account_password_policyc
                 C   s  i }
|dk	r(t |tkr(t| |
d< |dk	rLt |tkrLt| |
d< |dk	r\||
d< |dk	rl||
d< |dk	r|||
d< |dk	rt |tkrt| |
d< |dk	rt |tkrt| |
d< |dk	rt |tkrt| |
d	< |	dk	rt |tkrt|	 |
d
< | d|
S )a	  
        Update the password policy for the AWS account.

        Notes: unset parameters will be reset to Amazon default settings!
            Most of the password policy settings are enforced the next time your users
            change their passwords. When you set minimum length and character type
            requirements, they are enforced the next time your users change their
            passwords - users are not forced to change their existing passwords, even
            if the pre-existing passwords do not adhere to the updated password
            policy. When you set a password expiration period, the expiration period
            is enforced immediately.

        :type allow_users_to_change_password: bool
        :param allow_users_to_change_password: Allows all IAM users in your account
            to use the AWS Management Console to change their own passwords.

        :type hard_expiry: bool
        :param hard_expiry: Prevents IAM users from setting a new password after
            their password has expired.

        :type max_password_age: int
        :param max_password_age: The number of days that an IAM user password is valid.

        :type minimum_password_length: int
        :param minimum_password_length: The minimum number of characters allowed in
            an IAM user password.

        :type password_reuse_prevention: int
        :param password_reuse_prevention: Specifies the number of previous passwords
            that IAM users are prevented from reusing.

        :type require_lowercase_characters: bool
        :param require_lowercase_characters: Specifies whether IAM user passwords
            must contain at least one lowercase character from the ISO basic Latin
            alphabet (``a`` to ``z``).

        :type require_numbers: bool
        :param require_numbers: Specifies whether IAM user passwords must contain at
            least one numeric character (``0`` to ``9``).

        :type require_symbols: bool
        :param require_symbols: Specifies whether IAM user passwords must contain at
            least one of the following non-alphanumeric characters:
            ``! @ # $ % ^ & * ( ) _ + - = [ ] { } | '``

        :type require_uppercase_characters: bool
        :param require_uppercase_characters: Specifies whether IAM user passwords
            must contain at least one uppercase character from the ISO basic Latin
            alphabet (``A`` to ``Z``).
        NZAllowUsersToChangePasswordZ
HardExpiryZMaxPasswordAgeZMinimumPasswordLengthZPasswordReusePreventionZRequireLowercaseCharactersZRequireNumbersZRequireSymbolsZRequireUppercaseCharactersZUpdateAccountPasswordPolicytypeboolstrlowerr2   )r   Zallow_users_to_change_passwordZhard_expiryZmax_password_ageZminimum_password_lengthZpassword_reuse_preventionZrequire_lowercase_charactersZrequire_numbersZrequire_symbolsZrequire_uppercase_charactersr+   r   r   r   update_account_password_policy  s(    9z,IAMConnection.update_account_password_policyc                 C   s,   |||d}|dk	r t ||d< | d|S )a  
        Create a policy.

        :type policy_name: string
        :param policy_name: The name of the new policy

        :type policy_document string
        :param policy_document: The document of the new policy

        :type path: string
        :param path: The path in which the policy will be created.
            Defaults to /.

        :type description: string
        :param path: A description of the new policy.

        )rO   rP   rC   NDescriptionZCreatePolicy)r   r2   )r   rR   r   r   descriptionr+   r   r   r   create_policyl  s    zIAMConnection.create_policyc                 C   s2   ||d}t |tkr&t| |d< | d|S )ao  
        Create a policy version.

        :type policy_arn: string
        :param policy_arn: The ARN of the policy

        :type policy_document string
        :param policy_document: The document of the new policy version

        :type set_as_default: bool
        :param set_as_default: Sets the policy version as default
            Defaults to None.

        )	PolicyArnrP   ZSetAsDefaultZCreatePolicyVersionr   )r   
policy_arnr   Zset_as_defaultr+   r   r   r   create_policy_version  s    z#IAMConnection.create_policy_versionc                 C   s   d|i}|  d|S )z
        Delete a policy.

        :type policy_arn: string
        :param policy_arn: The ARN of the policy to delete

        r   ZDeletePolicyr8   r   r   r+   r   r   r   delete_policy  s    zIAMConnection.delete_policyc                 C   s   ||d}|  d|S )z
        Delete a policy version.

        :type policy_arn: string
        :param policy_arn: The ARN of the policy to delete a version from

        :type version_id: string
        :param version_id: The id of the version to delete

        r   Z	VersionIdZDeletePolicyVersionr8   r   r   
version_idr+   r   r   r   delete_policy_version  s    z#IAMConnection.delete_policy_versionc                 C   s   d|i}|  d|S )z
        Get policy information.

        :type policy_arn: string
        :param policy_arn: The ARN of the policy to get information for

        r   Z	GetPolicyr8   r   r   r   r   
get_policy  s    zIAMConnection.get_policyc                 C   s   ||d}|  d|S )a  
        Get policy information.

        :type policy_arn: string
        :param policy_arn: The ARN of the policy to get information for a
            specific version

        :type version_id: string
        :param version_id: The id of the version to get information for

        r   ZGetPolicyVersionr8   r   r   r   r   get_policy_version  s    z IAMConnection.get_policy_versionc                 C   sp   i }|dk	r||d< |dk	r$||d< |dk	r4||d< t |tkrPt| |d< |dk	r`||d< | jd|dd	S )
aG  
        List policies of account.

        :type marker: string
        :param marker: A marker used for pagination (received from previous
            accesses)

        :type max_items: int
        :param max_items: Send only max_items; allows paginations

        :type only_attached: bool
        :param only_attached: Send only policies attached to other resources

        :type path_prefix: string
        :param path_prefix: Send only items prefixed by this path

        :type scope: string
        :param scope: AWS|Local.  Choose between AWS policies or your own
        Nr3   r4   r5   ZOnlyAttachedZScopeZListPoliciesZPoliciesr7   r   )r   r;   r<   Zonly_attachedr:   Zscoper+   r   r   r   list_policies  s     zIAMConnection.list_policiesc                 C   s8   d|i}|dk	r||d< |dk	r(||d< | j d|ddS )an  
        List policy versions.

        :type policy_arn: string
        :param policy_arn: The ARN of the policy to get versions of

        :type marker: string
        :param marker: A marker used for pagination (received from previous
            accesses)

        :type max_items: int
        :param max_items: Send only max_items; allows paginations

        r   Nr4   r5   ZListPolicyVersionsZVersionsr7   r8   )r   r   r;   r<   r+   r   r   r   list_policy_versions  s    z"IAMConnection.list_policy_versionsc                 C   s   ||d}|  d|S )a  
        Set default policy version.

        :type policy_arn: string
        :param policy_arn: The ARN of the policy to set the default version
            for

        :type version_id: string
        :param version_id: The id of the version to set as default
        r   ZSetDefaultPolicyVersionr8   r   r   r   r   set_default_policy_version  s    z(IAMConnection.set_default_policy_versionc                 C   sX   d|i}|dk	r||d< |dk	r(||d< |dk	r8||d< |dk	rH||d< | j d|dd	S )
a_  
        :type policy_arn: string
        :param policy_arn: The ARN of the policy to get entities for

        :type marker: string
        :param marker: A marker used for pagination (received from previous
            accesses)

        :type max_items: int
        :param max_items: Send only max_items; allows paginations

        :type path_prefix: string
        :param path_prefix: Send only items prefixed by this path

        :type entity_filter: string
        :param entity_filter: Which entity type of User | Role | Group |
            LocalManagedPolicy | AWSManagedPolicy to return

        r   Nr4   r5   r3   ZEntityFilterZListEntitiesForPolicy)ZPolicyGroupsZPolicyUsersZPolicyRolesr7   r8   )r   r   r:   r;   r<   Zentity_filterr+   r   r   r   list_entities_for_policy"  s    z&IAMConnection.list_entities_for_policyc                 C   s   ||d}|  d|S )z
        :type policy_arn: string
        :param policy_arn: The ARN of the policy to attach

        :type group_name: string
        :param group_name: Group to attach the policy to

        r   r>   ZAttachGroupPolicyr8   r   r   rA   r+   r   r   r   attach_group_policyF  s    	
z!IAMConnection.attach_group_policyc                 C   s   ||d}|  d|S )z
        :type policy_arn: string
        :param policy_arn: The ARN of the policy to attach

        :type role_name: string
        :param role_name: Role to attach the policy to

        r   r   ZAttachRolePolicyr8   r   r   r   r+   r   r   r   attach_role_policyR  s    	
z IAMConnection.attach_role_policyc                 C   s   ||d}|  d|S )z
        :type policy_arn: string
        :param policy_arn: The ARN of the policy to attach

        :type user_name: string
        :param user_name: User to attach the policy to

        r   rJ   ZAttachUserPolicyr8   r   r   rL   r+   r   r   r   attach_user_policy^  s    	
z IAMConnection.attach_user_policyc                 C   s   ||d}|  d|S )z
        :type policy_arn: string
        :param policy_arn: The ARN of the policy to detach

        :type group_name: string
        :param group_name: Group to detach the policy from

        r   ZDetachGroupPolicyr8   r   r   r   r   detach_group_policyj  s    	
z!IAMConnection.detach_group_policyc                 C   s   ||d}|  d|S )z
        :type policy_arn: string
        :param policy_arn: The ARN of the policy to detach

        :type role_name: string
        :param role_name: Role to detach the policy from

        r   ZDetachRolePolicyr8   r   r   r   r   detach_role_policyv  s    	
z IAMConnection.detach_role_policyc                 C   s   ||d}|  d|S )z
        :type policy_arn: string
        :param policy_arn: The ARN of the policy to detach

        :type user_name: string
        :param user_name: User to detach the policy from

        r   ZDetachUserPolicyr8   r   r   r   r   detach_user_policy  s    	
z IAMConnection.detach_user_policy)NNTNNNNNr   r   Nr   NTN)r   Nr   r   )r   NN)NN)r   )NN)NN)r   NN)r   )N)NN)NN)NN)NN)N)N)N)NNN)N)N)N)r   NN)NN)NN)NN)r   )N)N)NN)NNN)NN)NN)NNN)	NNNNNNNNN)r   N)N)NNNNN)NN)NNNN)d__name__
__module____qualname__Z
APIVersionr   r   r2   r=   rB   rD   rE   rH   rM   rN   rT   rV   rY   rZ   r[   r\   r^   r_   r`   rb   rc   rf   rg   rh   ri   rj   rn   ro   rp   rs   rv   rw   rx   Zget_all_server_certsr{   r|   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   __classcell__r   r   r   r   r
   9   s"                             















  
 


    
"  
   
&

'



  
!  


.
           
N  
 
    
%
     
$r
   )r"   Zboto.jsonresponseZboto.compatr   r   Zboto.resultsetr   Zboto.iam.summarymapr   Zboto.connectionr   r   r   ZASSUME_ROLE_POLICY_DOCUMENTr
   r   r   r   r   <module>   s4     