Skip to main content

proxmox_api/generated/cluster/metrics/
server.rs

1pub mod id;
2#[derive(Debug, Clone)]
3pub struct ServerClient<T> {
4    client: T,
5    path: String,
6}
7impl<T> ServerClient<T>
8where
9    T: crate::client::Client,
10{
11    pub fn new(client: T, parent_path: &str) -> Self {
12        Self {
13            client,
14            path: format!("{}{}", parent_path, "/server"),
15        }
16    }
17}
18impl<T> ServerClient<T>
19where
20    T: crate::client::Client,
21{
22    #[doc = "List configured metric servers."]
23    #[doc = ""]
24    #[doc = "Permission check: perm(\"/\", [\"Sys.Audit\"])"]
25    pub async fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
26        let path = self.path.to_string();
27        let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &()).await?;
28        Ok(optional_vec.unwrap_or_default())
29    }
30}
31impl GetOutputItems {
32    pub fn new(disable: bool, id: String, port: i64, server: String, ty: String) -> Self {
33        Self {
34            disable,
35            id,
36            port,
37            server,
38            ty,
39            additional_properties: ::std::default::Default::default(),
40        }
41    }
42}
43#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
44pub struct GetOutputItems {
45    #[serde(
46        serialize_with = "crate::types::serialize_bool",
47        deserialize_with = "crate::types::deserialize_bool"
48    )]
49    #[doc = "Flag to disable the plugin."]
50    #[doc = ""]
51    pub disable: bool,
52    #[doc = "The ID of the entry."]
53    #[doc = ""]
54    pub id: String,
55    #[serde(
56        serialize_with = "crate::types::serialize_int",
57        deserialize_with = "crate::types::deserialize_int"
58    )]
59    #[doc = "Server network port"]
60    #[doc = ""]
61    pub port: i64,
62    #[doc = "Server dns name or IP address"]
63    #[doc = ""]
64    pub server: String,
65    #[serde(rename = "type")]
66    #[doc = "Plugin type."]
67    #[doc = ""]
68    pub ty: String,
69    #[serde(
70        flatten,
71        default,
72        skip_serializing_if = "::std::collections::HashMap::is_empty"
73    )]
74    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
75}
76impl<T> ServerClient<T>
77where
78    T: crate::client::Client,
79{
80    pub fn id(&self, id: &str) -> id::IdClient<T> {
81        id::IdClient::<T>::new(self.client.clone(), &self.path, id)
82    }
83}