U C^5@sdZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z eeZddgZdd d d d d ddddddddddgZGdddeZdS)zInternal module to help with normalizing botocore client args. This module (and all function/classes within this module) should be considered internal, and *not* a public API. N) RequestSigner)Config)EndpointCreatorlegacyZregionalzap-northeast-1z ap-south-1zap-southeast-1zap-southeast-2 aws-globalz ca-central-1z eu-central-1z eu-north-1z eu-west-1z eu-west-2z eu-west-3z sa-east-1 us-east-1z us-east-2z us-west-1z us-west-2c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!S)"ClientArgsCreatorcCs(||_||_||_||_||_||_dSN)_event_emitter _user_agent_response_parser_factory_loader_exceptions_factory _config_store)self event_emitter user_agentresponse_parser_factoryloaderexceptions_factoryZ config_storer3/tmp/pip-install-6_kvzl1k/botocore/botocore/args.py__init__;s zClientArgsCreator.__init__c  Cs|||| ||||} | d} | d} | d} | d}| d}| d}| ddd}| d }| d }| d }t|j}t|j|| d | d ||}||d<tf|}t|}|j||| d||j |j |j |j |j f||jd }tj|| }tj|}|||||||j|||jd S)N service_nameparameter_validationendpoint_configprotocol config_kwargs s3_configmetadata partitionsocket_optionssigning_region region_nameZ signing_namesignature_versions3 endpoint_url) r#r&verifyrmax_pool_connectionsproxiestimeoutr! client_cert) serializerendpointresponse_parserrZrequest_signer service_modelr client_configr r)compute_client_argsgetcopyr rZ service_idrrZcreate_endpointr r(r)connect_timeout read_timeoutr+botocore serializeZcreate_serializerparsers create_parserr r)rr/r# is_securer&r' credentials scoped_configr0endpoint_bridgeZ final_argsrrrrrrr r!r"Zendpoint_region_namerZsignerZ new_configZendpoint_creatorr-r,r.rrrget_client_argsDsv     z!ClientArgsCreator.get_client_argsc Cs|j}|jd} d} |r$|js$d} n"|rF|d} | dk rFtj| } |j} |dk r||jdk rd|j} |j dk r|| d|j 7} | |} |j |||||| d}t |d|d| d }|dk r|j |j|j|j|j|j|j|jd | |} || | || || ||d S) NrTFrz %s)rr#r&r:r=rr#r$)r#r$r)r4r5r(r)retriesr+inject_host_prefix)rrrrrrrr!)Zendpoint_prefixrrr2r6utilsZensure_booleanr rZuser_agent_extracompute_s3_config_compute_endpoint_configdictupdater4r5r(r)r?r+r@_compute_socket_options)rr/r0r=r#r&r:r<rrrZ raw_valuerrrrrrrr1}sb         z%ClientArgsCreator.compute_client_argscCsF|jd}|dk rB|jdk rB|dkr.|j}n|}||j|S)Nr%)rget_config_variabler%r3rE)rr0Zs3_configurationrrrrBs   z#ClientArgsCreator.compute_s3_configcCsL|||||d}|dkr,|jfd|i|S|dkr@|jf|S|jf|S)N)rr#r&r:r=r%rsts)_compute_s3_endpoint_config_compute_sts_endpoint_config_resolve_endpoint)rrr#r&r:r=rresolve_endpoint_kwargsrrrrCs z*ClientArgsCreator._compute_endpoint_configcKsT||d|}|rd|d<|jf|}|||d|rP|ddkrPd|d<|S)Nr#r=rr)_should_force_s3_globalrK!_set_region_if_custom_s3_endpoint)rrrLZforce_s3_globalrrrrrIs z-ClientArgsCreator._compute_s3_endpoint_configcCs2d}|r"d|kr"|d}|||dko0|dkS)NrZus_east_1_regional_endpoint)rN)_validate_s3_regional_config)rr#rZs3_regional_configrrrrMs  z)ClientArgsCreator._should_force_s3_globalcCs|tkrtjj|ddS)N)Z%s3_us_east_1_regional_endpoint_config)VALID_REGIONAL_ENDPOINTS_CONFIGr6 exceptionsZ+InvalidS3UsEast1RegionalEndpointConfigError)rZ config_valrrrrOsz.ClientArgsCreator._validate_s3_regional_configcCs>|ddkr:|ddkr:|d}|d|d<|d|d<dS)Nr"r#r%resolve)rrr=r-rrrrNs     z3ClientArgsCreator._set_region_if_custom_s3_endpointcKs4|jf|}||d|dr0|||d|S)Nr#r&r:)rK_should_set_global_sts_endpoint_set_global_sts_endpoint)rrLrrrrrJs z.ClientArgsCreator._compute_sts_endpoint_configcCs|rdS|dko|tkS)NFr)"_get_sts_regional_endpoints_configLEGACY_GLOBAL_STS_REGIONS)rr#r&rrrrTs  z1ClientArgsCreator._should_set_global_sts_endpointcCs.|jd}|sd}|tkr*tjj|d|S)NZsts_regional_endpointsr)sts_regional_endpoints_config)rrGrPr6rQZ&InvalidSTSRegionalEndpointsConfigError)rrXrrrrVsz4ClientArgsCreator._get_sts_regional_endpoints_configcCs$|rdnd}d||d<d|d<dS)Nhttpshttpz%s://sts.amazonaws.comr&rr"r)rrr:schemerrrrU$s  z*ClientArgsCreator._set_global_sts_endpointcCs|||||Sr rR)rrr#r&r:r=rrrrK)s z#ClientArgsCreator._resolve_endpointcCs>tjtjdfg}|r:||ddr:|tjtjdf|S)NZ tcp_keepaliveF)socket IPPROTO_TCP TCP_NODELAY_ensure_booleanr2append SOL_SOCKET SO_KEEPALIVE)rr<r!rrrrF.s z)ClientArgsCreator._compute_socket_optionscCst|tr|S|dkSdS)Ntrue) isinstanceboollower)rvalrrrr`9s z!ClientArgsCreator._ensure_booleanN)__name__ __module__ __qualname__rr>r1rBrCrIrMrOrNrJrTrVrUrKrFr`rrrrr:s  9;     r)__doc__r3loggingr]Zbotocore.exceptionsr6Zbotocore.serializeZbotocore.utilsZbotocore.signersrZbotocore.configrZbotocore.endpointr getLoggerriloggerrPrWobjectrrrrr s>