Class: AWSCDK::Lambda::AssetImageCode

Inherits:
Code
  • Object
show all
Defined in:
lambda/asset_image_code.rb

Overview

Represents an ECR image that will be constructed from the specified asset and can be bound as Lambda code.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(directory, props) ⇒ AssetImageCode

Returns a new instance of AssetImageCode.

Parameters:



10
11
12
13
14
15
# File 'lambda/asset_image_code.rb', line 10

def initialize(directory, props)
  props = props.is_a?(Hash) ? ::AWSCDK::Lambda::AssetImageCodeProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(directory, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "directory")
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLkFzc2V0SW1hZ2VDb2RlUHJvcHMifQ==")), "props")
  Jsii::Object.instance_method(:initialize).bind(self).call(directory, props)
end

Class Method Details

.jsii_overridable_methodsObject



17
18
19
20
21
22
23
# File 'lambda/asset_image_code.rb', line 17

def self.jsii_overridable_methods
  {
    :is_inline => { kind: :property, name: "isInline", is_optional: false },
    :bind => { kind: :method, name: "bind", is_optional: false },
    :bind_to_resource => { kind: :method, name: "bindToResource", is_optional: false },
  }
end

Instance Method Details

#bind(scope) ⇒ AWSCDK::Lambda::CodeConfig

Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun.

Parameters:

  • scope (Constructs::Construct)

Returns:



36
37
38
39
# File 'lambda/asset_image_code.rb', line 36

def bind(scope)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  jsii_call_method("bind", [scope])
end

#bind_to_resource(resource, options = nil) ⇒ void

This method returns an undefined value.

Called after the CFN function resource has been created to allow the code class to bind to it.

Specifically it's required to allow assets to add metadata for tooling like SAM CLI to be able to find their origins.

Parameters:



49
50
51
52
53
54
# File 'lambda/asset_image_code.rb', line 49

def bind_to_resource(resource, options = nil)
  Jsii::Type.check_type(resource, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5DZm5SZXNvdXJjZSJ9")), "resource")
  options = options.is_a?(Hash) ? ::AWSCDK::Lambda::ResourceBindOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLlJlc291cmNlQmluZE9wdGlvbnMifQ==")), "options") unless options.nil?
  jsii_call_method("bindToResource", [resource, options])
end

#is_inlineBoolean

Determines whether this Code is inline code or not.

Returns:

  • (Boolean)


28
29
30
# File 'lambda/asset_image_code.rb', line 28

def is_inline()
  jsii_get_property("isInline")
end