generated from methanium/template
72 lines
1.6 KiB
Rust
72 lines
1.6 KiB
Rust
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
use uuid::Uuid;
|
|
|
|
#[derive(Clone, Debug, Serialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct Snapshot {
|
|
pub categories: Vec<Category>,
|
|
pub incidents: Vec<Incident>,
|
|
pub generated_at: DateTime<Utc>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct Category {
|
|
pub id: String,
|
|
pub name: String,
|
|
pub logo: String,
|
|
pub services: Vec<Service>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct Service {
|
|
pub id: String,
|
|
pub name: String,
|
|
pub url: String,
|
|
pub check_http3: bool,
|
|
pub status: ServiceStatus,
|
|
pub status_code: Option<u16>,
|
|
pub latency_ms: Option<u64>,
|
|
pub error: Option<String>,
|
|
pub checked_at: Option<DateTime<Utc>>,
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum ServiceStatus {
|
|
Unknown,
|
|
Online,
|
|
Offline,
|
|
TimedOut,
|
|
HttpError,
|
|
Http3Error,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct Incident {
|
|
pub id: Uuid,
|
|
pub title: String,
|
|
pub message: String,
|
|
pub severity: Severity,
|
|
pub created_at: DateTime<Utc>,
|
|
pub resolved_at: Option<DateTime<Utc>>,
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum Severity {
|
|
Minor,
|
|
Major,
|
|
Critical,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
|
pub struct NewIncident {
|
|
pub title: String,
|
|
pub message: String,
|
|
pub severity: Severity,
|
|
}
|