module Cumulus::Lambda

Public Class Methods

functions() click to toggle source

Public: Provide a mapping of functions to their names. Lazily loads resources.

Returns the functions mapped to their names

# File lib/lambda/Lambda.rb, line 27
def functions
  @functions ||= init_functions
end
get_aws(name) click to toggle source

Public: Static method that will get a Lambda function from AWS by its name

name - the name of the function to get

Returns the function

# File lib/lambda/Lambda.rb, line 16
def get_aws(name)
  functions.fetch(name)
rescue KeyError
  puts "No Lambda function named #{name}"
  exit
end

Private Class Methods

init_functions() click to toggle source

Internal: Load the functions and map them to their names

Returns the functions mapped to their names

# File lib/lambda/Lambda.rb, line 36
def init_functions
  Hash[@@client.list_functions.functions.map { |f| [f.function_name, f] }]
end