Skip to main content

clientapi_pve/apis/
nodes_disks_api.rs

1/*
2 * Proxmox Virtual Environment API
3 *
4 * Generated from apidoc.js. NOT an official Proxmox specification. See https://pve.proxmox.com/pve-docs/api-viewer/ for the upstream documentation.
5 *
6 * The version of the OpenAPI document: 9.x
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18/// struct for typed errors of method [`nodes_disks_create_directory`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum NodesDisksCreateDirectoryError {
22    Status400(models::PveError),
23    Status401(models::PveError),
24    Status403(models::PveError),
25    Status404(models::PveError),
26    Status500(models::PveError),
27    Status501(models::PveError),
28    Status503(models::PveError),
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`nodes_disks_create_lvm`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum NodesDisksCreateLvmError {
36    Status400(models::PveError),
37    Status401(models::PveError),
38    Status403(models::PveError),
39    Status404(models::PveError),
40    Status500(models::PveError),
41    Status501(models::PveError),
42    Status503(models::PveError),
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`nodes_disks_create_lvmthin`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum NodesDisksCreateLvmthinError {
50    Status400(models::PveError),
51    Status401(models::PveError),
52    Status403(models::PveError),
53    Status404(models::PveError),
54    Status500(models::PveError),
55    Status501(models::PveError),
56    Status503(models::PveError),
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`nodes_disks_create_zfs`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum NodesDisksCreateZfsError {
64    Status400(models::PveError),
65    Status401(models::PveError),
66    Status403(models::PveError),
67    Status404(models::PveError),
68    Status500(models::PveError),
69    Status501(models::PveError),
70    Status503(models::PveError),
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`nodes_disks_delete_directory`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum NodesDisksDeleteDirectoryError {
78    Status400(models::PveError),
79    Status401(models::PveError),
80    Status403(models::PveError),
81    Status404(models::PveError),
82    Status500(models::PveError),
83    Status501(models::PveError),
84    Status503(models::PveError),
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`nodes_disks_delete_lvm`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum NodesDisksDeleteLvmError {
92    Status400(models::PveError),
93    Status401(models::PveError),
94    Status403(models::PveError),
95    Status404(models::PveError),
96    Status500(models::PveError),
97    Status501(models::PveError),
98    Status503(models::PveError),
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`nodes_disks_delete_lvmthin`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum NodesDisksDeleteLvmthinError {
106    Status400(models::PveError),
107    Status401(models::PveError),
108    Status403(models::PveError),
109    Status404(models::PveError),
110    Status500(models::PveError),
111    Status501(models::PveError),
112    Status503(models::PveError),
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`nodes_disks_delete_zfs`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum NodesDisksDeleteZfsError {
120    Status400(models::PveError),
121    Status401(models::PveError),
122    Status403(models::PveError),
123    Status404(models::PveError),
124    Status500(models::PveError),
125    Status501(models::PveError),
126    Status503(models::PveError),
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`nodes_disks_detail`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum NodesDisksDetailError {
134    Status400(models::PveError),
135    Status401(models::PveError),
136    Status403(models::PveError),
137    Status404(models::PveError),
138    Status500(models::PveError),
139    Status501(models::PveError),
140    Status503(models::PveError),
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`nodes_disks_get_directory`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum NodesDisksGetDirectoryError {
148    Status400(models::PveError),
149    Status401(models::PveError),
150    Status403(models::PveError),
151    Status404(models::PveError),
152    Status500(models::PveError),
153    Status501(models::PveError),
154    Status503(models::PveError),
155    UnknownValue(serde_json::Value),
156}
157
158/// struct for typed errors of method [`nodes_disks_get_disks`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum NodesDisksGetDisksError {
162    Status400(models::PveError),
163    Status401(models::PveError),
164    Status403(models::PveError),
165    Status404(models::PveError),
166    Status500(models::PveError),
167    Status501(models::PveError),
168    Status503(models::PveError),
169    UnknownValue(serde_json::Value),
170}
171
172/// struct for typed errors of method [`nodes_disks_get_list`]
173#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum NodesDisksGetListError {
176    Status400(models::PveError),
177    Status401(models::PveError),
178    Status403(models::PveError),
179    Status404(models::PveError),
180    Status500(models::PveError),
181    Status501(models::PveError),
182    Status503(models::PveError),
183    UnknownValue(serde_json::Value),
184}
185
186/// struct for typed errors of method [`nodes_disks_get_lvm`]
187#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum NodesDisksGetLvmError {
190    Status400(models::PveError),
191    Status401(models::PveError),
192    Status403(models::PveError),
193    Status404(models::PveError),
194    Status500(models::PveError),
195    Status501(models::PveError),
196    Status503(models::PveError),
197    UnknownValue(serde_json::Value),
198}
199
200/// struct for typed errors of method [`nodes_disks_get_lvmthin`]
201#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum NodesDisksGetLvmthinError {
204    Status400(models::PveError),
205    Status401(models::PveError),
206    Status403(models::PveError),
207    Status404(models::PveError),
208    Status500(models::PveError),
209    Status501(models::PveError),
210    Status503(models::PveError),
211    UnknownValue(serde_json::Value),
212}
213
214/// struct for typed errors of method [`nodes_disks_get_zfs`]
215#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum NodesDisksGetZfsError {
218    Status400(models::PveError),
219    Status401(models::PveError),
220    Status403(models::PveError),
221    Status404(models::PveError),
222    Status500(models::PveError),
223    Status501(models::PveError),
224    Status503(models::PveError),
225    UnknownValue(serde_json::Value),
226}
227
228/// struct for typed errors of method [`nodes_disks_initgpt`]
229#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum NodesDisksInitgptError {
232    Status400(models::PveError),
233    Status401(models::PveError),
234    Status403(models::PveError),
235    Status404(models::PveError),
236    Status500(models::PveError),
237    Status501(models::PveError),
238    Status503(models::PveError),
239    UnknownValue(serde_json::Value),
240}
241
242/// struct for typed errors of method [`nodes_disks_smart`]
243#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum NodesDisksSmartError {
246    Status400(models::PveError),
247    Status401(models::PveError),
248    Status403(models::PveError),
249    Status404(models::PveError),
250    Status500(models::PveError),
251    Status501(models::PveError),
252    Status503(models::PveError),
253    UnknownValue(serde_json::Value),
254}
255
256/// struct for typed errors of method [`nodes_disks_wipe_disk`]
257#[derive(Debug, Clone, Serialize, Deserialize)]
258#[serde(untagged)]
259pub enum NodesDisksWipeDiskError {
260    Status400(models::PveError),
261    Status401(models::PveError),
262    Status403(models::PveError),
263    Status404(models::PveError),
264    Status500(models::PveError),
265    Status501(models::PveError),
266    Status503(models::PveError),
267    UnknownValue(serde_json::Value),
268}
269
270
271/// Create a Filesystem on an unused disk. Will be mounted under '/mnt/pve/NAME'.  Permissions: Requires additionally 'Datastore.Allocate' on /storage when setting 'add_storage'
272pub async fn nodes_disks_create_directory(configuration: &configuration::Configuration, node: &str, nodes_disks_create_directory_request: models::NodesDisksCreateDirectoryRequest) -> Result<models::NodesDisksCreateDirectoryResponse, Error<NodesDisksCreateDirectoryError>> {
273    // add a prefix to parameters to efficiently prevent name collisions
274    let p_path_node = node;
275    let p_body_nodes_disks_create_directory_request = nodes_disks_create_directory_request;
276
277    let uri_str = format!("{}/nodes/{node}/disks/directory", configuration.base_path, node=crate::apis::urlencode(p_path_node));
278    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
279
280    if let Some(ref user_agent) = configuration.user_agent {
281        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
282    }
283    if let Some(ref apikey) = configuration.api_key {
284        let key = apikey.key.clone();
285        let value = match apikey.prefix {
286            Some(ref prefix) => format!("{} {}", prefix, key),
287            None => key,
288        };
289        req_builder = req_builder.header("Authorization", value);
290    };
291    if let Some(ref apikey) = configuration.api_key {
292        let key = apikey.key.clone();
293        let value = match apikey.prefix {
294            Some(ref prefix) => format!("{} {}", prefix, key),
295            None => key,
296        };
297        req_builder = req_builder.header("CSRFPreventionToken", value);
298    };
299    req_builder = req_builder.json(&p_body_nodes_disks_create_directory_request);
300
301    let req = req_builder.build()?;
302    let resp = configuration.client.execute(req).await?;
303
304    let status = resp.status();
305    let content_type = resp
306        .headers()
307        .get("content-type")
308        .and_then(|v| v.to_str().ok())
309        .unwrap_or("application/octet-stream");
310    let content_type = super::ContentType::from(content_type);
311
312    if !status.is_client_error() && !status.is_server_error() {
313        let content = resp.text().await?;
314        match content_type {
315            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
316            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesDisksCreateDirectoryResponse`"))),
317            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesDisksCreateDirectoryResponse`")))),
318        }
319    } else {
320        let content = resp.text().await?;
321        let entity: Option<NodesDisksCreateDirectoryError> = serde_json::from_str(&content).ok();
322        Err(Error::ResponseError(ResponseContent { status, content, entity }))
323    }
324}
325
326/// Create an LVM Volume Group  Permissions: Requires additionally 'Datastore.Allocate' on /storage when setting 'add_storage'
327pub async fn nodes_disks_create_lvm(configuration: &configuration::Configuration, node: &str, nodes_disks_create_lvm_request: models::NodesDisksCreateLvmRequest) -> Result<models::NodesDisksCreateLvmResponse, Error<NodesDisksCreateLvmError>> {
328    // add a prefix to parameters to efficiently prevent name collisions
329    let p_path_node = node;
330    let p_body_nodes_disks_create_lvm_request = nodes_disks_create_lvm_request;
331
332    let uri_str = format!("{}/nodes/{node}/disks/lvm", configuration.base_path, node=crate::apis::urlencode(p_path_node));
333    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
334
335    if let Some(ref user_agent) = configuration.user_agent {
336        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
337    }
338    if let Some(ref apikey) = configuration.api_key {
339        let key = apikey.key.clone();
340        let value = match apikey.prefix {
341            Some(ref prefix) => format!("{} {}", prefix, key),
342            None => key,
343        };
344        req_builder = req_builder.header("Authorization", value);
345    };
346    if let Some(ref apikey) = configuration.api_key {
347        let key = apikey.key.clone();
348        let value = match apikey.prefix {
349            Some(ref prefix) => format!("{} {}", prefix, key),
350            None => key,
351        };
352        req_builder = req_builder.header("CSRFPreventionToken", value);
353    };
354    req_builder = req_builder.json(&p_body_nodes_disks_create_lvm_request);
355
356    let req = req_builder.build()?;
357    let resp = configuration.client.execute(req).await?;
358
359    let status = resp.status();
360    let content_type = resp
361        .headers()
362        .get("content-type")
363        .and_then(|v| v.to_str().ok())
364        .unwrap_or("application/octet-stream");
365    let content_type = super::ContentType::from(content_type);
366
367    if !status.is_client_error() && !status.is_server_error() {
368        let content = resp.text().await?;
369        match content_type {
370            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
371            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesDisksCreateLvmResponse`"))),
372            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesDisksCreateLvmResponse`")))),
373        }
374    } else {
375        let content = resp.text().await?;
376        let entity: Option<NodesDisksCreateLvmError> = serde_json::from_str(&content).ok();
377        Err(Error::ResponseError(ResponseContent { status, content, entity }))
378    }
379}
380
381/// Create an LVM thinpool  Permissions: Requires additionally 'Datastore.Allocate' on /storage when setting 'add_storage'
382pub async fn nodes_disks_create_lvmthin(configuration: &configuration::Configuration, node: &str, nodes_disks_create_lvmthin_request: models::NodesDisksCreateLvmthinRequest) -> Result<models::NodesDisksCreateLvmthinResponse, Error<NodesDisksCreateLvmthinError>> {
383    // add a prefix to parameters to efficiently prevent name collisions
384    let p_path_node = node;
385    let p_body_nodes_disks_create_lvmthin_request = nodes_disks_create_lvmthin_request;
386
387    let uri_str = format!("{}/nodes/{node}/disks/lvmthin", configuration.base_path, node=crate::apis::urlencode(p_path_node));
388    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
389
390    if let Some(ref user_agent) = configuration.user_agent {
391        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
392    }
393    if let Some(ref apikey) = configuration.api_key {
394        let key = apikey.key.clone();
395        let value = match apikey.prefix {
396            Some(ref prefix) => format!("{} {}", prefix, key),
397            None => key,
398        };
399        req_builder = req_builder.header("Authorization", value);
400    };
401    if let Some(ref apikey) = configuration.api_key {
402        let key = apikey.key.clone();
403        let value = match apikey.prefix {
404            Some(ref prefix) => format!("{} {}", prefix, key),
405            None => key,
406        };
407        req_builder = req_builder.header("CSRFPreventionToken", value);
408    };
409    req_builder = req_builder.json(&p_body_nodes_disks_create_lvmthin_request);
410
411    let req = req_builder.build()?;
412    let resp = configuration.client.execute(req).await?;
413
414    let status = resp.status();
415    let content_type = resp
416        .headers()
417        .get("content-type")
418        .and_then(|v| v.to_str().ok())
419        .unwrap_or("application/octet-stream");
420    let content_type = super::ContentType::from(content_type);
421
422    if !status.is_client_error() && !status.is_server_error() {
423        let content = resp.text().await?;
424        match content_type {
425            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
426            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesDisksCreateLvmthinResponse`"))),
427            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesDisksCreateLvmthinResponse`")))),
428        }
429    } else {
430        let content = resp.text().await?;
431        let entity: Option<NodesDisksCreateLvmthinError> = serde_json::from_str(&content).ok();
432        Err(Error::ResponseError(ResponseContent { status, content, entity }))
433    }
434}
435
436/// Create a ZFS pool.  Permissions: Requires additionally 'Datastore.Allocate' on /storage when setting 'add_storage'
437pub async fn nodes_disks_create_zfs(configuration: &configuration::Configuration, node: &str, nodes_disks_create_zfs_request: models::NodesDisksCreateZfsRequest) -> Result<models::NodesDisksCreateZfsResponse, Error<NodesDisksCreateZfsError>> {
438    // add a prefix to parameters to efficiently prevent name collisions
439    let p_path_node = node;
440    let p_body_nodes_disks_create_zfs_request = nodes_disks_create_zfs_request;
441
442    let uri_str = format!("{}/nodes/{node}/disks/zfs", configuration.base_path, node=crate::apis::urlencode(p_path_node));
443    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
444
445    if let Some(ref user_agent) = configuration.user_agent {
446        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
447    }
448    if let Some(ref apikey) = configuration.api_key {
449        let key = apikey.key.clone();
450        let value = match apikey.prefix {
451            Some(ref prefix) => format!("{} {}", prefix, key),
452            None => key,
453        };
454        req_builder = req_builder.header("Authorization", value);
455    };
456    if let Some(ref apikey) = configuration.api_key {
457        let key = apikey.key.clone();
458        let value = match apikey.prefix {
459            Some(ref prefix) => format!("{} {}", prefix, key),
460            None => key,
461        };
462        req_builder = req_builder.header("CSRFPreventionToken", value);
463    };
464    req_builder = req_builder.json(&p_body_nodes_disks_create_zfs_request);
465
466    let req = req_builder.build()?;
467    let resp = configuration.client.execute(req).await?;
468
469    let status = resp.status();
470    let content_type = resp
471        .headers()
472        .get("content-type")
473        .and_then(|v| v.to_str().ok())
474        .unwrap_or("application/octet-stream");
475    let content_type = super::ContentType::from(content_type);
476
477    if !status.is_client_error() && !status.is_server_error() {
478        let content = resp.text().await?;
479        match content_type {
480            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
481            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesDisksCreateZfsResponse`"))),
482            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesDisksCreateZfsResponse`")))),
483        }
484    } else {
485        let content = resp.text().await?;
486        let entity: Option<NodesDisksCreateZfsError> = serde_json::from_str(&content).ok();
487        Err(Error::ResponseError(ResponseContent { status, content, entity }))
488    }
489}
490
491/// Unmounts the storage and removes the mount unit.  Permissions: Requires additionally 'Datastore.Allocate' on /storage when setting 'cleanup-config'
492pub async fn nodes_disks_delete_directory(configuration: &configuration::Configuration, name: &str, node: &str, cleanup_config: Option<&str>, cleanup_disks: Option<&str>) -> Result<models::NodesDisksDeleteDirectoryResponse, Error<NodesDisksDeleteDirectoryError>> {
493    // add a prefix to parameters to efficiently prevent name collisions
494    let p_path_name = name;
495    let p_path_node = node;
496    let p_query_cleanup_config = cleanup_config;
497    let p_query_cleanup_disks = cleanup_disks;
498
499    let uri_str = format!("{}/nodes/{node}/disks/directory/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name), node=crate::apis::urlencode(p_path_node));
500    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
501
502    if let Some(ref param_value) = p_query_cleanup_config {
503        req_builder = req_builder.query(&[("cleanup-config", &param_value.to_string())]);
504    }
505    if let Some(ref param_value) = p_query_cleanup_disks {
506        req_builder = req_builder.query(&[("cleanup-disks", &param_value.to_string())]);
507    }
508    if let Some(ref user_agent) = configuration.user_agent {
509        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
510    }
511    if let Some(ref apikey) = configuration.api_key {
512        let key = apikey.key.clone();
513        let value = match apikey.prefix {
514            Some(ref prefix) => format!("{} {}", prefix, key),
515            None => key,
516        };
517        req_builder = req_builder.header("Authorization", value);
518    };
519    if let Some(ref apikey) = configuration.api_key {
520        let key = apikey.key.clone();
521        let value = match apikey.prefix {
522            Some(ref prefix) => format!("{} {}", prefix, key),
523            None => key,
524        };
525        req_builder = req_builder.header("CSRFPreventionToken", value);
526    };
527
528    let req = req_builder.build()?;
529    let resp = configuration.client.execute(req).await?;
530
531    let status = resp.status();
532    let content_type = resp
533        .headers()
534        .get("content-type")
535        .and_then(|v| v.to_str().ok())
536        .unwrap_or("application/octet-stream");
537    let content_type = super::ContentType::from(content_type);
538
539    if !status.is_client_error() && !status.is_server_error() {
540        let content = resp.text().await?;
541        match content_type {
542            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
543            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesDisksDeleteDirectoryResponse`"))),
544            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesDisksDeleteDirectoryResponse`")))),
545        }
546    } else {
547        let content = resp.text().await?;
548        let entity: Option<NodesDisksDeleteDirectoryError> = serde_json::from_str(&content).ok();
549        Err(Error::ResponseError(ResponseContent { status, content, entity }))
550    }
551}
552
553/// Remove an LVM Volume Group.  Permissions: Requires additionally 'Datastore.Allocate' on /storage when setting 'cleanup-config'
554pub async fn nodes_disks_delete_lvm(configuration: &configuration::Configuration, name: &str, node: &str, cleanup_config: Option<&str>, cleanup_disks: Option<&str>) -> Result<models::NodesDisksDeleteLvmResponse, Error<NodesDisksDeleteLvmError>> {
555    // add a prefix to parameters to efficiently prevent name collisions
556    let p_path_name = name;
557    let p_path_node = node;
558    let p_query_cleanup_config = cleanup_config;
559    let p_query_cleanup_disks = cleanup_disks;
560
561    let uri_str = format!("{}/nodes/{node}/disks/lvm/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name), node=crate::apis::urlencode(p_path_node));
562    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
563
564    if let Some(ref param_value) = p_query_cleanup_config {
565        req_builder = req_builder.query(&[("cleanup-config", &param_value.to_string())]);
566    }
567    if let Some(ref param_value) = p_query_cleanup_disks {
568        req_builder = req_builder.query(&[("cleanup-disks", &param_value.to_string())]);
569    }
570    if let Some(ref user_agent) = configuration.user_agent {
571        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
572    }
573    if let Some(ref apikey) = configuration.api_key {
574        let key = apikey.key.clone();
575        let value = match apikey.prefix {
576            Some(ref prefix) => format!("{} {}", prefix, key),
577            None => key,
578        };
579        req_builder = req_builder.header("Authorization", value);
580    };
581    if let Some(ref apikey) = configuration.api_key {
582        let key = apikey.key.clone();
583        let value = match apikey.prefix {
584            Some(ref prefix) => format!("{} {}", prefix, key),
585            None => key,
586        };
587        req_builder = req_builder.header("CSRFPreventionToken", value);
588    };
589
590    let req = req_builder.build()?;
591    let resp = configuration.client.execute(req).await?;
592
593    let status = resp.status();
594    let content_type = resp
595        .headers()
596        .get("content-type")
597        .and_then(|v| v.to_str().ok())
598        .unwrap_or("application/octet-stream");
599    let content_type = super::ContentType::from(content_type);
600
601    if !status.is_client_error() && !status.is_server_error() {
602        let content = resp.text().await?;
603        match content_type {
604            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
605            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesDisksDeleteLvmResponse`"))),
606            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesDisksDeleteLvmResponse`")))),
607        }
608    } else {
609        let content = resp.text().await?;
610        let entity: Option<NodesDisksDeleteLvmError> = serde_json::from_str(&content).ok();
611        Err(Error::ResponseError(ResponseContent { status, content, entity }))
612    }
613}
614
615/// Remove an LVM thin pool.  Permissions: Requires additionally 'Datastore.Allocate' on /storage when setting 'cleanup-config'
616pub async fn nodes_disks_delete_lvmthin(configuration: &configuration::Configuration, name: &str, node: &str, volume_group: &str, cleanup_config: Option<&str>, cleanup_disks: Option<&str>) -> Result<models::NodesDisksDeleteLvmthinResponse, Error<NodesDisksDeleteLvmthinError>> {
617    // add a prefix to parameters to efficiently prevent name collisions
618    let p_path_name = name;
619    let p_path_node = node;
620    let p_query_volume_group = volume_group;
621    let p_query_cleanup_config = cleanup_config;
622    let p_query_cleanup_disks = cleanup_disks;
623
624    let uri_str = format!("{}/nodes/{node}/disks/lvmthin/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name), node=crate::apis::urlencode(p_path_node));
625    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
626
627    if let Some(ref param_value) = p_query_cleanup_config {
628        req_builder = req_builder.query(&[("cleanup-config", &param_value.to_string())]);
629    }
630    if let Some(ref param_value) = p_query_cleanup_disks {
631        req_builder = req_builder.query(&[("cleanup-disks", &param_value.to_string())]);
632    }
633    req_builder = req_builder.query(&[("volume-group", &p_query_volume_group.to_string())]);
634    if let Some(ref user_agent) = configuration.user_agent {
635        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
636    }
637    if let Some(ref apikey) = configuration.api_key {
638        let key = apikey.key.clone();
639        let value = match apikey.prefix {
640            Some(ref prefix) => format!("{} {}", prefix, key),
641            None => key,
642        };
643        req_builder = req_builder.header("Authorization", value);
644    };
645    if let Some(ref apikey) = configuration.api_key {
646        let key = apikey.key.clone();
647        let value = match apikey.prefix {
648            Some(ref prefix) => format!("{} {}", prefix, key),
649            None => key,
650        };
651        req_builder = req_builder.header("CSRFPreventionToken", value);
652    };
653
654    let req = req_builder.build()?;
655    let resp = configuration.client.execute(req).await?;
656
657    let status = resp.status();
658    let content_type = resp
659        .headers()
660        .get("content-type")
661        .and_then(|v| v.to_str().ok())
662        .unwrap_or("application/octet-stream");
663    let content_type = super::ContentType::from(content_type);
664
665    if !status.is_client_error() && !status.is_server_error() {
666        let content = resp.text().await?;
667        match content_type {
668            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
669            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesDisksDeleteLvmthinResponse`"))),
670            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesDisksDeleteLvmthinResponse`")))),
671        }
672    } else {
673        let content = resp.text().await?;
674        let entity: Option<NodesDisksDeleteLvmthinError> = serde_json::from_str(&content).ok();
675        Err(Error::ResponseError(ResponseContent { status, content, entity }))
676    }
677}
678
679/// Destroy a ZFS pool.  Permissions: Requires additionally 'Datastore.Allocate' on /storage when setting 'cleanup-config'
680pub async fn nodes_disks_delete_zfs(configuration: &configuration::Configuration, name: &str, node: &str, cleanup_config: Option<&str>, cleanup_disks: Option<&str>) -> Result<models::NodesDisksDeleteZfsResponse, Error<NodesDisksDeleteZfsError>> {
681    // add a prefix to parameters to efficiently prevent name collisions
682    let p_path_name = name;
683    let p_path_node = node;
684    let p_query_cleanup_config = cleanup_config;
685    let p_query_cleanup_disks = cleanup_disks;
686
687    let uri_str = format!("{}/nodes/{node}/disks/zfs/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name), node=crate::apis::urlencode(p_path_node));
688    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
689
690    if let Some(ref param_value) = p_query_cleanup_config {
691        req_builder = req_builder.query(&[("cleanup-config", &param_value.to_string())]);
692    }
693    if let Some(ref param_value) = p_query_cleanup_disks {
694        req_builder = req_builder.query(&[("cleanup-disks", &param_value.to_string())]);
695    }
696    if let Some(ref user_agent) = configuration.user_agent {
697        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
698    }
699    if let Some(ref apikey) = configuration.api_key {
700        let key = apikey.key.clone();
701        let value = match apikey.prefix {
702            Some(ref prefix) => format!("{} {}", prefix, key),
703            None => key,
704        };
705        req_builder = req_builder.header("Authorization", value);
706    };
707    if let Some(ref apikey) = configuration.api_key {
708        let key = apikey.key.clone();
709        let value = match apikey.prefix {
710            Some(ref prefix) => format!("{} {}", prefix, key),
711            None => key,
712        };
713        req_builder = req_builder.header("CSRFPreventionToken", value);
714    };
715
716    let req = req_builder.build()?;
717    let resp = configuration.client.execute(req).await?;
718
719    let status = resp.status();
720    let content_type = resp
721        .headers()
722        .get("content-type")
723        .and_then(|v| v.to_str().ok())
724        .unwrap_or("application/octet-stream");
725    let content_type = super::ContentType::from(content_type);
726
727    if !status.is_client_error() && !status.is_server_error() {
728        let content = resp.text().await?;
729        match content_type {
730            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
731            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesDisksDeleteZfsResponse`"))),
732            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesDisksDeleteZfsResponse`")))),
733        }
734    } else {
735        let content = resp.text().await?;
736        let entity: Option<NodesDisksDeleteZfsError> = serde_json::from_str(&content).ok();
737        Err(Error::ResponseError(ResponseContent { status, content, entity }))
738    }
739}
740
741/// Get details about a zpool.
742pub async fn nodes_disks_detail(configuration: &configuration::Configuration, name: &str, node: &str) -> Result<models::NodesDisksDetailResponse, Error<NodesDisksDetailError>> {
743    // add a prefix to parameters to efficiently prevent name collisions
744    let p_path_name = name;
745    let p_path_node = node;
746
747    let uri_str = format!("{}/nodes/{node}/disks/zfs/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name), node=crate::apis::urlencode(p_path_node));
748    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
749
750    if let Some(ref user_agent) = configuration.user_agent {
751        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
752    }
753    if let Some(ref apikey) = configuration.api_key {
754        let key = apikey.key.clone();
755        let value = match apikey.prefix {
756            Some(ref prefix) => format!("{} {}", prefix, key),
757            None => key,
758        };
759        req_builder = req_builder.header("Authorization", value);
760    };
761    if let Some(ref apikey) = configuration.api_key {
762        let key = apikey.key.clone();
763        let value = match apikey.prefix {
764            Some(ref prefix) => format!("{} {}", prefix, key),
765            None => key,
766        };
767        req_builder = req_builder.header("CSRFPreventionToken", value);
768    };
769
770    let req = req_builder.build()?;
771    let resp = configuration.client.execute(req).await?;
772
773    let status = resp.status();
774    let content_type = resp
775        .headers()
776        .get("content-type")
777        .and_then(|v| v.to_str().ok())
778        .unwrap_or("application/octet-stream");
779    let content_type = super::ContentType::from(content_type);
780
781    if !status.is_client_error() && !status.is_server_error() {
782        let content = resp.text().await?;
783        match content_type {
784            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
785            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesDisksDetailResponse`"))),
786            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesDisksDetailResponse`")))),
787        }
788    } else {
789        let content = resp.text().await?;
790        let entity: Option<NodesDisksDetailError> = serde_json::from_str(&content).ok();
791        Err(Error::ResponseError(ResponseContent { status, content, entity }))
792    }
793}
794
795/// PVE Managed Directory storages.
796pub async fn nodes_disks_get_directory(configuration: &configuration::Configuration, node: &str) -> Result<models::NodesDisksGetDirectoryResponse, Error<NodesDisksGetDirectoryError>> {
797    // add a prefix to parameters to efficiently prevent name collisions
798    let p_path_node = node;
799
800    let uri_str = format!("{}/nodes/{node}/disks/directory", configuration.base_path, node=crate::apis::urlencode(p_path_node));
801    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
802
803    if let Some(ref user_agent) = configuration.user_agent {
804        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
805    }
806    if let Some(ref apikey) = configuration.api_key {
807        let key = apikey.key.clone();
808        let value = match apikey.prefix {
809            Some(ref prefix) => format!("{} {}", prefix, key),
810            None => key,
811        };
812        req_builder = req_builder.header("Authorization", value);
813    };
814    if let Some(ref apikey) = configuration.api_key {
815        let key = apikey.key.clone();
816        let value = match apikey.prefix {
817            Some(ref prefix) => format!("{} {}", prefix, key),
818            None => key,
819        };
820        req_builder = req_builder.header("CSRFPreventionToken", value);
821    };
822
823    let req = req_builder.build()?;
824    let resp = configuration.client.execute(req).await?;
825
826    let status = resp.status();
827    let content_type = resp
828        .headers()
829        .get("content-type")
830        .and_then(|v| v.to_str().ok())
831        .unwrap_or("application/octet-stream");
832    let content_type = super::ContentType::from(content_type);
833
834    if !status.is_client_error() && !status.is_server_error() {
835        let content = resp.text().await?;
836        match content_type {
837            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
838            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesDisksGetDirectoryResponse`"))),
839            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesDisksGetDirectoryResponse`")))),
840        }
841    } else {
842        let content = resp.text().await?;
843        let entity: Option<NodesDisksGetDirectoryError> = serde_json::from_str(&content).ok();
844        Err(Error::ResponseError(ResponseContent { status, content, entity }))
845    }
846}
847
848/// Node index.
849pub async fn nodes_disks_get_disks(configuration: &configuration::Configuration, node: &str) -> Result<models::NodesDisksGetDisksResponse, Error<NodesDisksGetDisksError>> {
850    // add a prefix to parameters to efficiently prevent name collisions
851    let p_path_node = node;
852
853    let uri_str = format!("{}/nodes/{node}/disks", configuration.base_path, node=crate::apis::urlencode(p_path_node));
854    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
855
856    if let Some(ref user_agent) = configuration.user_agent {
857        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
858    }
859    if let Some(ref apikey) = configuration.api_key {
860        let key = apikey.key.clone();
861        let value = match apikey.prefix {
862            Some(ref prefix) => format!("{} {}", prefix, key),
863            None => key,
864        };
865        req_builder = req_builder.header("Authorization", value);
866    };
867    if let Some(ref apikey) = configuration.api_key {
868        let key = apikey.key.clone();
869        let value = match apikey.prefix {
870            Some(ref prefix) => format!("{} {}", prefix, key),
871            None => key,
872        };
873        req_builder = req_builder.header("CSRFPreventionToken", value);
874    };
875
876    let req = req_builder.build()?;
877    let resp = configuration.client.execute(req).await?;
878
879    let status = resp.status();
880    let content_type = resp
881        .headers()
882        .get("content-type")
883        .and_then(|v| v.to_str().ok())
884        .unwrap_or("application/octet-stream");
885    let content_type = super::ContentType::from(content_type);
886
887    if !status.is_client_error() && !status.is_server_error() {
888        let content = resp.text().await?;
889        match content_type {
890            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
891            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesDisksGetDisksResponse`"))),
892            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesDisksGetDisksResponse`")))),
893        }
894    } else {
895        let content = resp.text().await?;
896        let entity: Option<NodesDisksGetDisksError> = serde_json::from_str(&content).ok();
897        Err(Error::ResponseError(ResponseContent { status, content, entity }))
898    }
899}
900
901/// List local disks.
902pub async fn nodes_disks_get_list(configuration: &configuration::Configuration, node: &str, include_partitions: Option<&str>, skipsmart: Option<&str>, r#type: Option<models::PveNodesDisksTypeEnum>) -> Result<models::NodesDisksGetListResponse, Error<NodesDisksGetListError>> {
903    // add a prefix to parameters to efficiently prevent name collisions
904    let p_path_node = node;
905    let p_query_include_partitions = include_partitions;
906    let p_query_skipsmart = skipsmart;
907    let p_query_type = r#type;
908
909    let uri_str = format!("{}/nodes/{node}/disks/list", configuration.base_path, node=crate::apis::urlencode(p_path_node));
910    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
911
912    if let Some(ref param_value) = p_query_include_partitions {
913        req_builder = req_builder.query(&[("include-partitions", &param_value.to_string())]);
914    }
915    if let Some(ref param_value) = p_query_skipsmart {
916        req_builder = req_builder.query(&[("skipsmart", &param_value.to_string())]);
917    }
918    if let Some(ref param_value) = p_query_type {
919        req_builder = req_builder.query(&[("type", &param_value.to_string())]);
920    }
921    if let Some(ref user_agent) = configuration.user_agent {
922        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
923    }
924    if let Some(ref apikey) = configuration.api_key {
925        let key = apikey.key.clone();
926        let value = match apikey.prefix {
927            Some(ref prefix) => format!("{} {}", prefix, key),
928            None => key,
929        };
930        req_builder = req_builder.header("Authorization", value);
931    };
932    if let Some(ref apikey) = configuration.api_key {
933        let key = apikey.key.clone();
934        let value = match apikey.prefix {
935            Some(ref prefix) => format!("{} {}", prefix, key),
936            None => key,
937        };
938        req_builder = req_builder.header("CSRFPreventionToken", value);
939    };
940
941    let req = req_builder.build()?;
942    let resp = configuration.client.execute(req).await?;
943
944    let status = resp.status();
945    let content_type = resp
946        .headers()
947        .get("content-type")
948        .and_then(|v| v.to_str().ok())
949        .unwrap_or("application/octet-stream");
950    let content_type = super::ContentType::from(content_type);
951
952    if !status.is_client_error() && !status.is_server_error() {
953        let content = resp.text().await?;
954        match content_type {
955            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
956            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesDisksGetListResponse`"))),
957            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesDisksGetListResponse`")))),
958        }
959    } else {
960        let content = resp.text().await?;
961        let entity: Option<NodesDisksGetListError> = serde_json::from_str(&content).ok();
962        Err(Error::ResponseError(ResponseContent { status, content, entity }))
963    }
964}
965
966/// List LVM Volume Groups
967pub async fn nodes_disks_get_lvm(configuration: &configuration::Configuration, node: &str) -> Result<models::NodesDisksGetLvmResponse, Error<NodesDisksGetLvmError>> {
968    // add a prefix to parameters to efficiently prevent name collisions
969    let p_path_node = node;
970
971    let uri_str = format!("{}/nodes/{node}/disks/lvm", configuration.base_path, node=crate::apis::urlencode(p_path_node));
972    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
973
974    if let Some(ref user_agent) = configuration.user_agent {
975        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
976    }
977    if let Some(ref apikey) = configuration.api_key {
978        let key = apikey.key.clone();
979        let value = match apikey.prefix {
980            Some(ref prefix) => format!("{} {}", prefix, key),
981            None => key,
982        };
983        req_builder = req_builder.header("Authorization", value);
984    };
985    if let Some(ref apikey) = configuration.api_key {
986        let key = apikey.key.clone();
987        let value = match apikey.prefix {
988            Some(ref prefix) => format!("{} {}", prefix, key),
989            None => key,
990        };
991        req_builder = req_builder.header("CSRFPreventionToken", value);
992    };
993
994    let req = req_builder.build()?;
995    let resp = configuration.client.execute(req).await?;
996
997    let status = resp.status();
998    let content_type = resp
999        .headers()
1000        .get("content-type")
1001        .and_then(|v| v.to_str().ok())
1002        .unwrap_or("application/octet-stream");
1003    let content_type = super::ContentType::from(content_type);
1004
1005    if !status.is_client_error() && !status.is_server_error() {
1006        let content = resp.text().await?;
1007        match content_type {
1008            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1009            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesDisksGetLvmResponse`"))),
1010            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesDisksGetLvmResponse`")))),
1011        }
1012    } else {
1013        let content = resp.text().await?;
1014        let entity: Option<NodesDisksGetLvmError> = serde_json::from_str(&content).ok();
1015        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1016    }
1017}
1018
1019/// List LVM thinpools
1020pub async fn nodes_disks_get_lvmthin(configuration: &configuration::Configuration, node: &str) -> Result<models::NodesDisksGetLvmthinResponse, Error<NodesDisksGetLvmthinError>> {
1021    // add a prefix to parameters to efficiently prevent name collisions
1022    let p_path_node = node;
1023
1024    let uri_str = format!("{}/nodes/{node}/disks/lvmthin", configuration.base_path, node=crate::apis::urlencode(p_path_node));
1025    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1026
1027    if let Some(ref user_agent) = configuration.user_agent {
1028        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1029    }
1030    if let Some(ref apikey) = configuration.api_key {
1031        let key = apikey.key.clone();
1032        let value = match apikey.prefix {
1033            Some(ref prefix) => format!("{} {}", prefix, key),
1034            None => key,
1035        };
1036        req_builder = req_builder.header("Authorization", value);
1037    };
1038    if let Some(ref apikey) = configuration.api_key {
1039        let key = apikey.key.clone();
1040        let value = match apikey.prefix {
1041            Some(ref prefix) => format!("{} {}", prefix, key),
1042            None => key,
1043        };
1044        req_builder = req_builder.header("CSRFPreventionToken", value);
1045    };
1046
1047    let req = req_builder.build()?;
1048    let resp = configuration.client.execute(req).await?;
1049
1050    let status = resp.status();
1051    let content_type = resp
1052        .headers()
1053        .get("content-type")
1054        .and_then(|v| v.to_str().ok())
1055        .unwrap_or("application/octet-stream");
1056    let content_type = super::ContentType::from(content_type);
1057
1058    if !status.is_client_error() && !status.is_server_error() {
1059        let content = resp.text().await?;
1060        match content_type {
1061            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1062            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesDisksGetLvmthinResponse`"))),
1063            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesDisksGetLvmthinResponse`")))),
1064        }
1065    } else {
1066        let content = resp.text().await?;
1067        let entity: Option<NodesDisksGetLvmthinError> = serde_json::from_str(&content).ok();
1068        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1069    }
1070}
1071
1072/// List Zpools.
1073pub async fn nodes_disks_get_zfs(configuration: &configuration::Configuration, node: &str) -> Result<models::NodesDisksGetZfsResponse, Error<NodesDisksGetZfsError>> {
1074    // add a prefix to parameters to efficiently prevent name collisions
1075    let p_path_node = node;
1076
1077    let uri_str = format!("{}/nodes/{node}/disks/zfs", configuration.base_path, node=crate::apis::urlencode(p_path_node));
1078    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1079
1080    if let Some(ref user_agent) = configuration.user_agent {
1081        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1082    }
1083    if let Some(ref apikey) = configuration.api_key {
1084        let key = apikey.key.clone();
1085        let value = match apikey.prefix {
1086            Some(ref prefix) => format!("{} {}", prefix, key),
1087            None => key,
1088        };
1089        req_builder = req_builder.header("Authorization", value);
1090    };
1091    if let Some(ref apikey) = configuration.api_key {
1092        let key = apikey.key.clone();
1093        let value = match apikey.prefix {
1094            Some(ref prefix) => format!("{} {}", prefix, key),
1095            None => key,
1096        };
1097        req_builder = req_builder.header("CSRFPreventionToken", value);
1098    };
1099
1100    let req = req_builder.build()?;
1101    let resp = configuration.client.execute(req).await?;
1102
1103    let status = resp.status();
1104    let content_type = resp
1105        .headers()
1106        .get("content-type")
1107        .and_then(|v| v.to_str().ok())
1108        .unwrap_or("application/octet-stream");
1109    let content_type = super::ContentType::from(content_type);
1110
1111    if !status.is_client_error() && !status.is_server_error() {
1112        let content = resp.text().await?;
1113        match content_type {
1114            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1115            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesDisksGetZfsResponse`"))),
1116            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesDisksGetZfsResponse`")))),
1117        }
1118    } else {
1119        let content = resp.text().await?;
1120        let entity: Option<NodesDisksGetZfsError> = serde_json::from_str(&content).ok();
1121        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1122    }
1123}
1124
1125/// Initialize Disk with GPT
1126pub async fn nodes_disks_initgpt(configuration: &configuration::Configuration, node: &str, nodes_disks_initgpt_request: models::NodesDisksInitgptRequest) -> Result<models::NodesDisksInitgptResponse, Error<NodesDisksInitgptError>> {
1127    // add a prefix to parameters to efficiently prevent name collisions
1128    let p_path_node = node;
1129    let p_body_nodes_disks_initgpt_request = nodes_disks_initgpt_request;
1130
1131    let uri_str = format!("{}/nodes/{node}/disks/initgpt", configuration.base_path, node=crate::apis::urlencode(p_path_node));
1132    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1133
1134    if let Some(ref user_agent) = configuration.user_agent {
1135        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1136    }
1137    if let Some(ref apikey) = configuration.api_key {
1138        let key = apikey.key.clone();
1139        let value = match apikey.prefix {
1140            Some(ref prefix) => format!("{} {}", prefix, key),
1141            None => key,
1142        };
1143        req_builder = req_builder.header("Authorization", value);
1144    };
1145    if let Some(ref apikey) = configuration.api_key {
1146        let key = apikey.key.clone();
1147        let value = match apikey.prefix {
1148            Some(ref prefix) => format!("{} {}", prefix, key),
1149            None => key,
1150        };
1151        req_builder = req_builder.header("CSRFPreventionToken", value);
1152    };
1153    req_builder = req_builder.json(&p_body_nodes_disks_initgpt_request);
1154
1155    let req = req_builder.build()?;
1156    let resp = configuration.client.execute(req).await?;
1157
1158    let status = resp.status();
1159    let content_type = resp
1160        .headers()
1161        .get("content-type")
1162        .and_then(|v| v.to_str().ok())
1163        .unwrap_or("application/octet-stream");
1164    let content_type = super::ContentType::from(content_type);
1165
1166    if !status.is_client_error() && !status.is_server_error() {
1167        let content = resp.text().await?;
1168        match content_type {
1169            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1170            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesDisksInitgptResponse`"))),
1171            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesDisksInitgptResponse`")))),
1172        }
1173    } else {
1174        let content = resp.text().await?;
1175        let entity: Option<NodesDisksInitgptError> = serde_json::from_str(&content).ok();
1176        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1177    }
1178}
1179
1180/// Get SMART Health of a disk.
1181pub async fn nodes_disks_smart(configuration: &configuration::Configuration, disk: &str, node: &str, healthonly: Option<&str>) -> Result<models::NodesDisksSmartResponse, Error<NodesDisksSmartError>> {
1182    // add a prefix to parameters to efficiently prevent name collisions
1183    let p_query_disk = disk;
1184    let p_path_node = node;
1185    let p_query_healthonly = healthonly;
1186
1187    let uri_str = format!("{}/nodes/{node}/disks/smart", configuration.base_path, node=crate::apis::urlencode(p_path_node));
1188    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1189
1190    req_builder = req_builder.query(&[("disk", &p_query_disk.to_string())]);
1191    if let Some(ref param_value) = p_query_healthonly {
1192        req_builder = req_builder.query(&[("healthonly", &param_value.to_string())]);
1193    }
1194    if let Some(ref user_agent) = configuration.user_agent {
1195        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1196    }
1197    if let Some(ref apikey) = configuration.api_key {
1198        let key = apikey.key.clone();
1199        let value = match apikey.prefix {
1200            Some(ref prefix) => format!("{} {}", prefix, key),
1201            None => key,
1202        };
1203        req_builder = req_builder.header("Authorization", value);
1204    };
1205    if let Some(ref apikey) = configuration.api_key {
1206        let key = apikey.key.clone();
1207        let value = match apikey.prefix {
1208            Some(ref prefix) => format!("{} {}", prefix, key),
1209            None => key,
1210        };
1211        req_builder = req_builder.header("CSRFPreventionToken", value);
1212    };
1213
1214    let req = req_builder.build()?;
1215    let resp = configuration.client.execute(req).await?;
1216
1217    let status = resp.status();
1218    let content_type = resp
1219        .headers()
1220        .get("content-type")
1221        .and_then(|v| v.to_str().ok())
1222        .unwrap_or("application/octet-stream");
1223    let content_type = super::ContentType::from(content_type);
1224
1225    if !status.is_client_error() && !status.is_server_error() {
1226        let content = resp.text().await?;
1227        match content_type {
1228            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1229            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesDisksSmartResponse`"))),
1230            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesDisksSmartResponse`")))),
1231        }
1232    } else {
1233        let content = resp.text().await?;
1234        let entity: Option<NodesDisksSmartError> = serde_json::from_str(&content).ok();
1235        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1236    }
1237}
1238
1239/// Wipe a disk or partition.
1240pub async fn nodes_disks_wipe_disk(configuration: &configuration::Configuration, node: &str, nodes_disks_wipe_disk_request: models::NodesDisksWipeDiskRequest) -> Result<models::NodesDisksWipeDiskResponse, Error<NodesDisksWipeDiskError>> {
1241    // add a prefix to parameters to efficiently prevent name collisions
1242    let p_path_node = node;
1243    let p_body_nodes_disks_wipe_disk_request = nodes_disks_wipe_disk_request;
1244
1245    let uri_str = format!("{}/nodes/{node}/disks/wipedisk", configuration.base_path, node=crate::apis::urlencode(p_path_node));
1246    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1247
1248    if let Some(ref user_agent) = configuration.user_agent {
1249        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1250    }
1251    if let Some(ref apikey) = configuration.api_key {
1252        let key = apikey.key.clone();
1253        let value = match apikey.prefix {
1254            Some(ref prefix) => format!("{} {}", prefix, key),
1255            None => key,
1256        };
1257        req_builder = req_builder.header("Authorization", value);
1258    };
1259    if let Some(ref apikey) = configuration.api_key {
1260        let key = apikey.key.clone();
1261        let value = match apikey.prefix {
1262            Some(ref prefix) => format!("{} {}", prefix, key),
1263            None => key,
1264        };
1265        req_builder = req_builder.header("CSRFPreventionToken", value);
1266    };
1267    req_builder = req_builder.json(&p_body_nodes_disks_wipe_disk_request);
1268
1269    let req = req_builder.build()?;
1270    let resp = configuration.client.execute(req).await?;
1271
1272    let status = resp.status();
1273    let content_type = resp
1274        .headers()
1275        .get("content-type")
1276        .and_then(|v| v.to_str().ok())
1277        .unwrap_or("application/octet-stream");
1278    let content_type = super::ContentType::from(content_type);
1279
1280    if !status.is_client_error() && !status.is_server_error() {
1281        let content = resp.text().await?;
1282        match content_type {
1283            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1284            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesDisksWipeDiskResponse`"))),
1285            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::NodesDisksWipeDiskResponse`")))),
1286        }
1287    } else {
1288        let content = resp.text().await?;
1289        let entity: Option<NodesDisksWipeDiskError> = serde_json::from_str(&content).ok();
1290        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1291    }
1292}
1293