ApplicationListenerRule

class aws_cdk.aws_elasticloadbalancingv2.ApplicationListenerRule(scope, id, *, listener, priority, action=None, conditions=None, target_groups=None)

Bases: Construct

Define a new listener rule.

ExampleMetadata:

fixture=_generated

Example:

# 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 = elbv2.ApplicationListenerRule(self, "MyApplicationListenerRule",
    listener=application_listener,
    priority=123,

    # the properties below are optional
    action=listener_action,
    conditions=[listener_condition],
    target_groups=[application_target_group]
)
Parameters:
  • scope (Construct) –

  • id (str) –

  • listener (IApplicationListener) – The listener to attach the rule to.

  • priority (Union[int, float]) – Priority of the rule. The rule with the lowest priority will be used for every request. Priorities must be unique.

  • action (Optional[ListenerAction]) – Action to perform when requests are received. Only one of action, fixedResponse, redirectResponse or targetGroups can be specified. Default: - No action

  • conditions (Optional[Sequence[ListenerCondition]]) – Rule applies if matches the conditions. Default: - No conditions.

  • target_groups (Optional[Sequence[IApplicationTargetGroup]]) – Target groups to forward requests to. Only one of action, fixedResponse, redirectResponse or targetGroups can be specified. Implies a forward action. Default: - No target groups.

Methods

add_condition(condition)

Add a non-standard condition to this rule.

Parameters:

condition (ListenerCondition) –

Return type:

None

configure_action(action)

Configure the action to perform for this rule.

Parameters:

action (ListenerAction) –

Return type:

None

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

listener_rule_arn

The ARN of this rule.

node

The tree node.

Static Methods

classmethod is_construct(x)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.