use dashmap::DashMap;
use std::collections::HashMap;
#[derive(Debug, Default)]
pub struct LambdaState {
pub functions: DashMap<String, LambdaFunction>,
pub event_source_mappings: DashMap<String, EventSourceMapping>,
pub layers: DashMap<String, Vec<LayerVersion>>,
pub url_configs: DashMap<String, FunctionUrlConfig>,
pub event_invoke_configs: DashMap<String, EventInvokeConfig>,
}
#[derive(Debug, Clone, Default)]
pub struct EventInvokeConfig {
pub function_arn: String,
pub maximum_retry_attempts: Option<i32>,
pub maximum_event_age_in_seconds: Option<i32>,
pub destination_on_success: Option<String>,
pub destination_on_failure: Option<String>,
pub last_modified: f64,
}
#[derive(Debug, Clone)]
pub struct LambdaFunction {
pub name: String,
pub arn: String,
pub runtime: Option<String>,
pub role: String,
pub handler: Option<String>,
pub description: String,
pub timeout: u32,
pub memory_size: u32,
pub code_sha256: String,
pub code_size: u64,
pub code_data: Option<Vec<u8>>,
pub environment: HashMap<String, String>,
pub version: String,
pub versions: Vec<FunctionVersion>,
pub aliases: HashMap<String, Alias>,
pub last_modified: String,
pub state: String,
pub invocations: Vec<InvocationRecord>,
pub policy_statements: HashMap<String, serde_json::Value>,
pub tags: HashMap<String, String>,
}
#[derive(Debug, Clone)]
pub struct FunctionUrlConfig {
#[allow(dead_code)]
pub function_name: String,
pub function_arn: String,
pub function_url: String,
pub auth_type: String,
pub cors: Option<serde_json::Value>,
pub creation_time: String,
pub last_modified_time: String,
}
#[derive(Debug, Clone)]
pub struct FunctionVersion {
pub version: String,
pub description: String,
pub code_sha256: String,
pub code_size: u64,
pub last_modified: String,
}
#[derive(Debug, Clone)]
pub struct Alias {
pub name: String,
pub arn: String,
pub function_version: String,
pub description: String,
}
#[allow(dead_code)]
#[derive(Debug, Clone)]
pub struct InvocationRecord {
pub invocation_id: String,
pub invocation_type: String,
pub payload: serde_json::Value,
pub response: serde_json::Value,
pub status_code: u16,
pub timestamp: String,
}
#[derive(Debug, Clone)]
pub struct EventSourceMapping {
pub uuid: String,
pub event_source_arn: String,
pub function_arn: String,
pub batch_size: u32,
#[allow(dead_code)]
pub enabled: bool,
pub state: String,
pub last_modified: String,
}
#[derive(Debug, Clone)]
pub struct LayerVersion {
#[allow(dead_code)]
pub layer_name: String,
pub layer_arn: String,
pub version_arn: String,
pub version: u64,
pub description: String,
pub compatible_runtimes: Vec<String>,
pub code_sha256: String,
pub code_size: u64,
#[allow(dead_code)]
pub code_data: Option<Vec<u8>>,
pub created_date: String,
}