ó U!¶\c@s€dZddlZddlZddlmZejeƒZdZiid6Z de fd„ƒYZ de fd „ƒYZ dS( sÛResolves regions and endpoints. This module implements endpoint resolution, including resolving endpoints for a given service and region and resolving the available endpoints for a service in a specific AWS partition. iÿÿÿÿN(t NoRegionErrors{service}.{region}.{dnsSuffix}t endpointstBaseEndpointResolvercBs2eZdZdd„Zd„Zded„ZRS(s3Resolves regions and endpoints. Must be subclassed.cCs t‚dS(s7Resolves an endpoint for a service and region combination. :type service_name: string :param service_name: Name of the service to resolve an endpoint for (e.g., s3) :type region_name: string :param region_name: Region/endpoint name to resolve (e.g., us-east-1) if no region is provided, the first found partition-wide endpoint will be used if available. :rtype: dict :return: Returns a dict containing the following keys: - partition: (string, required) Resolved partition name - endpointName: (string, required) Resolved endpoint name - hostname: (string, required) Hostname to use for this endpoint - sslCommonName: (string) sslCommonName to use for this endpoint. - credentialScope: (dict) Signature version 4 credential scope - region: (string) region name override when signing. - service: (string) service name override when signing. - signatureVersions: (list) A list of possible signature versions, including s3, v4, v2, and s3v4 - protocols: (list) A list of supported protocols (e.g., http, https) - ...: Other keys may be included as well based on the metadata N(tNotImplementedError(tselft service_namet region_name((s4/tmp/pip-install-usGedi/botocore/botocore/regions.pytconstruct_endpointscCs t‚dS(sLists the partitions available to the endpoint resolver. :return: Returns a list of partition names (e.g., ["aws", "aws-cn"]). N(R(R((s4/tmp/pip-install-usGedi/botocore/botocore/regions.pytget_available_partitions<stawscCs t‚dS(sÒLists the endpoint names of a particular partition. :type service_name: string :param service_name: Name of a service to list endpoint for (e.g., s3) :type partition_name: string :param partition_name: Name of the partition to limit endpoints to. (e.g., aws for the public AWS endpoints, aws-cn for AWS China endpoints, aws-us-gov for AWS GovCloud (US) Endpoints, etc. :type allow_non_regional: bool :param allow_non_regional: Set to True to include endpoints that are not regional endpoints (e.g., s3-external-1, fips-us-gov-west-1, etc). :return: Returns a list of endpoint names (e.g., ["us-east-1"]). N(R(RRtpartition_nametallow_non_regional((s4/tmp/pip-install-usGedi/botocore/botocore/regions.pytget_available_endpointsCsN(t__name__t __module__t__doc__tNoneRRtFalseR (((s4/tmp/pip-install-usGedi/botocore/botocore/regions.pyRs   tEndpointResolvercBsheZdZd„Zd„Zded„Zd d„Zd„Z d„Z d„Z d „Z d „Z RS( s7Resolves endpoints based on partition endpoint metadatacCs(d|krtdƒ‚n||_dS(sA :param endpoint_data: A dict of partition data. t partitionss%Missing "partitions" in endpoint dataN(t ValueErrort_endpoint_data(Rt endpoint_data((s4/tmp/pip-install-usGedi/botocore/botocore/regions.pyt__init__Zs cCs3g}x&|jdD]}|j|dƒqW|S(NRt partition(Rtappend(RtresultR((s4/tmp/pip-install-usGedi/botocore/botocore/regions.pyRbsR cCs“g}x†|jdD]w}|d|kr0qn|d}||krLqnx<||dD],}|sw||dkr[|j|ƒq[q[WqW|S(NRRtservicesRtregions(RR(RRR R RRRt endpoint_name((s4/tmp/pip-install-usGedi/botocore/botocore/regions.pyR hs  cCs;x4|jdD]%}|j|||ƒ}|r|SqWdS(NR(Rt_endpoint_for_partition(RRRRR((s4/tmp/pip-install-usGedi/botocore/botocore/regions.pyRvs cCs|dj|tƒ}|dkrGd|kr;|d}qGtƒ‚n||dkrm|j||||ƒS|j||ƒr|jdƒ}|jdtƒ}|rÙ| rÙtjd|||ƒ|j||||ƒStjd||ƒ|j||||ƒSdS(NRtpartitionEndpointRtisRegionalizeds'Using partition endpoint for %s, %s: %ss*Creating a regex based endpoint for %s, %s( tgettDEFAULT_SERVICE_DATARRt_resolvet _region_matchtTruetLOGtdebug(RRRRt service_datatpartition_endpointtis_regionalized((s4/tmp/pip-install-usGedi/botocore/botocore/regions.pyR~s*           cCs>||dkrtSd|kr:tj|dƒj|ƒStS(NRt regionRegex(R%tretcompiletmatchR(RRR((s4/tmp/pip-install-usGedi/botocore/botocore/regions.pyR$›s  cCsÙ|dj|iƒ}|d|d<||d<|j|jdiƒ|ƒ|j|jdiƒ|ƒ|jdtƒ}|j||d||ƒ|ds   ;