Module: Jets::Stack::Main::Dsl::Base
- Defined in:
- lib/jets/stack/main/extensions/base.rb
Instance Method Summary collapse
-
#code_s3_key ⇒ Object
Due to ‘if Jets::Stack.has_resources?` check early on in the bootstraping process The code has not been built at that point.
- #depends_on(*stacks) ⇒ Object
-
#handler(name) ⇒ Object
resource(:hello, function_name: “hello”, code: { s3_bucket: “!Ref S3Bucket”, s3_key: code_s3_key }, description: “Hello world”, handler: handler_function(“hello.lambda_handler”), memory_size: 128, role: “!Ref IamRole”, runtime: “python3.6”, timeout: 20, ).
- #logical_id(value) ⇒ Object
- #ref(value) ⇒ Object
Instance Method Details
#code_s3_key ⇒ Object
Due to ‘if Jets::Stack.has_resources?` check early on in the bootstraping process The code has not been built at that point. So we use a placeholder and will replace the placeholder as part of the cfn template build process after the code has been built and the code_s3_key with md5 is available.
24 25 26 |
# File 'lib/jets/stack/main/extensions/base.rb', line 24 def code_s3_key "code_s3_key_placeholder" end |
#depends_on(*stacks) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/jets/stack/main/extensions/base.rb', line 11 def depends_on(*stacks) if stacks == [] @depends_on else @depends_on ||= [] @depends_on += stacks end end |
#handler(name) ⇒ Object
resource(:hello,
function_name: "hello",
code: {
s3_bucket: "!Ref S3Bucket",
s3_key: code_s3_key
},
description: "Hello world",
handler: handler_function("hello.lambda_handler"),
memory_size: 128,
role: "!Ref IamRole",
runtime: "python3.6",
timeout: 20,
)
41 42 43 |
# File 'lib/jets/stack/main/extensions/base.rb', line 41 def handler(name) "handlers/shared/functions/#{name}" # generated handler end |
#logical_id(value) ⇒ Object
7 8 9 |
# File 'lib/jets/stack/main/extensions/base.rb', line 7 def logical_id(value) value.to_s.camelize end |
#ref(value) ⇒ Object
3 4 5 |
# File 'lib/jets/stack/main/extensions/base.rb', line 3 def ref(value) "!Ref #{value.to_s.camelize}" end |