aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationListenerRule

class ApplicationListenerRule (construct)

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

Implements IConstruct, IDependable

Define a new listener rule.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_elasticloadbalancingv2 as elbv2 } from 'aws-cdk-lib';

declare const applicationListener: elbv2.ApplicationListener;
declare const applicationTargetGroup: elbv2.ApplicationTargetGroup;
declare const listenerAction: elbv2.ListenerAction;
declare const listenerCondition: elbv2.ListenerCondition;
const applicationListenerRule = new elbv2.ApplicationListenerRule(this, 'MyApplicationListenerRule', {
  listener: applicationListener,
  priority: 123,

  // the properties below are optional
  action: listenerAction,
  conditions: [listenerCondition],
  targetGroups: [applicationTargetGroup],
});

Initializer

new ApplicationListenerRule(scope: Construct, id: string, props: ApplicationListenerRuleProps)

Parameters

  • scope Construct
  • id string
  • props ApplicationListenerRuleProps

Construct Props

NameTypeDescription
listenerIApplicationListenerThe listener to attach the rule to.
prioritynumberPriority of the rule.
action?ListenerActionAction to perform when requests are received.
conditions?ListenerCondition[]Rule applies if matches the conditions.
targetGroups?IApplicationTargetGroup[]Target groups to forward requests to.

listener

Type: IApplicationListener

The listener to attach the rule to.


priority

Type: number

Priority of the rule.

The rule with the lowest priority will be used for every request.

Priorities must be unique.


action?

Type: ListenerAction (optional, default: No action)

Action to perform when requests are received.

Only one of action, fixedResponse, redirectResponse or targetGroups can be specified.


conditions?

Type: ListenerCondition[] (optional, default: No conditions.)

Rule applies if matches the conditions.

See also: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html


targetGroups?

Type: IApplicationTargetGroup[] (optional, default: No target groups.)

Target groups to forward requests to.

Only one of action, fixedResponse, redirectResponse or targetGroups can be specified.

Implies a forward action.

Properties

NameTypeDescription
listenerRuleArnstringThe ARN of this rule.
nodeNodeThe tree node.

listenerRuleArn

Type: string

The ARN of this rule.


node

Type: Node

The tree node.

Methods

NameDescription
addCondition(condition)Add a non-standard condition to this rule.
configureAction(action)Configure the action to perform for this rule.
toString()Returns a string representation of this construct.

addCondition(condition)

public addCondition(condition: ListenerCondition): void

Parameters

  • condition ListenerCondition

Add a non-standard condition to this rule.


configureAction(action)

public configureAction(action: ListenerAction): void

Parameters

  • action ListenerAction

Configure the action to perform for this rule.


toString()

public toString(): string

Returns

  • string

Returns a string representation of this construct.