pve/nodes/node/
rrd.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 = "The list of datasources you want to display."]
7    pub ds: String,
8    #[doc = "Specify the time frame you are interested in."]
9    pub timeframe: String,
10}
11
12#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
13pub struct GetResponseItem {
14    pub filename: String,
15}
16
17#[derive(Debug, Clone)]
18pub struct RrdClient<T> {
19    client: T,
20    path: String,
21}
22
23impl<T> RrdClient<T>
24where
25    T: Clone,
26{
27    pub fn new(client: T, parent_path: &str) -> Self {
28        Self {
29            client,
30            path: format!("{}/{}", parent_path, "rrd"),
31        }
32    }
33}
34impl<T> RrdClient<T>
35where
36    T: crate::client::HttpClient,
37{
38    #[doc = "Read node RRD statistics (returns PNG)"]
39    pub fn get(&self, parameters: GetParameters) -> Result<GetResponseItem, T::Error> {
40        self.client.get(&self.path, &parameters)
41    }
42}
43#[derive(Debug, Clone)]
44pub struct AsyncRrdClient<T> {
45    client: T,
46    path: String,
47}
48
49impl<T> AsyncRrdClient<T>
50where
51    T: Clone,
52{
53    pub fn new(client: T, parent_path: &str) -> Self {
54        Self {
55            client,
56            path: format!("{}/{}", parent_path, "rrd"),
57        }
58    }
59}
60impl<T> AsyncRrdClient<T>
61where
62    T: crate::client::AsyncHttpClient,
63{
64    #[doc = "Read node RRD statistics (returns PNG)"]
65    pub async fn get(&self, parameters: GetParameters) -> Result<GetResponseItem, T::Error> {
66        self.client.get(&self.path, &parameters).await
67    }
68}