"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.Listener=exports.ClientAffinity=exports.ConnectionProtocol=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),endpoint_group_1=require("./endpoint-group"),ga=require("./globalaccelerator.generated"),cdk=require("../../core");var ConnectionProtocol;(function(ConnectionProtocol2){ConnectionProtocol2.TCP="TCP",ConnectionProtocol2.UDP="UDP"})(ConnectionProtocol||(exports.ConnectionProtocol=ConnectionProtocol={}));var ClientAffinity;(function(ClientAffinity2){ClientAffinity2.NONE="NONE",ClientAffinity2.SOURCE_IP="SOURCE_IP"})(ClientAffinity||(exports.ClientAffinity=ClientAffinity={}));class Listener extends cdk.Resource{static fromListenerArn(scope,id,listenerArn){class Import extends cdk.Resource{constructor(){super(...arguments),this.listenerArn=listenerArn}}return new Import(scope,id)}constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings.aws_cdk_lib_aws_globalaccelerator_ListenerProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,Listener),error}const resource=new ga.CfnListener(this,"Resource",{acceleratorArn:props.accelerator.acceleratorArn,portRanges:props.portRanges.map(m=>({fromPort:m.fromPort,toPort:m.toPort??m.fromPort})),protocol:props.protocol??ConnectionProtocol.TCP,clientAffinity:props.clientAffinity??ClientAffinity.NONE});this.listenerArn=resource.attrListenerArn,this.listenerName=props.listenerName??resource.logicalId}addEndpointGroup(id,options={}){try{jsiiDeprecationWarnings.aws_cdk_lib_aws_globalaccelerator_EndpointGroupOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addEndpointGroup),error}return new endpoint_group_1.EndpointGroup(this,id,{listener:this,...options})}}exports.Listener=Listener,_a=JSII_RTTI_SYMBOL_1,Listener[_a]={fqn:"aws-cdk-lib.aws_globalaccelerator.Listener",version:"2.96.1"};
