Class Listener
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.globalaccelerator.Listener
- All Implemented Interfaces:
IResource,IListener,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.104.0 (build e79254c)",
date="2024-11-21T06:34:08.884Z")
@Stability(Stable)
public class Listener
extends Resource
implements IListener
The construct for the 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 ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.globalaccelerator.IListener
IListener.Jsii$Default, IListener.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedListener(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedListener(software.amazon.jsii.JsiiObjectRef objRef) Listener(software.constructs.Construct scope, String id, ListenerProps props) -
Method Summary
Modifier and TypeMethodDescriptionAdd a new endpoint group to this listener.addEndpointGroup(String id, EndpointGroupOptions options) Add a new endpoint group to this listener.static IListenerfromListenerArn(software.constructs.Construct scope, String id, String listenerArn) import from ARN.The ARN of the listener.The name of the listener.Methods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourceMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getEnv, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
Listener
protected Listener(software.amazon.jsii.JsiiObjectRef objRef) -
Listener
protected Listener(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
Listener
@Stability(Stable) public Listener(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull ListenerProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
fromListenerArn
@Stability(Stable) @NotNull public static IListener fromListenerArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String listenerArn) import from ARN.- Parameters:
scope- This parameter is required.id- This parameter is required.listenerArn- This parameter is required.
-
addEndpointGroup
@Stability(Stable) @NotNull public EndpointGroup addEndpointGroup(@NotNull String id, @Nullable EndpointGroupOptions options) Add a new endpoint group to this listener.- Parameters:
id- This parameter is required.options-
-
addEndpointGroup
Add a new endpoint group to this listener.- Parameters:
id- This parameter is required.
-
getListenerArn
The ARN of the listener.- Specified by:
getListenerArnin interfaceIListener
-
getListenerName
The name of the listener.
-