"use strict";var _a,_b,_c;Object.defineProperty(exports,"__esModule",{value:!0}),exports.SubnetNetworkAclAssociation=exports.NetworkAclEntry=exports.TrafficDirection=exports.Action=exports.NetworkAcl=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var ec2_generated_1=()=>{var tmp=require("./ec2.generated");return ec2_generated_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp};const NAME_TAG="Name";class NetworkAclBase extends core_1().Resource{addEntry(id,options){return new NetworkAclEntry(this,id,{networkAcl:this,...options})}}class NetworkAcl extends NetworkAclBase{static fromNetworkAclId(scope,id,networkAclId){class Import extends NetworkAclBase{constructor(){super(...arguments),this.networkAclId=networkAclId}}return new Import(scope,id)}constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ec2_NetworkAclProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,NetworkAcl),error}this.vpc=props.vpc,core_1().Tags.of(this).add(NAME_TAG,props.networkAclName||this.node.path),this.networkAcl=new(ec2_generated_1()).CfnNetworkAcl(this,"Resource",{vpcId:props.vpc.vpcId}),this.networkAclId=this.networkAcl.ref,this.networkAclVpcId=this.networkAcl.vpcId,props.subnetSelection!==void 0&&this.associateWithSubnet("DefaultAssociation",props.subnetSelection)}associateWithSubnet(id,selection){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ec2_SubnetSelection(selection)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.associateWithSubnet),error}const subnets=this.vpc.selectSubnets(selection);for(const subnet of subnets.subnets)subnet.associateNetworkAcl(id,this)}}exports.NetworkAcl=NetworkAcl,_a=JSII_RTTI_SYMBOL_1,NetworkAcl[_a]={fqn:"aws-cdk-lib.aws_ec2.NetworkAcl",version:"2.159.0"};var Action;(function(Action2){Action2.ALLOW="allow",Action2.DENY="deny"})(Action||(exports.Action=Action={}));class NetworkAclEntryBase extends core_1().Resource{}var TrafficDirection;(function(TrafficDirection2){TrafficDirection2[TrafficDirection2.EGRESS=0]="EGRESS",TrafficDirection2[TrafficDirection2.INGRESS=1]="INGRESS"})(TrafficDirection||(exports.TrafficDirection=TrafficDirection={}));class NetworkAclEntry extends NetworkAclEntryBase{constructor(scope,id,props){super(scope,id,{physicalName:props.networkAclEntryName});try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ec2_NetworkAclEntryProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,NetworkAclEntry),error}this.networkAcl=props.networkAcl,new(ec2_generated_1()).CfnNetworkAclEntry(this,"Resource",{networkAclId:this.networkAcl.networkAclId,ruleNumber:props.ruleNumber,ruleAction:props.ruleAction??Action.ALLOW,egress:props.direction!==void 0?props.direction===TrafficDirection.EGRESS:void 0,...props.traffic.toTrafficConfig(),...props.cidr.toCidrConfig()})}}exports.NetworkAclEntry=NetworkAclEntry,_b=JSII_RTTI_SYMBOL_1,NetworkAclEntry[_b]={fqn:"aws-cdk-lib.aws_ec2.NetworkAclEntry",version:"2.159.0"};class SubnetNetworkAclAssociationBase extends core_1().Resource{}class SubnetNetworkAclAssociation extends SubnetNetworkAclAssociationBase{static fromSubnetNetworkAclAssociationAssociationId(scope,id,subnetNetworkAclAssociationAssociationId){class Import extends SubnetNetworkAclAssociationBase{constructor(){super(...arguments),this.subnetNetworkAclAssociationAssociationId=subnetNetworkAclAssociationAssociationId}}return new Import(scope,id)}constructor(scope,id,props){super(scope,id,{physicalName:props.subnetNetworkAclAssociationName});try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ec2_SubnetNetworkAclAssociationProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,SubnetNetworkAclAssociation),error}this.association=new(ec2_generated_1()).CfnSubnetNetworkAclAssociation(this,"Resource",{networkAclId:props.networkAcl.networkAclId,subnetId:props.subnet.subnetId}),this.networkAcl=props.networkAcl,this.subnet=props.subnet,this.subnetNetworkAclAssociationAssociationId=this.association.attrAssociationId}}exports.SubnetNetworkAclAssociation=SubnetNetworkAclAssociation,_c=JSII_RTTI_SYMBOL_1,SubnetNetworkAclAssociation[_c]={fqn:"aws-cdk-lib.aws_ec2.SubnetNetworkAclAssociation",version:"2.159.0"};
