Class: AWSCDK::Lambda::AssetCode
- Inherits:
-
Code
- Object
- Code
- AWSCDK::Lambda::AssetCode
- Defined in:
- lambda/asset_code.rb
Overview
Lambda code from a local directory.
Class Method Summary collapse
Instance Method Summary collapse
-
#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.
-
#bind_to_resource(resource, options = nil) ⇒ void
Called after the CFN function resource has been created to allow the code class to bind to it.
-
#initialize(path, options = nil) ⇒ AssetCode
constructor
A new instance of AssetCode.
-
#is_inline ⇒ Boolean
Determines whether this Code is inline code or not.
-
#path ⇒ String
The path to the asset file or directory.
Constructor Details
#initialize(path, options = nil) ⇒ AssetCode
Returns a new instance of AssetCode.
10 11 12 13 14 15 |
# File 'lambda/asset_code.rb', line 10 def initialize(path, = nil) = .is_a?(Hash) ? ::AWSCDK::S3Assets::AssetOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "path") Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczNfYXNzZXRzLkFzc2V0T3B0aW9ucyJ9")), "options") unless .nil? Jsii::Object.instance_method(:initialize).bind(self).call(path, ) end |
Class Method Details
.jsii_overridable_methods ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lambda/asset_code.rb', line 17 def self.jsii_overridable_methods { :is_inline => { kind: :property, name: "isInline", is_optional: false }, :path => { kind: :property, name: "path", 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.
44 45 46 47 |
# File 'lambda/asset_code.rb', line 44 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.
57 58 59 60 61 62 |
# File 'lambda/asset_code.rb', line 57 def bind_to_resource(resource, = nil) Jsii::Type.check_type(resource, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5DZm5SZXNvdXJjZSJ9")), "resource") = .is_a?(Hash) ? ::AWSCDK::Lambda::ResourceBindOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLlJlc291cmNlQmluZE9wdGlvbnMifQ==")), "options") unless .nil? jsii_call_method("bindToResource", [resource, ]) end |
#is_inline ⇒ Boolean
Determines whether this Code is inline code or not.
29 30 31 |
# File 'lambda/asset_code.rb', line 29 def is_inline() jsii_get_property("isInline") end |
#path ⇒ String
The path to the asset file or directory.
36 37 38 |
# File 'lambda/asset_code.rb', line 36 def path() jsii_get_property("path") end |