a 97aG?@sdZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z eeZddgZgdZGd d d eZdS) 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)EndpointCreatorlegacyZregional)zap-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!d"Zd#d$Zd%d&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_storerh/private/var/folders/s6/9n5zrl012gv99k63s4q6ccsd4s6mqz/T/pip-target-f5cq3f2q/lib/python/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<tfi|}t|}|j||| d||j |j |j |j |j f||j|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_certproxies_config) serializerendpointresponse_parserrZrequest_signer service_modelr client_configr r)compute_client_argsgetcopyr rZ service_idrrZcreate_endpointr r(r)connect_timeout read_timeoutr+r,botocore serializeZcreate_serializerparsers create_parserr r)rr0r# is_securer&r' credentials scoped_configr1endpoint_bridgeZ final_argsrrrrrrr r!r"Zendpoint_region_namerZsignerZ new_configZendpoint_creatorr.r-r/rrrget_client_argsDsd    z!ClientArgsCreator.get_client_argsc Cs|j}|jd} d} |r$|js$d} n"|rF|d} | durFtj| } |j} |dur||jdurd|j} |j dur|| d|j 7} | |} |j |||||| d}t |d|d| d }|dur|j |j|j|j|j|j|j|j|jd ||| |} || | || || ||d S) NrTFrz %s)rr#r&r;r>rr#r$)r#r$r)r5r6r(r)r,retriesr+inject_host_prefix)rrrrrrrr!)Zendpoint_prefixrrr3r7utilsZensure_booleanr rZuser_agent_extracompute_s3_config_compute_endpoint_configdictupdater5r6r(r)r,r@r+rA_compute_retry_config_compute_socket_options)rr0r1r>r#r&r;r=rrrZ raw_valuerrrrrrrr2~sf          z%ClientArgsCreator.compute_client_argscCsF|jd}|durB|jdurB|dur.|j}n|}||j|S)Nr%)rget_config_variabler%r4rF)rr1Zs3_configurationrrrrCs   z#ClientArgsCreator.compute_s3_configcCsT|||||d}|dkr,|jfd|i|S|dkrD|jfi|S|jfi|S)N)rr#r&r;r>r%rsts)_compute_s3_endpoint_config_compute_sts_endpoint_config_resolve_endpoint)rrr#r&r;r>rresolve_endpoint_kwargsrrrrDsz*ClientArgsCreator._compute_endpoint_configcKsX||d|}|rd|d<|jfi|}|||d|rT|ddkrTd|d<|S)Nr#r>rr)_should_force_s3_globalrM!_set_region_if_custom_s3_endpoint)rrrNZforce_s3_globalrrrrrKsz-ClientArgsCreator._compute_s3_endpoint_configcCs2d}|r"d|vr"|d}|||dko0|dvS)NrZus_east_1_regional_endpoint)rN)_validate_s3_regional_config)rr#rZs3_regional_configrrrrOs  z)ClientArgsCreator._should_force_s3_globalcCs|tvrtjj|ddS)N)Z%s3_us_east_1_regional_endpoint_config)VALID_REGIONAL_ENDPOINTS_CONFIGr7 exceptionsZ+InvalidS3UsEast1RegionalEndpointConfigError)rZ config_valrrrrQsz.ClientArgsCreator._validate_s3_regional_configcCs>|ddur:|ddur:|d}|d|d<|d|d<dS)Nr"r#r%resolve)rrr>r.rrrrPs     z3ClientArgsCreator._set_region_if_custom_s3_endpointcKs8|jfi|}||d|dr4|||d|S)Nr#r&r;)rM_should_set_global_sts_endpoint_set_global_sts_endpoint)rrNrrrrrL sz.ClientArgsCreator._compute_sts_endpoint_configcCs|rdS|dko|tvS)NFr)"_get_sts_regional_endpoints_configLEGACY_GLOBAL_STS_REGIONS)rr#r&rrrrVs  z1ClientArgsCreator._should_set_global_sts_endpointcCs.|jd}|sd}|tvr*tjj|d|S)NZsts_regional_endpointsr)sts_regional_endpoints_config)rrIrRr7rSZ&InvalidSTSRegionalEndpointsConfigError)rrZrrrrXsz4ClientArgsCreator._get_sts_regional_endpoints_configcCs$|rdnd}d||d<d|d<dS)Nhttpshttpz%s://sts.amazonaws.comr&rr"r)rrr;schemerrrrW's  z*ClientArgsCreator._set_global_sts_endpointcCs|||||Sr rT)rrr#r&r;r>rrrrM,sz#ClientArgsCreator._resolve_endpointcCs>tjtjdfg}|r:||ddr:|tjtjdf|S)NZ tcp_keepaliveF)socket IPPROTO_TCP TCP_NODELAY_ensure_booleanr3append SOL_SOCKET SO_KEEPALIVE)rr=r!rrrrH1s z)ClientArgsCreator._compute_socket_optionscCs||||dSr )_compute_retry_max_attempts_compute_retry_mode)rrrrrrG<s z'ClientArgsCreator._compute_retry_configcCs|d}|durLd|vr*|dddSd|vrL|d}|d|d<dS|jd}|dur||durti}||d<||d<dS)Nr@Ztotal_max_attempts max_attemptsr^)r3poprrI)rrr@valuerhrrrrf@s     z-ClientArgsCreator._compute_retry_max_attemptscCsP|d}|dur i}||d<n d|vr,dS|jd}|durDd}||d<dS)Nr@mode retry_moder)r3rrI)rrr@rlrrrrg`s   z%ClientArgsCreator._compute_retry_modecCst|tr|S|dkSdS)Ntrue) isinstanceboollower)rvalrrrrbns z!ClientArgsCreator._ensure_booleanN)__name__ __module__ __qualname__rr?r2rCrDrKrOrQrPrLrVrXrWrMrHrGrfrgrbrrrrr:s& :=      r)__doc__r4loggingr_Zbotocore.exceptionsr7Zbotocore.serializeZbotocore.utilsZbotocore.signersrZbotocore.configrZbotocore.endpointr getLoggerrrloggerrRrYobjectrrrrr s