How to use the @aws-cdk/cx-api.EnvironmentUtils.format function in @aws-cdk/cx-api

To help you get started, we’ve selected a few @aws-cdk/cx-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / aws-cdk / packages / @aws-cdk / core / lib / stack.ts View on Github external
// created, it will be used. if not, use tokens for account and region but
    // they do not need to be scoped, the only situation in which
    // export/fn::importvalue would work if { Ref: "AWS::AccountId" } is the
    // same for provider and consumer anyway.
    const account = env.account || Aws.ACCOUNT_ID;
    const region  = env.region  || Aws.REGION;

    // this is the "aws://" env specification that will be written to the cloud assembly
    // manifest. it will use "unknown-account" and "unknown-region" to indicate
    // environment-agnosticness.
    const envAccount = !Token.isUnresolved(account) ? account : cxapi.UNKNOWN_ACCOUNT;
    const envRegion  = !Token.isUnresolved(region)  ? region  : cxapi.UNKNOWN_REGION;

    return {
      account, region,
      environment: EnvironmentUtils.format(envAccount, envRegion)
    };
  }