ApplicationListenerRuleProps

class aws_cdk.aws_elasticloadbalancingv2.ApplicationListenerRuleProps(*, priority, action=None, conditions=None, fixed_response=None, host_header=None, path_pattern=None, path_patterns=None, redirect_response=None, target_groups=None, listener)

Bases: BaseApplicationListenerRuleProps

Properties for defining a listener rule.

Parameters:
  • 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.

  • fixed_response (Union[FixedResponse, Dict[str, Any], None]) – (deprecated) Fixed response to return. Only one of action, fixedResponse, redirectResponse or targetGroups can be specified. Default: - No fixed response.

  • host_header (Optional[str]) – (deprecated) Rule applies if the requested host matches the indicated host. May contain up to three ‘*’ wildcards. Default: - No host condition.

  • path_pattern (Optional[str]) – (deprecated) Rule applies if the requested path matches the given path pattern. Default: - No path condition.

  • path_patterns (Optional[Sequence[str]]) – (deprecated) Rule applies if the requested path matches any of the given patterns. Paths may contain up to three ‘*’ wildcards. Default: - No path conditions.

  • redirect_response (Union[RedirectResponse, Dict[str, Any], None]) – (deprecated) Redirect response to return. Only one of action, fixedResponse, redirectResponse or targetGroups can be specified. Default: - No redirect response.

  • 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.

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

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.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],
    fixed_response=elbv2.FixedResponse(
        status_code="statusCode",

        # the properties below are optional
        content_type=elbv2.ContentType.TEXT_PLAIN,
        message_body="messageBody"
    ),
    host_header="hostHeader",
    path_pattern="pathPattern",
    path_patterns=["pathPatterns"],
    redirect_response=elbv2.RedirectResponse(
        status_code="statusCode",

        # the properties below are optional
        host="host",
        path="path",
        port="port",
        protocol="protocol",
        query="query"
    ),
    target_groups=[application_target_group]
)

Attributes

action

Action to perform when requests are received.

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

Default:
  • No action

conditions

Rule applies if matches the conditions.

Default:
  • No conditions.

See:

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

fixed_response

(deprecated) Fixed response to return.

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

Default:
  • No fixed response.

Deprecated:

Use action instead.

Stability:

deprecated

host_header

(deprecated) Rule applies if the requested host matches the indicated host.

May contain up to three ‘*’ wildcards.

Default:
  • No host condition.

Deprecated:

Use conditions instead.

See:

https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html#host-conditions

Stability:

deprecated

listener

The listener to attach the rule to.

path_pattern

(deprecated) Rule applies if the requested path matches the given path pattern.

Default:
  • No path condition.

Deprecated:

Use conditions instead.

See:

https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html#path-conditions

Stability:

deprecated

path_patterns

(deprecated) Rule applies if the requested path matches any of the given patterns.

Paths may contain up to three ‘*’ wildcards.

Default:
  • No path conditions.

Deprecated:

Use conditions instead.

See:

https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html#path-conditions

Stability:

deprecated

priority

Priority of the rule.

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

Priorities must be unique.

redirect_response

(deprecated) Redirect response to return.

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

Default:
  • No redirect response.

Deprecated:

Use action instead.

Stability:

deprecated

target_groups

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.