"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.VirtualNodeListener=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var utils_1=()=>{var tmp=require("./private/utils");return utils_1=()=>tmp,tmp},shared_interfaces_1=()=>{var tmp=require("./shared-interfaces");return shared_interfaces_1=()=>tmp,tmp};class VirtualNodeListener{static http(props={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_HttpVirtualNodeListenerOptions(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.http),error}return new VirtualNodeListenerImpl(shared_interfaces_1().Protocol.HTTP,props.healthCheck,props.timeout,props.port,props.tls,props.outlierDetection,props.connectionPool)}static http2(props={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_Http2VirtualNodeListenerOptions(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.http2),error}return new VirtualNodeListenerImpl(shared_interfaces_1().Protocol.HTTP2,props.healthCheck,props.timeout,props.port,props.tls,props.outlierDetection,props.connectionPool)}static grpc(props={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_GrpcVirtualNodeListenerOptions(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.grpc),error}return new VirtualNodeListenerImpl(shared_interfaces_1().Protocol.GRPC,props.healthCheck,props.timeout,props.port,props.tls,props.outlierDetection,props.connectionPool)}static tcp(props={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_TcpVirtualNodeListenerOptions(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.tcp),error}return new VirtualNodeListenerImpl(shared_interfaces_1().Protocol.TCP,props.healthCheck,props.timeout,props.port,props.tls,props.outlierDetection,props.connectionPool)}}exports.VirtualNodeListener=VirtualNodeListener,_a=JSII_RTTI_SYMBOL_1,VirtualNodeListener[_a]={fqn:"aws-cdk-lib.aws_appmesh.VirtualNodeListener",version:"2.148.1"};class VirtualNodeListenerImpl extends VirtualNodeListener{constructor(protocol,healthCheck,timeout,port=8080,tls,outlierDetection,connectionPool){super(),this.protocol=protocol,this.healthCheck=healthCheck,this.timeout=timeout,this.port=port,this.tls=tls,this.outlierDetection=outlierDetection,this.connectionPool=connectionPool}bind(scope){return{listener:{portMapping:{port:this.port,protocol:this.protocol},healthCheck:this.healthCheck?.bind(scope,{defaultPort:this.port}).virtualNodeHealthCheck,timeout:this.timeout?this.renderTimeout(this.timeout):void 0,tls:(0,utils_1().renderListenerTlsOptions)(scope,this.tls),outlierDetection:this.outlierDetection?this.renderOutlierDetection(this.outlierDetection):void 0,connectionPool:this.connectionPool?this.renderConnectionPool(this.connectionPool):void 0}}}renderTimeout(timeout){return{[this.protocol]:{idle:timeout?.idle!==void 0?{unit:"ms",value:timeout?.idle.toMilliseconds()}:void 0,perRequest:timeout?.perRequest!==void 0?{unit:"ms",value:timeout?.perRequest.toMilliseconds()}:void 0}}}renderOutlierDetection(outlierDetection){return{baseEjectionDuration:{unit:"ms",value:outlierDetection.baseEjectionDuration.toMilliseconds()},interval:{unit:"ms",value:outlierDetection.interval.toMilliseconds()},maxEjectionPercent:outlierDetection.maxEjectionPercent,maxServerErrors:outlierDetection.maxServerErrors}}renderConnectionPool(connectionPool){return{[this.protocol]:{maxRequests:connectionPool?.maxRequests!==void 0?connectionPool.maxRequests:void 0,maxConnections:connectionPool?.maxConnections!==void 0?connectionPool.maxConnections:void 0,maxPendingRequests:connectionPool?.maxPendingRequests!==void 0?connectionPool.maxPendingRequests:void 0}}}}
