8 releases (breaking)

0.11.1 May 8, 2024
0.11.0 Mar 28, 2024
0.10.0 Feb 26, 2024
0.9.0 Dec 20, 2023
0.5.0 Feb 20, 2022

#183 in HTTP server

Download history 37118/week @ 2024-08-19 44848/week @ 2024-08-26 38574/week @ 2024-09-02 38203/week @ 2024-09-09 27145/week @ 2024-09-16 34554/week @ 2024-09-23 36206/week @ 2024-09-30 36276/week @ 2024-10-07 38894/week @ 2024-10-14 39607/week @ 2024-10-21 43890/week @ 2024-10-28 49667/week @ 2024-11-04 47860/week @ 2024-11-11 51454/week @ 2024-11-18 43327/week @ 2024-11-25 56745/week @ 2024-12-02

201,137 downloads per month
Used in 61 crates (3 directly)

Apache-2.0

27KB
516 lines

AWS Lambda Runtime API Client

Docs

lambda-runtime-api-client is a library to interact with the AWS Lambda Runtime API.

This crate provides simple building blocks to send REST request to this API. You probably don't need to use this crate directly, look at lambda_runtime and lambda_extension instead.

Example

use http::{Method, Request};
use hyper::Body;
use lambda_runtime_api_client::{build_request, Client, Error};

fn register_request(extension_name: &str, events: &[&str]) -> Result<Request<Body>, Error> {
    let events = serde_json::json!({ "events": events });

    let req = build_request()
        .method(Method::POST)
        .uri("/2020-01-01/extension/register")
        .header("Lambda-Extension-Name", extension_name)
        .body(Body::from(serde_json::to_string(&events)?))?;

    Ok(req)
}

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::builder().build()?;
    let request = register_request("my_extension", &["INVOKE"])?;

    client.call(request).await
}

Dependencies

~6–16MB
~191K SLoC