<s> import sys <EOL> from awscli . customizations . commands import BasicCommand <EOL> from . import ConfigValue , NOT_SET <EOL> class ConfigureListCommand ( BasicCommand ) : <EOL> NAME = '<STR_LIT:list>' <EOL> DESCRIPTION = ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> SYNOPSIS = '<STR_LIT>' <EOL> EXAMPLES = ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT:\n>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT:\n>' <EOL> ) <EOL> def __init__ ( self , session , stream = sys . stdout ) : <EOL> super ( ConfigureListCommand , self ) . __init__ ( session ) <EOL> self . _stream = stream <EOL> def _run_main ( self , args , parsed_globals ) : <EOL> self . _display_config_value ( ConfigValue ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT:Name>' ) <EOL> self . _display_config_value ( ConfigValue ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT>' ) <EOL> if self . _session . profile is not None : <EOL> profile = ConfigValue ( self . _session . profile , '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> else : <EOL> profile = self . _lookup_config ( '<STR_LIT>' ) <EOL> self . _display_config_value ( profile , '<STR_LIT>' ) <EOL> access_key , secret_key = self . _lookup_credentials ( ) <EOL> self . _display_config_value ( access_key , '<STR_LIT>' ) <EOL> self . _display_config_value ( secret_key , '<STR_LIT>' ) <EOL> region = self . _lookup_config ( '<STR_LIT>' ) <EOL> self . _display_config_value ( region , '<STR_LIT>' ) <EOL> def _display_config_value ( self , config_value , config_name ) : <EOL> self . _stream . write ( '<STR_LIT>' % ( <EOL> config_name , config_value . value , config_value . config_type , <EOL> config_value . config_variable ) ) <EOL> def _lookup_credentials ( self ) : <EOL> access_key = self . _lookup_config ( '<STR_LIT>' ) <EOL> if access_key . value is not NOT_SET : <EOL> secret_key = self . _lookup_config ( '<STR_LIT>' ) <EOL> access_key . mask_value ( ) <EOL> secret_key . mask_value ( ) <EOL> return access_key , secret_key <EOL> else : <EOL> credentials = self . _session . get_credentials ( ) <EOL> if credentials is None : <EOL> no_config = ConfigValue ( NOT_SET , None , None ) <EOL> return no_config , no_config <EOL> else : <EOL> access_key = ConfigValue ( credentials . access_key , <EOL> credentials . method , '<STR_LIT>' ) <EOL> secret_key = ConfigValue ( credentials . secret_key , <EOL> credentials . method , '<STR_LIT>' ) <EOL> access_key . mask_value ( ) <EOL> secret_key . mask_value ( ) <EOL> return access_key , secret_key <EOL> def _lookup_config ( self , name ) : <EOL> value = self . _session . get_config_variable ( name , methods = ( '<STR_LIT>' , ) ) <EOL> if value is not None : <EOL> return ConfigValue ( value , '<STR_LIT>' , self . _session . session_var_map [ name ] [ <NUM_LIT:1> ] ) <EOL> value = self . _session . get_config_variable ( name , methods = ( '<STR_LIT>' , ) ) <EOL> if value is not None : <EOL> return ConfigValue ( value , '<STR_LIT>' , <EOL> self . _session . get_config_variable ( '<STR_LIT>' ) ) <EOL> else : <EOL> return ConfigValue ( NOT_SET , None , None ) </s>
