Skip to content

Commit

Permalink
refactor: rename cloud identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
emmenko committed Oct 11, 2024
1 parent be08ecc commit 0efa852
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 7 deletions.
8 changes: 8 additions & 0 deletions .changeset/silent-donuts-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@commercetools-frontend/application-config': patch
'@commercetools-backend/express': patch
---

The cloud identifiers for AWS regions have been renamed to `aws-eu` and `aws-us`.

For backwards compatibility the value `aws-fra` and `aws-ohio` still work.
7 changes: 5 additions & 2 deletions packages-backend/express/src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ const mapCloudIdentifierToIssuer = <Request extends TBaseRequest>(
return MC_API_URLS.GCP_EU;
case CLOUD_IDENTIFIERS.GCP_US:
return MC_API_URLS.GCP_US;
case CLOUD_IDENTIFIERS.AWS_EU:
case CLOUD_IDENTIFIERS.AWS_FRA:
return MC_API_URLS.AWS_FRA;
return MC_API_URLS.AWS_EU;
case CLOUD_IDENTIFIERS.AWS_US:
case CLOUD_IDENTIFIERS.AWS_OHIO:
return MC_API_URLS.AWS_OHIO;
return MC_API_URLS.AWS_US;
// TODO: remove it
case CLOUD_IDENTIFIERS.AWS_CN:
return MC_API_URLS.AWS_CN;
case CLOUD_IDENTIFIERS.AZURE_US:
Expand Down
22 changes: 22 additions & 0 deletions packages-backend/express/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,19 @@ export const CLOUD_IDENTIFIERS = {
GCP_AU: 'gcp-au',
GCP_EU: 'gcp-eu',
GCP_US: 'gcp-us',
AWS_EU: 'aws-eu',
AWS_US: 'aws-us',
/**
* @deprecated: use `AWS_EU` instead
*/
AWS_FRA: 'aws-fra',
/**
* @deprecated: use `AWS_US` instead
*/
AWS_OHIO: 'aws-ohio',
/**
* @deprecated: not supported anymore
*/
AWS_CN: 'aws-cn',
AZURE_US: 'azure-us',
AZURE_EU: 'azure-eu',
Expand All @@ -13,8 +24,19 @@ export const MC_API_URLS = {
GCP_AU: 'https://mc-api.australia-southeast1.gcp.commercetools.com',
GCP_EU: 'https://mc-api.europe-west1.gcp.commercetools.com',
GCP_US: 'https://mc-api.us-central1.gcp.commercetools.com',
AWS_EU: 'https://mc-api.eu-central-1.aws.commercetools.com',
AWS_US: 'https://mc-api.us-east-2.aws.commercetools.com',
/**
* @deprecated: use `AWS_EU` instead
*/
AWS_FRA: 'https://mc-api.eu-central-1.aws.commercetools.com',
/**
* @deprecated: use `AWS_US` instead
*/
AWS_OHIO: 'https://mc-api.us-east-2.aws.commercetools.com',
/**
* @deprecated: not supported anymore
*/
AWS_CN: 'https://mc-api.cn-northwest-1.aws.commercetools.cn',
AZURE_US: 'https://mc-api.eastus.azure.commercetools.com',
AZURE_EU: 'https://mc-api.germanywestcentral.azure.commercetools.com',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ describe.each`
${'gcp-au'} | ${'https://mc-api.australia-southeast1.gcp.commercetools.com'}
${'gcp-eu'} | ${'https://mc-api.europe-west1.gcp.commercetools.com'}
${'gcp-us'} | ${'https://mc-api.us-central1.gcp.commercetools.com'}
${'aws-fra'} | ${'https://mc-api.eu-central-1.aws.commercetools.com'}
${'aws-ohio'} | ${'https://mc-api.us-east-2.aws.commercetools.com'}
${'aws-cn'} | ${'https://mc-api.cn-northwest-1.aws.commercetools.cn'}
${'aws-eu'} | ${'https://mc-api.eu-central-1.aws.commercetools.com'}
${'aws-us'} | ${'https://mc-api.us-east-2.aws.commercetools.com'}
`(
'when the middleware uses as "issuer": "$cloudIdentifier"',
({ cloudIdentifier, issuer }) => {
Expand Down
22 changes: 22 additions & 0 deletions packages/application-config/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,19 @@ export const CLOUD_IDENTIFIERS = {
GCP_AU: 'gcp-au',
GCP_EU: 'gcp-eu',
GCP_US: 'gcp-us',
AWS_EU: 'aws-eu',
AWS_US: 'aws-us',
/**
* @deprecated: use `AWS_EU` instead
*/
AWS_FRA: 'aws-fra',
/**
* @deprecated: use `AWS_US` instead
*/
AWS_OHIO: 'aws-ohio',
/**
* @deprecated: not supported anymore
*/
AWS_CN: 'aws-cn',
AZURE_US: 'azure-us',
AZURE_EU: 'azure-eu',
Expand All @@ -13,8 +24,19 @@ export const MC_API_URLS = {
GCP_AU: 'https://mc-api.australia-southeast1.gcp.commercetools.com',
GCP_EU: 'https://mc-api.europe-west1.gcp.commercetools.com',
GCP_US: 'https://mc-api.us-central1.gcp.commercetools.com',
AWS_EU: 'https://mc-api.eu-central-1.aws.commercetools.com',
AWS_US: 'https://mc-api.us-east-2.aws.commercetools.com',
/**
* @deprecated: use `AWS_EU` instead
*/
AWS_FRA: 'https://mc-api.eu-central-1.aws.commercetools.com',
/**
* @deprecated: use `AWS_US` instead
*/
AWS_OHIO: 'https://mc-api.us-east-2.aws.commercetools.com',
/**
* @deprecated: not supported anymore
*/
AWS_CN: 'https://mc-api.cn-northwest-1.aws.commercetools.cn',
AZURE_US: 'https://mc-api.eastus.azure.commercetools.com',
AZURE_EU: 'https://mc-api.germanywestcentral.azure.commercetools.com',
Expand Down
7 changes: 5 additions & 2 deletions packages/application-config/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ const mapCloudIdentifierToApiUrl = (
return MC_API_URLS.GCP_EU;
case CLOUD_IDENTIFIERS.GCP_US:
return MC_API_URLS.GCP_US;
case CLOUD_IDENTIFIERS.AWS_EU:
case CLOUD_IDENTIFIERS.AWS_FRA:
return MC_API_URLS.AWS_FRA;
return MC_API_URLS.AWS_EU;
case CLOUD_IDENTIFIERS.AWS_US:
case CLOUD_IDENTIFIERS.AWS_OHIO:
return MC_API_URLS.AWS_OHIO;
return MC_API_URLS.AWS_US;
// TODO: remove it
case CLOUD_IDENTIFIERS.AWS_CN:
return MC_API_URLS.AWS_CN;
case CLOUD_IDENTIFIERS.AZURE_US:
Expand Down

0 comments on commit 0efa852

Please sign in to comment.