aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 1.25 kB
JavaScript
;var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.Annotations=void 0;const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),cxschema=require("../../cloud-assembly-schema"),cxapi=require("../../cx-api");class Annotations{constructor(scope){this.scope=scope;const disableTrace=scope.node.tryGetContext(cxapi.DISABLE_METADATA_STACK_TRACE)||process.env.CDK_DISABLE_STACK_TRACE;this.stackTraces=!disableTrace}static of(scope){return new Annotations(scope)}addWarning(message){this.addMessage(cxschema.ArtifactMetadataEntryType.WARN,message)}addInfo(message){this.addMessage(cxschema.ArtifactMetadataEntryType.INFO,message)}addError(message){this.addMessage(cxschema.ArtifactMetadataEntryType.ERROR,message)}addDeprecation(api,message){const text=`The API ${api} is deprecated: ${message}. This API will be removed in the next major release`;if(process.env.CDK_BLOCK_DEPRECATIONS)throw new Error(`${this.scope.node.path}: ${text}`);this.addWarning(text)}addMessage(level,message){!this.scope.node.metadata.find(x=>x.data===message)&&this.scope.node.addMetadata(level,message,{stackTrace:this.stackTraces})}}exports.Annotations=Annotations,_a=JSII_RTTI_SYMBOL_1,Annotations[_a]={fqn:"aws-cdk-lib.Annotations",version:"2.70.0"};