"use strict";var _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};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}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.148.1"};
