use serde::Serialize;
#[derive(Debug, Clone, Serialize)]
pub struct StorageList {
pub storages: Vec<crate::StorageInfo>,
pub coverage: Vec<crate::CoverageRow>,
}
#[derive(Debug, Clone, Serialize)]
pub struct RouterList {
pub asked: String,
pub routers: Vec<crate::report::RouterInfo>,
}
#[derive(Debug, Clone, serde::Serialize)]
pub struct RouterInfo {
pub zid: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub locators: Vec<String>,
pub raw: serde_json::Value,
}
#[derive(Debug, Clone, serde::Serialize)]
pub struct StorageInfo {
pub zid: String,
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub key_expr: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub strip_prefix: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub volume: Option<String>,
pub raw: serde_json::Value,
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize)]
#[serde(tag = "coverage", content = "storage", rename_all = "snake_case")]
pub enum Coverage {
Covered(String),
Partial(String),
Uncovered,
}
#[derive(Debug, Clone, serde::Serialize)]
pub struct CoverageRow {
pub producer: String,
pub path: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub ttl_s: Option<i64>,
#[serde(flatten)]
pub coverage: Coverage,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize)]
#[serde(rename_all = "snake_case")]
pub enum EntityKind {
Subscriber,
Publisher,
Queryable,
Querier,
Token,
}
#[derive(Debug, Clone, serde::Serialize)]
pub struct DeclaredEntity {
pub kind: EntityKind,
pub keyexpr: String,
pub node_zid: String,
pub sources: serde_json::Value,
}
#[derive(Debug, Clone, Default, serde::Serialize)]
pub struct DeclaredEntities {
pub entities: Vec<DeclaredEntity>,
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize)]
pub struct MeshLink {
pub a: String,
pub b: String,
pub corroborated: bool,
pub links: Vec<String>,
}
#[derive(Debug, Clone, serde::Serialize)]
pub struct OriginAttachment {
pub origin: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub session_zid: Option<String>,
pub reporter_zid: String,
pub token_key: String,
}
#[derive(Debug, Clone, serde::Serialize)]
pub struct TopologyNode {
pub zid: String,
pub whatami: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub version: Option<String>,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub locators: Vec<String>,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub locators_via_links: Vec<String>,
pub answered: bool,
}
#[derive(Debug, Clone, serde::Serialize)]
pub struct TopologyEdge {
pub reporter: String,
pub peer: String,
pub whatami: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub region: Option<String>,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub links: Vec<String>,
}
#[derive(Debug, Clone, serde::Serialize)]
pub struct TopologyReport {
pub nodes: Vec<TopologyNode>,
pub edges: Vec<TopologyEdge>,
pub asked: String,
pub answered: usize,
pub self_zid: String,
}