Documentation ¶
Overview ¶
Utils for making AWS Lambda & API Gateway usage easier
Index ¶
- func InLambda() bool
- func NewLambdaHttpHandlerAdapter(httpHandler http.Handler) lambda.Handler
- func NewMultiEventTypeHandler(fn multiEventTypeHandlerFn) lambda.Handler
- func ServeApiGatewayProxyRequestUsingHttpHandler(ctx context.Context, proxyRequest *events.APIGatewayProxyRequest, ...) ([]byte, error)
- type LambdaHttpHandlerAdapter
- type NoPayloadAdapter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InLambda ¶
func InLambda() bool
AWS Lambda doesn't support giving argv, so we use an ugly hack to detect it
func NewLambdaHttpHandlerAdapter ¶
adapts lambda.Handler to Go's http.Handler by translating between API gateway request/responses
func ServeApiGatewayProxyRequestUsingHttpHandler ¶
func ServeApiGatewayProxyRequestUsingHttpHandler( ctx context.Context, proxyRequest *events.APIGatewayProxyRequest, httpHandler http.Handler, ) ([]byte, error)
github.com/akrylysov/algnhsa has similar implementation than apex/gateway, but had the useful bits non-exported and it used httptest for production code
Types ¶
type LambdaHttpHandlerAdapter ¶
type LambdaHttpHandlerAdapter struct {
// contains filtered or unexported fields
}
higher level handler adapter. ServeApiGatewayProxyRequestUsingHttpHandler() is lower if you need to be able to give APIGatewayProxyRequest and get back byte slice & error
type NoPayloadAdapter ¶
simple function as a Lambda handler by discarding input payload and returning empty payload. this is available in AWS's lambda.Start(handler interface{}) but it's not typesafe (runtime error if fn sig doesn't match)