You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
This package makes it easy to run AWS Lambda Functions written in Rust. This workspace includes multiple crates:
6
6
7
7
-[](https://docs.rs/lambda_runtime)**`lambda-runtime`** is a library that provides a Lambda runtime for applications written in Rust.
8
-
-[](https://docs.rs/lambda_http)**`lambda-http`** is a library that makes it easy to write API Gateway proxy event focused Lambda functions in Rust.
8
+
-[](https://docs.rs/lambda_http)**`lambda-http`** is a library for writing HTTP Lambda functions in Rust, with support for upstream API Gateway, ALB, Lambda Function URLs, and VPC Lattice.
9
9
-[](https://docs.rs/lambda-extension)**`lambda-extension`** is a library that makes it easy to write Lambda Runtime Extensions in Rust.
10
10
-[](https://docs.rs/aws_lambda_events)**`lambda-events`** is a library with strongly-typed Lambda event structs in Rust.
11
11
-[](https://docs.rs/lambda_runtime_api_client)**`lambda-runtime-api-client`** is a shared library between the lambda runtime and lambda extension libraries that includes a common API client to talk with the AWS Lambda Runtime API.
**`lambda-http`** is an abstraction that takes payloads from different services and turns them into http objects, making it easy to write API Gateway proxy event focused Lambda functions in Rust.
5
+
**`lambda-http`** is an abstraction that takes HTTP-shaped payloads from different AWS services and turns them
6
+
into standard `http` objects, making it easy to write Lambda functions in Rust that serve HTTP traffic
7
+
regardless of the upstream trigger.
6
8
7
9
lambda-http handler is made of:
8
10
@@ -14,17 +16,18 @@ We are able to handle requests from:
14
16
*[API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html) REST, HTTP and WebSockets API lambda integrations
Thanks to the `Request` type we can seamlessly handle proxy integrations without the worry to specify the specific service type.
21
+
Thanks to the `Request` type we can seamlessly handle all of these triggers without having to write service-specific code.
19
22
20
-
There is also an extension for `lambda_http::Request` structs that provides access to [API gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format) and [ALB](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html) features.
23
+
There is also an extension for `lambda_http::Request` structs that provides access to [API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format), [ALB](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html), and [VPC Lattice](https://docs.aws.amazon.com/vpc-lattice/latest/ug/lambda-functions.html) features.
21
24
22
25
For example some handy extensions:
23
26
24
27
*`query_string_parameters` - Return pre-parsed http query string parameters, parameters provided after the `?` portion of a url associated with the request
25
28
*`path_parameters` - Return pre-extracted path parameters, parameter provided in url placeholders `/foo/{bar}/baz/{qux}` associated with the request
26
29
*`lambda_context` - Return the Lambda context for the invocation; see the [runtime docs](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-api.html#runtimes-api-next)
27
-
*`request_context` - Return the ALB/API Gateway request context
30
+
*`request_context` - Return the ALB, API Gateway, or VPC Lattice request context
28
31
* payload - Return the Result of a payload parsed into a type that implements `serde::Deserialize`
29
32
30
33
See the `lambda_http::RequestPayloadExt` and `lambda_http::RequestExt` traits for more extensions.
@@ -238,16 +241,17 @@ If you don't want to receive the stage as part of the path, you can set the envi
238
241
239
242
## Feature flags
240
243
241
-
`lambda_http` is a wrapper for HTTP events coming from three different services, Amazon Load Balancer (ALB), Amazon Api Gateway (APIGW), and AWS Lambda Function URLs. Amazon Api Gateway can also send events from three different endpoints, REST APIs, HTTP APIs, and WebSockets. `lambda_http` transforms events from all these sources into native `http::Request` objects, so you can incorporate Rust HTTP semantics into your Lambda functions.
244
+
`lambda_http` is a wrapper for HTTP events coming from four different AWS services: Application Load Balancer (ALB), API Gateway, Lambda Function URLs, and VPC Lattice. API Gateway can send events from three different endpoint types: REST APIs, HTTP APIs, and WebSockets. `lambda_http` transforms events from all these sources into native `http::Request` objects, so you can incorporate Rust HTTP semantics into your Lambda functions.
242
245
243
246
By default, `lambda_http` compiles your function to support any of those services. This increases the compile time of your function because we have to generate code for all the sources. In reality, you'll usually put a Lambda function only behind one of those sources. You can choose which source to generate code for with feature flags.
244
247
245
-
The available features flags for `lambda_http` are the following:
248
+
The available feature flags for `lambda_http` are the following:
246
249
247
250
-`alb`: for events coming from [Amazon Elastic Load Balancer](https://aws.amazon.com/elasticloadbalancing/).
248
-
-`apigw_rest`: for events coming from [Amazon API Gateway Rest APIs](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.html).
251
+
-`apigw_rest`: for events coming from [Amazon API Gateway REST APIs](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.html).
249
252
-`apigw_http`: for events coming from [Amazon API Gateway HTTP APIs](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api.html) and [AWS Lambda Function URLs](https://docs.aws.amazon.com/lambda/latest/dg/lambda-urls.html).
250
253
-`apigw_websockets`: for events coming from [Amazon API Gateway WebSockets](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html).
254
+
-`vpc_lattice`: for events coming from [AWS VPC Lattice](https://docs.aws.amazon.com/vpc-lattice/latest/ug/lambda-functions.html).
251
255
252
256
If you only want to support one of these sources, you can disable the default features, and enable only the source that you care about in your package's `Cargo.toml` file. Substitute the dependency line for `lambda_http` for the snippet below, changing the feature that you want to enable:
//! This crate abstracts over all of these trigger events using standard [`http`](https://github.com/hyperium/http) types minimizing the mental overhead
8
11
//! of understanding the nuances and variation between trigger details allowing you to focus more on your application while also giving you to the maximum flexibility to
0 commit comments