Interface ListenerOptions

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Subinterfaces:
ListenerProps
All Known Implementing Classes:
ListenerOptions.Jsii$Proxy, ListenerProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-08T21:35:07.779Z") @Stability(Stable) public interface ListenerOptions extends software.amazon.jsii.JsiiSerializable
Construct options for Listener.

Example:

 // Create an Accelerator
 Accelerator accelerator = new Accelerator(this, "Accelerator");
 // Create a Listener
 Listener listener = accelerator.addListener("Listener", ListenerOptions.builder()
         .portRanges(List.of(PortRange.builder().fromPort(80).build(), PortRange.builder().fromPort(443).build()))
         .build());
 // Import the Load Balancers
 INetworkLoadBalancer nlb1 = NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(this, "NLB1", NetworkLoadBalancerAttributes.builder()
         .loadBalancerArn("arn:aws:elasticloadbalancing:us-west-2:111111111111:loadbalancer/app/my-load-balancer1/e16bef66805b")
         .build());
 INetworkLoadBalancer nlb2 = NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(this, "NLB2", NetworkLoadBalancerAttributes.builder()
         .loadBalancerArn("arn:aws:elasticloadbalancing:ap-south-1:111111111111:loadbalancer/app/my-load-balancer2/5513dc2ea8a1")
         .build());
 // Add one EndpointGroup for each Region we are targeting
 listener.addEndpointGroup("Group1", EndpointGroupOptions.builder()
         .endpoints(List.of(new NetworkLoadBalancerEndpoint(nlb1)))
         .build());
 listener.addEndpointGroup("Group2", EndpointGroupOptions.builder()
         // Imported load balancers automatically calculate their Region from the ARN.
         // If you are load balancing to other resources, you must also pass a `region`
         // parameter here.
         .endpoints(List.of(new NetworkLoadBalancerEndpoint(nlb2)))
         .build());
 
  • Method Details

    • getPortRanges

      @Stability(Stable) @NotNull List<PortRange> getPortRanges()
      The list of port ranges for the connections from clients to the accelerator.
    • getClientAffinity

      @Stability(Stable) @Nullable default ClientAffinity getClientAffinity()
      Client affinity to direct all requests from a user to the same endpoint.

      If you have stateful applications, client affinity lets you direct all requests from a user to the same endpoint.

      By default, each connection from each client is routed to seperate endpoints. Set client affinity to SOURCE_IP to route all connections from a single client to the same endpoint.

      Default: ClientAffinity.NONE

    • getListenerName

      @Stability(Stable) @Nullable default String getListenerName()
      Name of the listener.

      Default: - logical ID of the resource

    • getProtocol

      @Stability(Stable) @Nullable default ConnectionProtocol getProtocol()
      The protocol for the connections from clients to the accelerator.

      Default: ConnectionProtocol.TCP

    • builder

      @Stability(Stable) static ListenerOptions.Builder builder()
      Returns:
      a ListenerOptions.Builder of ListenerOptions