pub struct LambdaA2aHandler { /* private fields */ }Expand description
Lambda handler wrapping the axum Router.
Implementations§
Source§impl LambdaA2aHandler
impl LambdaA2aHandler
pub fn builder() -> LambdaA2aServerBuilder
Sourcepub async fn handle(&self, event: Request) -> Result<Response<Body>, Error>
pub async fn handle(&self, event: Request) -> Result<Response<Body>, Error>
Handle a Lambda HTTP request.
Sourcepub async fn handle_http_event_value(
&self,
value: Value,
) -> Result<Value, Error>
pub async fn handle_http_event_value( &self, value: Value, ) -> Result<Value, Error>
Handle a raw Lambda HTTP event delivered as serde_json::Value
and return a response envelope matching the inbound event
shape:
Inbound shape detected by lambda_http::LambdaRequest | Response envelope |
|---|---|
API Gateway v1 (REST) — top-level httpMethod + path | ApiGatewayProxyResponse |
API Gateway v2 / Function URL — requestContext.http | ApiGatewayV2httpResponse |
ALB target group — requestContext.elb | AlbTargetGroupResponse |
| WebSocket / unrecognised | Err(...) |
Mismatching envelopes — most commonly a v2 response sent in
response to a v1 invocation — cause API Gateway to return
502 Bad Gateway regardless of the body, because the response
fails the gateway’s contract validation. This method ensures
symmetry: response shape is always picked from the inbound
shape, never hardcoded.
This is the framework’s canonical HTTP envelope conversion
primitive — useful when a single Lambda function routes among
HTTP and one or more non-framework triggers (EventBridge,
DynamoDB streams, custom invoke) and the adopter drives
lambda_runtime::run with serde_json::Value directly.
Handles the LambdaRequest deserialization, the text-vs-base64
content-type detection, and the response envelope rebuild.
Body encoding: text for text/*, application/json,
application/xml, application/javascript, or anything with
charset=; base64 otherwise.
Path-prefix stripping (see
LambdaA2aServerBuilder::strip_path_prefix) is applied
because dispatch flows through Self::handle. Adopters who
only serve HTTP should continue to use Self::run_http_only
or LambdaA2aServerBuilder::run; this entry point exists for
composition with adopter-owned third triggers.
Source§impl LambdaA2aHandler
impl LambdaA2aHandler
Sourcepub async fn run_http_only(self) -> Result<(), Error>
pub async fn run_http_only(self) -> Result<(), Error>
Run this handler as a pure HTTP Lambda. Strict: any non-HTTP
event shape (SQS, DynamoDB stream, scheduler, …) causes
lambda_http::run to return a deserialization error on
invocation.
Appropriate for Lambdas whose only trigger is a Function URL, API Gateway, or ALB. The request Lambda in the two-Lambda durable-executor topology is the canonical caller.
Trait Implementations§
Source§impl Clone for LambdaA2aHandler
impl Clone for LambdaA2aHandler
Source§fn clone(&self) -> LambdaA2aHandler
fn clone(&self) -> LambdaA2aHandler
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more