proxmox_api/generated/cluster/
config.rs

1pub mod apiversion;
2pub mod join;
3pub mod nodes;
4pub mod qdevice;
5pub mod totem;
6pub struct ConfigClient<T> {
7    client: T,
8    path: String,
9}
10impl<T> ConfigClient<T>
11where
12    T: crate::client::Client,
13{
14    pub fn new(client: T, parent_path: &str) -> Self {
15        Self {
16            client,
17            path: format!("{}{}", parent_path, "/config"),
18        }
19    }
20}
21impl<T> ConfigClient<T>
22where
23    T: crate::client::Client,
24{
25    #[doc = "Directory index."]
26    pub fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
27        let path = self.path.to_string();
28        self.client.get(&path, &())
29    }
30}
31impl<T> ConfigClient<T>
32where
33    T: crate::client::Client,
34{
35    #[doc = "Generate new cluster configuration. If no links given, default to local IP address as link0."]
36    pub fn post(&self, params: PostParams) -> Result<String, T::Error> {
37        let path = self.path.to_string();
38        self.client.post(&path, &params)
39    }
40}
41#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
42pub struct GetOutputItems {
43    #[serde(
44        flatten,
45        default,
46        skip_serializing_if = "::std::collections::HashMap::is_empty"
47    )]
48    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
49}
50impl PostParams {
51    pub fn new(clustername: String) -> Self {
52        Self {
53            clustername,
54            links: Default::default(),
55            nodeid: Default::default(),
56            votes: Default::default(),
57            additional_properties: Default::default(),
58        }
59    }
60}
61#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
62pub struct PostParams {
63    #[doc = "The name of the cluster."]
64    pub clustername: String,
65    #[serde(rename = "link[n]")]
66    #[serde(
67        serialize_with = "crate::types::serialize_multi::<NumberedLinks, _>",
68        deserialize_with = "crate::types::deserialize_multi::<NumberedLinks, _>"
69    )]
70    #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
71    #[serde(flatten)]
72    #[doc = "Address and priority information of a single corosync link. (up to 8 links supported; link0..link7)"]
73    pub links: ::std::collections::HashMap<u32, String>,
74    #[serde(
75        serialize_with = "crate::types::serialize_int_optional",
76        deserialize_with = "crate::types::deserialize_int_optional"
77    )]
78    #[serde(skip_serializing_if = "Option::is_none", default)]
79    #[doc = "Node id for this node."]
80    pub nodeid: Option<u64>,
81    #[serde(
82        serialize_with = "crate::types::serialize_int_optional",
83        deserialize_with = "crate::types::deserialize_int_optional"
84    )]
85    #[serde(skip_serializing_if = "Option::is_none", default)]
86    #[doc = "Number of votes for this node."]
87    pub votes: Option<u64>,
88    #[serde(
89        flatten,
90        deserialize_with = "crate::types::multi::deserialize_additional_data::<'_, PostParams, _, _>"
91    )]
92    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
93}
94impl crate::types::multi::Test for PostParams {
95    fn test_fn() -> fn(&str) -> bool {
96        fn the_test(input: &str) -> bool {
97            let array = [
98                <NumberedLinks as crate::types::multi::NumberedItems>::key_matches
99                    as fn(&str) -> bool,
100            ];
101            array.iter().any(|f| f(input))
102        }
103        the_test as _
104    }
105}
106#[derive(Default)]
107struct NumberedLinks;
108impl crate::types::multi::NumberedItems for NumberedLinks {
109    type Item = String;
110    const PREFIX: &'static str = "link";
111}
112impl<T> ConfigClient<T>
113where
114    T: crate::client::Client,
115{
116    pub fn apiversion(&self) -> apiversion::ApiversionClient<T> {
117        apiversion::ApiversionClient::<T>::new(self.client.clone(), &self.path)
118    }
119}
120impl<T> ConfigClient<T>
121where
122    T: crate::client::Client,
123{
124    pub fn nodes(&self) -> nodes::NodesClient<T> {
125        nodes::NodesClient::<T>::new(self.client.clone(), &self.path)
126    }
127}
128impl<T> ConfigClient<T>
129where
130    T: crate::client::Client,
131{
132    pub fn join(&self) -> join::JoinClient<T> {
133        join::JoinClient::<T>::new(self.client.clone(), &self.path)
134    }
135}
136impl<T> ConfigClient<T>
137where
138    T: crate::client::Client,
139{
140    pub fn totem(&self) -> totem::TotemClient<T> {
141        totem::TotemClient::<T>::new(self.client.clone(), &self.path)
142    }
143}
144impl<T> ConfigClient<T>
145where
146    T: crate::client::Client,
147{
148    pub fn qdevice(&self) -> qdevice::QdeviceClient<T> {
149        qdevice::QdeviceClient::<T>::new(self.client.clone(), &self.path)
150    }
151}