Documentation
¶
Overview ¶
Package apex provides Lambda support for Go via a Node.js shim and this package for operating over stdio.
Example ¶
Example of a Lambda function handling arbitrary JSON input.
package main
import (
"encoding/json"
"github.com/apex/go-apex"
)
type Message struct {
Hello string `json:"hello"`
}
// Example of a Lambda function handling arbitrary JSON input.
func main() {
apex.HandleFunc(func(event json.RawMessage, ctx *apex.Context) (interface{}, error) {
return &Message{"world"}, nil
})
}
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"`
Identity Identity `json:"identity,omitempty"`
InvokedFunctionARN string `json:"invokedFunctionArn"`
}
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.
type Identity ¶
type Identity struct {
CognitoIdentityID string `json:"cognitoIdentityId"`
CognitoIdentityIDPoolID string `json:"cognitoIdentityPoolId"`
}
Identity as defined in: http://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/lambda.html#identity-context
Directories
¶
| Path | Synopsis |
|---|---|
|
_examples
|
|
|
dynamo
command
|
|
|
kinesis
command
|
|
|
proxy
command
|
|
|
s3
command
|
|
|
Package cloudformation provides structs for working with AWS CloudFormation custom resources.
|
Package cloudformation provides structs for working with AWS CloudFormation custom resources. |
|
Package cognito provides structs for working with AWS Cognito records.
|
Package cognito provides structs for working with AWS Cognito records. |
|
Package dynamo provides structs for working with AWS Dynamo records.
|
Package dynamo provides structs for working with AWS Dynamo records. |
|
Package kinesis provides structs for working with AWS Kinesis records.
|
Package kinesis provides structs for working with AWS Kinesis records. |
|
Package logs provides structs for working with AWS CloudWatch Logs records.
|
Package logs provides structs for working with AWS CloudWatch Logs records. |
|
Package s3 provides structs for working with AWS S3 records.
|
Package s3 provides structs for working with AWS S3 records. |
|
Package ses provides structs for working with AWS SES records.
|
Package ses provides structs for working with AWS SES records. |
|
Package sns provides structs for working with AWS SNS records.
|
Package sns provides structs for working with AWS SNS records. |
Click to show internal directories.
Click to hide internal directories.