o
    .&ßau  ã                   @   s8   d dl Z d dlmZ ddlmZmZ G dd„ deƒZdS )é    N)ÚBasicCommandé   )ÚConfigValueÚNOT_SETc                       sR   e Zd ZdZdZdZdZejf‡ fdd„	Z	dd„ Z
d	d
„ Zdd„ Zdd„ Z‡  ZS )ÚConfigureListCommandÚlistaù  List the AWS CLI configuration data.  This command will show you the current configuration data.  For each configuration item, it will show you the value, where the configuration value was retrieved, and the configuration variable name.  For example, if you provide the AWS region in an environment variable, this command will show you the name of the region you've configured, it will tell you that this value came from an environment variable, and it will tell you the name of the environment variable.
z+aws configure list [--profile profile-name]aç  To show your current configuration values::

  $ aws configure list
        Name                    Value             Type    Location
        ----                    -----             ----    --------
     profile                <not set>             None    None
  access_key     ****************ABCD      config_file    ~/.aws/config
  secret_key     ****************ABCD      config_file    ~/.aws/config
      region                us-west-2              env    AWS_DEFAULT_REGION

c                    s   t t| ƒ |¡ || _d S )N)Úsuperr   Ú__init__Ú_stream)ÚselfÚsessionÚstream©Ú	__class__© úF/usr/lib/python3/dist-packages/awscli/customizations/configure/list.pyr	   /   s   
zConfigureListCommand.__init__c                 C   sœ   |   tdddƒd¡ |   tdddƒd¡ |r$|jd ur$t| jjdd	ƒ}n|  d
¡}|   |d
¡ |  ¡ \}}|   |d¡ |   |d¡ |  d¡}|   |d¡ d S )NÚValueÚTypeÚLocationÚNamez-----z----z--------Úmanualz	--profileÚprofileÚ
access_keyÚ
secret_keyÚregion)Ú_display_config_valuer   r   Ú_sessionÚ_lookup_configÚ_lookup_credentials)r   ÚargsÚparsed_globalsr   r   r   r   r   r   r   Ú	_run_main3   s   ÿÿ

zConfigureListCommand._run_mainc                 C   s"   | j  d||j|j|jf ¡ d S )Nz%10s %24s %16s    %s
)r
   ÚwriteÚvalueÚconfig_typeÚconfig_variable)r   Úconfig_valueÚconfig_namer   r   r   r   F   s   
þz*ConfigureListCommand._display_config_valuec                 C   s”   |   d¡}|jtur|   d¡}| ¡  | ¡  ||fS | j ¡ }|d u r.ttd d ƒ}||fS t|j|jdƒ}t|j	|jdƒ}| ¡  | ¡  ||fS )Nr   r   Ú )
r   r#   r   Ú
mask_valuer   Úget_credentialsr   r   Úmethodr   )r   r   r   ÚcredentialsÚ	no_configr   r   r   r   K   s&   



ÿÿz(ConfigureListCommand._lookup_credentialsc                 C   sh   | j j|dd�}|d urt|d| j j| d ƒS | j j|dd�}|d ur.t|d| j  d¡ƒS ttd d ƒS )N)Úenv)Úmethodsr.   r   )Úconfigzconfig-fileÚconfig_file)r   Úget_config_variabler   Úsession_var_mapr   )r   Únamer#   r   r   r   r   k   s   
ÿz#ConfigureListCommand._lookup_config)Ú__name__Ú
__module__Ú__qualname__ÚNAMEÚDESCRIPTIONÚSYNOPSISÚEXAMPLESÚsysÚstdoutr	   r!   r   r   r   Ú__classcell__r   r   r   r   r      s    ÿÿ r   )r<   Úawscli.customizations.commandsr   r(   r   r   r   r   r   r   r   Ú<module>   s   