aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
93 lines (92 loc) • 3.33 kB
TypeScript
import { Construct } from 'constructs';
import { INetworkListener } from './network-listener';
import { INetworkTargetGroup } from './network-target-group';
import { Duration } from '../../../core';
import { CfnListener, CfnListenerRule } from '../elasticloadbalancingv2.generated';
import { IListenerAction } from '../shared/listener-action';
/**
* 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.
*/
export declare class NetworkListenerAction implements IListenerAction {
private readonly defaultActionJson;
protected readonly next?: NetworkListenerAction | undefined;
/**
* Forward to one or more Target Groups
*/
static forward(targetGroups: INetworkTargetGroup[], options?: NetworkForwardOptions): NetworkListenerAction;
/**
* Forward to one or more Target Groups which are weighted differently
*/
static weightedForward(targetGroups: NetworkWeightedTargetGroup[], options?: NetworkForwardOptions): NetworkListenerAction;
private _actionJson?;
/**
* 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.
*/
protected constructor(defaultActionJson: CfnListener.ActionProperty, next?: NetworkListenerAction | undefined);
/**
* Render the listener rule actions in this chain
*/
renderRuleActions(): CfnListenerRule.ActionProperty[];
/**
* Render the listener default actions in this chain
*/
renderActions(): CfnListener.ActionProperty[];
/**
* Called when the action is being used in a listener
*/
bind(scope: Construct, listener: INetworkListener): void;
private _renumber;
/**
* 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`.
*/
protected renumber(actions: CfnListener.ActionProperty[]): CfnListener.ActionProperty[];
}
/**
* Options for `NetworkListenerAction.forward()`
*/
export interface NetworkForwardOptions {
/**
* For how long clients should be directed to the same target group
*
* Range between 1 second and 7 days.
*
* @default - No stickiness
*/
readonly stickinessDuration?: Duration;
}
/**
* A Target Group and weight combination
*/
export interface NetworkWeightedTargetGroup {
/**
* The target group
*/
readonly targetGroup: INetworkTargetGroup;
/**
* The target group's weight
*
* Range is [0..1000).
*
* @default 1
*/
readonly weight?: number;
}