Class NetworkListener
- All Implemented Interfaces:
IConstruct,IDependable,IResource,INetworkListener,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct
Example:
import software.amazon.awscdk.services.apigatewayv2.integrations.HttpNlbIntegration;
Vpc vpc = new Vpc(this, "VPC");
NetworkLoadBalancer lb = NetworkLoadBalancer.Builder.create(this, "lb").vpc(vpc).build();
NetworkListener listener = lb.addListener("listener", BaseNetworkListenerProps.builder().port(80).build());
listener.addTargets("target", AddNetworkTargetsProps.builder()
.port(80)
.build());
HttpApi httpEndpoint = HttpApi.Builder.create(this, "HttpProxyPrivateApi")
.defaultIntegration(new HttpNlbIntegration("DefaultIntegration", listener))
.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.amazon.awscdk.core.IConstruct
IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.elasticloadbalancingv2.INetworkListener
INetworkListener.Jsii$Default, INetworkListener.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.core.IResource
IResource.Jsii$Default -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNetworkListener(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedNetworkListener(software.amazon.jsii.JsiiObjectRef objRef) NetworkListener(software.constructs.Construct scope, String id, NetworkListenerProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAction(String _id, AddNetworkActionProps props) Perform the given Action on incoming requests.voidaddCertificates(String id, List<IListenerCertificate> certificates) Add one or more certificates to this listener.voidaddTargetGroups(String _id, @NotNull INetworkTargetGroup... targetGroups) Load balance incoming requests to the given target groups.addTargets(String id, AddNetworkTargetsProps props) Load balance incoming requests to the given load balancing targets.static INetworkListenerfromLookup(software.constructs.Construct scope, String id, NetworkListenerLookupOptions options) Looks up a network listener.static INetworkListenerfromNetworkListenerArn(software.constructs.Construct scope, String id, String networkListenerArn) Import an existing listener.The load balancer this listener is attached to.Methods inherited from class software.amazon.awscdk.services.elasticloadbalancingv2.BaseListener
getListenerArn, validateMethods inherited from class software.amazon.awscdk.core.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResourceMethods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesizeMethods inherited from class software.constructs.Construct
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.amazon.awscdk.core.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.services.elasticloadbalancingv2.INetworkListener
getListenerArnMethods inherited from interface software.amazon.awscdk.core.IResource
applyRemovalPolicy, getEnv, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
NetworkListener
protected NetworkListener(software.amazon.jsii.JsiiObjectRef objRef) -
NetworkListener
protected NetworkListener(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
NetworkListener
@Stability(Stable) public NetworkListener(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull NetworkListenerProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
fromLookup
@Stability(Stable) @NotNull public static INetworkListener fromLookup(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull NetworkListenerLookupOptions options) Looks up a network listener.- Parameters:
scope- This parameter is required.id- This parameter is required.options- This parameter is required.
-
fromNetworkListenerArn
@Stability(Stable) @NotNull public static INetworkListener fromNetworkListenerArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String networkListenerArn) Import an existing listener.- Parameters:
scope- This parameter is required.id- This parameter is required.networkListenerArn- This parameter is required.
-
addAction
Perform the given Action on incoming requests.This allows full control of the default Action of the load balancer, including weighted forwarding. See the
NetworkListenerActionclass for all options.- Parameters:
_id- This parameter is required.props- This parameter is required.
-
addCertificates
@Stability(Stable) public void addCertificates(@NotNull String id, @NotNull List<IListenerCertificate> certificates) Add one or more certificates to this listener.After the first certificate, this creates NetworkListenerCertificates resources since cloudformation requires the certificates array on the listener resource to have a length of 1.
- Parameters:
id- This parameter is required.certificates- This parameter is required.
-
addTargetGroups
@Stability(Stable) public void addTargetGroups(@NotNull String _id, @NotNull @NotNull INetworkTargetGroup... targetGroups) Load balance incoming requests to the given target groups.All target groups will be load balanced to with equal weight and without stickiness. For a more complex configuration than that, use
addAction().- Parameters:
_id- This parameter is required.targetGroups- This parameter is required.
-
addTargets
@Stability(Stable) @NotNull public NetworkTargetGroup addTargets(@NotNull String id, @NotNull AddNetworkTargetsProps props) Load balance incoming requests to the given load balancing targets.This method implicitly creates a NetworkTargetGroup for the targets involved, and a 'forward' action to route traffic to the given TargetGroup.
If you want more control over the precise setup, create the TargetGroup and use
addActionyourself.It's possible to add conditions to the targets added in this way. At least one set of targets must be added without conditions.
- Parameters:
id- This parameter is required.props- This parameter is required.- Returns:
- The newly created target group
-
getLoadBalancer
The load balancer this listener is attached to.
-