Skip to main content

core_api/host/
mod.rs

1//! Host observations, runtime management and User authorization contracts.
2pub mod access;
3pub mod auth;
4pub mod management;
5pub mod network;
6pub mod permissions;
7use serde::{Deserialize, Serialize};
8#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
9#[serde(rename_all = "camelCase")]
10pub struct Service {
11    pub service_id: String,
12    pub version: String,
13    pub kind: String,
14    pub status: String,
15}
16#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
17#[serde(rename_all = "camelCase")]
18pub struct ServiceInventory {
19    pub host_id: String,
20    pub observed_at_ms: i64,
21    pub services: Vec<Service>,
22}
23#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
24#[serde(rename_all = "camelCase")]
25pub struct Cpu {
26    pub arch: String,
27    pub logical_cores: u64,
28    pub model: String,
29}
30#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
31#[serde(rename_all = "camelCase")]
32pub struct Capacity {
33    pub total_bytes: u64,
34}
35#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
36#[serde(rename_all = "camelCase")]
37pub struct Gpu {
38    pub vendor: String,
39    pub name: String,
40    pub memory_bytes: Option<u64>,
41}
42#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
43#[serde(rename_all = "camelCase")]
44pub struct HostInfo {
45    pub host_id: String,
46    pub host_name: String,
47    pub host_type: String,
48    pub os: String,
49    pub os_version: Option<String>,
50    pub cpu: Cpu,
51    pub memory: Capacity,
52    pub disk: Option<Capacity>,
53    pub gpus: Vec<Gpu>,
54}
55#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
56#[serde(rename_all = "camelCase")]
57pub struct ServiceMetrics {
58    pub service_id: String,
59    pub status: String,
60    pub sample_state: String,
61    pub process_count: u64,
62    pub cpu_usage_percent: Option<f64>,
63    pub memory_resident_bytes: Option<u64>,
64    pub disk_read_bytes_per_second: Option<f64>,
65    pub disk_written_bytes_per_second: Option<f64>,
66}
67#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
68#[serde(rename_all = "camelCase")]
69pub struct HostMetrics {
70    pub host_id: String,
71    pub sampled_at_ms: i64,
72    pub cpu_usage_percent: Option<f64>,
73    pub memory_available_bytes: Option<u64>,
74    pub disk_available_bytes: Option<u64>,
75    pub network_received_bytes_per_second: Option<f64>,
76    pub network_sent_bytes_per_second: Option<f64>,
77    pub services: Vec<ServiceMetrics>,
78}