&>ac@sddlZddlmZmZddlmZddlmZddlm Z ddl m Z ddl m Z ddl mZmZmZmZdd lmZdd lmZdd lmZdd lmZmZmZmZmZmZmZm Z dd l!m"Z"ddl#m$Z$m%Z%m&Z&ddl'm(Z(ddl'm)Z)ddl*m+Z+ddl m,Z,ddlmZddlm-Z-ej.e/Z0e"Z1de2fdYZ3de2fdYZ4de2fdYZ5de2fdYZ6dZ7dS(iN(twaitert xform_name(tClientArgsCreator(tAUTH_TYPE_MAPS(tprepare_request_dict(tClientMethodDocstring(tPaginatorDocstring(tDataNotFoundErrortOperationNotPageableErrortUnknownSignatureVersionErrort*InvalidEndpointDiscoveryConfigurationError(tfirst_non_none_response(t ServiceModel(t Paginator(tCachedPropertytget_service_module_nametS3RegionRedirectortS3ArnParamHandlertS3EndpointSettertensure_booleantS3ControlArnParamHandlertS3ControlEndpointSetter(tget_global_history_recorder(tEndpointDiscoveryHandlertEndpointDiscoveryManagert,block_endpoint_discovery_required_operations(tstandard(tadaptive(tConfig(t ClientError(tUNSIGNEDt ClientCreatorcBseZdZddddZedddddddZddZdZdZ ddZ dZ dZ d Z d Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZRS(s%Creates client objects for a service.c CsU||_||_||_||_||_||_||_||_| |_dS(N( t_loadert_endpoint_resolvert _user_agentt_event_emittert_retry_handler_factoryt_retry_config_translatort_response_parser_factoryt_exceptions_factoryt _config_store( tselftloadertendpoint_resolvert user_agentt event_emittertretry_handler_factorytretry_config_translatortresponse_parser_factorytexceptions_factoryt config_store((s0/usr/lib/fence-agents/bundled/botocore/client.pyt__init__9s        c  Cs|jjdd|} t| d|}|j||} |j|| } |j|| \}} t|j|| d| jj dd|j } |j | ||||||| | }| |}|j ||j || || ||j|| || ||j||| |S(Nschoose-service-namet service_nametdefaulttservice_signing_namet signingNameR2(R#temitR t_load_service_modelt_create_client_classt_normalize_fips_regiontClientEndpointBridgeR!tmetadatatgetR(t_get_client_argst_register_retriest_register_s3_eventst_register_s3_control_eventst_register_endpoint_discovery(R)R4t region_namet is_securet endpoint_urltverifyt credentialst scoped_configt api_versiont client_configt responsest service_modeltclstendpoint_bridget client_argstservice_client((s0/usr/lib/fence-agents/bundled/botocore/client.pyt create_clientKs2        cCs"|j||}|j||S(N(R9R:(R)R4RJRM((s0/usr/lib/fence-agents/bundled/botocore/client.pytcreate_client_classksc Cs|j|}|j|}||d||dRdRtregister_retry_handler(R)RvRytkwargs((s0/usr/lib/fence-agents/bundled/botocore/client.pyRss    cCstj|dS(N(RRz(R)Rv((s0/usr/lib/fence-agents/bundled/botocore/client.pyRtsc Cs|jjj}|jjj}|j}|jjd}|sFdS|j|jjj }|j j ||j di|j di|}t jd|jjj|jj||}d|} |jjjd||d| dS(Nt_retrytretryt definitionss*Registering retry handlers for service: %ssretry-config-%ssneeds-retry.%st unique_id(RpRMtendpoint_prefixRZR[R t load_datat_transform_legacy_retriesRqRrR%tbuild_retry_configR>RhtdebugR4R$tcreate_retry_handlerteventstregister( R)RvRRZtservice_event_nametoriginal_configRrt retry_configthandlerR((s0/usr/lib/fence-agents/bundled/botocore/client.pyRus&         cCsR|dkrdS|j}d|krN|j}|jdd|dtget_config_variable(R)RvR2tclient_retries((s0/usr/lib/fence-agents/bundled/botocore/client.pyt_get_retry_modes  c Cs|dk rdS|jjjdkr)dS|jj}|jjjj}t}|rq|jdk rq|j}n|j r|j j d}n|j |}|r|j ||r|t k}t|d|}t|} | j||n|jdtdS(Ntendpoint_discovery_enabledtalways_discoversbefore-parameter-build(RdRpRMtendpoint_discovery_operationRRZR[tFalseRR(Rt$_normalize_endpoint_discovery_configt_requires_endpoint_discoveryRfRRRR( R)RvRFRqRRZtenabledtdiscovertmanagerR((s0/usr/lib/fence-agents/bundled/botocore/client.pyRCs(         cCspt|trJ|jj}|dkr1|S|dkr]t|Snt|tr]|Std|dS(s?Config must either be a boolean-string or string-literal 'auto'tautottruetfalset config_valueN(RR(t isinstanceR]tlowertstripRtboolR (R)R((s0/usr/lib/fence-agents/bundled/botocore/client.pyRs   cCs|dkr|jjjS|S(NR(RpRMtendpoint_discovery_required(R)RvR((s0/usr/lib/fence-agents/bundled/botocore/client.pyRs  c Cs|jjjdkrdSt||jtj|jj|jjj}t d|j d|jj d|jjj d|d|jj d|j|jj|j|j||dS(Nts3R+tregiont s3_configRFt partitionRc(RpRMR4RRRRRqRcRR!RDRRt!_set_s3_presign_signature_version(R)RvRORFRKRIRc((s0/usr/lib/fence-agents/bundled/botocore/client.pyRAs     c Cs|jjjdkrdS|jjj}tj|jjtd|j d|jj d|jjj d|d|jj d|j|jjdS(Nt s3controlR+RRRFRRc( RpRMR4RqRcRRRRR!RDRR(R)RvRORFRKRIRc((s0/usr/lib/fence-agents/bundled/botocore/client.pyRBs    cCstd||}|dk r"dS|jjd|j}|jdkr\|j|kr\dS|jjd|j}|d}d|krdS|jjd|j dS(NRs aws-globaltsignatureVersionsschoose-signer.s3( t!_get_configured_signature_versionRdR!tget_available_endpointsRRDtconstruct_endpointRRt_default_s3_presign_to_sigv2(R)t client_metaRKRItprovided_signature_versiontregionstendpointtsignature_versions((s0/usr/lib/fence-agents/bundled/botocore/client.pyR+s       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-postRN(tendswith(R)tsignature_versionR{tsuffix((s0/usr/lib/fence-agents/bundled/botocore/client.pyROsc CsUt|j|j|j|j|jd|j} | j||||||||| S(NR2(RR#R"R&R R'R(tget_client_args( R)RMRDRERFRGRHRIRKROt args_creator((s0/usr/lib/fence-agents/bundled/botocore/client.pyR?as   cCsCi}x6|jD]+}t|}|j|||||t _make_urlt_resolve_signature_versiont_resolve_signing_namet_create_result( R)RR4RDRFRERRRR((s0/usr/lib/fence-agents/bundled/botocore/client.pyRs       cCs_|j}t}|r7t||dk r7t||S|jdk r[|jj|}n|S(N(RKRtgetattrRdR2R(R)t config_varRKt config_val((s0/usr/lib/fence-agents/bundled/botocore/client.pyRs  cCs,|j|}|dk r|S|jdS(NR(t_is_s3_dualstack_modeRdR(R)R4ts3_dualstack_mode((s0/usr/lib/fence-agents/bundled/botocore/client.pyRs  cCs||jkrdS|j}|dk rQ|jdk rQd|jkrQ|jdS|jdk r|jjdijd}|tddgkrtSndS(NRRRfR(t_DUALSTACK_CUSTOMIZED_SERVICESRdRKRRIR>Rf(R)R4RKR((s0/usr/lib/fence-agents/bundled/botocore/client.pyRs   cCs|dkrE|jjd|d|}|j||ddg}ntjd||||j|idgd6}|j|di}|jd |d |d |d |d |d|diS(NtserviceRthttpthttpss#Assuming an endpoint for %s, %s: %stv4RRR4RDRRRRFR=( RdRtformatRRhRRRR(R)R4RDRFRERRR((s0/usr/lib/fence-agents/bundled/botocore/client.pyRs         cCs5i|d6|d6|d6|d6|d6|d6|d6S(NR4RDRRRFRR=((R)R4RDRRRFRR=((s0/usr/lib/fence-agents/bundled/botocore/client.pyR#scCs/|rd|krd}nd}d||fS(NRRs%s://%s((R)RREtsupported_protocolstscheme((s0/usr/lib/fence-agents/bundled/botocore/client.pyR0s cCs<d|kr(d|dkr(|ddS|jr8|jS|S(NtcredentialScopeR(R6(R)R4R((s0/usr/lib/fence-agents/bundled/botocore/client.pyR7s    cCs\|}|dkrR|d}|}d|krRd|dkrR|dd}qRn||fS(Nt endpointNameRR(Rd(R)RRDRFR((s0/usr/lib/fence-agents/bundled/botocore/client.pyRBs  cCst||j|j}|dk r(|Sd|kr|d}|dkrNdSd|kr^dSx!|D]}|tkre|SqeWntd|jddS(NRRts3v4RR(RRKRIRdRR R>(R)R4Rtconfigured_versiontpotential_versionstknown((s0/usr/lib/fence-agents/bundled/botocore/client.pyRVs        N(RRRRRRdR3RfRRRRRRRRRRRR(((s0/usr/lib/fence-agents/bundled/botocore/client.pyR<s&          RYcBseZiZdZdZdZedZdZdZ ddZ dZ dZ d Zd Zd Zed Zed ZdZRS(c Cs||_||_||_||_i|_||_||_t||j|j||j | |_ | |_ d|_ |jdS(N(t _serializert _endpointt_response_parsert_request_signert_cacheR t_client_configt ClientMetathostRTRpR'Rdt _exceptionst_register_handlers( R)t serializerRtresponse_parserR-trequest_signerRMR*RKRR1((s0/usr/lib/fence-agents/bundled/botocore/client.pyR3vs           cCsmd|jjj|f}|jjj|d|\}}|dk rM|Std|jj |fdS(Ns getattr.%s.%sRvs!'%s' object has no attribute '%s'( t_service_modelRZR[RpRtemit_until_responseRdtAttributeErrort __class__R(R)titemt event_nameRtevent_response((s0/usr/lib/fence-agents/bundled/botocore/client.pyt __getattr__s  cCs9|jjjj}|jjjd||jjdS(Nsrequest-created.%s(RpRMRZR[RRRR(R)RZ((s0/usr/lib/fence-agents/bundled/botocore/client.pyRs cCs |jjS(N(RpRM(R)((s0/usr/lib/fence-agents/bundled/botocore/client.pyRsc Cs|jj|}|jj}tjdi|d6|d6|d6|jrbtjd||ni|jj d6|jj d6|j d6|j d 6}|j ||d |}|jjj}|jjjd jd |d |d|d|d|jd |\}} | dk r#| \} } n|j|||\} } |jjjdjd |d |d| d| d|d || jdkr| jdijd} |jj| } | | |n| SdS(NtAPI_CALLRt operationtparamssWarning: %s.%s() is deprecatedt client_regionRKthas_streaming_inputt auth_typetcontexts)before-call.{service_id}.{operation_name}RZRtmodelRs(after-call.{service_id}.{operation_name}t http_responsetparsedi,tErrortCode(RRR4thistory_recordertrecordt deprecatedRhRRpRDRqRRt_convert_to_request_dictRZR[RRRRRdt _make_requestR8t status_codeR>t exceptionst from_code(R)Rt api_paramsRR4trequest_contextt request_dictRZRR Rtparsed_responset error_codet error_class((s0/usr/lib/fence-agents/bundled/botocore/client.pyRsL                    cCsty|jj||SWnVtk ro}|jjjdjd|jjj d|j d|d|nXdS(Ns.after-call-error.{service_id}.{operation_name}RZRt exceptionR( Rt make_requestt ExceptionRpRR8RRRZR[tname(R)RR!R te((s0/usr/lib/fence-agents/bundled/botocore/client.pyRs    cCsu|j|||}|jj||}|jjsI|jddnt|d|jj d|jj d||S(Nt host_prefixRFR,R( t_emit_api_paramsRtserialize_to_requestRtinject_host_prefixRRdRRRR,(R)RRRR!((s0/usr/lib/fence-agents/bundled/botocore/client.pyRs    cCs|j}|jjj}|jjjdjd|d|d|d|d|}t|d|}d}|jjj|jd|d|d|d|d||S( Ns3provide-client-params.{service_id}.{operation_name}RZRR RRR5s4before-parameter-build.{service_id}.{operation_name}( R(RRZR[RpRR8RR (R)RRRRRZRLR((s0/usr/lib/fence-agents/bundled/botocore/client.pyR+s       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{((s0/usr/lib/fence-agents/bundled/botocore/client.pyR. st page_configtpaginator_nameR-RMtpaginator_configRs%s.Paginator.%sR.N(t can_paginateRRTRRRpRRMRRR]RR\R RRR( R)Rtactual_operation_nameR.R1tpaginator_class_nametdocumented_paginator_clsRt paginator((s0/usr/lib/fence-agents/bundled/botocore/client.pyt get_paginators.         cCsd|jkrly9|jj|jjd|jjd}||jds    cCssd|jkrhy5|jj|jjd|jj}||jdRtdictRhR(R4RKRItservice_configtversion((s0/usr/lib/fence-agents/bundled/botocore/client.pyRs    (8tloggingtbotocoreRRt botocore.argsRt botocore.authRtbotocore.awsrequestRtbotocore.docs.docstringRRtbotocore.exceptionsRRR R tbotocore.hooksR tbotocore.modelR tbotocore.paginateR tbotocore.utilsRRRRRRRRtbotocore.historyRtbotocore.discoveryRRRtbotocore.retriesRRtbotocore.configRRRt getLoggerRRhRtobjectRR<RYRR(((s0/usr/lib/fence-agents/bundled/botocore/client.pyt s8 ": c'/