Class: ElasticGraph::AdminLambda::LambdaFunction

Inherits:
Object
  • Object
show all
Includes:
LambdaSupport::LambdaFunction
Defined in:
lib/elastic_graph/admin_lambda/lambda_function.rb

Instance Method Summary collapse

Constructor Details

#initializeLambdaFunction

Returns a new instance of LambdaFunction.



17
18
19
# File 'lib/elastic_graph/admin_lambda/lambda_function.rb', line 17

def initialize
  require "elastic_graph/admin_lambda/rake_adapter"
end

Instance Method Details

#handle_request(event:, context:) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/elastic_graph/admin_lambda/lambda_function.rb', line 21

def handle_request(event:, context:)
  # @type var event: ::Hash[::String, untyped]
  rake_output = RakeAdapter.run_rake(event.fetch("argv"))

  # Log the output of the rake task. We also want to return it so that when we invoke
  # a lambda rake task from the terminal we can print the output there.
  puts rake_output

  {"rake_output" => rake_output}
end