Client for the Lambda Runtime API
(version 2018-06-01), built on Mayfly.HTTP.
A behaviour as well as the default implementation, so Mayfly.Poller can be
tested against a fake. All functions return :ok/{:ok, _} for 2xx and
{:error, {:http, status, body}} or {:error, transport_reason} otherwise.
Headers handled
Lambda-Runtime-Invocation-Idis echoed on/responseand/error.Lambda-Runtime-Function-Error-Typeis set fromMayfly.ErrorPayload.header_type/1.Lambda-Runtime-Function-Xray-Error-Causecarries an X-Ray cause document (skipped when larger than 1 MiB).- Streaming responses use
Lambda-Runtime-Function-Response-Mode: streaming, chunked transfer encoding and error trailers.
Summary
Functions
Parses AWS_LAMBDA_RUNTIME_API (host:port) into an endpoint tuple.
Returns nil when unset.
Types
Callbacks
@callback init_error(endpoint(), Mayfly.ErrorPayload.t()) :: :ok | {:error, error()}
@callback invocation_error(endpoint(), Mayfly.Context.t(), Mayfly.ErrorPayload.t()) :: :ok | {:error, error()}
@callback invocation_response(endpoint(), Mayfly.Context.t(), Mayfly.Response.t()) :: :ok | {:error, error()}
@callback next_invocation(endpoint()) :: {:ok, invocation()} | {:error, error()}