pub struct RuntimeClient { /* fields omitted */ }
Used by the Runtime to communicate with the internal endpoint.
Creates a new instance of the Runtime APIclient SDK. The http client has timeouts disabled and
will always send a Connection: keep-alive
header. Optionally, the runtime client can receive
a user agent string. This string is used to make requests to the runtime APIs and is used to
identify the runtime being used by the function. For example, the lambda_runtime_core
crate
uses AWS_Lambda_Rust/0.1.0 (rustc/1.31.1-stable)
. The runtime client can also receive an
instance of Tokio Runtime to use.
Polls for new events to the Runtime APIs.
Calls the Lambda Runtime APIs to submit a response to an event. In this function we treat
all errors from the API as an unrecoverable error. This is because the API returns
4xx errors for responses that are too long. In that case, we simply log the output and fail.
request_id
The request id associated with the event we are serving the response for.
This is returned as a header from the poll (/next
) API.
output
The object be sent back to the Runtime APIs as a response.
A Result
object containing a bool return value for the call or an error::ApiError
instance.
Calls Lambda's Runtime APIs to send an error generated by the Handler
. Because it's rust,
the error type for lambda is always handled
.
request_id
The request id associated with the event we are serving the error for.
e
An instance of errors::HandlerError
generated by the handler function. Handler
functions can generate a new error using the new_error(&str)
method of the Context
object.
A Result
object containing a bool return value for the call or an error::ApiError
instance.
Calls the Runtime APIs to report a failure during the init process.
The contents of the error (e
) parmeter are passed to the Runtime APIs
using the private to_response()
method.
e
An instance of errors::RuntimeError
.
If it cannot send the init error. In this case we panic to force the runtime
to restart.
Returns the endpoint configured for this HTTP Runtime client.
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static