Created
May 22, 2019 14:45
-
-
Save mbklein/4f097dc2133ddea73d040d33394fe6b4 to your computer and use it in GitHub Desktop.
Ruby Lambda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'aws-sdk-ecs' | |
require 'aws-sdk-sqs' | |
require 'json' | |
def handle_event(event:, context:) | |
handler = LambdaHandler.new(event, context) | |
handler.process! | |
end | |
class LambdaHandler | |
attr_reader :event, :context | |
def initialize(event, context) | |
@event = event | |
@context = context | |
end | |
# Do whatever the Lambda should do | |
# | |
# @attr event is a hash passed in by the caller. (It's how | |
# Lambda functions receive arguments.) | |
# @attr context contains info about the Lambda and environment, | |
# and is documented at: | |
# https://docs.aws.amazon.com/lambda/latest/dg/ruby-context.html | |
# @return [status, message, body] | |
# (e.g., [201, 'Created', ''] | |
def process! | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment