Skip to content
v2.278.0

ApplicationListenerRuleProps Struct ​

Properties for defining a listener rule.

Example ​

ts
// 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 applicationListenerRuleProps: elbv2.ApplicationListenerRuleProps = {
  listener: applicationListener,
  priority: 123,

  // the properties below are optional
  action: listenerAction,
  conditions: [listenerCondition],
  targetGroups: [applicationTargetGroup],
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_elasticloadbalancingv2 as elbv2

# application_listener: elbv2.ApplicationListener
# application_target_group: elbv2.ApplicationTargetGroup
# listener_action: elbv2.ListenerAction
# listener_condition: elbv2.ListenerCondition

application_listener_rule_props = elbv2.ApplicationListenerRuleProps(
    listener=application_listener,
    priority=123,

    # the properties below are optional
    action=listener_action,
    conditions=[listener_condition],
    target_groups=[application_target_group]
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.elasticloadbalancingv2.*;

ApplicationListener applicationListener;
ApplicationTargetGroup applicationTargetGroup;
ListenerAction listenerAction;
ListenerCondition listenerCondition;

ApplicationListenerRuleProps applicationListenerRuleProps = ApplicationListenerRuleProps.builder()
        .listener(applicationListener)
        .priority(123)

        // the properties below are optional
        .action(listenerAction)
        .conditions(List.of(listenerCondition))
        .targetGroups(List.of(applicationTargetGroup))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ElasticLoadBalancingV2;

ApplicationListener applicationListener;
ApplicationTargetGroup applicationTargetGroup;
ListenerAction listenerAction;
ListenerCondition listenerCondition;

var applicationListenerRuleProps = new ApplicationListenerRuleProps {
    Listener = applicationListener,
    Priority = 123,

    // the properties below are optional
    Action = listenerAction,
    Conditions = new [] { listenerCondition },
    TargetGroups = new [] { applicationTargetGroup }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var applicationListener ApplicationListener
var applicationTargetGroup ApplicationTargetGroup
var listenerAction ListenerAction
var listenerCondition ListenerCondition

applicationListenerRuleProps := &ApplicationListenerRuleProps{
	Listener: applicationListener,
	Priority: jsii.Number(123),

	// the properties below are optional
	Action: listenerAction,
	Conditions: []ListenerCondition{
		listenerCondition,
	},
	TargetGroups: []IApplicationTargetGroup{
		applicationTargetGroup,
	},
}

Properties ​

actionoptionalListenerActionactionoptionalListenerActionactionoptionalListenerActionActionoptionalListenerActionActionoptionalListenerAction #
Action to perform when requests are received.

Default: No action

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

conditionsoptionalListenerCondition[]conditionsoptionaltyping.List[ListenerCondition]conditionsoptionalList<ListenerCondition>ConditionsoptionalListenerCondition[]Conditionsoptional*[]ListenerCondition #
Rule applies if matches the conditions.

Default: No conditions.

The listener to attach the rule to.
prioritynumberpriorityint | floatpriorityNumberPrioritydoublePriority*float64 required #
Priority of the rule.

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

Priorities must be unique.

targetGroupsoptionalIApplicationTargetGroup[]target_groupsoptionaltyping.List[IApplicationTargetGroup]targetGroupsoptionalList<IApplicationTargetGroup>TargetGroupsoptionalIApplicationTargetGroup[]TargetGroupsoptional*[]IApplicationTargetGroup #
Target groups to forward requests to.

Default: No target groups.

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

Implies a forward action.