"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"),cdk=require("../../core"),endpoint_group_1=require("./endpoint-group"),ga=require("./globalaccelerator.generated");var ConnectionProtocol;(function(ConnectionProtocol2){ConnectionProtocol2.TCP="TCP",ConnectionProtocol2.UDP="UDP"})(ConnectionProtocol=exports.ConnectionProtocol||(exports.ConnectionProtocol={}));var ClientAffinity;(function(ClientAffinity2){ClientAffinity2.NONE="NONE",ClientAffinity2.SOURCE_IP="SOURCE_IP"})(ClientAffinity=exports.ClientAffinity||(exports.ClientAffinity={}));class Listener extends cdk.Resource{constructor(scope,id,props){var _b,_c,_d;super(scope,id);jsiiDeprecationWarnings.aws_cdk_lib_aws_globalaccelerator_ListenerProps(props);const resource=new ga.CfnListener(this,"Resource",{acceleratorArn:props.accelerator.acceleratorArn,portRanges:props.portRanges.map(m=>{var _b2;return{fromPort:m.fromPort,toPort:(_b2=m.toPort)!==null&&_b2!==void 0?_b2:m.fromPort}}),protocol:(_b=props.protocol)!==null&&_b!==void 0?_b:ConnectionProtocol.TCP,clientAffinity:(_c=props.clientAffinity)!==null&&_c!==void 0?_c:ClientAffinity.NONE});this.listenerArn=resource.attrListenerArn,this.listenerName=(_d=props.listenerName)!==null&&_d!==void 0?_d:resource.logicalId}static fromListenerArn(scope,id,listenerArn){class Import extends cdk.Resource{constructor(){super(...arguments);this.listenerArn=listenerArn}}return new Import(scope,id)}addEndpointGroup(id,options={}){return jsiiDeprecationWarnings.aws_cdk_lib_aws_globalaccelerator_EndpointGroupOptions(options),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.13.0"};
//# sourceMappingURL=listener.js.map
