aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 2.45 kB
JavaScript
Object.defineProperty(exports,"__esModule",{value:!0}),exports.AWS_REGIONS=exports.AWS_REGIONS_AND_RULES=exports.RULE_CLASSIC_PARTITION_BECOMES_OPT_IN=exports.RULE_S3_WEBSITE_REGIONAL_SUBDOMAIN=void 0,exports.before=before,exports.regionsBefore=regionsBefore,exports.partitionInformation=partitionInformation,exports.RULE_S3_WEBSITE_REGIONAL_SUBDOMAIN=Symbol("S3_WEBSITE_REGIONAL_SUBDOMAIN"),exports.RULE_CLASSIC_PARTITION_BECOMES_OPT_IN=Symbol("CLASSIC_PARTITION_BECOMES_OPT_IN"),exports.AWS_REGIONS_AND_RULES=["us-east-1","eu-west-1","us-west-1","ap-southeast-1","ap-northeast-1","us-gov-west-1","us-west-2","sa-east-1","ap-southeast-2",exports.RULE_S3_WEBSITE_REGIONAL_SUBDOMAIN,"cn-north-1","us-iso-east-1","eu-central-1","ap-northeast-2","ap-south-1","us-east-2","ca-central-1","eu-west-2","us-isob-east-1","cn-northwest-1","eu-west-3","ap-northeast-3","us-gov-east-1","eu-north-1",exports.RULE_CLASSIC_PARTITION_BECOMES_OPT_IN,"ap-east-1","me-south-1","af-south-1","eu-south-1","us-iso-west-1","ap-southeast-3","me-central-1","eu-central-2","eu-south-2","ap-south-2","ap-southeast-4","il-central-1","ca-west-1","ap-southeast-5","ap-southeast-7","mx-central-1","eu-isoe-west-1"],exports.AWS_REGIONS=exports.AWS_REGIONS_AND_RULES.filter(x=>typeof x=="string").sort();function before(region,ruleOrRegion){const ruleIx=exports.AWS_REGIONS_AND_RULES.indexOf(ruleOrRegion);if(ruleIx===-1)throw new Error(`Unknown rule: ${String(ruleOrRegion)}`);const regionIx=exports.AWS_REGIONS_AND_RULES.indexOf(region);return regionIx===-1?!1:regionIx<ruleIx}function regionsBefore(ruleOrRegion){const ruleIx=exports.AWS_REGIONS_AND_RULES.indexOf(ruleOrRegion);if(ruleIx===-1)throw new Error(`Unknown rule: ${String(ruleOrRegion)}`);return exports.AWS_REGIONS_AND_RULES.slice(0,ruleIx).filter(entry=>typeof entry=="string").sort()}const PARTITION_MAP={default:{partition:"aws",domainSuffix:"amazonaws.com"},"cn-":{partition:"aws-cn",domainSuffix:"amazonaws.com.cn"},"us-gov-":{partition:"aws-us-gov",domainSuffix:"amazonaws.com"},"us-iso-":{partition:"aws-iso",domainSuffix:"c2s.ic.gov"},"us-isob-":{partition:"aws-iso-b",domainSuffix:"sc2s.sgov.gov"},"us-isof-":{partition:"aws-iso-f",domainSuffix:"csp.hci.ic.gov"},"eu-isoe-":{partition:"aws-iso-e",domainSuffix:"cloud.adc-e.uk"}};function partitionInformation(region){for(const[prefix,info]of Object.entries(PARTITION_MAP))if(region.startsWith(prefix))return info;return PARTITION_MAP.default}
;