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;