aws-cdk-lib.aws_elasticloadbalancingv2.NetworkListenerAction

class NetworkListenerAction

LanguageType name
.NETAmazon.CDK.AWS.ElasticLoadBalancingV2.NetworkListenerAction
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awselasticloadbalancingv2#NetworkListenerAction
Javasoftware.amazon.awscdk.services.elasticloadbalancingv2.NetworkListenerAction
Pythonaws_cdk.aws_elasticloadbalancingv2.NetworkListenerAction
TypeScript (source)aws-cdk-lib » aws_elasticloadbalancingv2 » NetworkListenerAction

Implements IListenerAction

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 cdk from 'aws-cdk-lib';
import { aws_elasticloadbalancingv2 as elbv2 } from 'aws-cdk-lib';

declare const networkTargetGroup: elbv2.NetworkTargetGroup;
const networkListenerAction = elbv2.NetworkListenerAction.forward([networkTargetGroup], /* all optional props */ {
  stickinessDuration: cdk.Duration.minutes(30),
});

Initializer (protected)

super(defaultActionJson: ActionProperty, next?: NetworkListenerAction)

Parameters

  • defaultActionJson ActionProperty
  • next NetworkListenerAction

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

NameTypeDescription
next?NetworkListenerAction

next?

Type: NetworkListenerAction (optional)

Methods

NameDescription
bind(scope, listener)Called when the action is being used in a listener.
renderActions()Render the listener default actions in this chain.
renderRuleActions()Render the listener rule 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 weightedForward(targetGroups, options?)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 INetworkListener

Called when the action is being used in a listener.


renderActions()

public renderActions(): ActionProperty[]

Returns

  • ActionProperty[]

Render the listener default actions in this chain.


renderRuleActions()

public renderRuleActions(): ActionProperty[]

Returns

  • ActionProperty[]

Render the listener rule actions in this chain.


protected renumber(actions)

protected renumber(actions: ActionProperty[]): ActionProperty[]

Parameters

  • actions ActionProperty[]

Returns

  • ActionProperty[]

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 INetworkTargetGroup[]
  • options NetworkForwardOptions

Returns

  • NetworkListenerAction

Forward to one or more Target Groups.


static weightedForward(targetGroups, options?)

public static weightedForward(targetGroups: NetworkWeightedTargetGroup[], options?: NetworkForwardOptions): NetworkListenerAction

Parameters

  • targetGroups NetworkWeightedTargetGroup[]
  • options NetworkForwardOptions

Returns

  • NetworkListenerAction

Forward to one or more Target Groups which are weighted differently.