FixedResponseOptions

class aws_cdk.aws_elasticloadbalancingv2.FixedResponseOptions(*, content_type=None, message_body=None)

Bases: object

Options for ListenerAction.fixedResponse().

Parameters
  • content_type (Optional[str]) – Content Type of the response. Valid Values: text/plain | text/css | text/html | application/javascript | application/json Default: - Automatically determined

  • message_body (Optional[str]) – The response body. Default: - No body

ExampleMetadata

infused

Example:

# listener is of type ApplicationListener


listener.add_action("Fixed",
    priority=10,
    conditions=[
        elbv2.ListenerCondition.path_patterns(["/ok"])
    ],
    action=elbv2.ListenerAction.fixed_response(200,
        content_type=elbv2.ContentType.TEXT_PLAIN,
        message_body="OK"
    )
)

Attributes

content_type

Content Type of the response.

Valid Values: text/plain | text/css | text/html | application/javascript | application/json

Default
  • Automatically determined

Return type

Optional[str]

message_body

The response body.

Default
  • No body

Return type

Optional[str]