Class NetworkListener
- All Implemented Interfaces:
IResource
,IListener
,INetworkListener
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
Example:
import software.amazon.awscdk.aws_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.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.elasticloadbalancingv2.IListener
IListener.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.elasticloadbalancingv2.INetworkListener
INetworkListener.Jsii$Default, INetworkListener.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
NetworkListener
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
NetworkListener
(software.amazon.jsii.JsiiObjectRef objRef) NetworkListener
(software.constructs.Construct scope, String id, NetworkListenerProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAction
(String _id, AddNetworkActionProps props) Perform the given Action on incoming requests.void
addCertificates
(String id, List<IListenerCertificate> certificates) Add one or more certificates to this listener.void
addTargetGroups
(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 INetworkListener
fromLookup
(software.constructs.Construct scope, String id, NetworkListenerLookupOptions options) Looks up a network listener.static INetworkListener
fromNetworkListenerArn
(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, removeAttribute, setAttribute, setAttribute, validateListener
Methods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResource
Methods inherited from class software.constructs.Construct
getNode, isConstruct, toString
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.constructs.IConstruct
getNode
Methods inherited from interface software.amazon.awscdk.services.elasticloadbalancingv2.IListener
getListenerArn
Methods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getEnv, getStack
Methods 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
NetworkListenerAction
class 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
addAction
yourself.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.
-