9(Zc@sddlZddlZddlmZmZddlmZddlmZddl m Z ddl m Z ddl m Z mZddl mZdd l mZdd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddl!m"Z"ddlm#Z#ddl$m%Z%ddl&m'Z'ej(e)Z*e'Z+de,fdYZ-de,fdYZ.de,fdYZ/de,fd YZ0d!Z1dS("iN(twaitert xform_name(tAUTH_TYPE_MAPS(tprepare_request_dict(tClientMethodDocstring(tPaginatorDocstring(t ClientErrortDataNotFoundError(tOperationNotPageableError(tUnknownSignatureVersionError(tfirst_non_none_response(t ServiceModel(t Paginator(tCachedProperty(tget_service_module_name(tswitch_host_s3_accelerate(tS3RegionRedirector(t fix_s3_host(tswitch_to_virtual_host_style(tS3_ACCELERATE_WHITELIST(tClientArgsCreator(turlsplit(tUNSIGNED(tConfig(tget_global_history_recordert ClientCreatorcBseZdZdddZedddddddZddZdZddZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZdZdZRS(s%Creates client objects for a service.c CsL||_||_||_||_||_||_||_||_dS(N(t_loadert_endpoint_resolvert _user_agentt_event_emittert_retry_handler_factoryt_retry_config_translatort_response_parser_factoryt_exceptions_factory( tselftloadertendpoint_resolvert user_agentt event_emittertretry_handler_factorytretry_config_translatortresponse_parser_factorytexceptions_factory((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyt__init__1s       c  Cs|j||} |j|| } t|j|| d| jjd} |j| ||||||| | } | | }|j||j|| || ||S(Ntservice_signing_namet signingName( t_load_service_modelt_create_client_classtClientEndpointBridgeRtmetadatatgett_get_client_argst_register_retriest_register_s3_events(R"t service_namet region_namet is_securet endpoint_urltverifyt credentialst scoped_configt api_versiont client_configt service_modeltclstendpoint_bridget client_argstservice_client((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyt create_client=s    cCs"|j||}|j||S(N(R.R/(R"R6R=R?((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pytcreate_client_classQscCs|j|}|j|}||dR<((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyR5~s  cCs_|dkri}n|j||}|j|||}|dk r[|jd|ndS(Nsbefore-sign.s3(tNonet_get_s3_addressing_stylet_get_s3_addressing_handlerRc(R"R9t s3_configR&taddressing_styleRg((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyRis    cCsK|jdt}|s*|j||r.dS|jd}|rG|SdS(Ntuse_accelerate_endpointtvirtualRq(R2tFalseRj(R"R9Rpt acceleratetconfigured_addressing_style((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyRns cCs||dkrtjdtS|dks5|dk rFtjddStjd|jdtrxtjtddStS(NRss'Using S3 virtual host style addressing.tpathsUsing S3 path style addressing.sSDefaulting to S3 virtual host style addressing with path style addressing fallback.tuse_dualstack_endpointtdefault_endpoint_url( R_R`RRmR2Rtt functoolstpartialR(R"R9RpRq((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyRos     cCs|dk r|jdrtS|dkr/tSt|j}|jdsQtS|jd}|ddkrttS|dd!}t|tt |krtSt d|DS( NRrs amazonaws.comt.is s3-accelerateiicss|]}|tkVqdS(N(R(t.0tp((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pys s( RmR2tTrueRtRtnetloctendswithtsplittlentsettall(R"R9RpRtpartst feature_parts((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyRjs  cCstd||}|dk r"dS|jjd|j}|j|krMdS|jjd|j}|d}d|krdS|jjd|j dS(NRhtsignatureVersionsschoose-signer.s3( t!_get_configured_signature_versionRmRtget_available_endpointst partitionR7tconstruct_endpointRbRct_default_s3_presign_to_sigv2(R"t client_metaR>R<tprovided_signature_versiontregionstendpointtsignature_versions((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyRls      cKs2x+ddgD]}|j|r d|Sq WdS(s Returns the 's3' (sigv2) signer if presigning an s3 request. This is intended to be used to set the default signature version for the signer to sigv2. :type signature_version: str :param signature_version: The current client signature version. :type signing_name: str :param signing_name: The signing name of the service. :return: 's3' if the request is an s3 presign request, None otherwise s-querys -presign-postRhN(R(R"tsignature_versiontkwargstsuffix((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyRsc CsLt|j|j|j|j|j} | j||||||||| S(N(RRRR RR!tget_client_args( R"R?R7R8R9R:R;R<R>RAt args_creator((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyR3s    cCsCi}x6|jD]+}t|}|j|||||tDEFAULT_ENDPOINTtdefault_endpoint(R"R$R<R>RR,((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyR+Ys     cCs`|j||}|jj||}|rF|j|||||S|j||||SdS(N(t_check_default_regionR$Rt_create_endpointt_assume_endpoint(R"R6R7R9R8tresolved((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pytresolvebs   cCs9|dk r|S|jr5|jjdk r5|jjSdS(N(RmR>R7(R"R6R7((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyRns c Cs|j|||\}}|dkr|j|rU|j|||d|}q|jd|jd}|j|||jdg}n|j||}|j||} |jd|d|d|d| d |d |d |S( Nt dnsSuffixt sslCommonNamethostnamet protocolsR6R7tsigning_regiont signing_nameR9R1R( t_pick_region_valuesRmt_is_s3_dualstack_modet_create_dualstack_endpointR2t _make_urlt_resolve_signature_versiont_resolve_signing_namet_create_result( R"RR6R7R9R8RRRR((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyRus$       cCs|dkrtS|j}|dk rN|jdk rNd|jkrN|jdS|jdkratS|jjdijdt}|tddgkrtStS(NRhRxRttrue(RtR>RmRhR<R2R(R"R6R>tenabled((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyRs    cCs7djd|d|d|}|j||ddgS(Ns){service}.dualstack.{region}.{dns_suffix}tservicetregiont dns_suffixthttpthttps(tformatR(R"R6R7RR8R((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyRs   cCs|dkrE|jjd|d|}|j||ddg}ntjd||||j|idgd6}|j|di}|jd |d |d |d |d |d|diS(NRRRRs#Assuming an endpoint for %s, %s: %stv4RRR6R7RRRR9R1( RmRRRR_R`RRR(R"R6R7R9R8RRR((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyRs         cCs5i|d6|d6|d6|d6|d6|d6|d6S(NR6R7RRR9RR1((R"R6R7RRR9RR1((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyRscCs/|rd|krd}nd}d||fS(NRRs%s://%s((R"RR8tsupported_protocolstscheme((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyRs cCs<d|kr(d|dkr(|ddS|jr8|jS|S(NtcredentialScopeR(R,(R"R6R((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyRs    cCs\|}|dkrR|d}|}d|krRd|dkrR|dd}qRn||fS(Nt endpointNameRR(Rm(R"RR7R9R((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyRs  cCst||j|j}|dk r(|Sd|kr|d}|dkrNdSd|kr^dSx!tD]}||kre|SqeWntd|jddS(NRRhts3v4RR(RR>R<RmRR R2(R"R6Rtconfigured_versiontpotential_versionstknown((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyRs        N(RRRRRmR+RRRRRRRRRRRR(((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyR0Ls"        RKcBseZiZdZdZdZedZdZd dZ dZ dZ dZ d Zed Zed Zd ZRS(c Cs||_||_||_||_i|_||_||_t||j|j||j | |_ | |_ d|_ |jdS(N(t _serializert _endpointt_response_parsert_request_signert_cacheRt_client_configt ClientMetathostRFRYR!Rmt _exceptionst_register_handlers( R"t serializerRtresponse_parserR&trequest_signerR?R#R>RR*((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyR+s           cCsgd|jj|f}|jjj|d|\}}|dk rG|Std|jj|fdS(Ns getattr.%s.%sRds!'%s' object has no attribute '%s'( t_service_modelR6RYRbtemit_until_responseRmtAttributeErrort __class__R(R"titemt event_nameRgtevent_response((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyt __getattr__!s  cCs-|jjjd|jjj|jjdS(Nsrequest-created.%s(RYRbRcR?RZRRg(R"((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyR.s cCs |jjS(N(RYR?(R"((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyR4sc Cs|jj|}|jj}tjdi|d6|d6|d6|jrbtjd||ni|jj d6|jj d6|j d6|j d 6}|j ||d |}|jjjd jd |jjd |d|d|d|jd |\}}|dk r|\} } n|jj||\} } |jjjdjd |jjd |d| d| d|d || jdkr| jdijd} |jj| } | | |n| SdS(NtAPI_CALLRt operationtparamssWarning: %s.%s() is deprecatedt client_regionR>thas_streaming_inputt auth_typetcontexts.before-call.{endpoint_prefix}.{operation_name}RZRtmodelRs-after-call.{endpoint_prefix}.{operation_name}t http_responsetparsedi,tErrortCode(RRR6thistory_recordertrecordt deprecatedR_R`RYR7R]RRt_convert_to_request_dictRbRRRZRRmRt make_requestRLt status_codeR2t exceptionst from_code( R"Rt api_paramsRR6trequest_contextt request_dictRgRRtparsed_responset error_codet error_class((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyR8sJ                       cCs|j}|jjjdjd|jjd|d|d|d|}t|d|}d}|jjj|jd|jjd|d|d|d||jj ||}t |d |j j d |j jd||S( Ns8provide-client-params.{endpoint_prefix}.{operation_name}RZRRRRtdefaults9before-parameter-build.{endpoint_prefix}.{operation_name}R9R%(tnameRYRbRLRRRZR Rtserialize_to_requestRRRRR%(R"RRRRt responsesRR((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyRhs&            c Cs|j|s!td|n|j|}d}|jd|}td|d|jjd|jjd|dt|_ t d t |jj|f}t |t fi|d 6}|jj|}|t||||}|Sd S( sCreate a paginator for an operation. :type operation_name: string :param operation_name: The operation name. This is the same name as the method name on the client. For example, if the method name is ``create_foo``, and you'd normally invoke the operation as ``client.create_foo(**kwargs)``, if the ``create_foo`` operation can be paginated, you can use the call ``client.get_paginator("create_foo")``. :raise OperationNotPageableError: Raised if the operation is not pageable. You can use the ``client.can_paginate`` method to check if an operation is pageable. :rtype: L{botocore.paginate.Paginator} :return: A paginator object. Rc[stj||S(N(R tpaginate(R"R((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyRst page_configtpaginator_nameR&R?tpaginator_configRs%s.Paginator.%sRN(t can_paginateRRFRRRYRbR?RtRRNRRMR RRtgetattr( R"Rtactual_operation_nameRRtpaginator_class_nametdocumented_paginator_clsRt paginator((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyt get_paginators.         cCsd|jkrly9|jj|jjd|jjd}||jdR9R?tmethod_to_api_mappingR((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyR+s      cCs|jS(N(R(R"((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyR?!scCs |jjS(N(RR7(R"((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyR7%scCs|jS(N(R(R"((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyR9)scCs|jS(N(R(R"((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyR]-scCs|jS(N(R(R"((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyR1scCs|jS(N(R(R"((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyR5s( RRRR+RR?R7R9R]RR(((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyR s  cCs|r|jdk r|jS|dk r|j|}|dk rt|tr|jd}|rtjd|||SqndS(s Gets the manually configured signature version. :returns: the customer configured signature version, or None if no signature version was configured. RsWSwitching signature version for service %s to version %s based on config file override.N(RRmR2t isinstancetdictR_R`(R6R>R<tservice_configtversion((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyR:s    (2tloggingRztbotocoreRRt botocore.authRtbotocore.awsrequestRtbotocore.docs.docstringRRtbotocore.exceptionsRRRR tbotocore.hooksR tbotocore.modelR tbotocore.paginateR tbotocore.utilsR RRRRRRt botocore.argsRtbotocore.compatRRtbotocore.configRtbotocore.historyRt getLoggerRR_RtobjectRR0RKRR(((s1/tmp/pip-build-wDUJoH/botocore/botocore/client.pyt sB   /