2023-08-26 22:32:38 +02:00
|
|
|
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 {
|
2023-08-27 00:07:56 +02:00
|
|
|
pub cursor: Option<uuid::Uuid>,
|
2023-08-26 22:32:38 +02:00
|
|
|
pub logs: Vec<String>,
|
|
|
|
}
|
2023-08-27 16:49:53 +02:00
|
|
|
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
|
|
pub struct LogEvent {
|
|
|
|
pub id: uuid::Uuid,
|
|
|
|
pub author: String,
|
|
|
|
pub content: String,
|
2023-08-27 18:15:25 +02:00
|
|
|
pub timestamp: chrono::DateTime<chrono::Utc>,
|
2023-08-27 16:49:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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(),
|
2023-08-27 18:15:25 +02:00
|
|
|
timestamp: chrono::Utc::now(),
|
2023-08-27 16:49:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-08-27 19:42:33 +02:00
|
|
|
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
|
|
pub struct Agent {
|
|
|
|
pub name: String,
|
|
|
|
}
|
2023-08-27 20:16:27 +02:00
|
|
|
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
|
|
pub struct Lease {
|
|
|
|
pub id: uuid::Uuid,
|
|
|
|
pub lease: uuid::Uuid,
|
|
|
|
}
|