Documentation
¶
Overview ¶
Package awslambda provides an AWS Lambda transport layer.
Index ¶
- func DefaultErrorEncoder(ctx context.Context, err error) ([]byte, error)
- type DecodeRequestFunc
- type EncodeResponseFunc
- type ErrorEncoder
- type Handler
- type HandlerFinalizerFunc
- type HandlerOption
- func HandlerAfter[Request, Response any](after ...HandlerResponseFunc) HandlerOption[Request, Response]
- func HandlerBefore[Request, Response any](before ...HandlerRequestFunc) HandlerOption[Request, Response]
- func HandlerErrorEncoder[Request, Response any](ee ErrorEncoder) HandlerOption[Request, Response]
- func HandlerErrorHandler[Request, Response any](errorHandler transport.ErrorHandler) HandlerOption[Request, Response]
- func HandlerErrorLogger[Request, Response any](logger log.Logger) HandlerOption[Request, Response]
- func HandlerFinalizer[Request, Response any](f ...HandlerFinalizerFunc) HandlerOption[Request, Response]
- type HandlerRequestFunc
- type HandlerResponseFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DecodeRequestFunc ¶
DecodeRequestFunc extracts a user-domain request object from an AWS Lambda payload.
type EncodeResponseFunc ¶
EncodeResponseFunc encodes the passed response object into []byte, ready to be sent as AWS Lambda response.
type ErrorEncoder ¶
ErrorEncoder is responsible for encoding an error.
type Handler ¶
type Handler[Request, Response any] struct { // contains filtered or unexported fields }
Handler wraps an endpoint.
func NewHandler ¶
func NewHandler[Request, Response any]( e endpoint.Endpoint[Request, Response], dec DecodeRequestFunc[Request], enc EncodeResponseFunc[Response], options ...HandlerOption[Request, Response], ) *Handler[Request, Response]
NewHandler constructs a new handler, which implements the AWS lambda.Handler interface.
type HandlerFinalizerFunc ¶
HandlerFinalizerFunc is executed at the end of Invoke. This can be used for logging purposes.
type HandlerOption ¶
HandlerOption sets an optional parameter for handlers.
func HandlerAfter ¶
func HandlerAfter[Request, Response any](after ...HandlerResponseFunc) HandlerOption[Request, Response]
HandlerAfter functions are only executed after invoking the endpoint but prior to returning a response.
func HandlerBefore ¶
func HandlerBefore[Request, Response any](before ...HandlerRequestFunc) HandlerOption[Request, Response]
HandlerBefore functions are executed on the payload byte, before the request is decoded.
func HandlerErrorEncoder ¶
func HandlerErrorEncoder[Request, Response any](ee ErrorEncoder) HandlerOption[Request, Response]
HandlerErrorEncoder is used to encode errors.
func HandlerErrorHandler ¶
func HandlerErrorHandler[Request, Response any](errorHandler transport.ErrorHandler) HandlerOption[Request, Response]
HandlerErrorHandler is used to handle non-terminal errors. By default, non-terminal errors are ignored.
func HandlerErrorLogger ¶
func HandlerErrorLogger[Request, Response any](logger log.Logger) HandlerOption[Request, Response]
HandlerErrorLogger is used to log non-terminal errors. By default, no errors are logged. Deprecated: Use HandlerErrorHandler instead.
func HandlerFinalizer ¶
func HandlerFinalizer[Request, Response any](f ...HandlerFinalizerFunc) HandlerOption[Request, Response]
HandlerFinalizer sets finalizer which are called at the end of request. By default no finalizer is registered.
type HandlerRequestFunc ¶
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 ¶
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.