UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 4.01 kB
"use strict";var __decorate=exports&&exports.__decorate||function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r},_a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.EndpointGroup=exports.HealthCheckProtocol=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var _accelerator_security_group_1=()=>{var tmp=require("./_accelerator-security-group");return _accelerator_security_group_1=()=>tmp,tmp},ga=()=>{var tmp=require("./globalaccelerator.generated");return ga=()=>tmp,tmp},cdk=()=>{var tmp=require("../../core");return cdk=()=>tmp,tmp},metadata_resource_1=()=>{var tmp=require("../../core/lib/metadata-resource");return metadata_resource_1=()=>tmp,tmp},HealthCheckProtocol;(function(HealthCheckProtocol2){HealthCheckProtocol2.TCP="TCP",HealthCheckProtocol2.HTTP="HTTP",HealthCheckProtocol2.HTTPS="HTTPS"})(HealthCheckProtocol||(exports.HealthCheckProtocol=HealthCheckProtocol={}));class EndpointGroup extends cdk().Resource{static fromEndpointGroupArn(scope,id,endpointGroupArn){class Import extends cdk().Resource{constructor(){super(...arguments),this.endpointGroupArn=endpointGroupArn}}return new Import(scope,id)}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}(0,metadata_resource_1().addConstructMetadata)(this,props);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)}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.185.0"},__decorate([(0,metadata_resource_1().MethodMetadata)()],EndpointGroup.prototype,"addEndpoint",null),__decorate([(0,metadata_resource_1().MethodMetadata)()],EndpointGroup.prototype,"connectionsPeer",null);