Skip to main content

proxmox_api/generated/nodes/node/disks/
lvm.rs

1pub mod name;
2#[derive(Debug, Clone)]
3pub struct LvmClient<T> {
4    client: T,
5    path: String,
6}
7impl<T> LvmClient<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, "/lvm"),
15        }
16    }
17}
18impl<T> LvmClient<T>
19where
20    T: crate::client::Client,
21{
22    #[doc = "List LVM Volume Groups"]
23    #[doc = ""]
24    #[doc = "Permission check: perm(\"/\", [\"Sys.Audit\"])"]
25    pub async fn get(&self) -> Result<GetOutput, T::Error> {
26        let path = self.path.to_string();
27        self.client.get(&path, &()).await
28    }
29}
30impl<T> LvmClient<T>
31where
32    T: crate::client::Client,
33{
34    #[doc = "Create an LVM Volume Group"]
35    #[doc = ""]
36    #[doc = "Permission check: perm(\"/\", [\"Sys.Modify\"])"]
37    #[doc = "Requires additionally 'Datastore.Allocate' on /storage when setting 'add_storage'"]
38    pub async fn post(&self, params: PostParams) -> Result<String, T::Error> {
39        let path = self.path.to_string();
40        self.client.post(&path, &params).await
41    }
42}
43impl ChildrenGetOutputChildrenItems {
44    pub fn new(free: i64, leaf: bool, name: String, size: i64) -> Self {
45        Self {
46            free,
47            leaf,
48            name,
49            size,
50            children: ::std::default::Default::default(),
51            additional_properties: ::std::default::Default::default(),
52        }
53    }
54}
55#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
56pub struct ChildrenGetOutputChildrenItems {
57    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
58    #[doc = "The underlying physical volumes"]
59    #[doc = ""]
60    pub children: Vec<ChildrenGetOutputChildrenItemsChildrenItems>,
61    #[serde(
62        serialize_with = "crate::types::serialize_int",
63        deserialize_with = "crate::types::deserialize_int"
64    )]
65    #[doc = "The free bytes in the volume group"]
66    #[doc = ""]
67    pub free: i64,
68    #[serde(
69        serialize_with = "crate::types::serialize_bool",
70        deserialize_with = "crate::types::deserialize_bool"
71    )]
72    pub leaf: bool,
73    #[doc = "The name of the volume group"]
74    #[doc = ""]
75    pub name: String,
76    #[serde(
77        serialize_with = "crate::types::serialize_int",
78        deserialize_with = "crate::types::deserialize_int"
79    )]
80    #[doc = "The size of the volume group in bytes"]
81    #[doc = ""]
82    pub size: i64,
83    #[serde(
84        flatten,
85        default,
86        skip_serializing_if = "::std::collections::HashMap::is_empty"
87    )]
88    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
89}
90impl ChildrenGetOutputChildrenItemsChildrenItems {
91    pub fn new(free: i64, leaf: bool, name: String, size: i64) -> Self {
92        Self {
93            free,
94            leaf,
95            name,
96            size,
97            additional_properties: ::std::default::Default::default(),
98        }
99    }
100}
101#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
102pub struct ChildrenGetOutputChildrenItemsChildrenItems {
103    #[serde(
104        serialize_with = "crate::types::serialize_int",
105        deserialize_with = "crate::types::deserialize_int"
106    )]
107    #[doc = "The free bytes in the physical volume"]
108    #[doc = ""]
109    pub free: i64,
110    #[serde(
111        serialize_with = "crate::types::serialize_bool",
112        deserialize_with = "crate::types::deserialize_bool"
113    )]
114    pub leaf: bool,
115    #[doc = "The name of the physical volume"]
116    #[doc = ""]
117    pub name: String,
118    #[serde(
119        serialize_with = "crate::types::serialize_int",
120        deserialize_with = "crate::types::deserialize_int"
121    )]
122    #[doc = "The size of the physical volume in bytes"]
123    #[doc = ""]
124    pub size: i64,
125    #[serde(
126        flatten,
127        default,
128        skip_serializing_if = "::std::collections::HashMap::is_empty"
129    )]
130    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
131}
132impl GetOutput {
133    pub fn new(children: Vec<ChildrenGetOutputChildrenItems>, leaf: bool) -> Self {
134        Self {
135            children,
136            leaf,
137            additional_properties: ::std::default::Default::default(),
138        }
139    }
140}
141#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
142pub struct GetOutput {
143    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
144    pub children: Vec<ChildrenGetOutputChildrenItems>,
145    #[serde(
146        serialize_with = "crate::types::serialize_bool",
147        deserialize_with = "crate::types::deserialize_bool"
148    )]
149    pub leaf: bool,
150    #[serde(
151        flatten,
152        default,
153        skip_serializing_if = "::std::collections::HashMap::is_empty"
154    )]
155    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
156}
157impl PostParams {
158    pub fn new(device: String, name: String) -> Self {
159        Self {
160            device,
161            name,
162            add_storage: ::std::default::Default::default(),
163            additional_properties: ::std::default::Default::default(),
164        }
165    }
166}
167#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
168pub struct PostParams {
169    #[serde(
170        serialize_with = "crate::types::serialize_bool_optional",
171        deserialize_with = "crate::types::deserialize_bool_optional"
172    )]
173    #[serde(skip_serializing_if = "Option::is_none", default)]
174    #[doc = "Configure storage using the Volume Group"]
175    #[doc = ""]
176    pub add_storage: Option<bool>,
177    #[doc = "The block device you want to create the volume group on"]
178    #[doc = ""]
179    pub device: String,
180    #[doc = "The storage identifier."]
181    #[doc = ""]
182    pub name: String,
183    #[serde(
184        flatten,
185        default,
186        skip_serializing_if = "::std::collections::HashMap::is_empty"
187    )]
188    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
189}
190impl<T> LvmClient<T>
191where
192    T: crate::client::Client,
193{
194    pub fn name(&self, name: &str) -> name::NameClient<T> {
195        name::NameClient::<T>::new(self.client.clone(), &self.path, name)
196    }
197}