@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:39.517Z") @Stability(value=Stable) public class Listener extends Resource implements IListener
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());
| Modifier and Type | Class and Description |
|---|---|
static class |
Listener.Builder
A fluent builder for
Listener. |
software.amazon.jsii.JsiiObject.InitializationModeIListener.Jsii$Default, IListener.Jsii$Proxy| Modifier | Constructor and Description |
|---|---|
|
Listener(software.constructs.Construct scope,
String id,
ListenerProps props) |
protected |
Listener(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Listener(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
EndpointGroup |
addEndpointGroup(String id)
Add a new endpoint group to this listener.
|
EndpointGroup |
addEndpointGroup(String id,
EndpointGroupOptions options)
Add a new endpoint group to this listener.
|
static IListener |
fromListenerArn(software.constructs.Construct scope,
String id,
String listenerArn)
import from ARN.
|
String |
getListenerArn()
The ARN of the listener.
|
String |
getListenerName()
The name of the listener.
|
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourcejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitapplyRemovalPolicy, getEnv, getStackprotected Listener(software.amazon.jsii.JsiiObjectRef objRef)
protected Listener(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public Listener(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
ListenerProps props)
scope - This parameter is required.id - This parameter is required.props - This parameter is required.@Stability(value=Stable) @NotNull public static IListener fromListenerArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String listenerArn)
scope - This parameter is required.id - This parameter is required.listenerArn - This parameter is required.@Stability(value=Stable) @NotNull public EndpointGroup addEndpointGroup(@NotNull String id, @Nullable EndpointGroupOptions options)
id - This parameter is required.options - @Stability(value=Stable) @NotNull public EndpointGroup addEndpointGroup(@NotNull String id)
id - This parameter is required.@Stability(value=Stable) @NotNull public String getListenerArn()
getListenerArn in interface IListener@Stability(value=Stable) @NotNull public String getListenerName()
Copyright © 2022. All rights reserved.