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.104.0 (build e79254c)",
date="2024-11-21T06:34:08.884Z")
@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());
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forListenerOptionsstatic final classAn implementation forListenerOptions -
Method Summary
Modifier and TypeMethodDescriptionstatic ListenerOptions.Builderbuilder()default ClientAffinityClient affinity to direct all requests from a user to the same endpoint.default StringName of the listener.The list of port ranges for the connections from clients to the accelerator.default ConnectionProtocolThe protocol for the connections from clients to the accelerator.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getPortRanges
The list of port ranges for the connections from clients to the accelerator. -
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
Name of the listener.Default: - logical ID of the resource
-
getProtocol
The protocol for the connections from clients to the accelerator.Default: ConnectionProtocol.TCP
-
builder
- Returns:
- a
ListenerOptions.BuilderofListenerOptions
-