pve/nodes/node/disks/
list.rs1#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, Default)]
2pub struct GetParameters {
3 #[doc = "Also include partitions."]
4 #[serde(
5 rename = "include-partitions",
6 skip_serializing_if = "Option::is_none",
7 default,
8 deserialize_with = "crate::common::deserialize_option_bool_lax",
9 serialize_with = "crate::common::serialize_option_bool_as_u64"
10 )]
11 pub include_partitions: Option<bool>,
12 #[doc = "Skip smart checks."]
13 #[serde(
14 skip_serializing_if = "Option::is_none",
15 default,
16 deserialize_with = "crate::common::deserialize_option_bool_lax",
17 serialize_with = "crate::common::serialize_option_bool_as_u64"
18 )]
19 pub skipsmart: Option<bool>,
20 #[doc = "Only list specific types of disks."]
21 #[serde(skip_serializing_if = "Option::is_none", default)]
22 pub r#type: Option<String>,
23}
24
25#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
26pub struct GetResponseItem {
27 #[doc = "The device path"]
28 pub devpath: String,
29 #[serde(
30 deserialize_with = "crate::common::deserialize_bool_lax",
31 serialize_with = "crate::common::serialize_bool_as_u64"
32 )]
33 pub gpt: bool,
34 #[serde(skip_serializing_if = "Option::is_none", default)]
35 pub health: Option<String>,
36 #[serde(skip_serializing_if = "Option::is_none", default)]
37 pub model: Option<String>,
38 #[serde(
39 deserialize_with = "crate::common::deserialize_bool_lax",
40 serialize_with = "crate::common::serialize_bool_as_u64"
41 )]
42 pub mounted: bool,
43 pub osdid: u64,
44 #[doc = "For partitions only. The device path of the disk the partition resides on."]
45 #[serde(skip_serializing_if = "Option::is_none", default)]
46 pub parent: Option<String>,
47 #[serde(skip_serializing_if = "Option::is_none", default)]
48 pub serial: Option<String>,
49 pub size: u64,
50 #[serde(skip_serializing_if = "Option::is_none", default)]
51 pub used: Option<String>,
52 #[serde(skip_serializing_if = "Option::is_none", default)]
53 pub vendor: Option<String>,
54 #[serde(skip_serializing_if = "Option::is_none", default)]
55 pub wwn: Option<String>,
56}
57
58#[derive(Debug, Clone)]
59pub struct ListClient<T> {
60 client: T,
61 path: String,
62}
63
64impl<T> ListClient<T>
65where
66 T: Clone,
67{
68 pub fn new(client: T, parent_path: &str) -> Self {
69 Self {
70 client,
71 path: format!("{}/{}", parent_path, "list"),
72 }
73 }
74}
75impl<T> ListClient<T>
76where
77 T: crate::client::HttpClient,
78{
79 #[doc = "List local disks."]
80 pub fn get(&self, parameters: GetParameters) -> Result<Vec<GetResponseItem>, T::Error> {
81 self.client.get(&self.path, ¶meters)
82 }
83}
84#[derive(Debug, Clone)]
85pub struct AsyncListClient<T> {
86 client: T,
87 path: String,
88}
89
90impl<T> AsyncListClient<T>
91where
92 T: Clone,
93{
94 pub fn new(client: T, parent_path: &str) -> Self {
95 Self {
96 client,
97 path: format!("{}/{}", parent_path, "list"),
98 }
99 }
100}
101impl<T> AsyncListClient<T>
102where
103 T: crate::client::AsyncHttpClient,
104{
105 #[doc = "List local disks."]
106 pub async fn get(&self, parameters: GetParameters) -> Result<Vec<GetResponseItem>, T::Error> {
107 self.client.get(&self.path, ¶meters).await
108 }
109}