churn/crates/churn-domain/src/lib.rs
kjuulh 541b9b22d2
chore: change to byte slice
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-08-27 20:16:27 +02:00

56 lines
1.2 KiB
Rust

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<uuid::Uuid>,
pub logs: Vec<String>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct LogEvent {
pub id: uuid::Uuid,
pub author: String,
pub content: String,
pub timestamp: chrono::DateTime<chrono::Utc>,
}
impl LogEvent {
pub fn new(author: impl Into<String>, content: impl Into<String>) -> 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,
}