Class: Maze::Aws::Sam
- Inherits:
-
Object
- Object
- Maze::Aws::Sam
- Defined in:
- lib/maze/aws/sam.rb
Overview
Interacts with the AWS SAM CLI to invoke Lambda functions Note that the SAM CLI must be installed on the host machine as it does not run in a Docker container! For this reason the “start-api” command is not supported as it could easily cause port clashes and zombie processes
Class Attribute Summary collapse
-
.last_exit_code ⇒ Object
readonly
Returns the value of attribute last_exit_code.
-
.last_response ⇒ Object
readonly
Returns the value of attribute last_response.
Class Method Summary collapse
-
.invoke(directory, lambda, event = nil) ⇒ void
Invoke the given lambda with an optional event.
-
.reset! ⇒ void
Reset the last response and last exit code.
Class Attribute Details
.last_exit_code ⇒ Object (readonly)
Returns the value of attribute last_exit_code.
14 15 16 |
# File 'lib/maze/aws/sam.rb', line 14 def last_exit_code @last_exit_code end |
.last_response ⇒ Object (readonly)
Returns the value of attribute last_response.
14 15 16 |
# File 'lib/maze/aws/sam.rb', line 14 def last_response @last_response end |
Class Method Details
.invoke(directory, lambda, event = nil) ⇒ void
This method returns an undefined value.
Invoke the given lambda with an optional event
This happens synchronously so there is no need to wait for a response
25 26 27 28 29 30 31 |
# File 'lib/maze/aws/sam.rb', line 25 def invoke(directory, lambda, event = nil) command = build_invoke_command(lambda, event) output, @last_exit_code = Maze::Runner.run_command("cd #{directory} && #{command}") @last_response = parse(output) end |
.reset! ⇒ void
This method returns an undefined value.
Reset the last response and last exit code
36 37 38 39 |
# File 'lib/maze/aws/sam.rb', line 36 def reset! @last_response = nil @last_exit_code = nil end |