proxmox_api/generated/nodes/node/
rrddata.rs1#[derive(Debug, Clone)]
2pub struct RrddataClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> RrddataClient<T>
7where
8 T: crate::client::Client,
9{
10 pub fn new(client: T, parent_path: &str) -> Self {
11 Self {
12 client,
13 path: format!("{}{}", parent_path, "/rrddata"),
14 }
15 }
16}
17impl<T> RrddataClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Read node RRD statistics"]
22 #[doc = ""]
23 #[doc = "Permission check: perm(\"/nodes/{node}\", [\"Sys.Audit\"])"]
24 pub async fn get(&self, params: GetParams) -> Result<Vec<GetOutputItems>, T::Error> {
25 let path = self.path.to_string();
26 let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, ¶ms).await?;
27 Ok(optional_vec.unwrap_or_default())
28 }
29}
30#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
31pub struct GetOutputItems {
32 #[serde(
33 flatten,
34 default,
35 skip_serializing_if = "::std::collections::HashMap::is_empty"
36 )]
37 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
38}
39impl GetParams {
40 pub fn new(timeframe: Timeframe) -> Self {
41 Self {
42 timeframe,
43 cf: ::std::default::Default::default(),
44 additional_properties: ::std::default::Default::default(),
45 }
46 }
47}
48#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
49pub struct GetParams {
50 #[serde(skip_serializing_if = "Option::is_none", default)]
51 #[doc = "The RRD consolidation function"]
52 #[doc = ""]
53 pub cf: Option<Cf>,
54 #[doc = "Specify the time frame you are interested in."]
55 #[doc = ""]
56 pub timeframe: Timeframe,
57 #[serde(
58 flatten,
59 default,
60 skip_serializing_if = "::std::collections::HashMap::is_empty"
61 )]
62 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
63}
64#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
65#[doc = "The RRD consolidation function"]
66#[doc = ""]
67pub enum Cf {
68 AVERAGE,
69 MAX,
70}
71impl TryFrom<&str> for Cf {
72 type Error = String;
73 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
74 match value {
75 "AVERAGE" => Ok(Self::AVERAGE),
76 "MAX" => Ok(Self::MAX),
77 v => Err(format!("Unknown variant {v}")),
78 }
79 }
80}
81#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
82#[doc = "Specify the time frame you are interested in."]
83#[doc = ""]
84pub enum Timeframe {
85 #[serde(rename = "day")]
86 Day,
87 #[serde(rename = "decade")]
88 Decade,
89 #[serde(rename = "hour")]
90 Hour,
91 #[serde(rename = "month")]
92 Month,
93 #[serde(rename = "week")]
94 Week,
95 #[serde(rename = "year")]
96 Year,
97}
98impl TryFrom<&str> for Timeframe {
99 type Error = String;
100 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
101 match value {
102 "day" => Ok(Self::Day),
103 "decade" => Ok(Self::Decade),
104 "hour" => Ok(Self::Hour),
105 "month" => Ok(Self::Month),
106 "week" => Ok(Self::Week),
107 "year" => Ok(Self::Year),
108 v => Err(format!("Unknown variant {v}")),
109 }
110 }
111}