Class: AWSCDK::APIGateway::GatewayResponseOptions

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

Overview

Options to add gateway response.

Direct Known Subclasses

GatewayResponseProps

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, response_headers: nil, status_code: nil, templates: nil) ⇒ GatewayResponseOptions

Returns a new instance of GatewayResponseOptions.

Parameters:

  • type (AWSCDK::APIGateway::ResponseType)

    Response type to associate with gateway response.

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

    Custom headers parameters for response.

  • status_code (String, nil) (defaults to: nil)

    Http status code for response.

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

    Custom templates to get mapped as response.



11
12
13
14
15
16
17
18
19
20
# File 'api_gateway/gateway_response_options.rb', line 11

def initialize(type:, response_headers: nil, status_code: nil, templates: nil)
  @type = type
  Jsii::Type.check_type(@type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5SZXNwb25zZVR5cGUifQ==")), "type")
  @response_headers = response_headers
  Jsii::Type.check_type(@response_headers, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "responseHeaders") unless @response_headers.nil?
  @status_code = status_code
  Jsii::Type.check_type(@status_code, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "statusCode") unless @status_code.nil?
  @templates = templates
  Jsii::Type.check_type(@templates, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "templates") unless @templates.nil?
end

Instance Attribute Details

#response_headersHash{String => String}? (readonly)

Note:

Default: - no headers

Custom headers parameters for response.

Returns:

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


31
32
33
# File 'api_gateway/gateway_response_options.rb', line 31

def response_headers
  @response_headers
end

#status_codeString? (readonly)

Note:

Default: - standard http status code for the response type.

Http status code for response.

Returns:

  • (String, nil)


36
37
38
# File 'api_gateway/gateway_response_options.rb', line 36

def status_code
  @status_code
end

#templatesHash{String => String}? (readonly)

Note:

Default: - Response from api will be returned without applying any transformation.

Custom templates to get mapped as response.

Returns:

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


41
42
43
# File 'api_gateway/gateway_response_options.rb', line 41

def templates
  @templates
end

#typeAWSCDK::APIGateway::ResponseType (readonly)

Response type to associate with gateway response.



26
27
28
# File 'api_gateway/gateway_response_options.rb', line 26

def type
  @type
end

Class Method Details

.jsii_propertiesObject



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

def self.jsii_properties
  {
    :type => "type",
    :response_headers => "responseHeaders",
    :status_code => "statusCode",
    :templates => "templates",
  }
end

Instance Method Details

#to_jsiiObject



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

def to_jsii
  result = {}
  result.merge!({
    "type" => @type,
    "responseHeaders" => @response_headers,
    "statusCode" => @status_code,
    "templates" => @templates,
  })
  result.compact
end