aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 2.96 kB
JavaScript
;var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.EndpointGroup=exports.HealthCheckProtocol=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),cdk=require("../../core"),_accelerator_security_group_1=require("./_accelerator-security-group"),ga=require("./globalaccelerator.generated");var HealthCheckProtocol;(function(HealthCheckProtocol2){HealthCheckProtocol2.TCP="TCP",HealthCheckProtocol2.HTTP="HTTP",HealthCheckProtocol2.HTTPS="HTTPS"})(HealthCheckProtocol=exports.HealthCheckProtocol||(exports.HealthCheckProtocol={}));class EndpointGroup extends cdk.Resource{constructor(scope,id,props){super(scope,id),this.endpoints=new Array;try{jsiiDeprecationWarnings.aws_cdk_lib_aws_globalaccelerator_EndpointGroupProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,EndpointGroup),error}const resource=new ga.CfnEndpointGroup(this,"Resource",{listenerArn:props.listener.listenerArn,endpointGroupRegion:props.region??cdk.Lazy.string({produce:()=>this.firstEndpointRegion()}),endpointConfigurations:cdk.Lazy.any({produce:()=>this.renderEndpoints()},{omitEmptyArray:!0}),healthCheckIntervalSeconds:props.healthCheckInterval?.toSeconds({integral:!0}),healthCheckPath:props.healthCheckPath,healthCheckPort:props.healthCheckPort,healthCheckProtocol:props.healthCheckProtocol,thresholdCount:props.healthCheckThreshold,trafficDialPercentage:props.trafficDialPercentage,portOverrides:props.portOverrides?.map(o=>({endpointPort:o.endpointPort,listenerPort:o.listenerPort}))});this.endpointGroupArn=resource.attrEndpointGroupArn,this.endpointGroupName=props.endpointGroupName??resource.logicalId;for(const endpoint of props.endpoints??[])this.addEndpoint(endpoint)}static fromEndpointGroupArn(scope,id,endpointGroupArn){class Import extends cdk.Resource{constructor(){super(...arguments),this.endpointGroupArn=endpointGroupArn}}return new Import(scope,id)}addEndpoint(endpoint){try{jsiiDeprecationWarnings.aws_cdk_lib_aws_globalaccelerator_IEndpoint(endpoint)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addEndpoint),error}this.endpoints.push(endpoint)}connectionsPeer(id,vpc){try{jsiiDeprecationWarnings.aws_cdk_lib_aws_ec2_IVpc(vpc)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.connectionsPeer),error}return _accelerator_security_group_1.AcceleratorSecurityGroupPeer.fromVpc(this,id,vpc,this)}renderEndpoints(){return this.endpoints.map(e=>e.renderEndpointConfiguration())}firstEndpointRegion(){for(const endpoint of this.endpoints)if(endpoint.region)return endpoint.region;return cdk.Stack.of(this).region}}exports.EndpointGroup=EndpointGroup,_a=JSII_RTTI_SYMBOL_1,EndpointGroup[_a]={fqn:"aws-cdk-lib.aws_globalaccelerator.EndpointGroup",version:"2.70.0"};