Class: AWSCDK::APIGateway::LambdaIntegrationOptions

Inherits:
IntegrationOptions
  • Object
show all
Defined in:
api_gateway/lambda_integration_options.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cache_key_parameters: nil, cache_namespace: nil, connection_type: nil, content_handling: nil, credentials_passthrough: nil, credentials_role: nil, integration_responses: nil, passthrough_behavior: nil, request_parameters: nil, request_templates: nil, response_transfer_mode: nil, timeout: nil, vpc_link: nil, allow_test_invoke: nil, proxy: nil, scope_permission_to_method: nil) ⇒ LambdaIntegrationOptions

Returns a new instance of LambdaIntegrationOptions.

Parameters:

  • cache_key_parameters (Array<String>, nil) (defaults to: nil)

    A list of request parameters whose values are to be cached.

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

    An API-specific tag group of related cached parameters.

  • connection_type (AWSCDK::APIGateway::ConnectionType, nil) (defaults to: nil)

    The type of network connection to the integration endpoint.

  • content_handling (AWSCDK::APIGateway::ContentHandling, nil) (defaults to: nil)

    Specifies how to handle request payload content type conversions.

  • credentials_passthrough (Boolean, nil) (defaults to: nil)

    Requires that the caller's identity be passed through from the request.

  • credentials_role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    An IAM role that API Gateway assumes.

  • integration_responses (Array<AWSCDK::APIGateway::IntegrationResponse>, nil) (defaults to: nil)

    The response that API Gateway provides after a method's backend completes processing a request.

  • passthrough_behavior (AWSCDK::APIGateway::PassthroughBehavior, nil) (defaults to: nil)

    Specifies the pass-through behavior for incoming requests based on the Content-Type header in the request, and the available mapping templates specified as the requestTemplates property on the Integration resource.

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

    The request parameters that API Gateway sends with the backend request.

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

    A map of Apache Velocity templates that are applied on the request payload.

  • response_transfer_mode (AWSCDK::APIGateway::ResponseTransferMode, nil) (defaults to: nil)

    The response transfer mode for the integration.

  • timeout (AWSCDK::Duration, nil) (defaults to: nil)

    The maximum amount of time an integration will run before it returns without a response.

  • vpc_link (AWSCDK::APIGateway::IVPCLink, nil) (defaults to: nil)

    The VpcLink used for the integration.

  • allow_test_invoke (Boolean, nil) (defaults to: nil)

    Allow invoking method from AWS Console UI (for testing purposes).

  • proxy (Boolean, nil) (defaults to: nil)

    Use proxy integration or normal (request/response mapping) integration.

  • scope_permission_to_method (Boolean, nil) (defaults to: nil)

    Scope the permission for invoking the AWS Lambda down to the specific method associated with this integration.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'api_gateway/lambda_integration_options.rb', line 22

def initialize(cache_key_parameters: nil, cache_namespace: nil, connection_type: nil, content_handling: nil, credentials_passthrough: nil, credentials_role: nil, integration_responses: nil, passthrough_behavior: nil, request_parameters: nil, request_templates: nil, response_transfer_mode: nil, timeout: nil, vpc_link: nil, allow_test_invoke: nil, proxy: nil, scope_permission_to_method: nil)
  @cache_key_parameters = cache_key_parameters
  Jsii::Type.check_type(@cache_key_parameters, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "cacheKeyParameters") unless @cache_key_parameters.nil?
  @cache_namespace = cache_namespace
  Jsii::Type.check_type(@cache_namespace, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "cacheNamespace") unless @cache_namespace.nil?
  @connection_type = connection_type
  Jsii::Type.check_type(@connection_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5Db25uZWN0aW9uVHlwZSJ9")), "connectionType") unless @connection_type.nil?
  @content_handling = content_handling
  Jsii::Type.check_type(@content_handling, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5Db250ZW50SGFuZGxpbmcifQ==")), "contentHandling") unless @content_handling.nil?
  @credentials_passthrough = credentials_passthrough
  Jsii::Type.check_type(@credentials_passthrough, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "credentialsPassthrough") unless @credentials_passthrough.nil?
  @credentials_role = credentials_role
  Jsii::Type.check_type(@credentials_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "credentialsRole") unless @credentials_role.nil?
  @integration_responses = integration_responses.is_a?(Array) ? integration_responses.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::APIGateway::IntegrationResponse.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : integration_responses
  Jsii::Type.check_type(@integration_responses, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hcGlnYXRld2F5LkludGVncmF0aW9uUmVzcG9uc2UifSwia2luZCI6ImFycmF5In19")), "integrationResponses") unless @integration_responses.nil?
  @passthrough_behavior = passthrough_behavior
  Jsii::Type.check_type(@passthrough_behavior, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5QYXNzdGhyb3VnaEJlaGF2aW9yIn0=")), "passthroughBehavior") unless @passthrough_behavior.nil?
  @request_parameters = request_parameters
  Jsii::Type.check_type(@request_parameters, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "requestParameters") unless @request_parameters.nil?
  @request_templates = request_templates
  Jsii::Type.check_type(@request_templates, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "requestTemplates") unless @request_templates.nil?
  @response_transfer_mode = response_transfer_mode
  Jsii::Type.check_type(@response_transfer_mode, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5SZXNwb25zZVRyYW5zZmVyTW9kZSJ9")), "responseTransferMode") unless @response_transfer_mode.nil?
  @timeout = timeout
  Jsii::Type.check_type(@timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "timeout") unless @timeout.nil?
  @vpc_link = vpc_link
  Jsii::Type.check_type(@vpc_link, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5JVnBjTGluayJ9")), "vpcLink") unless @vpc_link.nil?
  @allow_test_invoke = allow_test_invoke
  Jsii::Type.check_type(@allow_test_invoke, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "allowTestInvoke") unless @allow_test_invoke.nil?
  @proxy = proxy
  Jsii::Type.check_type(@proxy, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "proxy") unless @proxy.nil?
  @scope_permission_to_method = scope_permission_to_method
  Jsii::Type.check_type(@scope_permission_to_method, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "scopePermissionToMethod") unless @scope_permission_to_method.nil?
end

Instance Attribute Details

#allow_test_invokeBoolean? (readonly)

Note:

Default: true

Allow invoking method from AWS Console UI (for testing purposes).

This will add another permission to the AWS Lambda resource policy which will allow the test-invoke-stage stage to invoke this handler. If this is set to false, the function will only be usable from the deployment endpoint.

Note that this property is ignored when scope_permission_to_method is false.

Returns:

  • (Boolean, nil)


171
172
173
# File 'api_gateway/lambda_integration_options.rb', line 171

def allow_test_invoke
  @allow_test_invoke
end

#cache_key_parametersArray<String>? (readonly)

A list of request parameters whose values are to be cached.

It determines request parameters that will make it into the cache key.

Returns:

  • (Array<String>, nil)


63
64
65
# File 'api_gateway/lambda_integration_options.rb', line 63

def cache_key_parameters
  @cache_key_parameters
end

#cache_namespaceString? (readonly)

An API-specific tag group of related cached parameters.

Returns:

  • (String, nil)


67
68
69
# File 'api_gateway/lambda_integration_options.rb', line 67

def cache_namespace
  @cache_namespace
end

#connection_typeAWSCDK::APIGateway::ConnectionType? (readonly)

Note:

Default: - ConnectionType.VPC_LINK if vpcLink property is configured; ConnectionType.Internet otherwise.

The type of network connection to the integration endpoint.



72
73
74
# File 'api_gateway/lambda_integration_options.rb', line 72

def connection_type
  @connection_type
end

#content_handlingAWSCDK::APIGateway::ContentHandling? (readonly)

Note:

Default: none if this property isn't defined, the request payload is passed through from the method request to the integration request without modification, provided that the passthroughBehaviors property is configured to support payload pass-through.

Specifies how to handle request payload content type conversions.



77
78
79
# File 'api_gateway/lambda_integration_options.rb', line 77

def content_handling
  @content_handling
end

#credentials_passthroughBoolean? (readonly)

Note:

Default: Caller identity is not passed through

Requires that the caller's identity be passed through from the request.

Returns:

  • (Boolean, nil)


82
83
84
# File 'api_gateway/lambda_integration_options.rb', line 82

def credentials_passthrough
  @credentials_passthrough
end

#credentials_roleAWSCDK::IAM::IRole? (readonly)

Note:

Default: A role is not assumed

An IAM role that API Gateway assumes.

Mutually exclusive with credentials_pass_through.

Returns:



89
90
91
# File 'api_gateway/lambda_integration_options.rb', line 89

def credentials_role
  @credentials_role
end

#integration_responsesArray<AWSCDK::APIGateway::IntegrationResponse>? (readonly)

The response that API Gateway provides after a method's backend completes processing a request.

API Gateway intercepts the response from the backend so that you can control how API Gateway surfaces backend responses. For example, you can map the backend status codes to codes that you define.



98
99
100
# File 'api_gateway/lambda_integration_options.rb', line 98

def integration_responses
  @integration_responses
end

#passthrough_behaviorAWSCDK::APIGateway::PassthroughBehavior? (readonly)

Specifies the pass-through behavior for incoming requests based on the Content-Type header in the request, and the available mapping templates specified as the requestTemplates property on the Integration resource.

There are three valid values: WHEN_NO_MATCH, WHEN_NO_TEMPLATES, and NEVER.



105
106
107
# File 'api_gateway/lambda_integration_options.rb', line 105

def passthrough_behavior
  @passthrough_behavior
end

#proxyBoolean? (readonly)

Note:

Default: true

Use proxy integration or normal (request/response mapping) integration.



177
178
179
# File 'api_gateway/lambda_integration_options.rb', line 177

def proxy
  @proxy
end

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

The request parameters that API Gateway sends with the backend request.

Specify request parameters as key-value pairs (string-to-string mappings), with a destination as the key and a source as the value.

Specify the destination by using the following pattern integration.request.location.name, where location is querystring, path, or header, and name is a valid, unique parameter name.

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 their destination in the request.

Returns:

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


120
121
122
# File 'api_gateway/lambda_integration_options.rb', line 120

def request_parameters
  @request_parameters
end

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

A map of Apache Velocity templates that are applied on the request payload.

The template that API Gateway uses is based on the value of the Content-Type header that's sent by the client. The content type value is the key, and the template is the value (specified as a string), such as the following snippet:

  { "application/json": "{ \"statusCode\": 200 }" }


134
135
136
# File 'api_gateway/lambda_integration_options.rb', line 134

def request_templates
  @request_templates
end

#response_transfer_modeAWSCDK::APIGateway::ResponseTransferMode? (readonly)

Note:

Default: ResponseTransferMode.BUFFERED

The response transfer mode for the integration.

To enable response streaming, set this value to ResponseTransferMode.STREAM.



141
142
143
# File 'api_gateway/lambda_integration_options.rb', line 141

def response_transfer_mode
  @response_transfer_mode
end

#scope_permission_to_methodBoolean? (readonly)

Note:

Default: true

Scope the permission for invoking the AWS Lambda down to the specific method associated with this integration.

If this is set to false, the permission will allow invoking the AWS Lambda from any method. This is useful for reducing the AWS Lambda policy size for cases where the same AWS Lambda function is reused for many integrations.

Note that this will always allow test invocations.

Returns:

  • (Boolean, nil)


188
189
190
# File 'api_gateway/lambda_integration_options.rb', line 188

def scope_permission_to_method
  @scope_permission_to_method
end

#timeoutAWSCDK::Duration? (readonly)

Note:

Default: Duration.seconds(29)

The maximum amount of time an integration will run before it returns without a response.

By default, the value must be between 50 milliseconds and 29 seconds. The upper bound can be increased for regional and private Rest APIs only, via a quota increase request for your account. This increase might require a reduction in your account-level throttle quota limit.

See https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html Amazon API Gateway quotas for more details.

Returns:



153
154
155
# File 'api_gateway/lambda_integration_options.rb', line 153

def timeout
  @timeout
end

The VpcLink used for the integration.

Required if connectionType is VPC_LINK



159
160
161
# File 'api_gateway/lambda_integration_options.rb', line 159

def vpc_link
  @vpc_link
end

Class Method Details

.jsii_propertiesObject



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'api_gateway/lambda_integration_options.rb', line 190

def self.jsii_properties
  {
    :cache_key_parameters => "cacheKeyParameters",
    :cache_namespace => "cacheNamespace",
    :connection_type => "connectionType",
    :content_handling => "contentHandling",
    :credentials_passthrough => "credentialsPassthrough",
    :credentials_role => "credentialsRole",
    :integration_responses => "integrationResponses",
    :passthrough_behavior => "passthroughBehavior",
    :request_parameters => "requestParameters",
    :request_templates => "requestTemplates",
    :response_transfer_mode => "responseTransferMode",
    :timeout => "timeout",
    :vpc_link => "vpcLink",
    :allow_test_invoke => "allowTestInvoke",
    :proxy => "proxy",
    :scope_permission_to_method => "scopePermissionToMethod",
  }
end

Instance Method Details

#to_jsiiObject



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'api_gateway/lambda_integration_options.rb', line 211

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "cacheKeyParameters" => @cache_key_parameters,
    "cacheNamespace" => @cache_namespace,
    "connectionType" => @connection_type,
    "contentHandling" => @content_handling,
    "credentialsPassthrough" => @credentials_passthrough,
    "credentialsRole" => @credentials_role,
    "integrationResponses" => @integration_responses,
    "passthroughBehavior" => @passthrough_behavior,
    "requestParameters" => @request_parameters,
    "requestTemplates" => @request_templates,
    "responseTransferMode" => @response_transfer_mode,
    "timeout" => @timeout,
    "vpcLink" => @vpc_link,
    "allowTestInvoke" => @allow_test_invoke,
    "proxy" => @proxy,
    "scopePermissionToMethod" => @scope_permission_to_method,
  })
  result.compact
end