Class: AWSCDK::APIGateway::MethodResponse

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
api_gateway/method_response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status_code:, response_models: nil, response_parameters: nil) ⇒ MethodResponse

Returns a new instance of MethodResponse.

Parameters:

  • status_code (String)

    The method response's status code, which you map to an IntegrationResponse.

  • response_models (Hash{String => AWSCDK::APIGateway::IModel}, nil) (defaults to: nil)

    The resources used for the response's content type.

  • response_parameters (Hash{String => Boolean}, nil) (defaults to: nil)

    Response parameters that API Gateway sends to the client that called a method.



9
10
11
12
13
14
15
16
# File 'api_gateway/method_response.rb', line 9

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("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hcGlnYXRld2F5LklNb2RlbCJ9LCJraW5kIjoibWFwIn19")), "responseModels") unless @response_models.nil?
  @response_parameters = response_parameters
  Jsii::Type.check_type(@response_parameters, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImJvb2xlYW4ifSwia2luZCI6Im1hcCJ9fQ==")), "responseParameters") unless @response_parameters.nil?
end

Instance Attribute Details

#response_modelsHash{String => AWSCDK::APIGateway::IModel}? (readonly)

Note:

Default: None

The resources used for the response's content type.

Specify response models as key-value pairs (string-to-string maps), with a content type as the key and a Model resource name as the value.

Returns:



32
33
34
# File 'api_gateway/method_response.rb', line 32

def response_models
  @response_models
end

#response_parametersHash{String => Boolean}? (readonly)

Note:

Default: None

Response parameters that API Gateway sends to the client that called a method.

Specify response parameters as key-value pairs (string-to-Boolean maps), with a destination as the key and a Boolean as the value. Specify the destination using the following pattern: method.response.header.name, where the name is a valid, unique header name. The Boolean specifies whether a parameter is required.

Returns:

  • (Hash{String => Boolean}, nil)


42
43
44
# File 'api_gateway/method_response.rb', line 42

def response_parameters
  @response_parameters
end

#status_codeString (readonly)

The method response's status code, which you map to an IntegrationResponse.

Required.

Returns:

  • (String)


23
24
25
# File 'api_gateway/method_response.rb', line 23

def status_code
  @status_code
end

Class Method Details

.jsii_propertiesObject



44
45
46
47
48
49
50
# File 'api_gateway/method_response.rb', line 44

def self.jsii_properties
  {
    :status_code => "statusCode",
    :response_models => "responseModels",
    :response_parameters => "responseParameters",
  }
end

Instance Method Details

#to_jsiiObject



52
53
54
55
56
57
58
59
60
# File 'api_gateway/method_response.rb', line 52

def to_jsii
  result = {}
  result.merge!({
    "statusCode" => @status_code,
    "responseModels" => @response_models,
    "responseParameters" => @response_parameters,
  })
  result.compact
end