use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Deserialize, Serialize)] pub struct LeaseResp { pub token: String, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct AgentEnrollReq { pub lease: String, pub server: String, pub agent_name: String, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ServerEnrollReq { pub lease: String, pub agent_name: String, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ServerMonitorResp { pub cursor: Option, pub logs: Vec, } #[derive(Clone, Debug, Serialize, Deserialize)] pub struct LogEvent { pub id: uuid::Uuid, pub author: String, pub content: String, pub timestamp: chrono::DateTime, } impl LogEvent { pub fn new(author: impl Into, content: impl Into) -> Self { Self { id: uuid::Uuid::new_v4(), author: author.into(), content: content.into(), timestamp: chrono::Utc::now(), } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Agent { pub name: String, } #[derive(Clone, Debug, Serialize, Deserialize)] pub struct Lease { pub id: uuid::Uuid, pub lease: uuid::Uuid, }