Sha256: a24e4aee95bbe3a96c45e8f98545127dea0d51b2bbd714c3421e969978e73354
Contents?: true
Size: 1.93 KB
Versions: 32
Compression:
Stored size: 1.93 KB
Contents
module Jets::Stack::Main::Dsl module Lambda # Example: # # function(:hello, # handler: handler("hello.lambda_hander"), # runtime: "python3.6" # ) # # Defaults to ruby. So: # # function(:hello) # # is the same as: # # function(:hello, # handler: handler("hello.hande"), # runtime: :ruby # ) # def function(id, props={}) # Required: code, handler, role, runtime Docs: https://amzn.to/2pdot7S meth = id.to_s.underscore defaults = { function_name: "#{Jets.config.project_namespace}-#{id.to_s.underscore}", code: { s3_bucket: "!Ref S3Bucket", s3_key: code_s3_key }, role: "!Ref IamRole", handler: "#{meth}.handle", # default ruby convention runtime: :ruby, timeout: Jets.config.function.timeout, memory_size: Jets.config.function.memory_size, } props = defaults.merge(props) props[:runtime] = "nodejs8.10" if props[:runtime].to_s == "ruby" props[:handler] = handler(props[:handler]) resource(id, "AWS::Lambda::Function", props) end alias_method :ruby_function, :function alias_method :lambda_function, :function def python_function(id, props={}) meth = id.to_s.underscore props[:handler] ||= "#{meth}.lambda_handler" # default python convention props[:runtime] = "python3.6" function(id, props) end def node_function(id, props={}) meth = id.to_s.underscore props[:handler] ||= "#{meth}.handler" # default python convention props[:runtime] = "node8.10" function(id, props) end # Usage: # # permission(:my_permission, principal: "events.amazonaws.com") # def permission(id, props={}) defaults = { action: "lambda:InvokeFunction" } props = defaults.merge(props) resource(id, "AWS::Lambda::Permission", props) end end end
Version data entries
32 entries across 32 versions & 1 rubygems