"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.SecretValue=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),cfn_dynamic_reference_1=require("./cfn-dynamic-reference"),intrinsic_1=require("./private/intrinsic"),token_1=require("./token");class SecretValue extends intrinsic_1.Intrinsic{static plainText(secret){return new SecretValue(secret)}static secretsManager(secretId,options={}){if(jsiiDeprecationWarnings.aws_cdk_lib_SecretsManagerSecretOptions(options),!secretId)throw new Error("secretId cannot be empty");if(!token_1.Token.isUnresolved(secretId)&&!secretId.startsWith("arn:")&&secretId.includes(":"))throw new Error(`secret id "${secretId}" is not an ARN but contains ":"`);if(options.versionStage&&options.versionId)throw new Error(`verionStage: '${options.versionStage}' and versionId: '${options.versionId}' were both provided but only one is allowed`);const parts=[secretId,"SecretString",options.jsonField||"",options.versionStage||"",options.versionId||""],dyref=new cfn_dynamic_reference_1.CfnDynamicReference(cfn_dynamic_reference_1.CfnDynamicReferenceService.SECRETS_MANAGER,parts.join(":"));return this.cfnDynamicReference(dyref)}static ssmSecure(parameterName,version){return this.cfnDynamicReference(new cfn_dynamic_reference_1.CfnDynamicReference(cfn_dynamic_reference_1.CfnDynamicReferenceService.SSM_SECURE,version?`${parameterName}:${version}`:parameterName))}static cfnDynamicReference(ref){return jsiiDeprecationWarnings.aws_cdk_lib_CfnDynamicReference(ref),new SecretValue(ref)}static cfnParameter(param){if(jsiiDeprecationWarnings.aws_cdk_lib_CfnParameter(param),!param.noEcho)throw new Error('CloudFormation parameter must be configured with "NoEcho"');return new SecretValue(param.value)}}exports.SecretValue=SecretValue,_a=JSII_RTTI_SYMBOL_1,SecretValue[_a]={fqn:"aws-cdk-lib.SecretValue",version:"2.13.0"};
//# sourceMappingURL=secret-value.js.map
