Class: AWSCDK::APIGateway::LambdaIntegration

Inherits:
AWSIntegration
  • Object
show all
Defined in:
api_gateway/lambda_integration.rb

Overview

Integrates an AWS Lambda function to an API Gateway method.

Examples:

resource = nil # AWSCDK::APIGateway::Resource
handler = nil # AWSCDK::Lambda::Function

resource.add_method("GET", AWSCDK::APIGateway::LambdaIntegration.new(handler))

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(handler, options = nil) ⇒ LambdaIntegration

Returns a new instance of LambdaIntegration.

Parameters:



16
17
18
19
20
21
# File 'api_gateway/lambda_integration.rb', line 16

def initialize(handler, options = nil)
  options = options.is_a?(Hash) ? ::AWSCDK::APIGateway::LambdaIntegrationOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(handler, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklGdW5jdGlvbiJ9")), "handler")
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5MYW1iZGFJbnRlZ3JhdGlvbk9wdGlvbnMifQ==")), "options") unless options.nil?
  Jsii::Object.instance_method(:initialize).bind(self).call(handler, options)
end

Class Method Details

.jsii_overridable_methodsObject



23
24
25
26
27
# File 'api_gateway/lambda_integration.rb', line 23

def self.jsii_overridable_methods
  {
    :bind => { kind: :method, name: "bind", is_optional: false },
  }
end

Instance Method Details

#bind(method) ⇒ AWSCDK::APIGateway::IntegrationConfig

Can be overridden by subclasses to allow the integration to interact with the method being integrated, access the REST API object, method ARNs, etc.



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

def bind(method)
  Jsii::Type.check_type(method, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheS5NZXRob2QifQ==")), "method")
  jsii_call_method("bind", [method])
end