"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.Mesh=exports.MeshFilterType=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),appmesh_generated_1=require("./appmesh.generated"),virtual_gateway_1=require("./virtual-gateway"),virtual_node_1=require("./virtual-node"),virtual_router_1=require("./virtual-router"),cdk=require("../../core");var MeshFilterType;(function(MeshFilterType2){MeshFilterType2.ALLOW_ALL="ALLOW_ALL",MeshFilterType2.DROP_ALL="DROP_ALL"})(MeshFilterType||(exports.MeshFilterType=MeshFilterType={}));class MeshBase extends cdk.Resource{addVirtualRouter(id,props={}){return new virtual_router_1.VirtualRouter(this,id,{...props,mesh:this})}addVirtualNode(id,props={}){return new virtual_node_1.VirtualNode(this,id,{...props,mesh:this})}addVirtualGateway(id,props){return new virtual_gateway_1.VirtualGateway(this,id,{...props,mesh:this})}}class Mesh extends MeshBase{static fromMeshArn(scope,id,meshArn){const parts=cdk.Stack.of(scope).splitArn(meshArn,cdk.ArnFormat.SLASH_RESOURCE_NAME);class Import extends MeshBase{constructor(){super(...arguments),this.meshName=parts.resourceName||"",this.meshArn=meshArn}}return new Import(scope,id,{environmentFromArn:meshArn})}static fromMeshName(scope,id,meshName){const arn=cdk.Stack.of(scope).formatArn({service:"appmesh",resource:"mesh",resourceName:meshName});class Import extends MeshBase{constructor(){super(...arguments),this.meshName=meshName,this.meshArn=arn}}return new Import(scope,id)}constructor(scope,id,props={}){super(scope,id,{physicalName:props.meshName||cdk.Lazy.string({produce:()=>cdk.Names.uniqueId(this)})});try{jsiiDeprecationWarnings.aws_cdk_lib_aws_appmesh_MeshProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,Mesh),error}const mesh=new appmesh_generated_1.CfnMesh(this,"Resource",{meshName:this.physicalName,spec:{egressFilter:props.egressFilter?{type:props.egressFilter}:void 0,serviceDiscovery:props.serviceDiscovery}});this.meshName=this.getResourceNameAttribute(mesh.attrMeshName),this.meshArn=this.getResourceArnAttribute(mesh.ref,{service:"appmesh",resource:"mesh",resourceName:this.physicalName})}}exports.Mesh=Mesh,_a=JSII_RTTI_SYMBOL_1,Mesh[_a]={fqn:"aws-cdk-lib.aws_appmesh.Mesh",version:"2.96.1"};
