7 releases (breaking)

0.11.0 Mar 28, 2024
0.10.0 Feb 26, 2024
0.9.0 Dec 20, 2023
0.8.0 Apr 11, 2023
0.5.0 Feb 20, 2022

#348 in HTTP server

Download history 25993/week @ 2023-12-18 10359/week @ 2023-12-25 24225/week @ 2024-01-01 26828/week @ 2024-01-08 31096/week @ 2024-01-15 34443/week @ 2024-01-22 34583/week @ 2024-01-29 35053/week @ 2024-02-05 38333/week @ 2024-02-12 27321/week @ 2024-02-19 30267/week @ 2024-02-26 30859/week @ 2024-03-04 33737/week @ 2024-03-11 28326/week @ 2024-03-18 24214/week @ 2024-03-25 33569/week @ 2024-04-01

120,922 downloads per month
Used in 46 crates (3 directly)

Apache-2.0

27KB
515 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–17MB
~202K SLoC