1use dashmap::DashMap;
2use std::collections::HashMap;
3
4#[derive(Debug, Default)]
6pub struct LambdaState {
7 pub functions: DashMap<String, LambdaFunction>,
8 pub event_source_mappings: DashMap<String, EventSourceMapping>,
9 pub layers: DashMap<String, Vec<LayerVersion>>,
10 pub url_configs: DashMap<String, FunctionUrlConfig>,
12 pub event_invoke_configs: DashMap<String, EventInvokeConfig>,
14}
15
16#[derive(Debug, Clone, Default)]
17pub struct EventInvokeConfig {
18 pub function_arn: String,
19 pub maximum_retry_attempts: Option<i32>,
20 pub maximum_event_age_in_seconds: Option<i32>,
21 pub destination_on_success: Option<String>,
22 pub destination_on_failure: Option<String>,
23 pub last_modified: f64,
24}
25
26#[derive(Debug, Clone)]
27pub struct LambdaFunction {
28 pub name: String,
29 pub arn: String,
30 pub runtime: Option<String>,
31 pub role: String,
32 pub handler: Option<String>,
33 pub description: String,
34 pub timeout: u32,
35 pub memory_size: u32,
36 pub code_sha256: String,
37 pub code_size: u64,
38 pub code_data: Option<Vec<u8>>,
39 pub environment: HashMap<String, String>,
40 pub version: String,
42 pub versions: Vec<FunctionVersion>,
43 pub aliases: HashMap<String, Alias>,
44 pub last_modified: String,
45 pub state: String,
47 pub invocations: Vec<InvocationRecord>,
49 pub policy_statements: HashMap<String, serde_json::Value>,
51 pub tags: HashMap<String, String>,
53}
54
55#[derive(Debug, Clone)]
57pub struct FunctionUrlConfig {
58 #[allow(dead_code)]
60 pub function_name: String,
61 pub function_arn: String,
62 pub function_url: String,
63 pub auth_type: String,
64 pub cors: Option<serde_json::Value>,
65 pub creation_time: String,
66 pub last_modified_time: String,
67}
68
69#[derive(Debug, Clone)]
70pub struct FunctionVersion {
71 pub version: String,
72 pub description: String,
73 pub code_sha256: String,
74 pub code_size: u64,
75 pub last_modified: String,
76}
77
78#[derive(Debug, Clone)]
79pub struct Alias {
80 pub name: String,
81 pub arn: String,
82 pub function_version: String,
83 pub description: String,
84}
85
86#[allow(dead_code)]
88#[derive(Debug, Clone)]
89pub struct InvocationRecord {
90 pub invocation_id: String,
91 pub invocation_type: String,
92 pub payload: serde_json::Value,
93 pub response: serde_json::Value,
94 pub status_code: u16,
95 pub timestamp: String,
96}
97
98#[derive(Debug, Clone)]
99pub struct EventSourceMapping {
100 pub uuid: String,
101 pub event_source_arn: String,
102 pub function_arn: String,
103 pub batch_size: u32,
104 #[allow(dead_code)]
106 pub enabled: bool,
107 pub state: String,
108 pub last_modified: String,
109}
110
111#[derive(Debug, Clone)]
112pub struct LayerVersion {
113 #[allow(dead_code)]
115 pub layer_name: String,
116 pub layer_arn: String,
117 pub version_arn: String,
118 pub version: u64,
119 pub description: String,
120 pub compatible_runtimes: Vec<String>,
121 pub code_sha256: String,
122 pub code_size: u64,
123 #[allow(dead_code)]
125 pub code_data: Option<Vec<u8>>,
126 pub created_date: String,
127}