Interface ListenerOptions

All Superinterfaces:
All Known Subinterfaces:
All Known Implementing Classes:
ListenerOptions.Jsii$Proxy, ListenerProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:45.532Z") @Stability(Stable) public interface ListenerOptions extends
Construct options for Listener.


 // 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()))
 // Import the Load Balancers
 INetworkLoadBalancer nlb1 = NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(this, "NLB1", NetworkLoadBalancerAttributes.builder()
 INetworkLoadBalancer nlb2 = NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(this, "NLB2", NetworkLoadBalancerAttributes.builder()
 // Add one EndpointGroup for each Region we are targeting
 listener.addEndpointGroup("Group1", EndpointGroupOptions.builder()
         .endpoints(List.of(new NetworkLoadBalancerEndpoint(nlb1)))
 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)))
  • 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()
      a ListenerOptions.Builder of ListenerOptions