UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 999 B
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.accountIfDifferentFromStack=exports.regionIfDifferentFromStack=void 0;var cdk=()=>{var tmp=require("../../../core");return cdk=()=>tmp,tmp};function regionIfDifferentFromStack(region){return cdk().Token.asString(new StackDependentToken(region,stack=>stack.region))}exports.regionIfDifferentFromStack=regionIfDifferentFromStack;function accountIfDifferentFromStack(account){return cdk().Token.asString(new StackDependentToken(account,stack=>stack.account))}exports.accountIfDifferentFromStack=accountIfDifferentFromStack;class StackDependentToken{constructor(originalValue,fn){this.originalValue=originalValue,this.fn=fn,this.creationStack=cdk().captureStackTrace()}resolve(context){const stackValue=this.fn(cdk().Stack.of(context.scope));if(!(!cdk().Token.isUnresolved(stackValue)&&stackValue===this.originalValue))return this.originalValue}toString(){return cdk().Token.asString(this)}toJSON(){return this.originalValue}}