Class: AWSCDK::APIGateway::GatewayResponseProps

Inherits:
GatewayResponseOptions
  • Object
show all
Defined in:
api_gateway/gateway_response_props.rb

Overview

Properties for a new gateway response.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of GatewayResponseProps.

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.

  • rest_api (AWSCDK::APIGateway::IRestAPI)

    Rest api resource to target.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'api_gateway/gateway_response_props.rb', line 12

def initialize(type:, response_headers: nil, status_code: nil, templates: nil, rest_api:)
  @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?
  @rest_api = rest_api
  Jsii::Type.check_type(@rest_api, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5JUmVzdEFwaSJ9")), "restApi")
end

Instance Attribute Details

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

Note:

Default: - no headers

Custom headers parameters for response.

Returns:

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


34
35
36
# File 'api_gateway/gateway_response_props.rb', line 34

def response_headers
  @response_headers
end

#rest_apiAWSCDK::APIGateway::IRestAPI (readonly)

Rest api resource to target.



48
49
50
# File 'api_gateway/gateway_response_props.rb', line 48

def rest_api
  @rest_api
end

#status_codeString? (readonly)

Note:

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

Http status code for response.

Returns:

  • (String, nil)


39
40
41
# File 'api_gateway/gateway_response_props.rb', line 39

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)


44
45
46
# File 'api_gateway/gateway_response_props.rb', line 44

def templates
  @templates
end

#typeAWSCDK::APIGateway::ResponseType (readonly)

Response type to associate with gateway response.



29
30
31
# File 'api_gateway/gateway_response_props.rb', line 29

def type
  @type
end

Class Method Details

.jsii_propertiesObject



50
51
52
53
54
55
56
57
58
# File 'api_gateway/gateway_response_props.rb', line 50

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

Instance Method Details

#to_jsiiObject



60
61
62
63
64
65
66
67
68
69
70
71
# File 'api_gateway/gateway_response_props.rb', line 60

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