UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 5.18 kB
"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?(function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]})),__setModuleDefault=exports&&exports.__setModuleDefault||(Object.create?(function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}):function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||(function(){var ownKeys=function(o){return ownKeys=Object.getOwnPropertyNames||function(o2){var ar=[];for(var k in o2)Object.prototype.hasOwnProperty.call(o2,k)&&(ar[ar.length]=k);return ar},ownKeys(o)};return function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k=ownKeys(mod),i=0;i<k.length;i++)k[i]!=="default"&&__createBinding(result,mod,k[i]);return __setModuleDefault(result,mod),result}})();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=__importStar(require("../../core"));return cdk=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class HealthCheck{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.HealthCheck",version:"2.260.0"};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;class HealthCheckImpl extends HealthCheck{protocol;healthyThreshold;unhealthyThreshold;interval;timeout;path;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(cdk()).UnscopedValidationError((0,literal_string_1().lit)`HealthyThresholdOutOfRange`,"healthyThreshold must be between 2 and 10");if(unhealthyThreshold<2||unhealthyThreshold>10)throw new(cdk()).UnscopedValidationError((0,literal_string_1().lit)`UnhealthyThresholdOutOfRange`,"unhealthyThreshold must be between 2 and 10");if(interval.toMilliseconds()<5e3||interval.toMilliseconds()>3e5)throw new(cdk()).UnscopedValidationError((0,literal_string_1().lit)`IntervalOutOfRange`,"interval must be between 5 seconds and 300 seconds");if(timeout.toMilliseconds()<2e3||timeout.toMilliseconds()>6e4)throw new(cdk()).UnscopedValidationError((0,literal_string_1().lit)`TimeoutOutOfRange`,"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}}}}