Documentation ¶
Overview ¶
Package apex provides Lambda support for Go via a Node.js shim and this package for operating over stdio.
Example ¶
package main import ( "encoding/json" "github.com/apex/apex" ) type Message struct { Hello string `json:"hello"` } func main() { apex.HandleFunc(func(event json.RawMessage, ctx *apex.Context) (interface{}, error) { return &Message{"world"}, nil }) }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleFunc ¶
func HandleFunc(h HandlerFunc)
HandleFunc handles Lambda events with the given handler function.
Types ¶
type Context ¶
type Context struct { InvokeID string `json:"invokeid"` RequestID string `json:"awsRequestId"` FunctionName string `json:"functionName"` FunctionVersion string `json:"functionVersion"` LogGroupName string `json:"logGroupName"` LogStreamName string `json:"logStreamName"` MemoryLimitInMB string `json:"memoryLimitInMB"` IsDefaultFunctionVersion bool `json:"isDefaultFunctionVersion"` ClientContext json.RawMessage `json:"clientContext"` }
Context represents the context data provided by a Lambda invocation.
type Handler ¶
type Handler interface {
Handle(json.RawMessage, *Context) (interface{}, error)
}
Handler handles Lambda events.
type HandlerFunc ¶
type HandlerFunc func(json.RawMessage, *Context) (interface{}, error)
HandlerFunc implements Handler.
func (HandlerFunc) Handle ¶
func (h HandlerFunc) Handle(event json.RawMessage, ctx *Context) (interface{}, error)
Handle Lambda event.
Directories ¶
Path | Synopsis |
---|---|
_examples
|
|
cmd
|
|
Package dryrun implements the Lambda API in order to no-op changes, and display dry-run output.
|
Package dryrun implements the Lambda API in order to no-op changes, and display dry-run output. |
Package function implements function-level operations.
|
Package function implements function-level operations. |
Package kinesis provides structs for working with AWS Kinesis records.
|
Package kinesis provides structs for working with AWS Kinesis records. |
Package logs implements AWS CloudWatchLogs tailing.
|
Package logs implements AWS CloudWatchLogs tailing. |
Package metrics fetches CloudWatch metrics for a function.
|
Package metrics fetches CloudWatch metrics for a function. |
plugins
|
|
env
Package env populates .env.json if the function has any environment variables defined.
|
Package env populates .env.json if the function has any environment variables defined. |
golang
Package golang implements the "golang" runtime.
|
Package golang implements the "golang" runtime. |
hooks
Package hooks implements hook script support.
|
Package hooks implements hook script support. |
inference
Package inference adds file-based inference to detect runtimes when they are not explicitly specified.
|
Package inference adds file-based inference to detect runtimes when they are not explicitly specified. |
nodejs
Package nodejs implements the "nodejs" runtime.
|
Package nodejs implements the "nodejs" runtime. |
python
Package python implements the "python" runtime.
|
Package python implements the "python" runtime. |
shim
Package shim adds a nodejs shim when the shim field is true, this is also used transparently in other plugins such as "golang" which are not directly supported by Lambda.
|
Package shim adds a nodejs shim when the shim field is true, this is also used transparently in other plugins such as "golang" which are not directly supported by Lambda. |
Package project implements multi-function operations.
|
Package project implements multi-function operations. |
Package shim provides a shim for running arbitrary languages on Lambda.
|
Package shim provides a shim for running arbitrary languages on Lambda. |
Package upgrade fetches the latest Apex binary, if any, for the current platform.
|
Package upgrade fetches the latest Apex binary, if any, for the current platform. |
Package wiki implements a simple GitHub wiki miner and output formatter.
|
Package wiki implements a simple GitHub wiki miner and output formatter. |
Click to show internal directories.
Click to hide internal directories.