UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 4.53 kB
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.CliCredentialsStackSynthesizer=void 0;const jsiiDeprecationWarnings=require("../../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),cxapi=require("../../../cx-api"),_shared_1=require("./_shared"),asset_manifest_builder_1=require("./asset-manifest-builder"),default_synthesizer_1=require("./default-synthesizer"),stack_synthesizer_1=require("./stack-synthesizer"),token_1=require("../token");class CliCredentialsStackSynthesizer extends stack_synthesizer_1.StackSynthesizer{constructor(props={}){super(),this.props=props,this.assetManifest=new asset_manifest_builder_1.AssetManifestBuilder;try{jsiiDeprecationWarnings.aws_cdk_lib_CliCredentialsStackSynthesizerProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CliCredentialsStackSynthesizer),error}for(const key in props)props.hasOwnProperty(key)&&validateNoToken(key);function validateNoToken(key){const prop=props[key];if(typeof prop=="string"&&token_1.Token.isUnresolved(prop))throw new Error(`CliCredentialsStackSynthesizer property '${key}' cannot contain tokens; only the following placeholder strings are allowed: `+["${Qualifier}",cxapi.EnvironmentPlaceholders.CURRENT_REGION,cxapi.EnvironmentPlaceholders.CURRENT_ACCOUNT,cxapi.EnvironmentPlaceholders.CURRENT_PARTITION].join(", "))}}get bootstrapQualifier(){return this.qualifier}bind(stack){try{jsiiDeprecationWarnings.aws_cdk_lib_Stack(stack)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bind),error}super.bind(stack);const qualifier=this.props.qualifier??stack.node.tryGetContext(default_synthesizer_1.BOOTSTRAP_QUALIFIER_CONTEXT)??default_synthesizer_1.DefaultStackSynthesizer.DEFAULT_QUALIFIER;this.qualifier=qualifier;const spec=new _shared_1.StringSpecializer(stack,qualifier);this.bucketName=spec.specialize(this.props.fileAssetsBucketName??default_synthesizer_1.DefaultStackSynthesizer.DEFAULT_FILE_ASSETS_BUCKET_NAME),this.repositoryName=spec.specialize(this.props.imageAssetsRepositoryName??default_synthesizer_1.DefaultStackSynthesizer.DEFAULT_IMAGE_ASSETS_REPOSITORY_NAME),this.bucketPrefix=spec.specialize(this.props.bucketPrefix??default_synthesizer_1.DefaultStackSynthesizer.DEFAULT_FILE_ASSET_PREFIX),this.dockerTagPrefix=spec.specialize(this.props.dockerTagPrefix??default_synthesizer_1.DefaultStackSynthesizer.DEFAULT_DOCKER_ASSET_PREFIX)}reusableBind(stack){try{jsiiDeprecationWarnings.aws_cdk_lib_Stack(stack)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.reusableBind),error}const copy=Object.create(this);return copy.bind(stack),copy}addFileAsset(asset){try{jsiiDeprecationWarnings.aws_cdk_lib_FileAssetSource(asset)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addFileAsset),error}_shared_1.assertBound(this.bucketName);const location=this.assetManifest.defaultAddFileAsset(this.boundStack,asset,{bucketName:this.bucketName,bucketPrefix:this.bucketPrefix});return this.cloudFormationLocationFromFileAsset(location)}addDockerImageAsset(asset){try{jsiiDeprecationWarnings.aws_cdk_lib_DockerImageAssetSource(asset)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addDockerImageAsset),error}_shared_1.assertBound(this.repositoryName);const location=this.assetManifest.defaultAddDockerImageAsset(this.boundStack,asset,{repositoryName:this.repositoryName,dockerTagPrefix:this.dockerTagPrefix});return this.cloudFormationLocationFromDockerImageAsset(location)}synthesize(session){try{jsiiDeprecationWarnings.aws_cdk_lib_ISynthesisSession(session)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.synthesize),error}_shared_1.assertBound(this.qualifier);const templateAssetSource=this.synthesizeTemplate(session),templateAsset=this.addFileAsset(templateAssetSource),assetManifestId=this.assetManifest.emitManifest(this.boundStack,session);this.emitArtifact(session,{stackTemplateAssetObjectUrl:templateAsset.s3ObjectUrlWithPlaceholders,additionalDependencies:[assetManifestId]})}}exports.CliCredentialsStackSynthesizer=CliCredentialsStackSynthesizer,_a=JSII_RTTI_SYMBOL_1,CliCredentialsStackSynthesizer[_a]={fqn:"aws-cdk-lib.CliCredentialsStackSynthesizer",version:"2.70.0"};