put all files in their expected file
This commit is contained in:
81
WatcherAgent/src/models.rs
Normal file
81
WatcherAgent/src/models.rs
Normal file
@@ -0,0 +1,81 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::time::Instant;
|
||||
|
||||
// Data structures matching the C# DTOs
|
||||
#[derive(Serialize, Debug)]
|
||||
pub struct RegistrationDto {
|
||||
#[serde(rename = "id")]
|
||||
pub id: i32,
|
||||
#[serde(rename = "ipAddress")]
|
||||
pub ip_address: String,
|
||||
#[serde(rename = "cpuType")]
|
||||
pub cpu_type: String,
|
||||
#[serde(rename = "cpuCores")]
|
||||
pub cpu_cores: i32,
|
||||
#[serde(rename = "gpuType")]
|
||||
pub gpu_type: String,
|
||||
#[serde(rename = "ramSize")]
|
||||
pub ram_size: f64,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
pub struct MetricDto {
|
||||
#[serde(rename = "serverId")]
|
||||
pub server_id: i32,
|
||||
#[serde(rename = "ipAddress")]
|
||||
pub ip_address: String,
|
||||
#[serde(rename = "cpu_Load")]
|
||||
pub cpu_load: f64,
|
||||
#[serde(rename = "cpu_Temp")]
|
||||
pub cpu_temp: f64,
|
||||
#[serde(rename = "gpu_Load")]
|
||||
pub gpu_load: f64,
|
||||
#[serde(rename = "gpu_Temp")]
|
||||
pub gpu_temp: f64,
|
||||
#[serde(rename = "gpu_Vram_Size")]
|
||||
pub gpu_vram_size: f64,
|
||||
#[serde(rename = "gpu_Vram_Usage")]
|
||||
pub gpu_vram_usage: f64,
|
||||
#[serde(rename = "ram_Load")]
|
||||
pub ram_load: f64,
|
||||
#[serde(rename = "ram_Size")]
|
||||
pub ram_size: f64,
|
||||
#[serde(rename = "disk_Size")]
|
||||
pub disk_size: f64,
|
||||
#[serde(rename = "disk_Usage")]
|
||||
pub disk_usage: f64,
|
||||
#[serde(rename = "disk_Temp")]
|
||||
pub disk_temp: f64,
|
||||
#[serde(rename = "net_In")]
|
||||
pub net_in: f64,
|
||||
#[serde(rename = "net_Out")]
|
||||
pub net_out: f64,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct IdResponse {
|
||||
pub id: i32,
|
||||
#[serde(rename = "ipAddress")]
|
||||
pub ip_address: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct HeartbeatDto {
|
||||
#[serde(rename = "IpAddress")]
|
||||
pub ip_address: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
pub struct HardwareDto {
|
||||
pub cpu_type: String,
|
||||
pub cpu_cores: i32,
|
||||
pub gpu_type: String,
|
||||
pub ram_size: f64,
|
||||
pub ip_address: String,
|
||||
}
|
||||
|
||||
pub struct NetworkState {
|
||||
pub prev_rx: u64,
|
||||
pub prev_tx: u64,
|
||||
pub last_update: Instant,
|
||||
}
|
Reference in New Issue
Block a user