Skip to main content

proxmox_api/generated/nodes/node/ceph/osd/osdid/
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 OSD details"]
22    #[doc = ""]
23    #[doc = "Permission check: perm(\"/\", [\"Sys.Audit\"], any)"]
24    pub async fn get(&self) -> Result<GetOutput, T::Error> {
25        let path = self.path.to_string();
26        self.client.get(&path, &()).await
27    }
28}
29impl DevicesGetOutputDevicesItems {
30    pub fn new(
31        dev_node: String,
32        device: Device,
33        devices: String,
34        size: i64,
35        support_discard: bool,
36        ty: String,
37    ) -> Self {
38        Self {
39            dev_node,
40            device,
41            devices,
42            size,
43            support_discard,
44            ty,
45            additional_properties: ::std::default::Default::default(),
46        }
47    }
48}
49#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
50pub struct DevicesGetOutputDevicesItems {
51    #[doc = "Device node"]
52    #[doc = ""]
53    pub dev_node: String,
54    #[doc = "Kind of OSD device"]
55    #[doc = ""]
56    pub device: Device,
57    #[doc = "Physical disks used"]
58    #[doc = ""]
59    pub devices: String,
60    #[serde(
61        serialize_with = "crate::types::serialize_int",
62        deserialize_with = "crate::types::deserialize_int"
63    )]
64    #[doc = "Size in bytes"]
65    #[doc = ""]
66    pub size: i64,
67    #[serde(
68        serialize_with = "crate::types::serialize_bool",
69        deserialize_with = "crate::types::deserialize_bool"
70    )]
71    #[doc = "Discard support of the physical device"]
72    #[doc = ""]
73    pub support_discard: bool,
74    #[serde(rename = "type")]
75    #[doc = "Type of device. For example, hdd or ssd"]
76    #[doc = ""]
77    pub ty: String,
78    #[serde(
79        flatten,
80        default,
81        skip_serializing_if = "::std::collections::HashMap::is_empty"
82    )]
83    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
84}
85impl GetOutput {
86    pub fn new(devices: Vec<DevicesGetOutputDevicesItems>, osd: OsdGetOutputOsd) -> Self {
87        Self {
88            devices,
89            osd,
90            additional_properties: ::std::default::Default::default(),
91        }
92    }
93}
94#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
95pub struct GetOutput {
96    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
97    #[doc = "Array containing data about devices"]
98    #[doc = ""]
99    pub devices: Vec<DevicesGetOutputDevicesItems>,
100    #[doc = "General information about the OSD"]
101    #[doc = ""]
102    pub osd: OsdGetOutputOsd,
103    #[serde(
104        flatten,
105        default,
106        skip_serializing_if = "::std::collections::HashMap::is_empty"
107    )]
108    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
109}
110impl OsdGetOutputOsd {
111    pub fn new(
112        back_addr: String,
113        front_addr: String,
114        hb_back_addr: String,
115        hb_front_addr: String,
116        hostname: String,
117        id: i64,
118        mem_usage: i64,
119        osd_data: String,
120        osd_objectstore: String,
121        pid: i64,
122        version: String,
123    ) -> Self {
124        Self {
125            back_addr,
126            front_addr,
127            hb_back_addr,
128            hb_front_addr,
129            hostname,
130            id,
131            mem_usage,
132            osd_data,
133            osd_objectstore,
134            pid,
135            version,
136            additional_properties: ::std::default::Default::default(),
137        }
138    }
139}
140#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
141pub struct OsdGetOutputOsd {
142    #[doc = "Address and port used to talk to other OSDs."]
143    #[doc = ""]
144    pub back_addr: String,
145    #[doc = "Address and port used to talk to clients and monitors."]
146    #[doc = ""]
147    pub front_addr: String,
148    #[doc = "Heartbeat address and port for other OSDs."]
149    #[doc = ""]
150    pub hb_back_addr: String,
151    #[doc = "Heartbeat address and port for clients and monitors."]
152    #[doc = ""]
153    pub hb_front_addr: String,
154    #[doc = "Name of the host containing the OSD."]
155    #[doc = ""]
156    pub hostname: String,
157    #[serde(
158        serialize_with = "crate::types::serialize_int",
159        deserialize_with = "crate::types::deserialize_int"
160    )]
161    #[doc = "ID of the OSD."]
162    #[doc = ""]
163    pub id: i64,
164    #[serde(
165        serialize_with = "crate::types::serialize_int",
166        deserialize_with = "crate::types::deserialize_int"
167    )]
168    #[doc = "Memory usage of the OSD service."]
169    #[doc = ""]
170    pub mem_usage: i64,
171    #[doc = "Path to the OSD's data directory."]
172    #[doc = ""]
173    pub osd_data: String,
174    #[doc = "The type of object store used."]
175    #[doc = ""]
176    pub osd_objectstore: String,
177    #[serde(
178        serialize_with = "crate::types::serialize_int",
179        deserialize_with = "crate::types::deserialize_int"
180    )]
181    #[doc = "OSD process ID."]
182    #[doc = ""]
183    pub pid: i64,
184    #[doc = "Ceph version of the OSD service."]
185    #[doc = ""]
186    pub version: String,
187    #[serde(
188        flatten,
189        default,
190        skip_serializing_if = "::std::collections::HashMap::is_empty"
191    )]
192    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
193}
194#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
195#[doc = "Kind of OSD device"]
196#[doc = ""]
197pub enum Device {
198    #[serde(rename = "block")]
199    Block,
200    #[serde(rename = "db")]
201    Db,
202    #[serde(rename = "wal")]
203    Wal,
204}
205impl TryFrom<&str> for Device {
206    type Error = String;
207    fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
208        match value {
209            "block" => Ok(Self::Block),
210            "db" => Ok(Self::Db),
211            "wal" => Ok(Self::Wal),
212            v => Err(format!("Unknown variant {v}")),
213        }
214    }
215}