class NetworkListenerAction
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.ElasticLoadBalancingV2.NetworkListenerAction |
Java | software.amazon.awscdk.services.elasticloadbalancingv2.NetworkListenerAction |
Python | aws_cdk.aws_elasticloadbalancingv2.NetworkListenerAction |
TypeScript (source) | @aws-cdk/aws-elasticloadbalancingv2 » NetworkListenerAction |
Implements
IListener
What to do when a client makes a request to a listener.
Some actions can be combined with other ones (specifically, you can perform authentication before serving the request).
Multiple actions form a linked chain; the chain must always terminate in a (weighted)forward, fixedResponse or redirect action.
If an action supports chaining, the next action can be indicated
by passing it in the next
property.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2';
import * as cdk from '@aws-cdk/core';
declare const networkTargetGroup: elbv2.NetworkTargetGroup;
const networkListenerAction = elbv2.NetworkListenerAction.forward([networkTargetGroup], /* all optional props */ {
stickinessDuration: cdk.Duration.minutes(30),
});
Initializer (protected)
super(actionJson: ActionProperty, next?: NetworkListenerAction)
Parameters
- actionJson
Action
Property - next
Network
Listener Action
Create an instance of NetworkListenerAction.
The default class should be good enough for most cases and should be created by using one of the static factory functions, but allow overriding to make sure we allow flexibility for the future.
Properties
Name | Type | Description |
---|---|---|
next? | Network |
next?
Type:
Network
(optional)
Methods
Name | Description |
---|---|
bind(scope, listener) | Called when the action is being used in a listener. |
render | Render the actions in this chain. |
protected renumber(actions) | Renumber the "order" fields in the actions array. |
static forward(targetGroups, options?) | Forward to one or more Target Groups. |
static weighted | Forward to one or more Target Groups which are weighted differently. |
bind(scope, listener)
public bind(scope: Construct, listener: INetworkListener): void
Parameters
- scope
Construct
- listener
INetwork
Listener
Called when the action is being used in a listener.
Actions()
renderpublic renderActions(): ActionProperty[]
Returns
Render the actions in this chain.
protected renumber(actions)
protected renumber(actions: ActionProperty[]): ActionProperty[]
Parameters
- actions
Action
Property []
Returns
Renumber the "order" fields in the actions array.
We don't number for 0 or 1 elements, but otherwise number them 1...#actions so ELB knows about the right order.
Do this in NetworkListenerAction
instead of in Listener
so that we give
users the opportunity to override by subclassing and overriding renderActions
.
static forward(targetGroups, options?)
public static forward(targetGroups: INetworkTargetGroup[], options?: NetworkForwardOptions): NetworkListenerAction
Parameters
- targetGroups
INetwork
Target Group []
- options
Network
Forward Options
Returns
Forward to one or more Target Groups.
Forward(targetGroups, options?)
static weightedpublic static weightedForward(targetGroups: NetworkWeightedTargetGroup[], options?: NetworkForwardOptions): NetworkListenerAction
Parameters
- targetGroups
Network
Weighted Target Group []
- options
Network
Forward Options
Returns
Forward to one or more Target Groups which are weighted differently.