"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.CfnOutput=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),cfn_element_1=require("./cfn-element");class CfnOutput extends cfn_element_1.CfnElement{constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings.aws_cdk_lib_CfnOutputProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.constructor),error}if(props.value===void 0)throw new Error(`Missing value for CloudFormation output at path "${this.node.path}"`);this._description=props.description,this._value=props.value,this._condition=props.condition,this._exportName=props.exportName,this.node.addValidation({validate:()=>this.validateOutput()})}get description(){return this._description}set description(description){this._description=description}get value(){return this._value}set value(value){this._value=value}get condition(){return this._condition}set condition(condition){this._condition=condition}get exportName(){return this._exportName}set exportName(exportName){this._exportName=exportName}get importValue(){return cfn_fn_1.Fn.importValue(lazy_1.Lazy.uncachedString({produce:ctx=>{if(stack_1.Stack.of(ctx.scope)===this.stack)throw new Error(`'importValue' property of '${this.node.path}' should only be used in a different Stack`);if(!this._exportName)throw new Error(`Add an exportName to the CfnOutput at '${this.node.path}' in order to use 'output.importValue'`);return this._exportName}}))}_toCloudFormation(){return{Outputs:{[this.logicalId]:{Description:this._description,Value:this._value,Export:this._exportName!=null?{Name:this._exportName}:void 0,Condition:this._condition?this._condition.logicalId:void 0}}}}validateOutput(){return this._exportName&&!token_1.Token.isUnresolved(this._exportName)&&this._exportName.length>255?[`Export name cannot exceed 255 characters (got ${this._exportName.length} characters)`]:[]}}exports.CfnOutput=CfnOutput,_a=JSII_RTTI_SYMBOL_1,CfnOutput[_a]={fqn:"aws-cdk-lib.CfnOutput",version:"2.21.0"};const cfn_fn_1=require("./cfn-fn"),lazy_1=require("./lazy"),stack_1=require("./stack"),token_1=require("./token");
//# sourceMappingURL=cfn-output.js.map
