UNPKG

@aws-amplify/core

Version:
1 lines 1.56 kB
{"version":3,"file":"getDnsSuffix.mjs","sources":["../../../../src/clients/endpoints/getDnsSuffix.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { defaultPartition, partitionsInfo } from './partitions';\n/**\n * Get the AWS Services endpoint URL's DNS suffix for a given region. A typical AWS regional service endpoint URL will\n * follow this pattern: {endpointPrefix}.{region}.{dnsSuffix}. For example, the endpoint URL for Cognito Identity in\n * us-east-1 will be cognito-identity.us-east-1.amazonaws.com. Here the DnsSuffix is `amazonaws.com`.\n *\n * @param region\n * @returns The DNS suffix\n *\n * @internal\n */\nexport const getDnsSuffix = (region) => {\n const { partitions } = partitionsInfo;\n for (const { regions, outputs, regionRegex } of partitions) {\n const regex = new RegExp(regionRegex);\n if (regions.includes(region) || regex.test(region)) {\n return outputs.dnsSuffix;\n }\n }\n return defaultPartition.outputs.dnsSuffix;\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,YAAY,GAAG,CAAC,MAAM,KAAK;AACxC,IAAI,MAAM,EAAE,UAAU,EAAE,GAAG,cAAc;AACzC,IAAI,KAAK,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,UAAU,EAAE;AAChE,QAAQ,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,WAAW,CAAC;AAC7C,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;AAC5D,YAAY,OAAO,OAAO,CAAC,SAAS;AACpC;AACA;AACA,IAAI,OAAO,gBAAgB,CAAC,OAAO,CAAC,SAAS;AAC7C;;;;"}