Class: AWSCDK::APIGateway::CfnMethod::MethodResponseProperty
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::APIGateway::CfnMethod::MethodResponseProperty
- Defined in:
- api_gateway/cfn_method.rb
Overview
Represents a method response of a given HTTP status code returned to the client.
The method response is passed from the back end through the associated integration response that can be transformed using a mapping template.
Instance Attribute Summary collapse
-
#response_models ⇒ AWSCDK::IResolvable, ...
readonly
Specifies the Model resources used for the response's content-type.
-
#response_parameters ⇒ AWSCDK::IResolvable, ...
readonly
A key-value map specifying required or optional response parameters that API Gateway can send back to the caller.
-
#status_code ⇒ String
readonly
The method response's status code.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(status_code:, response_models: nil, response_parameters: nil) ⇒ MethodResponseProperty
constructor
A new instance of MethodResponseProperty.
- #to_jsii ⇒ Object
Constructor Details
#initialize(status_code:, response_models: nil, response_parameters: nil) ⇒ MethodResponseProperty
Returns a new instance of MethodResponseProperty.
950 951 952 953 954 955 956 957 |
# File 'api_gateway/cfn_method.rb', line 950 def initialize(status_code:, response_models: nil, response_parameters: nil) @status_code = status_code Jsii::Type.check_type(@status_code, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "statusCode") @response_models = response_models Jsii::Type.check_type(@response_models, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsicHJpbWl0aXZlIjoic3RyaW5nIn0sImtpbmQiOiJtYXAifX1dfX0=")), "responseModels") unless @response_models.nil? @response_parameters = response_parameters Jsii::Type.check_type(@response_parameters, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7InByaW1pdGl2ZSI6ImJvb2xlYW4ifSx7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn1dfX0sImtpbmQiOiJtYXAifX1dfX0=")), "responseParameters") unless @response_parameters.nil? end |
Instance Attribute Details
#response_models ⇒ AWSCDK::IResolvable, ... (readonly)
Specifies the Model resources used for the response's content-type.
Response models are represented as a key/value map, with a content-type as the key and a Model name as the value.
970 971 972 |
# File 'api_gateway/cfn_method.rb', line 970 def response_models @response_models end |
#response_parameters ⇒ AWSCDK::IResolvable, ... (readonly)
A key-value map specifying required or optional response parameters that API Gateway can send back to the caller.
A key defines a method response header and the value specifies whether the associated method response header is required or not. The expression of the key must match the pattern method.response.header.{name} , where name is a valid and unique header name. API Gateway passes certain integration response data to the method response headers specified here according to the mapping you prescribe in the API's IntegrationResponse. The integration response data that can be mapped include an integration response header expressed in integration.response.header.{name} , a static value enclosed within a pair of single quotes (e.g., 'application/json' ), or a JSON expression from the back-end response payload in the form of integration.response.body.{JSON-expression} , where JSON-expression is a valid JSON expression without the $ prefix.)
977 978 979 |
# File 'api_gateway/cfn_method.rb', line 977 def response_parameters @response_parameters end |
#status_code ⇒ String (readonly)
The method response's status code.
963 964 965 |
# File 'api_gateway/cfn_method.rb', line 963 def status_code @status_code end |
Class Method Details
.jsii_properties ⇒ Object
979 980 981 982 983 984 985 |
# File 'api_gateway/cfn_method.rb', line 979 def self.jsii_properties { :status_code => "statusCode", :response_models => "responseModels", :response_parameters => "responseParameters", } end |
Instance Method Details
#to_jsii ⇒ Object
987 988 989 990 991 992 993 994 995 |
# File 'api_gateway/cfn_method.rb', line 987 def to_jsii result = {} result.merge!({ "statusCode" => @status_code, "responseModels" => @response_models, "responseParameters" => @response_parameters, }) result.compact end |