changed Dtos and Docker structs

This commit is contained in:
2025-10-04 22:05:28 +02:00
parent bb55b46c34
commit b35cac0dbe
8 changed files with 73 additions and 38 deletions

View File

@@ -186,22 +186,52 @@ pub struct Acknowledgment {
/// - `_net_out`: Network transmit rate in **bytes per second (B/s)**
/// - `_cpu_load`: CPU usage as a percentage (**0.0100.0**)
#[derive(Debug, Serialize, Clone)]
pub struct DockerContainerRegistrationDto {
pub struct DockerRegistrationDto {
/// Unique server identifier (integer)
pub server_id: u32,
pub containers: Vec<DockerContainerDto>,
/// json stringified array of DockerContainer
///
/// ## Json Example
/// json format: [{"id":"234dsf234","image":"nginx:latest","name":"webserver"},...]
///
/// ## Fields
/// id: unique container ID (first 12 hex digits)
/// image: docker image name
/// name: container name
pub containers: String,
}
#[derive(Debug, Serialize, Clone)]
pub struct DockerContainerDto {
pub id: String,
pub image: String,
pub name: String,
pub struct DockerMetricDto {
pub server_id: String,
/// json stringified array of DockerContainer
///
/// ## Json Example
/// json format: [{"id":"234dsf234","status":"running","image":"nginx:latest","name":"webserver","network":{"net_in":1024,"net_out":2048},"cpu":{"cpu_load":12.5},"ram":{"ram_load":10.0}},...]
///
/// ## Fields
/// id: unique container ID (first 12 hex digits)
/// status: "running";"stopped";others
/// image: docker image name
/// name: container name
/// network: network stats
/// cpu: cpu stats
/// ram: ram stats
pub containers: String,
}
#[derive(Debug, Serialize, Clone)]
pub struct DockerContainerMetricDto {
pub struct DockerContainer {
pub id: String,
pub status: String, // "running";"stopped";others
pub image: String,
pub name: String,
pub network: stats::ContainerNetworkInfo,
pub cpu: stats::ContainerCpuInfo,
//pub ram: stats::ContainerRamInfo,
}
#[derive(Debug, Serialize, Clone)]
pub struct Docker {
pub containers: Vec<DockerContainer>,
}