"use strict";var _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},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}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.148.1"};
