From 88731c52f056979a82dbc03c64526d8c12d17fa9 Mon Sep 17 00:00:00 2001 From: Lukas Wagner Date: Tue, 6 Aug 2024 14:59:54 +0200 Subject: [PATCH] rrd: add api-types Signed-off-by: Lukas Wagner --- proxmox-rrd/Cargo.toml | 1 + proxmox-rrd/src/api_types.rs | 33 +++++++++++++++++++++++++++++++++ proxmox-rrd/src/lib.rs | 3 +++ 3 files changed, 37 insertions(+) create mode 100644 proxmox-rrd/src/api_types.rs diff --git a/proxmox-rrd/Cargo.toml b/proxmox-rrd/Cargo.toml index 362c8d65..72bba638 100644 --- a/proxmox-rrd/Cargo.toml +++ b/proxmox-rrd/Cargo.toml @@ -28,4 +28,5 @@ proxmox-time.workspace = true [features] default = [ "rrd_v1" ] +api-types = [] rrd_v1 = [] diff --git a/proxmox-rrd/src/api_types.rs b/proxmox-rrd/src/api_types.rs new file mode 100644 index 00000000..e41c8992 --- /dev/null +++ b/proxmox-rrd/src/api_types.rs @@ -0,0 +1,33 @@ +use serde::{Deserialize, Serialize}; + +use proxmox_schema::api; + +#[api()] +#[derive(Copy, Clone, Serialize, Deserialize)] +#[serde(rename_all = "UPPERCASE")] +/// RRD consolidation mode +pub enum RRDMode { + /// Maximum + Max, + /// Average + Average, +} + +#[api()] +#[derive(Copy, Clone, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +/// RRD time frame +pub enum RRDTimeFrame { + /// Hour + Hour, + /// Day + Day, + /// Week + Week, + /// Month + Month, + /// Year + Year, + /// Decade (10 years) + Decade, +} diff --git a/proxmox-rrd/src/lib.rs b/proxmox-rrd/src/lib.rs index 175bb877..d0fd71c8 100644 --- a/proxmox-rrd/src/lib.rs +++ b/proxmox-rrd/src/lib.rs @@ -17,3 +17,6 @@ pub use rrd::Entry; mod cache; pub use cache::*; + +#[cfg(feature = "api-types")] +pub mod api_types;