1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//! # Armature Lambda
//!
//! AWS Lambda runtime adapter for Armature applications.
//!
//! This crate allows you to deploy Armature applications to AWS Lambda
//! with API Gateway, ALB, or Lambda Function URLs.
//!
//! ## Quick Start
//!
//! ```rust,ignore
//! use armature::prelude::*;
//! use armature_lambda::LambdaRuntime;
//!
//! #[controller("/")]
//! struct HelloController;
//!
//! #[controller_impl]
//! impl HelloController {
//! #[get("/")]
//! async fn hello() -> &'static str {
//! "Hello from Lambda!"
//! }
//! }
//!
//! #[module(controllers: [HelloController])]
//! struct AppModule;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), lambda_runtime::Error> {
//! // Initialize tracing for CloudWatch
//! armature_lambda::init_tracing();
//!
//! // Create Armature application
//! let app = Application::create::<AppModule>();
//!
//! // Run on Lambda
//! LambdaRuntime::new(app).run().await
//! }
//! ```
//!
//! ## With AWS Services
//!
//! ```rust,ignore
//! use armature_lambda::LambdaRuntime;
//! use armature_aws::{AwsServices, AwsConfig};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), lambda_runtime::Error> {
//! armature_lambda::init_tracing();
//!
//! // Initialize AWS services
//! let aws = AwsServices::new(
//! AwsConfig::from_env()
//! .enable_dynamodb()
//! .enable_s3()
//! .build()
//! ).await?;
//!
//! // Register in DI container
//! let app = Application::create::<AppModule>();
//! app.container().register(aws);
//!
//! LambdaRuntime::new(app).run().await
//! }
//! ```
//!
//! ## Deployment
//!
//! Build for Lambda with:
//!
//! ```bash
//! # Install cargo-lambda
//! cargo install cargo-lambda
//!
//! # Build for Lambda
//! cargo lambda build --release
//!
//! # Deploy
//! cargo lambda deploy
//! ```
pub use ;
pub use LambdaRequest;
pub use LambdaResponse;
pub use ;
// Re-export lambda types
pub use lambda_http;
pub use lambda_runtime;
/// Initialize tracing for Lambda/CloudWatch.
///
/// This sets up structured JSON logging suitable for CloudWatch Logs.
/// Initialize tracing with a custom log level.