Class: AWSCDK::APIGateway::IntegrationResponse
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::APIGateway::IntegrationResponse
- Defined in:
- api_gateway/integration_response.rb
Instance Attribute Summary collapse
-
#content_handling ⇒ AWSCDK::APIGateway::ContentHandling?
readonly
Specifies how to handle request payload content type conversions.
-
#response_parameters ⇒ Hash{String => String}?
readonly
The response parameters from the backend response that API Gateway sends to the method response.
-
#response_templates ⇒ Hash{String => String}?
readonly
The templates that are used to transform the integration response body.
-
#selection_pattern ⇒ String?
readonly
Specifies the regular expression (regex) pattern used to choose an integration response based on the response from the back end.
-
#status_code ⇒ String
readonly
The status code that API Gateway uses to map the integration response to a MethodResponse status code.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(status_code:, content_handling: nil, response_parameters: nil, response_templates: nil, selection_pattern: nil) ⇒ IntegrationResponse
constructor
A new instance of IntegrationResponse.
- #to_jsii ⇒ Object
Constructor Details
#initialize(status_code:, content_handling: nil, response_parameters: nil, response_templates: nil, selection_pattern: nil) ⇒ IntegrationResponse
Returns a new instance of IntegrationResponse.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'api_gateway/integration_response.rb', line 11 def initialize(status_code:, content_handling: nil, response_parameters: nil, response_templates: nil, selection_pattern: nil) @status_code = status_code Jsii::Type.check_type(@status_code, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "statusCode") @content_handling = content_handling Jsii::Type.check_type(@content_handling, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5Db250ZW50SGFuZGxpbmcifQ==")), "contentHandling") unless @content_handling.nil? @response_parameters = response_parameters Jsii::Type.check_type(@response_parameters, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "responseParameters") unless @response_parameters.nil? @response_templates = response_templates Jsii::Type.check_type(@response_templates, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "responseTemplates") unless @response_templates.nil? @selection_pattern = selection_pattern Jsii::Type.check_type(@selection_pattern, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "selectionPattern") unless @selection_pattern.nil? end |
Instance Attribute Details
#content_handling ⇒ AWSCDK::APIGateway::ContentHandling? (readonly)
Default: none the request payload is passed through from the method request to the integration request without modification.
Specifies how to handle request payload content type conversions.
32 33 34 |
# File 'api_gateway/integration_response.rb', line 32 def content_handling @content_handling end |
#response_parameters ⇒ Hash{String => String}? (readonly)
The response parameters from the backend response that API Gateway sends to the method response.
Use the destination as the key and the source as the value:
- The destination must be an existing response parameter in the MethodResponse property.
- The source must be an existing method request parameter or a static value. You must enclose static values in single quotation marks and pre-encode these values based on the destination specified in the request.
46 47 48 |
# File 'api_gateway/integration_response.rb', line 46 def response_parameters @response_parameters end |
#response_templates ⇒ Hash{String => String}? (readonly)
The templates that are used to transform the integration response body.
Specify templates as key-value pairs, with a content type as the key and a template as the value.
54 55 56 |
# File 'api_gateway/integration_response.rb', line 54 def response_templates @response_templates end |
#selection_pattern ⇒ String? (readonly)
Specifies the regular expression (regex) pattern used to choose an integration response based on the response from the back end.
For example, if the success response returns nothing and the error response returns some string, you
could use the .+ regex to match error response. However, make sure that the error response does not contain any
newline (\n) character in such cases. If the back end is an AWS Lambda function, the AWS Lambda function error
header is matched. For all other HTTP and AWS back ends, the HTTP status code is matched.
64 65 66 |
# File 'api_gateway/integration_response.rb', line 64 def selection_pattern @selection_pattern end |
#status_code ⇒ String (readonly)
The status code that API Gateway uses to map the integration response to a MethodResponse status code.
27 28 29 |
# File 'api_gateway/integration_response.rb', line 27 def status_code @status_code end |
Class Method Details
.jsii_properties ⇒ Object
66 67 68 69 70 71 72 73 74 |
# File 'api_gateway/integration_response.rb', line 66 def self.jsii_properties { :status_code => "statusCode", :content_handling => "contentHandling", :response_parameters => "responseParameters", :response_templates => "responseTemplates", :selection_pattern => "selectionPattern", } end |
Instance Method Details
#to_jsii ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 |
# File 'api_gateway/integration_response.rb', line 76 def to_jsii result = {} result.merge!({ "statusCode" => @status_code, "contentHandling" => @content_handling, "responseParameters" => @response_parameters, "responseTemplates" => @response_templates, "selectionPattern" => @selection_pattern, }) result.compact end |