Class: AWSCDK::CloudFront::ErrorResponse
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::CloudFront::ErrorResponse
- Defined in:
- cloud_front/error_response.rb
Overview
Options for configuring custom error responses.
Instance Attribute Summary collapse
-
#http_status ⇒ Numeric
readonly
The HTTP status code for which you want to specify a custom error page and/or a caching duration.
-
#response_http_status ⇒ Numeric?
readonly
The HTTP status code that you want CloudFront to return to the viewer along with the custom error page.
-
#response_page_path ⇒ String?
readonly
The path to the custom error page that you want CloudFront to return to a viewer when your origin returns the
httpStatus, for example, /4xx-errors/403-forbidden.html. -
#ttl ⇒ AWSCDK::Duration?
readonly
The minimum amount of time, in seconds, that you want CloudFront to cache the HTTP status code specified in ErrorCode.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(http_status:, response_http_status: nil, response_page_path: nil, ttl: nil) ⇒ ErrorResponse
constructor
A new instance of ErrorResponse.
- #to_jsii ⇒ Object
Constructor Details
#initialize(http_status:, response_http_status: nil, response_page_path: nil, ttl: nil) ⇒ ErrorResponse
Returns a new instance of ErrorResponse.
11 12 13 14 15 16 17 18 19 20 |
# File 'cloud_front/error_response.rb', line 11 def initialize(http_status:, response_http_status: nil, response_page_path: nil, ttl: nil) @http_status = http_status Jsii::Type.check_type(@http_status, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "httpStatus") @response_http_status = response_http_status Jsii::Type.check_type(@response_http_status, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "responseHttpStatus") unless @response_http_status.nil? @response_page_path = response_page_path Jsii::Type.check_type(@response_page_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "responsePagePath") unless @response_page_path.nil? @ttl = ttl Jsii::Type.check_type(@ttl, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "ttl") unless @ttl.nil? end |
Instance Attribute Details
#http_status ⇒ Numeric (readonly)
The HTTP status code for which you want to specify a custom error page and/or a caching duration.
25 26 27 |
# File 'cloud_front/error_response.rb', line 25 def http_status @http_status end |
#response_http_status ⇒ Numeric? (readonly)
Default: - the error code will be returned as the response code.
The HTTP status code that you want CloudFront to return to the viewer along with the custom error page.
If you specify a value for response_http_status, you must also specify a value for response_page_path.
32 33 34 |
# File 'cloud_front/error_response.rb', line 32 def response_http_status @response_http_status end |
#response_page_path ⇒ String? (readonly)
Default: - the default CloudFront response is shown.
The path to the custom error page that you want CloudFront to return to a viewer when your origin returns the httpStatus, for example, /4xx-errors/403-forbidden.html.
37 38 39 |
# File 'cloud_front/error_response.rb', line 37 def response_page_path @response_page_path end |
#ttl ⇒ AWSCDK::Duration? (readonly)
Default: - the default caching TTL behavior applies
The minimum amount of time, in seconds, that you want CloudFront to cache the HTTP status code specified in ErrorCode.
42 43 44 |
# File 'cloud_front/error_response.rb', line 42 def ttl @ttl end |
Class Method Details
.jsii_properties ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'cloud_front/error_response.rb', line 44 def self.jsii_properties { :http_status => "httpStatus", :response_http_status => "responseHttpStatus", :response_page_path => "responsePagePath", :ttl => "ttl", } end |
Instance Method Details
#to_jsii ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'cloud_front/error_response.rb', line 53 def to_jsii result = {} result.merge!({ "httpStatus" => @http_status, "responseHttpStatus" => @response_http_status, "responsePagePath" => @response_page_path, "ttl" => @ttl, }) result.compact end |