rmLbc @sjddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl ZddlmZddlZddlZddlZddlmZmZmZmZmZmZmZmZmZmZmZm Z ddl!m"Z"m#Z#ddl$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:ddl;m<Z<ej=e>Z?dZ@dZAd ZBd d fZCd ZDejEd ZFe+e*e,e-fZGdgZHiIdd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d"d#6d$d%6d&d'6d(d)6d*d+6d,d-6d.d/6d0d16d2d36d4d56d6d76d8d96d:d;6d<d=6d>d?6d@dA6dBdC6dDdE6dFdG6dHdI6dJdK6dLdM6dHdN6dOdP6dQdR6dSdT6dUdV6dWdX6dWdY6d.dZ6d0d[6d8d\6d]d^6d_d`6dadb6dcdd6dedf6dgdh6didj6dSdk6dldm6dndo6dndp6dqdr6dcds6dtdu6dvdw6dxdy6d]dz6d{d|6d}d~6dd6ded6dd6dd6dd6dd6dd6dd6dd6dd6dBd6d{d6ZIdZJdZKdjLdeKd eJZMieKd6eMd6ZNdddddddddg ZOdZPddjQgeOD]ZReReN^qdZSdePdZTdeSdeTdZUejEdeUdZVeWdZXdZYdZZdZ[dZ\dZ]dZ^dZ_dZ`dZaebdZcdZddeefdYZfdeefdYZgdehfdYZideifdYZjdehfdYZkdeifdYZlemdZndZoepdZqdZreDdZseDdZtdZudZvdZwexdZyemdZzdZ{dZ|dehfdYZ}dehfdYZ~dZdZdZdZdZexdZexdZdZdZdZdZebdZebdZdZdZdehfdYZdefdYZdehfdYZdehfdYZdehfdYZdehfdYZdehfdYZdehfdYZdZdZddZdZdZdZdZdehfdYZdehfdYZdS(iN(ttzutc( tjsontquotet zip_longestturlsplitt urlunsplitt OrderedDicttsixturlparsetget_tzinfo_optionstget_md5t MD5_AVAILABLEtHAS_CRT(t getproxiest proxy_bypass(tInvalidExpressionErrortConfigNotFoundtInvalidDNSNameErrort ClientErrortMetadataRetrievalErrortEndpointConnectionErrortReadTimeoutErrortConnectionClosedErrortConnectTimeoutErrortUnsupportedS3ArnErrort*UnsupportedS3AccesspointConfigurationErrortSSOTokenLoadErrortInvalidRegionErrortInvalidIMDSEndpointErrortInvalidIMDSEndpointModeErrortUnsupportedOutpostResourceErrort&UnsupportedS3ControlConfigurationErrortUnsupportedS3ControlArnErrortInvalidHostLabelErrortHTTPClientErrortUnsupportedS3ConfigurationErrortMissingDependencyException(tLocationParseErrorishttp://169.254.169.254/shttp://[fd00:ec2::254]/tipv4tipv6s-._~s-z0-9][a-z0-9\-]*[a-z0-9]t dualstacksalexa-for-businessta4btalexaforbusinesst mediatailorsapi.mediatailortpricings api.pricingt sagemakers api.sagemakers api-gatewayt apigatewaysapplication-auto-scalingsapplication-autoscalingt appstreamt appstream2s auto-scalingt autoscalingsauto-scaling-planssautoscaling-planss cost-explorertces cloudhsm-v2t cloudhsmv2scloudsearch-domaintcloudsearchdomainscognito-identity-providers cognito-idpsconfig-servicetconfigscost-and-usage-report-servicetcursiot-data-planesdata.iotsiot-jobs-data-planes data.jobs.iotsmediastore-datasdata.mediastores data-pipelinet datapipelines device-farmt devicefarmsiot-1click-devices-servicesdevices.iot1clicksdirect-connectt directconnectsapplication-discovery-servicet discoverysdatabase-migration-servicetdmssdirectory-servicetdssdynamodb-streamstdynamodbstreamsselastic-beanstalktelasticbeanstalktefstelasticfilesystemselastic-load-balancingtelasticloadbalancingtemrtelasticmapreduceselastic-transcodertelastictranscodertelbselastic-load-balancing-v2telbv2tsestemailsmarketplace-entitlement-servicesentitlement.marketplaceselasticsearch-servicetest eventbridgeteventsscloudwatch-eventssiot-datas iot-jobs-datasiot1click-devicessiot-1click-projectssiot1click-projectsskinesis-analyticstkinesisanalyticss kinesis-videot kinesisvideoslex-model-building-services lex-modelsslex-runtime-services lex-runtimescloudwatch-logstlogssmachine-learningtmachinelearningsmarketplace-entitlementsmarketplace-commerce-analyticstmarketplacecommerceanalyticssmarketplace-meteringsmetering.marketplacetmeteringmarketplaces migration-hubtmghs models.lext cloudwatcht monitoringtmturksmturk-requestert opsworkscms opsworks-cmsprojects.iot1clicksresource-groups-tagging-apitresourcegroupstaggingapisroute-53troute53sroute-53-domainstroute53domainss runtime.lexssagemaker-runtimesruntime.sagemakertsimpledbtsdbssecrets-managertsecretsmanagertserverlessapplicationrepositorytserverlessreposservice-catalogtservicecatalogtsfntstatest stepfunctionssstorage-gatewaytstoragegatewaysstreams.dynamodbttaggings(?:[0-9]{1,3}\.){3}[0-9]{1,3}s[0-9A-Fa-f]{1,4}s(?:{hex}:{hex}|{ipv4})thextls32s(?:%(hex)s:){6}%(ls32)ss::(?:%(hex)s:){5}%(ls32)ss%(?:%(hex)s)?::(?:%(hex)s:){4}%(ls32)ss2(?:(?:%(hex)s:)?%(hex)s)?::(?:%(hex)s:){3}%(ls32)ss6(?:(?:%(hex)s:){0,2}%(hex)s)?::(?:%(hex)s:){2}%(ls32)ss/(?:(?:%(hex)s:){0,3}%(hex)s)?::%(hex)s:%(ls32)ss'(?:(?:%(hex)s:){0,4}%(hex)s)?::%(ls32)ss&(?:(?:%(hex)s:){0,5}%(hex)s)?::%(hex)ss(?:(?:%(hex)s:){0,6}%(hex)s)?::sDABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._!\-~s(?:t|t)s (?:%25|%)(?:[s]|%[a-fA-F0-9]{2})+s\[s)?\]t^t$s cCs:t|tr|St|tr2|jdkStSdS(s~Ensures a boolean value if a string or boolean is provided For strings, the value for True/False is case insensitive ttrueN(t isinstancetbooltstrtlowertFalse(tval((s//usr/lib/fence-agents/bundled/botocore/utils.pytensure_booleans cCsq|jd}|dk rZ|j}|tkrVi|d6td6}t|n|S|jdrmdSdS(sResolving IMDS endpoint mode to either IPv6 or IPv4. ec2_metadata_service_endpoint_mode takes precedence over imds_use_ipv6. t"ec2_metadata_service_endpoint_modetmodet valid_modest imds_use_ipv6R'R&N(tget_config_variabletNoneRotMETADATA_ENDPOINT_MODESR(tsessiont endpoint_modetlendpoint_modeterror_msg_kwargs((s//usr/lib/fence-agents/bundled/botocore/utils.pytresolve_imds_endpoint_modes     cCsIt|doH|jjdtoH|jjddkoH|jdkS(sDetermines if the provided shape is the special header type jsonvalue. :type shape: botocore.shape :param shape: Shape to be inspected for the jsonvalue trait. :return: True if this type is a jsonvalue, False otherwise :rtype: Bool t serializationt jsonvaluetlocationtheadertstring(thasattrRtgetRpt type_name(tshape((s//usr/lib/fence-agents/bundled/botocore/utils.pytis_json_value_headers cCsb|dkrtSt|tjjr/||kS|jg|jD]}|j^qEkSdS(s&Case-insensitive check for header key.N(RxRpRltbotocoret awsrequestt HeadersDictRotkeys(t header_nametheaderstkey((s//usr/lib/fence-agents/bundled/botocore/utils.pyt has_headers    cCsd|jjd|jjd|j}|jdd}|jdd}tjdd|}|S(svReturns the module name for a service This is the value used in both the documentation and client class name tserviceAbbreviationtserviceFullNametAmazonttAWSs\W+(tmetadataRt service_nametreplacetretsub(t service_modeltname((s//usr/lib/fence-agents/bundled/botocore/utils.pytget_service_module_names  cCs|s dSt|S(Nt/(tremove_dot_segments(tpath((s//usr/lib/fence-agents/bundled/botocore/utils.pytnormalize_url_pathscCs|dkr|St|SdS(sLReturns None if val is None, otherwise ensure value converted to booleanN(RxRr(Rq((s//usr/lib/fence-agents/bundled/botocore/utils.pytnormalize_boolean s cCs|s dS|jd}g}xR|D]J}|r&|dkr&|dkr`|rm|jqmqp|j|q&q&W|ddkrd}nd}|ddkr|rd}nd}|dj||S(NRRt.s..ii(tsplittpoptappendtjoin(turlt input_urlt output_listtxtfirsttlast((s//usr/lib/fence-agents/bundled/botocore/utils.pyRs"    cCsa| s|dkr%td|nx5dddgD]$}||kr5td|q5q5WdS(NRt expressiont[t]t*(R(Rtinvalid((s//usr/lib/fence-agents/bundled/botocore/utils.pytvalidate_jmespath_for_set.s  cCs|rt|n|jdd}|dt|dkrH|dnd}}|sjtd|n|r||kri|||d7}|j|jntj||dS(NsHMetadata service returned %s response with status code of %s for url: %ss, content body: %s(RRRRRR(RRt reason_to_logR t statementt logger_args((s//usr/lib/fence-agents/bundled/botocore/utils.pyRs  N(RRRRRRt DEFAULT_METADATA_SERVICE_TIMEOUTRRxRRRRRR RRRR R RpR(((s//usr/lib/fence-agents/bundled/botocore/utils.pyRks"     %     tInstanceMetadataFetchercBseeZdZddddgZdZd dZd dZdZd Z d Z d Z RS( s*latest/meta-data/iam/security-credentials/t AccessKeyIdtSecretAccessKeytTokent ExpirationcCsy|j}|j|}|j||}|j|rvi|d6|dd6|dd6|dd6|dd 6Sd |krd |krtjd |niSWnL|jk rtjd |jn&tk r}tjd|j nXiS(Nt role_nameRt access_keyRt secret_keyRR Rt expiry_timetCodetMessages7Error response received when retrievingcredentials: %s.s\Max number of attempts exceeded (%s) when attempting to retrieve data from metadata service.sBad IMDS request: %s( Rt _get_iam_rolet_get_credentialst_contains_all_credential_fieldsRRRRRR(RR Rt credentialsR((s//usr/lib/fence-agents/bundled/botocore/utils.pytretrieve_iam_role_credentialss*         cCs%|jd|jd|jd|jS(NRRR (R t _URL_PATHt_needs_retry_for_role_nameR(RR ((s//usr/lib/fence-agents/bundled/botocore/utils.pyR>s   cCs8|jd|j|d|jd|}tj|jS(NRRR (R R$t_needs_retry_for_credentialsRtloadsR(RRR tr((s//usr/lib/fence-agents/bundled/botocore/utils.pyR Es     cCsAytj|jtSWn"tk r<|j|dtSXdS(Ns invalid json(RR'RRpt ValueErrorRR(RR((s//usr/lib/fence-agents/bundled/botocore/utils.pyt_is_invalid_jsonMs  cCs|j|p|j|S(N(R R (RR((s//usr/lib/fence-agents/bundled/botocore/utils.pyR%UscCs+|j|p*|j|p*|j|S(N(R R R*(RR((s//usr/lib/fence-agents/bundled/botocore/utils.pyR&[scCs8x1|jD]&}||kr tjd|tSq WtS(Ns3Retrieved credentials is missing required field: %s(t_REQUIRED_CREDENTIAL_FIELDSRRRpR(RR"tfield((s//usr/lib/fence-agents/bundled/botocore/utils.pyR!bs N( RRR$R+R#RxRR R*R%R&R!(((s//usr/lib/fence-agents/bundled/botocore/utils.pyRs "     tIMDSRegionProvidercBs;eZdddZdZdZdZdZRS(cCs7||_|dkr!tj}n||_||_dS(sUInitialize IMDSRegionProvider. :type session: :class:`botocore.session.Session` :param session: The session is needed to look up configuration for how to contact the instance metadata service. Specifically the whether or not it should use the IMDS region at all, and if so how to configure the timeout and number of attempts to reach the service. :type environ: None or dict :param environ: A dictionary of environment variables to use. If ``None`` is the argument then ``os.environ`` will be used by default. :type fecther: :class:`botocore.utils.InstanceMetadataRegionFetcher` :param fetcher: The class to actually handle the fetching of the region from the IMDS. If not provided a default one will be created. N(RRxRRt_environt_fetcher(RRzRtfetcher((s//usr/lib/fence-agents/bundled/botocore/utils.pyRms     cCs|j}|S(s#Provide the region value from IMDS.(t_get_instance_metadata_region(Rtinstance_region((s//usr/lib/fence-agents/bundled/botocore/utils.pytprovides cCs|j}|j}|S(N(t _get_fetchertretrieve_region(RR0R((s//usr/lib/fence-agents/bundled/botocore/utils.pyR1s  cCs(|jdkr!|j|_n|jS(N(R/Rxt_create_fetcher(R((s//usr/lib/fence-agents/bundled/botocore/utils.pyR4sc Cs|jjd}|jjd}i|jjdd6t|jd6}td|d|d|jd|jjd |}|S( Ntmetadata_service_timeouttmetadata_service_num_attemptsRRsRRRRR5(RRwR~tInstanceMetadataRegionFetcherR.R(Rtmetadata_timeouttmetadata_num_attemptst imds_configR0((s//usr/lib/fence-agents/bundled/botocore/utils.pyR6s         N(RRRxRR3R1R4R6(((s//usr/lib/fence-agents/bundled/botocore/utils.pyR-ls    R9cBs eZdZdZdZRS(s-latest/meta-data/placement/availability-zone/cCsBy|j}|SWn'|jk r=tjd|jnXdS(sRGet the current region from the instance metadata service. :rvalue: str :returns: The region the current instance is running in or None if the instance metadata service cannot be contacted or does not give a valid response. :rtype: None or str :returns: Returns the region as a string if it is configured to use IMDS as a region source. Otherwise returns ``None``. It will also return ``None`` if it fails to get the region from IMDS due to exhausting its retries or not being able to connect. s\Max number of attempts exceeded (%s) when attempting to retrieve data from metadata service.N(t _get_regionRRRRRx(RR((s//usr/lib/fence-agents/bundled/botocore/utils.pyR5s   cCsG|j}|jd|jd|jd|}|j}|d }|S(NRRR i(RR R$RR(RR Rtavailability_zoneR((s//usr/lib/fence-agents/bundled/botocore/utils.pyR=s       (RRR$R5R=(((s//usr/lib/fence-agents/bundled/botocore/utils.pyR9s cCsx|D]}t||tra||krP||krPt||||q||||sRN(thashlibtsha256titertupdatet hexdigesttdigest(R}tas_hextchecksumtchunk((R}s//usr/lib/fence-agents/bundled/botocore/utils.pytcalculate_sha256s   csg}dtj}x<tfddD]}|j||jq1W|sj|djSxxt|dkrg}xSt|D]E\}}|dk r|j|||jq|j|qW|}qmWt j |dj dS( s\Calculate a tree hash checksum. For more information see: http://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html :param body: Any file like object. This has the same constraints as the ``body`` param in calculate_sha256 :rtype: str :returns: The hex version of the calculated tree hash ics jS(N(RH((R}trequired_chunk_size(s//usr/lib/fence-agents/bundled/botocore/utils.pyR~sRiitasciiiN( RRRRRRRt _in_pairsRxtbinasciithexlifytdecode(R}tchunksRRt new_chunksRtsecond((R}Rs//usr/lib/fence-agents/bundled/botocore/utils.pytcalculate_tree_hashs "   cCst|}t||S(N(RR(titerablet shared_iter((s//usr/lib/fence-agents/bundled/botocore/utils.pyRs tCachedPropertycBs eZdZdZdZRS(sA read only property that caches the initially computed value. This descriptor will only call the provided ``fget`` function once. Subsequent access to this property will return the cached value. cCs ||_dS(N(t_fget(Rtfget((s//usr/lib/fence-agents/bundled/botocore/utils.pyRscCs:|dkr|S|j|}||j|jj<|SdS(N(RxRt__dict__R(Rtobjtclstcomputed_value((s//usr/lib/fence-agents/bundled/botocore/utils.pyt__get__s  (RRRRR(((s//usr/lib/fence-agents/bundled/botocore/utils.pyRs tArgumentGeneratorcBsJeZdZedZdZddZdZdZdZ RS(sGenerate sample input based on a shape model. This class contains a ``generate_skeleton`` method that will take an input/output shape (created from ``botocore.model``) and generate a sample dictionary corresponding to the input/output shape. The specific values used are place holder values. For strings either an empty string or the member name can be used, for numbers 0 or 0.0 is used. The intended usage of this class is to generate the *shape* of the input structure. This can be useful for operations that have complex input shapes. This allows a user to just fill in the necessary data instead of worrying about the specific structure of the input arguments. Example usage:: s = botocore.session.get_session() ddb = s.get_service_model('dynamodb') arg_gen = ArgumentGenerator() sample_input = arg_gen.generate_skeleton( ddb.operation_model('CreateTable').input_shape) print("Sample input for dynamodb.CreateTable: %s" % sample_input) cCs ||_dS(N(t_use_member_names(Rtuse_member_names((s//usr/lib/fence-agents/bundled/botocore/utils.pyR(scCsg}|j||S(sGenerate a sample input. :type shape: ``botocore.model.Shape`` :param shape: The input shape. :return: The generated skeleton input corresponding to the provided input shape. (t_generate_skeleton(RRtstack((s//usr/lib/fence-agents/bundled/botocore/utils.pytgenerate_skeleton+s RcCs |j|jz|jdkr2|j||S|jdkrQ|j||S|jdkrp|j||S|jdkr|jr|S|jrtj |jSdS|jdkrdS|jdkrd S|jd krt S|jd kr t j ddddddSWd|j XdS(Nt structureRAtmapRRtintegertlongiRetdoublegtbooleant timestampii(Rslong(sfloatR( RRRt_generate_type_structuret_generate_type_listt_generate_type_mapRtenumtrandomtchoiceRRfR(RRRR((s//usr/lib/fence-agents/bundled/botocore/utils.pyR8s.   cCse|j|jdkriSt}x9|jjD](\}}|j||d|||tj|rtSdjt|j}tj|dk S(Ns[{}]( tUNSAFE_URL_CHARSt intersectionRptformatRthostnamet IPV6_ADDRZ_REtmatchRx(t endpoint_urlR((s//usr/lib/fence-agents/bundled/botocore/utils.pytis_valid_ipv6_endpoint_urlnscCstj|rtSt|}|j}|dkr8tSt|dkrNtS|ddkrk|d }ntjdtj }|j |S(sVerify the endpoint_url is valid. :type endpoint_url: string :param endpoint_url: An endpoint_url. Must have at least a scheme and a hostname. :return: True if the endpoint url is valid. False otherwise. iiRs;^((?!-)[A-Z\d-]{1,63}(?accesspoint|outpost)[/:](?P.+)$sc^(?P[a-zA-Z0-9\-]{1,63})[/:]accesspoint[/:](?P[a-zA-Z0-9\-]{1,63}$)RcCs(||_|dkr$t|_ndS(N(t _arn_parserRxR;(Rt arn_parser((s//usr/lib/fence-agents/bundled/botocore/utils.pyR>s  cCs|jd|jdS(Nsbefore-parameter-build.s3(Rt handle_arn(RR((s//usr/lib/fence-agents/bundled/botocore/utils.pyRCscKs|j|jkrdS|j|}|dkr5dS|ddkr[|j|||n&|ddkr|j|||ndS(Nt resource_typet accesspointtoutpost(Rt_BLACKLISTED_OPERATIONSt"_get_arn_details_from_bucket_paramRxt_store_accesspointt_store_outpost(RR9tmodelRRt arn_details((s//usr/lib/fence-agents/bundled/botocore/utils.pyRGFs cCs[d|krWy4|d}|jj|}|j|||SWqWtk rSqWXndS(NR5(RERCt_add_resource_type_and_nameR:Rx(RR9RARP((s//usr/lib/fence-agents/bundled/botocore/utils.pyRLQs   cCsX|jj|d}|rE|jd|d<|jd|dR((RR9RRP((s//usr/lib/fence-agents/bundled/botocore/utils.pyRMds    cCs|d}|jj|}|s4td|n|jd}||dR(t_OUTPOST_RESOURCE_REGEXRRRT(RR9RRPRRRRU((s//usr/lib/fence-agents/bundled/botocore/utils.pyRNus     N(RRRRRSRWRKRxRRRGRLRQRMRN(((s//usr/lib/fence-agents/bundled/botocore/utils.pyRD2s       tS3EndpointSettercBseZdZdZddddedZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZedZedZedZRS(tawss amazonaws.comcCsm||_||_||_||_|dkr<i|_n||_||_|dkri|j|_ndS(N(Rt_regiont _s3_configt_use_fips_endpointRxt _endpoint_urlt _partitiont_DEFAULT_PARTITION(Rtendpoint_resolverRt s3_configRR=tuse_fips_endpoint((s//usr/lib/fence-agents/bundled/botocore/utils.pyRs         cCs=|jd|j|jd|j|jd|jdS(Nsbefore-sign.s3schoose-signer.s3s%before-call.s3.WriteGetObjectResponse(Rt set_endpointt set_signert#update_endpoint_to_s3_object_lambda(RR((s//usr/lib/fence-agents/bundled/botocore/utils.pyRs cKs|jrtddn|j|d|jr8dS|j}|jd|j}djd|dd|d}t|d|t |dss3-object-lambdatuse_dualstack_endpointsjClient does not support s3 dualstack configuration when an S3 Object Lambda access point ARN is specified.RVsTClient does not support s3 dualstack configuration when an outpost ARN is specified.(RhRRR^RR[t_validate_mrap_s3_config(RRtrequest_partitiont s3_serviceRV((s//usr/lib/fence-agents/bundled/botocore/utils.pyRns"    cCs_t|jsdS|jjdr7tddn$|jjdr[tddndS(Nt$s3_disable_multiregion_access_pointsRfsCInvalid configuration, Multi-Region Access Point ARNs are disabled.RxseClient does not support s3 dualstack configuration when a Multi-Region Access Point ARN is specified.(RRR[RR(RR((s//usr/lib/fence-agents/bundled/botocore/utils.pyRy*s cCsct|jr"|j|dn:|jjdtr\|jdd}|j|||S|jS(NRRvRR(RRt_override_signing_regionR[RRRZ(RRRw((s//usr/lib/fence-agents/bundled/botocore/utils.pyRq<scKs,t|r(trdStddndS(Nts3v4aRfszUsing S3 with an MRAP arn requires an additional dependency. You will need to pip install botocore[crt] before proceeding.(RR R$(RRR((s//usr/lib/fence-agents/bundled/botocore/utils.pyRdIs  cCs(|jdd}|j|j|dS(NRR>(RRi(RRtaccesspoint_service((s//usr/lib/fence-agents/bundled/botocore/utils.pyRrTscCsxt|j}t|j|j|j||j|j|j|jdf}t j d|j|f||_dS(NRsUpdating URI from %s to %s( RRRRt _get_netlocRt_get_accesspoint_pathRRRR(RRRtoriginal_componentstaccesspoint_endpoint((s//usr/lib/fence-agents/bundled/botocore/utils.pyRsXs cCs-t|r|j|S|j||SdS(N(Rt_get_mrap_netloct_get_accesspoint_netloc(Rtrequest_contextR((s//usr/lib/fence-agents/bundled/botocore/utils.pyRfs  cCs~|d}d}|dg}|jrHt|jj}|j|n)|d}|jd||j|gdj|S(NRs s3-globalRR=RIR(R]RRRRBt_get_partition_dns_suffixR(RRRRtmrap_netloc_componentstendpoint_url_netlocR=((s//usr/lib/fence-agents/bundled/botocore/utils.pyRls    c Cs3|d}d|d|dfg}|jd}|jru|rS|j|nt|jj}|j|n|r|dg}|j|nQ|ddkr|jd|}|j|n|jd |}|j||jjd r |jd n|j||j|gd j |S( NRs%s-%sRR?RVs s3-outpostsR>ss3-object-lambdass3-accesspointRxR(R( RR]RRRRBt_inject_fips_if_neededR[t_get_dns_suffixR( RRRRtaccesspoint_netloc_componentsRVRt outpost_hostt component((s//usr/lib/fence-agents/bundled/botocore/utils.pyRs0      cCs|jrd|S|S(Ns%s-fips(R\(RRR((s//usr/lib/fence-agents/bundled/botocore/utils.pyRs cCs+|dd}|jd|ddp*dS(NRRRRi(R(Rt original_pathRR((s//usr/lib/fence-agents/bundled/botocore/utils.pyRscCs.|jj|}|dkr*|j}n|S(N(Rtget_partition_dns_suffixRxt_DEFAULT_DNS_SUFFIX(Rtpartition_namet dns_suffix((s//usr/lib/fence-agents/bundled/botocore/utils.pyRs     cCsA|jjd|}|j}|r=d|kr=|d}n|S(NR%t dnsSuffix(RRjR(RRRlR((s//usr/lib/fence-agents/bundled/botocore/utils.pyRs     cCs0|jjdi}||d<||jds( R[RRR]RxRpRRRRRtsettall(RRRt feature_parts((s//usr/lib/fence-agents/bundled/botocore/utils.pyRhs cCs-|jr dS|jjd}|r)|SdS(Ntvirtualtaddressing_style(RhR[R(Rtconfigured_addressing_style((s//usr/lib/fence-agents/bundled/botocore/utils.pyt_addressing_styles  cCs`|jdkr tjdtS|jdks>|jdk rOtjddStjdtS(NRs'Using S3 virtual host style addressing.RsUsing S3 path style addressing.sSDefaulting to S3 virtual host style addressing with path style addressing fallback.(RRRRR]RxR(R((s//usr/lib/fence-agents/bundled/botocore/utils.pyRts   N( RRR_RRxRpRRReRcRmRoRpRnRyRqRdRrRsRRRRRRRR}RiRRhRRt(((s//usr/lib/fence-agents/bundled/botocore/utils.pyRXs:      " $      !    # tS3ControlEndpointSettercBs eZdZdZejdZddddedZ dZ dZ dZ dZ dZd Zd Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZ RS(RYs amazonaws.coms^[a-zA-Z0-9\-]{1,63}$cCsm||_||_||_||_|dkr<i|_n||_||_|dkri|j|_ndS(N(RRZR[R\RxR]R^R_(RR`RRaRR=Rb((s//usr/lib/fence-agents/bundled/botocore/utils.pyRs         cCs|jd|jdS(Nsbefore-sign.s3-control(RRc(RR((s//usr/lib/fence-agents/bundled/botocore/utils.pyR*scKs|j|rX|j||j|}|j||j|||j|nQ|j|r|j||j|d|j |j }|j ||ndS(Ns s3-outposts( t_use_endpoint_from_arn_detailst-_validate_endpoint_from_arn_details_supportedt _resolve_region_from_arn_detailst&_resolve_signing_name_from_arn_detailst"_resolve_endpoint_from_arn_detailst_add_headers_from_arn_detailst_use_endpoint_from_outpost_idt#_validate_outpost_redirection_validRit_construct_outpost_endpointRZt_update_request_netloc(RRRRt new_netloc((s//usr/lib/fence-agents/bundled/botocore/utils.pyRc-s   cCs d|jkS(NRP(R(RR((s//usr/lib/fence-agents/bundled/botocore/utils.pyR:scCs d|jkS(Nt outpost_id(R(RR((s//usr/lib/fence-agents/bundled/botocore/utils.pyR=scCs$d|jddkr=td|jddddhn|jjdts|jdd}||jkrd ||jf}td|qn|jdd }||jkrtdd |j|fn|jjd rtdd nd|jdkr |j|ndS(NRuRPRRARFRfs,Invalid ARN, FIPS region not allowed in ARN.RvspThe use_arn_region configuration is disabled but received arn for "%s" when the client is configured to use "%s"R=sClient is configured for "%s" partition, but arn provided is for "%s" partition. The client and arn partition must be the same.Rs7S3 control client does not support accelerate endpointsRV( RR R[RRpRZRR^R(RRt arn_regiont error_msgtrequest_partion((s//usr/lib/fence-agents/bundled/botocore/utils.pyR@s( cCs(|jjdr$tddndS(NRxRfsPClient does not support s3 dualstack configuration when an outpost is specified.(R[RR(RR((s//usr/lib/fence-agents/bundled/botocore/utils.pyRbscCsA|jjdtr:|jdd}|j|||S|jS(NRvRPR(R[RRpRR}RZ(RRR((s//usr/lib/fence-agents/bundled/botocore/utils.pyRks cCs%|jdd}|j|||S(NRPR>(RRi(RRt arn_service((s//usr/lib/fence-agents/bundled/botocore/utils.pyRtscCs&|j||}|j||dS(N(t _resolve_netloc_from_arn_detailsR(RRRR((s//usr/lib/fence-agents/bundled/botocore/utils.pyRyscCsZt|j}t|j||j|jdf}tjd|j|f||_dS(NRsUpdating URI from %s to %s(RRRRRRRR(RRRRtarn_details_endpoint((s//usr/lib/fence-agents/bundled/botocore/utils.pyR}s cCs@|jd}d|kr&|j|S|d}|j||S(NRPRVR?(RRt_construct_s3_control_endpoint(RRRRPR?((s//usr/lib/fence-agents/bundled/botocore/utils.pyRs     cCs|jj|S(N(t_HOST_LABEL_REGEXR(Rtlabel((s//usr/lib/fence-agents/bundled/botocore/utils.pyt_is_valid_host_labelscGs6x/|D]'}|j|std|qqWdS(NR(RR!(RtlabelsR((s//usr/lib/fence-agents/bundled/botocore/utils.pyt_validate_host_labelss cCs|j|||jr:t|jj}||g}n;|dg}|j||j|}|j||g|j|S(Ns s3-control(RR]RRt_add_dualstackRRBt_construct_netloc(RRR?RRR((s//usr/lib/fence-agents/bundled/botocore/utils.pyRs   cCsX|j||jr&t|jjSd||j|g}|j||j|S(Ns s3-outposts(RR]RRRt _add_fipsR(RRR((s//usr/lib/fence-agents/bundled/botocore/utils.pyRs   cCs dj|S(NR(R(RR((s//usr/lib/fence-agents/bundled/botocore/utils.pyRscCs"|jr|dd|ds s3-outpostsRiiRJiRI(RpR(RRPR((s//usr/lib/fence-agents/bundled/botocore/utils.pyR. s  cCsR|j|||dd}||d<||d<|dd|d<||ds s3-outpostsRiiRJiR#(RpR(RRPR((s//usr/lib/fence-agents/bundled/botocore/utils.pyRN s  cCsR|j|||dd}||d<||d<|dd|d<||dytt|jrtSWnttjfk r9nXtS(s: Returns whether we should bypass proxies or not. (RRRRRhtsockettgaierrorRp(R((s//usr/lib/fence-agents/bundled/botocore/utils.pyR s s ISO-8859-1cCs_|jd}|sdStj|\}}d|krK|djdSd|kr[|SdS(sReturns encodings from given HTTP Header Dict. :param headers: dictionary to extract encoding from. :param default: default encoding if the content-type is text s content-typetcharsets'"RN(RRxtcgit parse_headerRR(Rtdefaultt content_typeR9((s//usr/lib/fence-agents/bundled/botocore/utils.pytget_encoding_from_headers s  cKsFt|ttfr$t|}n t|}tj|jdS(NR(Rltbytest bytearrayt_calculate_md5_from_bytest_calculate_md5_from_filetbase64t b64encodeR(R}Rt binary_md5((s//usr/lib/fence-agents/bundled/botocore/utils.pyt calculate_md5 s cCst|}|jS(N(R R(t body_bytestmd5((s//usr/lib/fence-agents/bundled/botocore/utils.pyR s cs\j}t}x-tfddD]}|j|q.Wj||jS(Ncs jdS(Nii(RH((tfileobj(s//usr/lib/fence-agents/bundled/botocore/utils.pyR~ sR(ttellR RRtseekR(Rtstart_positionRR((Rs//usr/lib/fence-agents/bundled/botocore/utils.pyR s    cKsV|d}|d}trR|dk rRd|krRt||}||dd sz                 R       .       ! V<$    $    -   ! `      >       W{d