Skip to content

Commit

Permalink
fix: recognize cost explorer global endpoints (#4458)
Browse files Browse the repository at this point in the history
Co-authored-by: Trivikram Kamat <[email protected]>
  • Loading branch information
rjerue and trivikr authored Jun 28, 2023
1 parent 21e65fc commit 4247c36
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/next-release/bugfix-Global-Services-2456cbf7.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "bugfix",
"category": "Cost Explorer",
"description": "recognize Cost Explorer global endpoints."
}
12 changes: 12 additions & 0 deletions lib/region_config_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@
},

"us-gov-*/iam": "globalGovCloud",

"*/ce": {
"endpoint": "{service}.us-east-1.amazonaws.com",
"globalEndpoint": true,
"signingRegion": "us-east-1"
},
"cn-*/ce": {
"endpoint": "{service}.cn-northwest-1.amazonaws.com.cn",
"globalEndpoint": true,
"signingRegion": "cn-northwest-1"
},

"us-gov-*/sts": {
"endpoint": "{service}.{region}.amazonaws.com"
},
Expand Down
18 changes: 18 additions & 0 deletions test/region_config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,24 @@ describe('region_config.js', function() {
expect(service.endpoint.host).to.equal('iam.cn-north-1.amazonaws.com.cn');
});

it('uses "global" endpoint for Cost Explorer in us-east-2', function() {
var service = new AWS.CostExplorer({
region: 'us-east-2'
});
expect(service.isGlobalEndpoint).to.equal(true);
expect(service.signingRegion).to.equal('us-east-1');
expect(service.endpoint.host).to.equal('ce.us-east-1.amazonaws.com');
});

it('uses "global" endpoint for Cost Explorer in cn-north-1', function() {
var service = new AWS.CostExplorer({
region: 'cn-north-1'
});
expect(service.isGlobalEndpoint).to.equal(true);
expect(service.signingRegion).to.equal('cn-northwest-1');
expect(service.endpoint.host).to.equal('ce.cn-northwest-1.amazonaws.com.cn');
});

[
['cn-north-1', 'cn-northwest-1', 'route53.amazonaws.com.cn'],
['us-gov-west-1', 'us-gov-west-1', 'route53.us-gov.amazonaws.com'],
Expand Down

0 comments on commit 4247c36

Please sign in to comment.