autumn_plugin_aws_lambda/lib.rs
1//! Run an [Autumn](https://autumn-web.app) application on AWS Lambda.
2//!
3//! Add the plugin. Do not change the call to `run()`:
4//!
5//! ```rust,no_run
6//! use autumn_plugin_aws_lambda::AwsLambdaPlugin;
7//! use autumn_web::prelude::*;
8//!
9//! #[get("/")]
10//! async fn index() -> &'static str {
11//! "hello"
12//! }
13//!
14//! #[autumn_web::main]
15//! async fn main() {
16//! autumn_web::app()
17//! .plugin(AwsLambdaPlugin::new())
18//! .routes(routes![index])
19//! .run()
20//! .await;
21//! }
22//! ```
23//!
24//! On Lambda, the plugin receives each event. It sends the event to the
25//! Autumn server as an HTTP request on loopback. With the default
26//! [`Activation::Auto`], the plugin stays idle outside Lambda. See the
27//! [design record](https://github.com/autumn-foundation/autumn-plugin-aws-lambda/blob/main/docs/adr/0001-loopback-proxy.md).
28
29mod activation;
30mod error;
31mod headers;
32mod plugin;
33mod proxy;
34mod runtime;
35mod timing;
36mod upstream;
37
38pub use activation::Activation;
39pub use error::PluginError;
40pub use plugin::AwsLambdaPlugin;
41pub use runtime::ResponseMode;
42
43/// Internal items for the tests of this crate.
44///
45/// This module is not part of the public API. It can change in any release.
46#[doc(hidden)]
47pub mod __private {
48 pub use crate::activation::{RUNTIME_API_ENV, lambda_concurrency, missing_lambda_env};
49 pub use crate::headers::{
50 LAMBDA_REQUEST_ID_HEADER, fold_repeated_headers, forwarded_client_ip,
51 prepare_request_headers, set_forwarded_for, strip_hop_by_hop, text_body_is_lossless,
52 upstream_path_and_query,
53 };
54 pub use crate::plugin::slow_shutdown_settings;
55 pub use crate::proxy::{LambdaProxy, ProxyBody, ProxyFailure};
56 pub use crate::runtime::wait_until;
57 pub use crate::timing::{invoke_budget_ms, next_delay_ms};
58 pub use crate::upstream::Upstream;
59}