"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.BaseListener=void 0;const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var util_1=()=>{var tmp=require("./util");return util_1=()=>tmp,tmp},cxschema=()=>{var tmp=require("../../../cloud-assembly-schema");return cxschema=()=>tmp,tmp},core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp},elasticloadbalancingv2_generated_1=()=>{var tmp=require("../elasticloadbalancingv2.generated");return elasticloadbalancingv2_generated_1=()=>tmp,tmp};class BaseListener extends core_1().Resource{static _queryContextProvider(scope,options){if(core_1().Token.isUnresolved(options.userOptions.loadBalancerArn)||Object.values(options.userOptions.loadBalancerTags??{}).some(core_1().Token.isUnresolved)||core_1().Token.isUnresolved(options.userOptions.listenerPort))throw new Error("All arguments to look up a load balancer listener must be concrete (no Tokens)");let cxschemaTags;return options.userOptions.loadBalancerTags&&(cxschemaTags=(0,util_1().mapTagMapToCxschema)(options.userOptions.loadBalancerTags)),core_1().ContextProvider.getValue(scope,{provider:cxschema().ContextProvider.LOAD_BALANCER_LISTENER_PROVIDER,props:{listenerArn:options.listenerArn,listenerPort:options.userOptions.listenerPort,listenerProtocol:options.listenerProtocol,loadBalancerArn:options.userOptions.loadBalancerArn,loadBalancerTags:cxschemaTags,loadBalancerType:options.loadBalancerType},dummyValue:{listenerArn:`arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/${options.loadBalancerType}/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2`,listenerPort:80,securityGroupIds:["sg-123456789012"]}}).value}constructor(scope,id,additionalProps){super(scope,id);const resource=new(elasticloadbalancingv2_generated_1()).CfnListener(this,"Resource",{...additionalProps,defaultActions:core_1().Lazy.any({produce:()=>this.defaultAction?.renderActions()??[]})});this.listenerArn=resource.ref,this.node.addValidation({validate:()=>this.validateListener()})}validateListener(){return this.defaultAction?[]:["Listener needs at least one default action or target group (call addTargetGroups or addAction)"]}_setDefaultAction(action){this.defaultAction&&core_1().Annotations.of(this).addWarningV2("@aws-cdk/aws-elbv2:listenerExistingDefaultActionReplaced","A default Action already existed on this Listener and was replaced. Configure exactly one default Action."),this.defaultAction=action}}exports.BaseListener=BaseListener,_a=JSII_RTTI_SYMBOL_1,BaseListener[_a]={fqn:"aws-cdk-lib.aws_elasticloadbalancingv2.BaseListener",version:"2.148.1"};
