ListenerCondition

class aws_cdk.aws_elasticloadbalancingv2.ListenerCondition

Bases: object

ListenerCondition providers definition.

ExampleMetadata:

infused

Example:

# listener: elbv2.ApplicationListener
# asg: autoscaling.AutoScalingGroup


listener.add_targets("Example.Com Fleet",
    priority=10,
    conditions=[
        elbv2.ListenerCondition.host_headers(["example.com"]),
        elbv2.ListenerCondition.path_patterns(["/ok", "/path"])
    ],
    port=8080,
    targets=[asg]
)

Methods

abstract render_raw_condition()

Render the raw Cfn listener rule condition object.

Return type:

Any

Static Methods

classmethod host_headers(values)

Create a host-header listener rule condition.

Parameters:

values (Sequence[str]) – Hosts for host headers.

Return type:

ListenerCondition

classmethod http_header(name, values)

Create a http-header listener rule condition.

Parameters:
  • name (str) – HTTP header name.

  • values (Sequence[str]) – HTTP header values.

Return type:

ListenerCondition

classmethod http_request_methods(values)

Create a http-request-method listener rule condition.

Parameters:

values (Sequence[str]) – HTTP request methods.

Return type:

ListenerCondition

classmethod path_patterns(values)

Create a path-pattern listener rule condition.

Parameters:

values (Sequence[str]) – Path patterns.

Return type:

ListenerCondition

classmethod query_strings(values)

Create a query-string listener rule condition.

Parameters:

values (Sequence[Union[QueryStringCondition, Dict[str, Any]]]) – Query string key/value pairs.

Return type:

ListenerCondition

classmethod source_ips(values)

Create a source-ip listener rule condition.

Parameters:

values (Sequence[str]) – Source ips.

Return type:

ListenerCondition