Class: AWSCDK::WAFv2::CfnRuleGroup::CustomResponseProperty
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::WAFv2::CfnRuleGroup::CustomResponseProperty
- Defined in:
- wa_fv2/cfn_rule_group.rb
Overview
A custom response to send to the client.
You can define a custom response for rule actions and default web ACL actions that are set to Block .
For information about customizing web requests and responses, see Customizing web requests and responses in AWS WAF in the AWS WAF developer guide .
Instance Attribute Summary collapse
-
#custom_response_body_key ⇒ String?
readonly
References the response body that you want AWS WAF to return to the web request client.
-
#response_code ⇒ Numeric
readonly
The HTTP status code to return to the client.
-
#response_headers ⇒ AWSCDK::IResolvable, ...
readonly
The HTTP headers to use in the response.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(response_code:, custom_response_body_key: nil, response_headers: nil) ⇒ CustomResponseProperty
constructor
A new instance of CustomResponseProperty.
- #to_jsii ⇒ Object
Constructor Details
#initialize(response_code:, custom_response_body_key: nil, response_headers: nil) ⇒ CustomResponseProperty
Returns a new instance of CustomResponseProperty.
1469 1470 1471 1472 1473 1474 1475 1476 |
# File 'wa_fv2/cfn_rule_group.rb', line 1469 def initialize(response_code:, custom_response_body_key: nil, response_headers: nil) @response_code = response_code Jsii::Type.check_type(@response_code, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "responseCode") @custom_response_body_key = custom_response_body_key Jsii::Type.check_type(@custom_response_body_key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "customResponseBodyKey") unless @custom_response_body_key.nil? @response_headers = response_headers Jsii::Type.check_type(@response_headers, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfd2FmdjIuQ2ZuUnVsZUdyb3VwLkN1c3RvbUhUVFBIZWFkZXJQcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "responseHeaders") unless @response_headers.nil? end |
Instance Attribute Details
#custom_response_body_key ⇒ String? (readonly)
References the response body that you want AWS WAF to return to the web request client.
You can define a custom response for a rule action or a default web ACL action that is set to block. To do this, you first define the response body key and value in the CustomResponseBodies setting for the WebACL or RuleGroup where you want to use it. Then, in the rule action or web ACL default action BlockAction setting, you reference the response body using this key.
1491 1492 1493 |
# File 'wa_fv2/cfn_rule_group.rb', line 1491 def custom_response_body_key @custom_response_body_key end |
#response_code ⇒ Numeric (readonly)
The HTTP status code to return to the client.
For a list of status codes that you can use in your custom responses, see Supported status codes for custom response in the AWS WAF Developer Guide .
1484 1485 1486 |
# File 'wa_fv2/cfn_rule_group.rb', line 1484 def response_code @response_code end |
#response_headers ⇒ AWSCDK::IResolvable, ... (readonly)
The HTTP headers to use in the response.
You can specify any header name except for content-type . Duplicate header names are not allowed.
For information about the limits on count and size for custom request and response settings, see AWS WAF quotas in the AWS WAF Developer Guide .
1500 1501 1502 |
# File 'wa_fv2/cfn_rule_group.rb', line 1500 def response_headers @response_headers end |
Class Method Details
.jsii_properties ⇒ Object
1502 1503 1504 1505 1506 1507 1508 |
# File 'wa_fv2/cfn_rule_group.rb', line 1502 def self.jsii_properties { :response_code => "responseCode", :custom_response_body_key => "customResponseBodyKey", :response_headers => "responseHeaders", } end |
Instance Method Details
#to_jsii ⇒ Object
1510 1511 1512 1513 1514 1515 1516 1517 1518 |
# File 'wa_fv2/cfn_rule_group.rb', line 1510 def to_jsii result = {} result.merge!({ "responseCode" => @response_code, "customResponseBodyKey" => @custom_response_body_key, "responseHeaders" => @response_headers, }) result.compact end |