Skip to content

Commit

Permalink
feat: get partition of given region (#1435)
Browse files Browse the repository at this point in the history
* chore: add partition to regioninfo

* feat: update clients endpoint providers

* feat(types): make patition in RegionInfo required
  • Loading branch information
AllanZhengYP authored Aug 14, 2020
1 parent 5d79645 commit c18bfe4
Show file tree
Hide file tree
Showing 225 changed files with 3,805 additions and 2 deletions.
6 changes: 6 additions & 0 deletions clients/client-accessanalyzer/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,38 @@ export const defaultRegionInfoProvider: RegionInfoProvider = (region: string, op
if (AWS_REGIONS.has(region)) {
regionInfo = {
hostname: AWS_TEMPLATE.replace("{region}", region),
partition: "aws",
};
}
if (AWS_CN_REGIONS.has(region)) {
regionInfo = {
hostname: AWS_CN_TEMPLATE.replace("{region}", region),
partition: "aws-cn",
};
}
if (AWS_ISO_REGIONS.has(region)) {
regionInfo = {
hostname: AWS_ISO_TEMPLATE.replace("{region}", region),
partition: "aws-iso",
};
}
if (AWS_ISO_B_REGIONS.has(region)) {
regionInfo = {
hostname: AWS_ISO_B_TEMPLATE.replace("{region}", region),
partition: "aws-iso-b",
};
}
if (AWS_US_GOV_REGIONS.has(region)) {
regionInfo = {
hostname: AWS_US_GOV_TEMPLATE.replace("{region}", region),
partition: "aws-us-gov",
};
}
// Finally, assume it's an AWS partition endpoint.
if (regionInfo === undefined) {
regionInfo = {
hostname: AWS_TEMPLATE.replace("{region}", region),
partition: "aws",
};
}
}
Expand Down
26 changes: 26 additions & 0 deletions clients/client-acm-pca/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,134 +40,160 @@ export const defaultRegionInfoProvider: RegionInfoProvider = (region: string, op
case "ap-east-1":
regionInfo = {
hostname: "acm-pca.ap-east-1.amazonaws.com",
partition: "aws",
};
break;
case "ap-northeast-1":
regionInfo = {
hostname: "acm-pca.ap-northeast-1.amazonaws.com",
partition: "aws",
};
break;
case "ap-northeast-2":
regionInfo = {
hostname: "acm-pca.ap-northeast-2.amazonaws.com",
partition: "aws",
};
break;
case "ap-south-1":
regionInfo = {
hostname: "acm-pca.ap-south-1.amazonaws.com",
partition: "aws",
};
break;
case "ap-southeast-1":
regionInfo = {
hostname: "acm-pca.ap-southeast-1.amazonaws.com",
partition: "aws",
};
break;
case "ap-southeast-2":
regionInfo = {
hostname: "acm-pca.ap-southeast-2.amazonaws.com",
partition: "aws",
};
break;
case "ca-central-1":
regionInfo = {
hostname: "acm-pca.ca-central-1.amazonaws.com",
partition: "aws",
};
break;
case "eu-central-1":
regionInfo = {
hostname: "acm-pca.eu-central-1.amazonaws.com",
partition: "aws",
};
break;
case "eu-north-1":
regionInfo = {
hostname: "acm-pca.eu-north-1.amazonaws.com",
partition: "aws",
};
break;
case "eu-west-1":
regionInfo = {
hostname: "acm-pca.eu-west-1.amazonaws.com",
partition: "aws",
};
break;
case "eu-west-2":
regionInfo = {
hostname: "acm-pca.eu-west-2.amazonaws.com",
partition: "aws",
};
break;
case "eu-west-3":
regionInfo = {
hostname: "acm-pca.eu-west-3.amazonaws.com",
partition: "aws",
};
break;
case "me-south-1":
regionInfo = {
hostname: "acm-pca.me-south-1.amazonaws.com",
partition: "aws",
};
break;
case "sa-east-1":
regionInfo = {
hostname: "acm-pca.sa-east-1.amazonaws.com",
partition: "aws",
};
break;
case "us-east-1":
regionInfo = {
hostname: "acm-pca.us-east-1.amazonaws.com",
partition: "aws",
};
break;
case "us-east-2":
regionInfo = {
hostname: "acm-pca.us-east-2.amazonaws.com",
partition: "aws",
};
break;
case "us-gov-east-1":
regionInfo = {
hostname: "acm-pca.us-gov-east-1.amazonaws.com",
partition: "aws-us-gov",
};
break;
case "us-gov-west-1":
regionInfo = {
hostname: "acm-pca.us-gov-west-1.amazonaws.com",
partition: "aws-us-gov",
};
break;
case "us-west-1":
regionInfo = {
hostname: "acm-pca.us-west-1.amazonaws.com",
partition: "aws",
};
break;
case "us-west-2":
regionInfo = {
hostname: "acm-pca.us-west-2.amazonaws.com",
partition: "aws",
};
break;
// Next, try to match partition endpoints.
default:
if (AWS_REGIONS.has(region)) {
regionInfo = {
hostname: AWS_TEMPLATE.replace("{region}", region),
partition: "aws",
};
}
if (AWS_CN_REGIONS.has(region)) {
regionInfo = {
hostname: AWS_CN_TEMPLATE.replace("{region}", region),
partition: "aws-cn",
};
}
if (AWS_ISO_REGIONS.has(region)) {
regionInfo = {
hostname: AWS_ISO_TEMPLATE.replace("{region}", region),
partition: "aws-iso",
};
}
if (AWS_ISO_B_REGIONS.has(region)) {
regionInfo = {
hostname: AWS_ISO_B_TEMPLATE.replace("{region}", region),
partition: "aws-iso-b",
};
}
if (AWS_US_GOV_REGIONS.has(region)) {
regionInfo = {
hostname: AWS_US_GOV_TEMPLATE.replace("{region}", region),
partition: "aws-us-gov",
};
}
// Finally, assume it's an AWS partition endpoint.
if (regionInfo === undefined) {
regionInfo = {
hostname: AWS_TEMPLATE.replace("{region}", region),
partition: "aws",
};
}
}
Expand Down
26 changes: 26 additions & 0 deletions clients/client-acm/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,134 +40,160 @@ export const defaultRegionInfoProvider: RegionInfoProvider = (region: string, op
case "ap-east-1":
regionInfo = {
hostname: "acm.ap-east-1.amazonaws.com",
partition: "aws",
};
break;
case "ap-northeast-1":
regionInfo = {
hostname: "acm.ap-northeast-1.amazonaws.com",
partition: "aws",
};
break;
case "ap-northeast-2":
regionInfo = {
hostname: "acm.ap-northeast-2.amazonaws.com",
partition: "aws",
};
break;
case "ap-south-1":
regionInfo = {
hostname: "acm.ap-south-1.amazonaws.com",
partition: "aws",
};
break;
case "ap-southeast-1":
regionInfo = {
hostname: "acm.ap-southeast-1.amazonaws.com",
partition: "aws",
};
break;
case "ap-southeast-2":
regionInfo = {
hostname: "acm.ap-southeast-2.amazonaws.com",
partition: "aws",
};
break;
case "ca-central-1":
regionInfo = {
hostname: "acm.ca-central-1.amazonaws.com",
partition: "aws",
};
break;
case "eu-central-1":
regionInfo = {
hostname: "acm.eu-central-1.amazonaws.com",
partition: "aws",
};
break;
case "eu-north-1":
regionInfo = {
hostname: "acm.eu-north-1.amazonaws.com",
partition: "aws",
};
break;
case "eu-west-1":
regionInfo = {
hostname: "acm.eu-west-1.amazonaws.com",
partition: "aws",
};
break;
case "eu-west-2":
regionInfo = {
hostname: "acm.eu-west-2.amazonaws.com",
partition: "aws",
};
break;
case "eu-west-3":
regionInfo = {
hostname: "acm.eu-west-3.amazonaws.com",
partition: "aws",
};
break;
case "me-south-1":
regionInfo = {
hostname: "acm.me-south-1.amazonaws.com",
partition: "aws",
};
break;
case "sa-east-1":
regionInfo = {
hostname: "acm.sa-east-1.amazonaws.com",
partition: "aws",
};
break;
case "us-east-1":
regionInfo = {
hostname: "acm.us-east-1.amazonaws.com",
partition: "aws",
};
break;
case "us-east-2":
regionInfo = {
hostname: "acm.us-east-2.amazonaws.com",
partition: "aws",
};
break;
case "us-gov-east-1":
regionInfo = {
hostname: "acm.us-gov-east-1.amazonaws.com",
partition: "aws-us-gov",
};
break;
case "us-gov-west-1":
regionInfo = {
hostname: "acm.us-gov-west-1.amazonaws.com",
partition: "aws-us-gov",
};
break;
case "us-west-1":
regionInfo = {
hostname: "acm.us-west-1.amazonaws.com",
partition: "aws",
};
break;
case "us-west-2":
regionInfo = {
hostname: "acm.us-west-2.amazonaws.com",
partition: "aws",
};
break;
// Next, try to match partition endpoints.
default:
if (AWS_REGIONS.has(region)) {
regionInfo = {
hostname: AWS_TEMPLATE.replace("{region}", region),
partition: "aws",
};
}
if (AWS_CN_REGIONS.has(region)) {
regionInfo = {
hostname: AWS_CN_TEMPLATE.replace("{region}", region),
partition: "aws-cn",
};
}
if (AWS_ISO_REGIONS.has(region)) {
regionInfo = {
hostname: AWS_ISO_TEMPLATE.replace("{region}", region),
partition: "aws-iso",
};
}
if (AWS_ISO_B_REGIONS.has(region)) {
regionInfo = {
hostname: AWS_ISO_B_TEMPLATE.replace("{region}", region),
partition: "aws-iso-b",
};
}
if (AWS_US_GOV_REGIONS.has(region)) {
regionInfo = {
hostname: AWS_US_GOV_TEMPLATE.replace("{region}", region),
partition: "aws-us-gov",
};
}
// Finally, assume it's an AWS partition endpoint.
if (regionInfo === undefined) {
regionInfo = {
hostname: AWS_TEMPLATE.replace("{region}", region),
partition: "aws",
};
}
}
Expand Down
Loading

0 comments on commit c18bfe4

Please sign in to comment.