]> git.proxmox.com Git - proxmox-backup.git/commitdiff
api2/types: add necessary types for node status
authorDominik Csapak <d.csapak@proxmox.com>
Mon, 19 Apr 2021 11:02:01 +0000 (13:02 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 23 Apr 2021 08:30:30 +0000 (10:30 +0200)
we want to use concrete types instead of value

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/api2/types/mod.rs

index 9d1bd3018e175b6f78adfbbd665cf4e21928387f..6868b131a77fb29d5507a378a91fdfb1128c608d 100644 (file)
@@ -751,9 +751,8 @@ impl Default for GarbageCollectionStatus {
     }
 }
 
-
 #[api()]
-#[derive(Serialize, Deserialize)]
+#[derive(Default, Serialize, Deserialize)]
 /// Storage space usage information.
 pub struct StorageStatus {
     /// Total space (bytes).
@@ -1507,3 +1506,49 @@ pub struct JobScheduleStatus {
     #[serde(skip_serializing_if="Option::is_none")]
     pub last_run_endtime: Option<i64>,
 }
+
+#[api]
+#[derive(Serialize, Deserialize, Default)]
+#[serde(rename_all = "kebab-case")]
+/// Node memory usage counters
+pub struct NodeMemoryCounters {
+    /// Total memory
+    pub total: u64,
+    /// Used memory
+    pub used: u64,
+    /// Free memory
+    pub free: u64,
+}
+
+#[api]
+#[derive(Serialize,Deserialize,Default)]
+#[serde(rename_all = "kebab-case")]
+/// Contains general node information such as the fingerprint`
+pub struct NodeInformation {
+    /// The SSL Fingerprint
+    pub fingerprint: String,
+}
+
+#[api(
+    properties: {
+        memory: {
+            type: NodeMemoryCounters,
+        },
+        root: {
+            type: StorageStatus,
+        },
+        info: {
+            type: NodeInformation,
+        }
+    },
+)]
+#[derive(Serialize, Deserialize, Default)]
+#[serde(rename_all = "kebab-case")]
+/// The Node status
+pub struct NodeStatus {
+    pub memory: NodeMemoryCounters,
+    pub root: StorageStatus,
+    /// Total CPU usage since last query.
+    pub cpu: f64,
+    pub info: NodeInformation,
+}