@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-22T19:35:47.143Z") public class NetworkListener extends BaseListener implements INetworkListener
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();
Modifier and Type | Class and Description |
---|---|
static class |
NetworkListener.Builder
A fluent builder for
NetworkListener . |
INetworkListener.Jsii$Default, INetworkListener.Jsii$Proxy
Modifier | Constructor and Description |
---|---|
protected |
NetworkListener(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
NetworkListener(software.amazon.jsii.JsiiObjectRef objRef) |
|
NetworkListener(software.constructs.Construct scope,
java.lang.String id,
NetworkListenerProps props) |
Modifier and Type | Method and Description |
---|---|
void |
addAction(java.lang.String _id,
AddNetworkActionProps props)
Perform the given Action on incoming requests.
|
void |
addCertificates(java.lang.String id,
java.util.List<IListenerCertificate> certificates)
Add one or more certificates to this listener.
|
void |
addTargetGroups(java.lang.String _id,
INetworkTargetGroup... targetGroups)
Load balance incoming requests to the given target groups.
|
NetworkTargetGroup |
addTargets(java.lang.String id,
AddNetworkTargetsProps props)
Load balance incoming requests to the given load balancing targets.
|
static INetworkListener |
fromLookup(software.constructs.Construct scope,
java.lang.String id,
NetworkListenerLookupOptions options)
Looks up a network listener.
|
static INetworkListener |
fromNetworkListenerArn(software.constructs.Construct scope,
java.lang.String id,
java.lang.String networkListenerArn)
Import an existing listener.
|
INetworkLoadBalancer |
getLoadBalancer()
The load balancer this listener is attached to.
|
getListenerArn, validate
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getListenerArn
applyRemovalPolicy, getEnv, getStack
getNode
protected NetworkListener(software.amazon.jsii.JsiiObjectRef objRef)
protected NetworkListener(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public NetworkListener(software.constructs.Construct scope, java.lang.String id, NetworkListenerProps props)
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.public static INetworkListener fromLookup(software.constructs.Construct scope, java.lang.String id, NetworkListenerLookupOptions options)
scope
- This parameter is required.id
- This parameter is required.options
- This parameter is required.public static INetworkListener fromNetworkListenerArn(software.constructs.Construct scope, java.lang.String id, java.lang.String networkListenerArn)
scope
- This parameter is required.id
- This parameter is required.networkListenerArn
- This parameter is required.public void addAction(java.lang.String _id, AddNetworkActionProps props)
This allows full control of the default Action of the load balancer,
including weighted forwarding. See the NetworkListenerAction
class for
all options.
_id
- This parameter is required.props
- This parameter is required.public void addCertificates(java.lang.String id, java.util.List<IListenerCertificate> certificates)
After the first certificate, this creates NetworkListenerCertificates resources since cloudformation requires the certificates array on the listener resource to have a length of 1.
id
- This parameter is required.certificates
- This parameter is required.public void addTargetGroups(java.lang.String _id, INetworkTargetGroup... targetGroups)
All target groups will be load balanced to with equal weight and without
stickiness. For a more complex configuration than that, use addAction()
.
_id
- This parameter is required.targetGroups
- This parameter is required.public NetworkTargetGroup addTargets(java.lang.String id, AddNetworkTargetsProps props)
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.
id
- This parameter is required.props
- This parameter is required.public INetworkLoadBalancer getLoadBalancer()