Method: Lamma::Function#initialize

Defined in:
lib/lamma/function.rb

#initialize(yaml_path) ⇒ Function

Returns a new instance of Function.

Parameters:

  • yaml_path (String)


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/lamma/function.rb', line 27

def initialize(yaml_path)
  path = Pathname.new(yaml_path)
  yaml = YAML.load(path.open)

  @conf = yaml.fetch('function', {})

  @publish = false
  @name = @conf.fetch('name', nil)
  @role_arn = @conf.fetch('role_arn', nil)
  @description = @conf.fetch('description', nil)
  @timeout = @conf.fetch('timeout', 3)
  @memory_size = @conf.fetch('memory_size', 128)
  # @dead_letter_config = dead_letter_config(@conf)
  @region = @conf.fetch('region') { raise Lamma::ValidationError.new('region must be set.') }
  @kms_key_arn = @conf.fetch('kms_key_arn', nil)
end