kit: github.com/go-kit/kit/transport/awslambda Index | Files

package awslambda

import "github.com/go-kit/kit/transport/awslambda"

Package awslambda provides an AWS Lambda transport layer.

Index

Package Files

doc.go encode_decode.go handler.go request_response_funcs.go

func DefaultErrorEncoder Uses

func DefaultErrorEncoder(ctx context.Context, err error) ([]byte, error)

DefaultErrorEncoder defines the default behavior of encoding an error response, where it returns nil, and the error itself.

type DecodeRequestFunc Uses

type DecodeRequestFunc func(context.Context, []byte) (interface{}, error)

DecodeRequestFunc extracts a user-domain request object from an AWS Lambda payload.

type EncodeResponseFunc Uses

type EncodeResponseFunc func(context.Context, interface{}) ([]byte, error)

EncodeResponseFunc encodes the passed response object into []byte, ready to be sent as AWS Lambda response.

type ErrorEncoder Uses

type ErrorEncoder func(ctx context.Context, err error) ([]byte, error)

ErrorEncoder is responsible for encoding an error.

type Handler Uses

type Handler struct {
    // contains filtered or unexported fields
}

Handler wraps an endpoint.

func NewHandler Uses

func NewHandler(
    e endpoint.Endpoint,
    dec DecodeRequestFunc,
    enc EncodeResponseFunc,
    options ...HandlerOption,
) *Handler

NewHandler constructs a new handler, which implements the AWS lambda.Handler interface.

func (*Handler) Invoke Uses

func (h *Handler) Invoke(
    ctx context.Context,
    payload []byte,
) (resp []byte, err error)

Invoke represents implementation of the AWS lambda.Handler interface.

type HandlerFinalizerFunc Uses

type HandlerFinalizerFunc func(ctx context.Context, resp []byte, err error)

HandlerFinalizerFunc is executed at the end of Invoke. This can be used for logging purposes.

type HandlerOption Uses

type HandlerOption func(*Handler)

HandlerOption sets an optional parameter for handlers.

func HandlerAfter Uses

func HandlerAfter(after ...HandlerResponseFunc) HandlerOption

HandlerAfter functions are only executed after invoking the endpoint but prior to returning a response.

func HandlerBefore Uses

func HandlerBefore(before ...HandlerRequestFunc) HandlerOption

HandlerBefore functions are executed on the payload byte, before the request is decoded.

func HandlerErrorEncoder Uses

func HandlerErrorEncoder(ee ErrorEncoder) HandlerOption

HandlerErrorEncoder is used to encode errors.

func HandlerErrorHandler Uses

func HandlerErrorHandler(errorHandler transport.ErrorHandler) HandlerOption

HandlerErrorHandler is used to handle non-terminal errors. By default, non-terminal errors are ignored.

func HandlerErrorLogger Uses

func HandlerErrorLogger(logger log.Logger) HandlerOption

HandlerErrorLogger is used to log non-terminal errors. By default, no errors are logged. Deprecated: Use HandlerErrorHandler instead.

func HandlerFinalizer Uses

func HandlerFinalizer(f ...HandlerFinalizerFunc) HandlerOption

HandlerFinalizer sets finalizer which are called at the end of request. By default no finalizer is registered.

type HandlerRequestFunc Uses

type HandlerRequestFunc func(ctx context.Context, payload []byte) context.Context

HandlerRequestFunc may take information from the received payload and use it to place items in the request scoped context. HandlerRequestFuncs are executed prior to invoking the endpoint and decoding of the payload.

type HandlerResponseFunc Uses

type HandlerResponseFunc func(ctx context.Context, response interface{}) context.Context

HandlerResponseFunc may take information from a request context and use it to manipulate the response before it's marshaled. HandlerResponseFunc are executed after invoking the endpoint but prior to returning a response.

Package awslambda imports 4 packages (graph). Updated 2019-04-25. Refresh now. Tools for package owners.