Skip to main content

proxmox_api/generated/cluster/ceph/
metadata.rs

1#[derive(Debug, Clone)]
2pub struct MetadataClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> MetadataClient<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, "/metadata"),
14        }
15    }
16}
17impl<T> MetadataClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Get ceph metadata."]
22    #[doc = ""]
23    #[doc = "Permission check: perm(\"/\", [\"Sys.Audit\", \"Datastore.Audit\"], any)"]
24    pub async fn get(&self, params: GetParams) -> Result<GetOutput, T::Error> {
25        let path = self.path.to_string();
26        self.client.get(&path, &params).await
27    }
28}
29impl GetOutput {
30    pub fn new(
31        mds: MdsGetOutputMds,
32        mgr: MgrGetOutputMgr,
33        mon: MonGetOutputMon,
34        node: NodeGetOutputNode,
35        osd: OsdGetOutputOsd,
36    ) -> Self {
37        Self {
38            mds,
39            mgr,
40            mon,
41            node,
42            osd,
43            additional_properties: ::std::default::Default::default(),
44        }
45    }
46}
47#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
48pub struct GetOutput {
49    #[doc = "Metadata servers configured in the cluster and their properties."]
50    #[doc = ""]
51    pub mds: MdsGetOutputMds,
52    #[doc = "Managers configured in the cluster and their properties."]
53    #[doc = ""]
54    pub mgr: MgrGetOutputMgr,
55    #[doc = "Monitors configured in the cluster and their properties."]
56    #[doc = ""]
57    pub mon: MonGetOutputMon,
58    #[doc = "Ceph version installed on the nodes."]
59    #[doc = ""]
60    pub node: NodeGetOutputNode,
61    #[doc = "OSDs configured in the cluster and their properties."]
62    #[doc = ""]
63    pub osd: OsdGetOutputOsd,
64    #[serde(
65        flatten,
66        default,
67        skip_serializing_if = "::std::collections::HashMap::is_empty"
68    )]
69    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
70}
71#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
72pub struct GetParams {
73    #[serde(skip_serializing_if = "Option::is_none", default)]
74    pub scope: Option<Scope>,
75    #[serde(
76        flatten,
77        default,
78        skip_serializing_if = "::std::collections::HashMap::is_empty"
79    )]
80    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
81}
82impl IdGetOutputMdsId {
83    pub fn new(
84        addr: String,
85        ceph_release: String,
86        ceph_version: String,
87        ceph_version_short: String,
88        hostname: String,
89        mem_swap_kb: i64,
90        mem_total_kb: i64,
91        name: String,
92    ) -> Self {
93        Self {
94            addr,
95            ceph_release,
96            ceph_version,
97            ceph_version_short,
98            hostname,
99            mem_swap_kb,
100            mem_total_kb,
101            name,
102            additional_properties: ::std::default::Default::default(),
103        }
104    }
105}
106#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
107pub struct IdGetOutputMdsId {
108    #[doc = "Bind addresses and ports."]
109    #[doc = ""]
110    pub addr: String,
111    #[doc = "Ceph release codename currently used."]
112    #[doc = ""]
113    pub ceph_release: String,
114    #[doc = "Version info currently used by the service."]
115    #[doc = ""]
116    pub ceph_version: String,
117    #[doc = "Short version (numerical) info currently used by the service."]
118    #[doc = ""]
119    pub ceph_version_short: String,
120    #[doc = "Hostname on which the service is running."]
121    #[doc = ""]
122    pub hostname: String,
123    #[serde(
124        serialize_with = "crate::types::serialize_int",
125        deserialize_with = "crate::types::deserialize_int"
126    )]
127    #[doc = "Memory of the service currently in swap."]
128    #[doc = ""]
129    pub mem_swap_kb: i64,
130    #[serde(
131        serialize_with = "crate::types::serialize_int",
132        deserialize_with = "crate::types::deserialize_int"
133    )]
134    #[doc = "Memory consumption of the service."]
135    #[doc = ""]
136    pub mem_total_kb: i64,
137    #[doc = "Name of the service instance."]
138    #[doc = ""]
139    pub name: String,
140    #[serde(
141        flatten,
142        default,
143        skip_serializing_if = "::std::collections::HashMap::is_empty"
144    )]
145    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
146}
147impl IdGetOutputMgrId {
148    pub fn new(
149        addr: String,
150        ceph_release: String,
151        ceph_version: String,
152        ceph_version_short: String,
153        hostname: String,
154        mem_swap_kb: i64,
155        mem_total_kb: i64,
156        name: String,
157    ) -> Self {
158        Self {
159            addr,
160            ceph_release,
161            ceph_version,
162            ceph_version_short,
163            hostname,
164            mem_swap_kb,
165            mem_total_kb,
166            name,
167            additional_properties: ::std::default::Default::default(),
168        }
169    }
170}
171#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
172pub struct IdGetOutputMgrId {
173    #[doc = "Bind address"]
174    #[doc = ""]
175    pub addr: String,
176    #[doc = "Ceph release codename currently used."]
177    #[doc = ""]
178    pub ceph_release: String,
179    #[doc = "Version info currently used by the service."]
180    #[doc = ""]
181    pub ceph_version: String,
182    #[doc = "Short version (numerical) info currently used by the service."]
183    #[doc = ""]
184    pub ceph_version_short: String,
185    #[doc = "Hostname on which the service is running."]
186    #[doc = ""]
187    pub hostname: String,
188    #[serde(
189        serialize_with = "crate::types::serialize_int",
190        deserialize_with = "crate::types::deserialize_int"
191    )]
192    #[doc = "Memory of the service currently in swap."]
193    #[doc = ""]
194    pub mem_swap_kb: i64,
195    #[serde(
196        serialize_with = "crate::types::serialize_int",
197        deserialize_with = "crate::types::deserialize_int"
198    )]
199    #[doc = "Memory consumption of the service."]
200    #[doc = ""]
201    pub mem_total_kb: i64,
202    #[doc = "Name of the service instance."]
203    #[doc = ""]
204    pub name: String,
205    #[serde(
206        flatten,
207        default,
208        skip_serializing_if = "::std::collections::HashMap::is_empty"
209    )]
210    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
211}
212impl IdGetOutputMonId {
213    pub fn new(
214        addrs: String,
215        ceph_release: String,
216        ceph_version: String,
217        ceph_version_short: String,
218        hostname: String,
219        mem_swap_kb: i64,
220        mem_total_kb: i64,
221        name: String,
222    ) -> Self {
223        Self {
224            addrs,
225            ceph_release,
226            ceph_version,
227            ceph_version_short,
228            hostname,
229            mem_swap_kb,
230            mem_total_kb,
231            name,
232            additional_properties: ::std::default::Default::default(),
233        }
234    }
235}
236#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
237pub struct IdGetOutputMonId {
238    #[doc = "Bind addresses and ports."]
239    #[doc = ""]
240    pub addrs: String,
241    #[doc = "Ceph release codename currently used."]
242    #[doc = ""]
243    pub ceph_release: String,
244    #[doc = "Version info currently used by the service."]
245    #[doc = ""]
246    pub ceph_version: String,
247    #[doc = "Short version (numerical) info currently used by the service."]
248    #[doc = ""]
249    pub ceph_version_short: String,
250    #[doc = "Hostname on which the service is running."]
251    #[doc = ""]
252    pub hostname: String,
253    #[serde(
254        serialize_with = "crate::types::serialize_int",
255        deserialize_with = "crate::types::deserialize_int"
256    )]
257    #[doc = "Memory of the service currently in swap."]
258    #[doc = ""]
259    pub mem_swap_kb: i64,
260    #[serde(
261        serialize_with = "crate::types::serialize_int",
262        deserialize_with = "crate::types::deserialize_int"
263    )]
264    #[doc = "Memory consumption of the service."]
265    #[doc = ""]
266    pub mem_total_kb: i64,
267    #[doc = "Name of the service instance."]
268    #[doc = ""]
269    pub name: String,
270    #[serde(
271        flatten,
272        default,
273        skip_serializing_if = "::std::collections::HashMap::is_empty"
274    )]
275    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
276}
277impl IdGetOutputOsdId {
278    pub fn new(
279        back_addr: String,
280        ceph_release: String,
281        ceph_version: String,
282        ceph_version_short: String,
283        device_id: String,
284        front_addr: String,
285        hostname: String,
286        id: i64,
287        mem_swap_kb: i64,
288        mem_total_kb: i64,
289        osd_data: String,
290        osd_objectstore: String,
291    ) -> Self {
292        Self {
293            back_addr,
294            ceph_release,
295            ceph_version,
296            ceph_version_short,
297            device_id,
298            front_addr,
299            hostname,
300            id,
301            mem_swap_kb,
302            mem_total_kb,
303            osd_data,
304            osd_objectstore,
305            additional_properties: ::std::default::Default::default(),
306        }
307    }
308}
309#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
310pub struct IdGetOutputOsdId {
311    #[doc = "Bind addresses and ports for backend inter OSD traffic."]
312    #[doc = ""]
313    pub back_addr: String,
314    #[doc = "Ceph release codename currently used."]
315    #[doc = ""]
316    pub ceph_release: String,
317    #[doc = "Version info currently used by the service."]
318    #[doc = ""]
319    pub ceph_version: String,
320    #[doc = "Short version (numerical) info currently used by the service."]
321    #[doc = ""]
322    pub ceph_version_short: String,
323    #[doc = "Devices used by the OSD."]
324    #[doc = ""]
325    pub device_id: String,
326    #[doc = "Bind addresses and ports for frontend traffic to OSDs."]
327    #[doc = ""]
328    pub front_addr: String,
329    #[doc = "Hostname on which the service is running."]
330    #[doc = ""]
331    pub hostname: String,
332    #[serde(
333        serialize_with = "crate::types::serialize_int",
334        deserialize_with = "crate::types::deserialize_int"
335    )]
336    #[doc = "OSD ID."]
337    #[doc = ""]
338    pub id: i64,
339    #[serde(
340        serialize_with = "crate::types::serialize_int",
341        deserialize_with = "crate::types::deserialize_int"
342    )]
343    #[doc = "Memory of the service currently in swap."]
344    #[doc = ""]
345    pub mem_swap_kb: i64,
346    #[serde(
347        serialize_with = "crate::types::serialize_int",
348        deserialize_with = "crate::types::deserialize_int"
349    )]
350    #[doc = "Memory consumption of the service."]
351    #[doc = ""]
352    pub mem_total_kb: i64,
353    #[doc = "Path to the OSD data directory."]
354    #[doc = ""]
355    pub osd_data: String,
356    #[doc = "OSD objectstore type."]
357    #[doc = ""]
358    pub osd_objectstore: String,
359    #[serde(
360        flatten,
361        default,
362        skip_serializing_if = "::std::collections::HashMap::is_empty"
363    )]
364    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
365}
366impl MdsGetOutputMds {
367    pub fn new(_id: IdGetOutputMdsId) -> Self {
368        Self {
369            _id,
370            additional_properties: ::std::default::Default::default(),
371        }
372    }
373}
374#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
375pub struct MdsGetOutputMds {
376    #[serde(rename = "{id}")]
377    #[doc = "Useful properties are listed, but not the full list."]
378    #[doc = ""]
379    pub _id: IdGetOutputMdsId,
380    #[serde(
381        flatten,
382        default,
383        skip_serializing_if = "::std::collections::HashMap::is_empty"
384    )]
385    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
386}
387impl MgrGetOutputMgr {
388    pub fn new(_id: IdGetOutputMgrId) -> Self {
389        Self {
390            _id,
391            additional_properties: ::std::default::Default::default(),
392        }
393    }
394}
395#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
396pub struct MgrGetOutputMgr {
397    #[serde(rename = "{id}")]
398    #[doc = "Useful properties are listed, but not the full list."]
399    #[doc = ""]
400    pub _id: IdGetOutputMgrId,
401    #[serde(
402        flatten,
403        default,
404        skip_serializing_if = "::std::collections::HashMap::is_empty"
405    )]
406    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
407}
408impl MonGetOutputMon {
409    pub fn new(_id: IdGetOutputMonId) -> Self {
410        Self {
411            _id,
412            additional_properties: ::std::default::Default::default(),
413        }
414    }
415}
416#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
417pub struct MonGetOutputMon {
418    #[serde(rename = "{id}")]
419    #[doc = "Useful properties are listed, but not the full list."]
420    #[doc = ""]
421    pub _id: IdGetOutputMonId,
422    #[serde(
423        flatten,
424        default,
425        skip_serializing_if = "::std::collections::HashMap::is_empty"
426    )]
427    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
428}
429impl NodeGetOutputNode {
430    pub fn new(_node: NodeGetOutputNodeNode) -> Self {
431        Self {
432            _node,
433            additional_properties: ::std::default::Default::default(),
434        }
435    }
436}
437#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
438pub struct NodeGetOutputNode {
439    #[serde(rename = "{node}")]
440    pub _node: NodeGetOutputNodeNode,
441    #[serde(
442        flatten,
443        default,
444        skip_serializing_if = "::std::collections::HashMap::is_empty"
445    )]
446    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
447}
448impl NodeGetOutputNodeNode {
449    pub fn new(buildcommit: String, version: VersionGetOutputNodeNodeVersion) -> Self {
450        Self {
451            buildcommit,
452            version,
453            additional_properties: ::std::default::Default::default(),
454        }
455    }
456}
457#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
458pub struct NodeGetOutputNodeNode {
459    #[doc = "GIT commit used for the build."]
460    #[doc = ""]
461    pub buildcommit: String,
462    #[doc = "Version info."]
463    #[doc = ""]
464    pub version: VersionGetOutputNodeNodeVersion,
465    #[serde(
466        flatten,
467        default,
468        skip_serializing_if = "::std::collections::HashMap::is_empty"
469    )]
470    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
471}
472impl OsdGetOutputOsd {
473    pub fn new(_id: IdGetOutputOsdId) -> Self {
474        Self {
475            _id,
476            additional_properties: ::std::default::Default::default(),
477        }
478    }
479}
480#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
481pub struct OsdGetOutputOsd {
482    #[serde(rename = "{id}")]
483    #[doc = "Useful properties are listed, but not the full list."]
484    #[doc = ""]
485    pub _id: IdGetOutputOsdId,
486    #[serde(
487        flatten,
488        default,
489        skip_serializing_if = "::std::collections::HashMap::is_empty"
490    )]
491    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
492}
493impl VersionGetOutputNodeNodeVersion {
494    pub fn new(str: String) -> Self {
495        Self {
496            str,
497            additional_properties: ::std::default::Default::default(),
498        }
499    }
500}
501#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
502pub struct VersionGetOutputNodeNodeVersion {
503    #[doc = "Version as single string."]
504    #[doc = ""]
505    pub str: String,
506    #[serde(
507        flatten,
508        default,
509        skip_serializing_if = "::std::collections::HashMap::is_empty"
510    )]
511    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
512}
513#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq, Default)]
514pub enum Scope {
515    #[serde(rename = "all")]
516    #[default]
517    All,
518    #[serde(rename = "versions")]
519    Versions,
520}
521impl TryFrom<&str> for Scope {
522    type Error = String;
523    fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
524        match value {
525            "all" => Ok(Self::All),
526            "versions" => Ok(Self::Versions),
527            v => Err(format!("Unknown variant {v}")),
528        }
529    }
530}