ApplicationListenerRule

class aws_cdk.aws_elasticloadbalancingv2.ApplicationListenerRule(scope, id, *, listener, priority, fixed_response=None, host_header=None, path_pattern=None, target_groups=None)

Bases: aws_cdk.core.Construct

Define a new listener rule.

__init__(scope, id, *, listener, priority, fixed_response=None, host_header=None, path_pattern=None, target_groups=None)
Parameters
  • scope (Construct) –

  • id (str) –

  • props

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

  • fixed_response (Optional[FixedResponse]) – Fixed response to return. Only one of fixedResponse or targetGroups can be specified. Default: - No fixed response.

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

  • path_pattern (Optional[str]) – Rule applies if the requested path matches the given path pattern. May contain up to three ‘*’ wildcards. Default: - No path condition.

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

Return type

None

Methods

add_fixed_response(*, status_code, content_type=None, message_body=None)

Add a fixed response.

Parameters
  • fixed_response

  • status_code (str) – The HTTP response code (2XX, 4XX or 5XX).

  • content_type (Optional[ContentType]) – The content type. Default: text/plain

  • message_body (Optional[str]) – The message. Default: no message

Return type

None

add_target_group(target_group)

Add a TargetGroup to load balance to.

Parameters

target_group (IApplicationTargetGroup) –

Return type

None

set_condition(field, values=None)

Add a non-standard condition to this rule.

Parameters
  • field (str) –

  • values (Optional[List[str]]) –

Return type

None

to_string()

Returns a string representation of this construct.

Return type

str

Attributes

listener_rule_arn

The ARN of this rule.

Return type

str

node

Construct tree node which offers APIs for interacting with the construct tree.

Return type

ConstructNode

Static Methods

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool