pve/nodes/node/
rrddata.rs

1#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2pub struct GetParameters {
3    #[doc = "The RRD consolidation function"]
4    #[serde(skip_serializing_if = "Option::is_none", default)]
5    pub cf: Option<String>,
6    #[doc = "Specify the time frame you are interested in."]
7    pub timeframe: String,
8}
9
10#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, Default)]
11pub struct GetResponseItem {}
12
13#[derive(Debug, Clone)]
14pub struct RrddataClient<T> {
15    client: T,
16    path: String,
17}
18
19impl<T> RrddataClient<T>
20where
21    T: Clone,
22{
23    pub fn new(client: T, parent_path: &str) -> Self {
24        Self {
25            client,
26            path: format!("{}/{}", parent_path, "rrddata"),
27        }
28    }
29}
30impl<T> RrddataClient<T>
31where
32    T: crate::client::HttpClient,
33{
34    #[doc = "Read node RRD statistics"]
35    pub fn get(&self, parameters: GetParameters) -> Result<Vec<GetResponseItem>, T::Error> {
36        self.client.get(&self.path, &parameters)
37    }
38}
39#[derive(Debug, Clone)]
40pub struct AsyncRrddataClient<T> {
41    client: T,
42    path: String,
43}
44
45impl<T> AsyncRrddataClient<T>
46where
47    T: Clone,
48{
49    pub fn new(client: T, parent_path: &str) -> Self {
50        Self {
51            client,
52            path: format!("{}/{}", parent_path, "rrddata"),
53        }
54    }
55}
56impl<T> AsyncRrddataClient<T>
57where
58    T: crate::client::AsyncHttpClient,
59{
60    #[doc = "Read node RRD statistics"]
61    pub async fn get(&self, parameters: GetParameters) -> Result<Vec<GetResponseItem>, T::Error> {
62        self.client.get(&self.path, &parameters).await
63    }
64}