aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 3.44 kB
JavaScript
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.VpcLink=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var index_1=()=>{var tmp=require(".././index");return index_1=()=>tmp,tmp},ec2=()=>{var tmp=require("../../../aws-ec2");return ec2=()=>tmp,tmp},core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp},metadata_resource_1=()=>{var tmp=require("../../../core/lib/metadata-resource");return metadata_resource_1=()=>tmp,tmp};class VpcLink extends core_1().Resource{static fromVpcLinkAttributes(scope,id,attrs){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_apigatewayv2_VpcLinkAttributes(attrs)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromVpcLinkAttributes),error}class Import extends core_1().Resource{constructor(){super(...arguments),this.vpcLinkId=attrs.vpcLinkId,this.vpc=attrs.vpc}}return new Import(scope,id)}constructor(scope,id,props){super(scope,id),this.subnets=new Array,this.securityGroups=new Array;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_apigatewayv2_VpcLinkProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,VpcLink),error}(0,metadata_resource_1().addConstructMetadata)(this,props),this.vpc=props.vpc;const cfnResource=new(index_1()).CfnVpcLink(this,"Resource",{name:props.vpcLinkName||core_1().Lazy.string({produce:()=>core_1().Names.uniqueId(this)}),subnetIds:core_1().Lazy.list({produce:()=>this.renderSubnets()}),securityGroupIds:core_1().Lazy.list({produce:()=>this.renderSecurityGroups()})});this.vpcLinkId=cfnResource.ref;const{subnets}=props.vpc.selectSubnets(props.subnets??{subnetType:ec2().SubnetType.PRIVATE_WITH_EGRESS});this.addSubnets(...subnets),props.securityGroups&&this.addSecurityGroups(...props.securityGroups)}addSubnets(...subnets){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ec2_ISubnet(subnets)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addSubnets),error}this.subnets.push(...subnets)}addSecurityGroups(...groups){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ec2_ISecurityGroup(groups)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addSecurityGroups),error}this.securityGroups.push(...groups)}renderSubnets(){return this.subnets.map(subnet=>subnet.subnetId)}renderSecurityGroups(){return this.securityGroups.map(sg=>sg.securityGroupId)}}exports.VpcLink=VpcLink,_a=JSII_RTTI_SYMBOL_1,VpcLink[_a]={fqn:"aws-cdk-lib.aws_apigatewayv2.VpcLink",version:"2.185.0"},__decorate([(0,metadata_resource_1().MethodMetadata)()],VpcLink.prototype,"addSubnets",null),__decorate([(0,metadata_resource_1().MethodMetadata)()],VpcLink.prototype,"addSecurityGroups",null);
;