Module: Jets::Stack::Main::Dsl::Base

Defined in:
lib/jets/stack/main/extensions/base.rb

Instance Method Summary collapse

Instance Method Details

#code_s3_keyObject

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.



28
29
30
# File 'lib/jets/stack/main/extensions/base.rb', line 28

def code_s3_key
  "code_s3_key_placeholder"
end

#depends_on(*stacks) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/jets/stack/main/extensions/base.rb', line 15

def depends_on(*stacks)
  if stacks == []
    @depends_on
  else
    @depends_on ||= []
    @depends_on += stacks
  end
end

#getatt(value, attribute = :arn) ⇒ Object



7
8
9
# File 'lib/jets/stack/main/extensions/base.rb', line 7

def getatt(value, attribute=:arn)
  "!GetAtt #{value.to_s.camelize}.#{attribute.to_s.camelize}"
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,

)



45
46
47
# File 'lib/jets/stack/main/extensions/base.rb', line 45

def handler(name)
  "handlers/shared/functions/#{name}" # generated handler
end

#logical_id(value) ⇒ Object



11
12
13
# File 'lib/jets/stack/main/extensions/base.rb', line 11

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