"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.HealthCheck=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var shared_interfaces_1=()=>{var tmp=require("./shared-interfaces");return shared_interfaces_1=()=>tmp,tmp},cdk=()=>{var tmp=require("../../core");return cdk=()=>tmp,tmp};class HealthCheck{static http(options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_HttpHealthCheckOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.http),error}return new HealthCheckImpl(shared_interfaces_1().Protocol.HTTP,options.healthyThreshold,options.unhealthyThreshold,options.interval,options.timeout,options.path)}static http2(options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_HttpHealthCheckOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.http2),error}return new HealthCheckImpl(shared_interfaces_1().Protocol.HTTP2,options.healthyThreshold,options.unhealthyThreshold,options.interval,options.timeout,options.path)}static grpc(options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_GrpcHealthCheckOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.grpc),error}return new HealthCheckImpl(shared_interfaces_1().Protocol.GRPC,options.healthyThreshold,options.unhealthyThreshold,options.interval,options.timeout)}static tcp(options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_TcpHealthCheckOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.tcp),error}return new HealthCheckImpl(shared_interfaces_1().Protocol.TCP,options.healthyThreshold,options.unhealthyThreshold,options.interval,options.timeout)}}exports.HealthCheck=HealthCheck,_a=JSII_RTTI_SYMBOL_1,HealthCheck[_a]={fqn:"aws-cdk-lib.aws_appmesh.HealthCheck",version:"2.159.0"};class HealthCheckImpl extends HealthCheck{constructor(protocol,healthyThreshold=2,unhealthyThreshold=2,interval=cdk().Duration.seconds(5),timeout=cdk().Duration.seconds(2),path){if(super(),this.protocol=protocol,this.healthyThreshold=healthyThreshold,this.unhealthyThreshold=unhealthyThreshold,this.interval=interval,this.timeout=timeout,this.path=path,healthyThreshold<2||healthyThreshold>10)throw new Error("healthyThreshold must be between 2 and 10");if(unhealthyThreshold<2||unhealthyThreshold>10)throw new Error("unhealthyThreshold must be between 2 and 10");if(interval.toMilliseconds()<5e3||interval.toMilliseconds()>3e5)throw new Error("interval must be between 5 seconds and 300 seconds");if(timeout.toMilliseconds()<2e3||timeout.toMilliseconds()>6e4)throw new Error("timeout must be between 2 seconds and 60 seconds");path===void 0&&(protocol===shared_interfaces_1().Protocol.HTTP||protocol===shared_interfaces_1().Protocol.HTTP2)&&(this.path="/")}bind(_scope,options){return{virtualNodeHealthCheck:{protocol:this.protocol,healthyThreshold:this.healthyThreshold,unhealthyThreshold:this.unhealthyThreshold,intervalMillis:this.interval.toMilliseconds(),timeoutMillis:this.timeout.toMilliseconds(),path:this.path,port:options.defaultPort},virtualGatewayHealthCheck:{protocol:this.protocol,healthyThreshold:this.healthyThreshold,unhealthyThreshold:this.unhealthyThreshold,intervalMillis:this.interval.toMilliseconds(),timeoutMillis:this.timeout.toMilliseconds(),path:this.path,port:options.defaultPort}}}}
