rmLbc@sSdZddlZddlZddlZddlmZejeZidddgddfd6dbd6dcd 6ddd 6ded6ddidfd6dfd6ddde fd6ddde fd6dgd6dhd6dde ej fd6dd dej fd6d!d"dej fd!6d#de dfd#6d$d%e ej fd$6did&6d)d*d+e fd)6djd,6dkd/6dld26dmd56dnd76d9d:de fd96Zidpd<6dqddej fd=6drddej fd6dsddej fd>6d?dtgdAdej fd@6dBdugdDddfdC6dvdFdej fdE6ZidwdG6dxdH6dIddejfdI6ZdJZdKZdLdydMYZdNefdOYZdPefdQYZdRdzdSYZdTefdUYZdVefdWYZdXefdYYZdZefd[YZd\efd]YZd^efd_YZd`efdaYZdS({sOThis module contains the inteface for controlling how configuration is loaded. iN(tutilstAWS_DEFAULT_PROFILEt AWS_PROFILEtprofiletregiontAWS_DEFAULT_REGIONt data_patht AWS_DATA_PATHtAWS_CONFIG_FILEs ~/.aws/configt config_filet ca_bundlet AWS_CA_BUNDLEt api_versionstAWS_SHARED_CREDENTIALS_FILEs~/.aws/credentialstcredentials_filetmetadata_service_timeouttAWS_METADATA_SERVICE_TIMEOUTitmetadata_service_num_attemptst!AWS_METADATA_SERVICE_NUM_ATTEMPTStec2_metadata_service_endpointt!AWS_EC2_METADATA_SERVICE_ENDPOINTt"ec2_metadata_service_endpoint_modet&AWS_EC2_METADATA_SERVICE_ENDPOINT_MODEt imds_use_ipv6tAWS_IMDS_USE_IPV6tuse_dualstack_endpointtAWS_USE_DUALSTACK_ENDPOINTtuse_fips_endpointtAWS_USE_FIPS_ENDPOINTtparameter_validationt csm_enabledtAWS_CSM_ENABLEDtcsm_hostt AWS_CSM_HOSTs 127.0.0.1tcsm_portt AWS_CSM_PORTiyt csm_client_idtAWS_CSM_CLIENT_IDttendpoint_discovery_enabledtAWS_ENDPOINT_DISCOVERY_ENABLEDtautotsts_regional_endpointstAWS_STS_REGIONAL_ENDPOINTStlegacyt retry_modetAWS_RETRY_MODEt defaults_modetAWS_DEFAULTS_MODEt max_attemptstAWS_MAX_ATTEMPTSts3taddressing_styletuse_accelerate_endpointtpayload_signing_enabledts3_use_arn_regiontuse_arn_regiontAWS_S3_USE_ARN_REGIONts3_us_east_1_regional_endpointtus_east_1_regional_endpointt"AWS_S3_US_EAST_1_REGIONAL_ENDPOINTt$s3_disable_multiregion_access_pointst(AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTStproxy_ca_bundletproxy_client_certtproxy_use_forwarding_for_httpscCs`td|}t|t}td|t|t|d config_property_name -> default. Any values that were none are omitted form the chain. t instance_varRBtvaluet providersRQN( RytappendtInstanceVarProviderRxRqt_get_env_providerst_get_scoped_config_providerstConstantProvidert ChainProvider(R^RMRNRORPRQR((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyRSs (    cCsUg}t|ts!|g}nx-|D]%}|jtd|d|jq(W|S(Ntnametenv(t isinstanceRfRtEnvironmentProviderR|(R^RNtenv_var_providerst env_var_name((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyR5s  cCsUg}t|ts!|g}nx-|D]%}|jtd|d|jq(W|S(Ntconfig_var_nameRB(RRfRtScopedConfigProviderRx(R^ROtscoped_config_providerstconfig_property_name((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyR?s  N(RvRwt__doc__RyR`RSRR(((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyRDs  < tConfigValueStorecBsPeZdZddZdZdZdZdZdZ dZ RS( s8The ConfigValueStore object stores configuration values.cCsRi|_i|_|dk rNx-|jD]\}}|j||q+WndS(sNInitialize a ConfigValueStore. :type mapping: dict :param mapping: The mapping parameter is a map of string to a subclass of BaseProvider. When a config variable is asked for via the get_config_variable method, the corresponding provider will be invoked to load the value. N(t _overridest_mappingRyRRtset_config_provider(R^RURVtprovider((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyR`Os   cCsttj|j|S(N(RRdtdeepcopyR(R^tmemo((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyt __deepcopy__^scCsD||jkr|j|S||jkr-dS|j|}|jS(s Retrieve the value associeated with the specified logical_name from the corresponding provider. If no value is found None will be returned. :type logical_name: str :param logical_name: The logical name of the session variable you want to retrieve. This name will be mapped to the appropriate environment variable name for this session as well as the appropriate config file entry. :returns: value of variable or None if not defined. N(RRRytprovide(R^RVR((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pytget_config_variablecs   cCs3||jks||jkr"dS|j|}|S(s Retrieve the provider associated with the specified logical_name. If no provider is found None will be returned. :type logical_name: str :param logical_name: The logical name of the session variable you want to retrieve. This name will be mapped to the appropriate environment variable name for this session as well as the appropriate config file entry. :returns: configuration provider or None if not defined. N(RRRy(R^RVR((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pytget_config_providerxs  cCs||j|>> # Assume logical name 'foo' maps to env var 'FOO' >>> os.environ['FOO'] = 'myvalue' >>> s.get_config_variable('foo') 'myvalue' >>> s.set_config_variable('foo', 'othervalue') >>> s.get_config_variable('foo') 'othervalue' :type logical_name: str :param logical_name: The logical name of the session variable you want to set. These are the keys in ``SESSION_VARIABLES``. :param value: The value to associate with the config variable. N(R(R^RVR~((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pytset_config_variablescCs|jj|ddS(sRemove an override config variable from the session. :type logical_name: str :param logical_name: The name of the parameter to clear the override value from. N(RtpopRy(R^RV((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pytclear_config_variablescCs||j|BsisLChainProvider object contains multiple instances of ConstantProvider objects(RRRRtsumtloggertinfo(R^Rtnum_of_constants((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyR<s  cCs |jdk r|j|S|S(N(RRy(R^R~((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyRKs cCs-ddjg|jD]}t|^qS(Ns[%s]s, (tjoinRtstr(R^tp((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyt__repr__PsN( RvRwRRyR`RRRRR(((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyRs   RcBs2eZdZdZdZdZdZRS(s>This class loads config values from the session instance vars.cCs||_||_dS(s>Initialize InstanceVarProvider. :type instance_var: str :param instance_var: The instance variable to load from the session. :type session: :class:`botocore.session.Session` :param session: The botocore session to get the loaded configuration file variables from. N(t _instance_varRx(R^R}RB((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyR`Vs cCsttj|j||jS(N(RRdRRRx(R^R((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyRcscCs%|jj}|j|j}|S(s6Provide a config value from the session instance vars.(Rxtinstance_variablesReR(R^t instance_varsR~((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyRiscCsd|j|jfS(Ns0InstanceVarProvider(instance_var=%s, session=%s)(RRx(R^((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyRos(RvRwRR`RRR(((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyRTs   RcBs,eZdZdZdZdZRS(cCs||_||_dS(s2Initialize ScopedConfigProvider. :type config_var_name: str or tuple :param config_var_name: The name of the config variable to load from the configuration file. If the value is a tuple, it must only consist of two items, where the first item represents the section and the second item represents the config var name in the section. :type session: :class:`botocore.session.Session` :param session: The botocore session to get the loaded configuration file variables from. N(t_config_var_nameRx(R^RRB((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyR`ws cCsttj|j||jS(N(RRdRRRx(R^R((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyRscCsn|jj}t|jtr^|j|jd}t|tsJdS|j|jdS|j|jS(s,Provide a value from a config file property.iiN(Rxtget_scoped_configRRttupleRetdictRy(R^t scoped_configtsection_config((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyRscCsd|j|jfS(Ns4ScopedConfigProvider(config_var_name=%s, session=%s)(RRx(R^((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyRs(RvRwR`RRR(((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyRvs   RcBs2eZdZdZdZdZdZRS(s:This class loads config values from environment variables.cCs||_||_dS(sInitialize with the keys in the dictionary to check. :type name: str :param name: The key with that name will be loaded and returned. :type env: dict :param env: Environment variables dictionary to get variables from. N(t_namet_env(R^RR((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyR`s cCs+ttj|j|tj|j|S(N(RRdRRR(R^R((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyRscCs$|j|jkr |j|jSdS(s0Provide a config value from a source dictionary.N(RRRy(R^((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyRscCsd|j|jfS(Ns$EnvironmentProvider(name=%s, env=%s)(RR(R^((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyRs(RvRwRR`RRR(((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyRs   RGcBs>eZdZddZdZdZdZdZRS(sProvides a dictionary from a section in the scoped config This is useful for retrieving scoped config variables (i.e. s3) that have their own set of config variables and resolving logic. cCsR||_||_t|j|j|_||_|jdkrNi|_ndS(N(t _section_nameRxRt_scoped_config_providert_override_providersRy(R^RRBtoverride_providers((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyR`s   cCs1ttj|j||jtj|j|S(N(RGRdRRRxR(R^R((s8/usr/lib/fence-agents/bundled/botocore/configprovider.pyRscCs|jj}|r?t|t r?tjd|j|dSxW|jj D]F\}}|j}|dk rO|dkri}n|||s     %mrH B"(8