RoutingRuleCondition

class aws_cdk.aws_s3.RoutingRuleCondition(*, http_error_code_returned_equals=None, key_prefix_equals=None)

Bases: object

Parameters:
  • http_error_code_returned_equals (Optional[str]) – The HTTP error code when the redirect is applied. In the event of an error, if the error code equals this value, then the specified redirect is applied. If both condition properties are specified, both must be true for the redirect to be applied. Default: - The HTTP error code will not be verified

  • key_prefix_equals (Optional[str]) – The object key name prefix when the redirect is applied. If both condition properties are specified, both must be true for the redirect to be applied. Default: - The object key name will not be verified

ExampleMetadata:

infused

Example:

bucket = s3.Bucket(self, "MyRedirectedBucket",
    website_routing_rules=[s3.RoutingRule(
        host_name="www.example.com",
        http_redirect_code="302",
        protocol=s3.RedirectProtocol.HTTPS,
        replace_key=s3.ReplaceKey.prefix_with("test/"),
        condition=s3.RoutingRuleCondition(
            http_error_code_returned_equals="200",
            key_prefix_equals="prefix"
        )
    )]
)

Attributes

http_error_code_returned_equals

The HTTP error code when the redirect is applied.

In the event of an error, if the error code equals this value, then the specified redirect is applied.

If both condition properties are specified, both must be true for the redirect to be applied.

Default:
  • The HTTP error code will not be verified

key_prefix_equals

The object key name prefix when the redirect is applied.

If both condition properties are specified, both must be true for the redirect to be applied.

Default:
  • The object key name will not be verified