UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 4.13 kB
"use strict";var __decorate=exports&&exports.__decorate||function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r},_a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ParameterGroup=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var rds_generated_1=()=>{var tmp=require("./rds.generated");return rds_generated_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},errors_1=()=>{var tmp=require("../../core/lib/errors");return errors_1=()=>tmp,tmp},metadata_resource_1=()=>{var tmp=require("../../core/lib/metadata-resource");return metadata_resource_1=()=>tmp,tmp};class ParameterGroup extends core_1().Resource{static fromParameterGroupName(scope,id,parameterGroupName){class Import extends core_1().Resource{bindToCluster(_options){return{parameterGroupName}}bindToInstance(_options){return{parameterGroupName}}addParameter(_key,_value){return!1}}return new Import(scope,id)}constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_rds_ParameterGroupProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,ParameterGroup),error}(0,metadata_resource_1().addConstructMetadata)(this,props);const family=props.engine.parameterGroupFamily;if(!family)throw new(errors_1()).ValidationError("ParameterGroup cannot be used with an engine that doesn't specify a version",this);this.family=family,this.description=props.description,this.name=props.name,this.parameters=props.parameters??{},this.removalPolicy=props.removalPolicy}bindToCluster(_options){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_rds_ParameterGroupClusterBindOptions(_options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bindToCluster),error}if(!this.clusterCfnGroup){const id=this.instanceCfnGroup?"ClusterParameterGroup":"Resource";this.clusterCfnGroup=new(rds_generated_1()).CfnDBClusterParameterGroup(this,id,{description:this.description||`Cluster parameter group for ${this.family}`,family:this.family,dbClusterParameterGroupName:this.name,parameters:core_1().Lazy.any({produce:()=>this.parameters})})}return this.removalPolicy&&this.clusterCfnGroup.applyRemovalPolicy(this.removalPolicy??core_1().RemovalPolicy.DESTROY),{parameterGroupName:this.clusterCfnGroup.ref}}bindToInstance(_options){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_rds_ParameterGroupInstanceBindOptions(_options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bindToInstance),error}if(!this.instanceCfnGroup){const id=this.clusterCfnGroup?"InstanceParameterGroup":"Resource";this.instanceCfnGroup=new(rds_generated_1()).CfnDBParameterGroup(this,id,{description:this.description||`Parameter group for ${this.family}`,family:this.family,dbParameterGroupName:this.name,parameters:core_1().Lazy.any({produce:()=>this.parameters})})}return this.removalPolicy&&this.instanceCfnGroup.applyRemovalPolicy(this.removalPolicy??core_1().RemovalPolicy.DESTROY),{parameterGroupName:this.instanceCfnGroup.ref}}addParameter(key,value){return this.parameters[key]=value,!0}}exports.ParameterGroup=ParameterGroup,_a=JSII_RTTI_SYMBOL_1,ParameterGroup[_a]={fqn:"aws-cdk-lib.aws_rds.ParameterGroup",version:"2.185.0"},__decorate([(0,metadata_resource_1().MethodMetadata)()],ParameterGroup.prototype,"bindToCluster",null),__decorate([(0,metadata_resource_1().MethodMetadata)()],ParameterGroup.prototype,"bindToInstance",null),__decorate([(0,metadata_resource_1().MethodMetadata)()],ParameterGroup.prototype,"addParameter",null);