1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum NodesScanCifsscanError {
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#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum NodesScanGetScanError {
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#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum NodesScanIscsiscanError {
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#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum NodesScanLvmscanError {
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#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum NodesScanLvmthinscanError {
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#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum NodesScanNfsscanError {
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#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum NodesScanPbsscanError {
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#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum NodesScanZfsscanError {
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
131pub async fn nodes_scan_cifsscan(configuration: &configuration::Configuration, node: &str, server: &str, domain: Option<&str>, password: Option<&str>, username: Option<&str>) -> Result<models::NodesScanCifsscanResponse, Error<NodesScanCifsscanError>> {
133 let p_path_node = node;
135 let p_query_server = server;
136 let p_query_domain = domain;
137 let p_query_password = password;
138 let p_query_username = username;
139
140 let uri_str = format!("{}/nodes/{node}/scan/cifs", configuration.base_path, node=crate::apis::urlencode(p_path_node));
141 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
142
143 if let Some(ref param_value) = p_query_domain {
144 req_builder = req_builder.query(&[("domain", ¶m_value.to_string())]);
145 }
146 if let Some(ref param_value) = p_query_password {
147 req_builder = req_builder.query(&[("password", ¶m_value.to_string())]);
148 }
149 req_builder = req_builder.query(&[("server", &p_query_server.to_string())]);
150 if let Some(ref param_value) = p_query_username {
151 req_builder = req_builder.query(&[("username", ¶m_value.to_string())]);
152 }
153 if let Some(ref user_agent) = configuration.user_agent {
154 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
155 }
156 if let Some(ref apikey) = configuration.api_key {
157 let key = apikey.key.clone();
158 let value = match apikey.prefix {
159 Some(ref prefix) => format!("{} {}", prefix, key),
160 None => key,
161 };
162 req_builder = req_builder.header("Authorization", value);
163 };
164 if let Some(ref apikey) = configuration.api_key {
165 let key = apikey.key.clone();
166 let value = match apikey.prefix {
167 Some(ref prefix) => format!("{} {}", prefix, key),
168 None => key,
169 };
170 req_builder = req_builder.header("CSRFPreventionToken", value);
171 };
172
173 let req = req_builder.build()?;
174 let resp = configuration.client.execute(req).await?;
175
176 let status = resp.status();
177 let content_type = resp
178 .headers()
179 .get("content-type")
180 .and_then(|v| v.to_str().ok())
181 .unwrap_or("application/octet-stream");
182 let content_type = super::ContentType::from(content_type);
183
184 if !status.is_client_error() && !status.is_server_error() {
185 let content = resp.text().await?;
186 match content_type {
187 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
188 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesScanCifsscanResponse`"))),
189 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::NodesScanCifsscanResponse`")))),
190 }
191 } else {
192 let content = resp.text().await?;
193 let entity: Option<NodesScanCifsscanError> = serde_json::from_str(&content).ok();
194 Err(Error::ResponseError(ResponseContent { status, content, entity }))
195 }
196}
197
198pub async fn nodes_scan_get_scan(configuration: &configuration::Configuration, node: &str) -> Result<models::NodesScanGetScanResponse, Error<NodesScanGetScanError>> {
200 let p_path_node = node;
202
203 let uri_str = format!("{}/nodes/{node}/scan", configuration.base_path, node=crate::apis::urlencode(p_path_node));
204 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
205
206 if let Some(ref user_agent) = configuration.user_agent {
207 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
208 }
209 if let Some(ref apikey) = configuration.api_key {
210 let key = apikey.key.clone();
211 let value = match apikey.prefix {
212 Some(ref prefix) => format!("{} {}", prefix, key),
213 None => key,
214 };
215 req_builder = req_builder.header("Authorization", value);
216 };
217 if let Some(ref apikey) = configuration.api_key {
218 let key = apikey.key.clone();
219 let value = match apikey.prefix {
220 Some(ref prefix) => format!("{} {}", prefix, key),
221 None => key,
222 };
223 req_builder = req_builder.header("CSRFPreventionToken", value);
224 };
225
226 let req = req_builder.build()?;
227 let resp = configuration.client.execute(req).await?;
228
229 let status = resp.status();
230 let content_type = resp
231 .headers()
232 .get("content-type")
233 .and_then(|v| v.to_str().ok())
234 .unwrap_or("application/octet-stream");
235 let content_type = super::ContentType::from(content_type);
236
237 if !status.is_client_error() && !status.is_server_error() {
238 let content = resp.text().await?;
239 match content_type {
240 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
241 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesScanGetScanResponse`"))),
242 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::NodesScanGetScanResponse`")))),
243 }
244 } else {
245 let content = resp.text().await?;
246 let entity: Option<NodesScanGetScanError> = serde_json::from_str(&content).ok();
247 Err(Error::ResponseError(ResponseContent { status, content, entity }))
248 }
249}
250
251pub async fn nodes_scan_iscsiscan(configuration: &configuration::Configuration, node: &str, portal: &str) -> Result<models::NodesScanIscsiscanResponse, Error<NodesScanIscsiscanError>> {
253 let p_path_node = node;
255 let p_query_portal = portal;
256
257 let uri_str = format!("{}/nodes/{node}/scan/iscsi", configuration.base_path, node=crate::apis::urlencode(p_path_node));
258 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
259
260 req_builder = req_builder.query(&[("portal", &p_query_portal.to_string())]);
261 if let Some(ref user_agent) = configuration.user_agent {
262 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
263 }
264 if let Some(ref apikey) = configuration.api_key {
265 let key = apikey.key.clone();
266 let value = match apikey.prefix {
267 Some(ref prefix) => format!("{} {}", prefix, key),
268 None => key,
269 };
270 req_builder = req_builder.header("Authorization", value);
271 };
272 if let Some(ref apikey) = configuration.api_key {
273 let key = apikey.key.clone();
274 let value = match apikey.prefix {
275 Some(ref prefix) => format!("{} {}", prefix, key),
276 None => key,
277 };
278 req_builder = req_builder.header("CSRFPreventionToken", value);
279 };
280
281 let req = req_builder.build()?;
282 let resp = configuration.client.execute(req).await?;
283
284 let status = resp.status();
285 let content_type = resp
286 .headers()
287 .get("content-type")
288 .and_then(|v| v.to_str().ok())
289 .unwrap_or("application/octet-stream");
290 let content_type = super::ContentType::from(content_type);
291
292 if !status.is_client_error() && !status.is_server_error() {
293 let content = resp.text().await?;
294 match content_type {
295 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
296 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesScanIscsiscanResponse`"))),
297 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::NodesScanIscsiscanResponse`")))),
298 }
299 } else {
300 let content = resp.text().await?;
301 let entity: Option<NodesScanIscsiscanError> = serde_json::from_str(&content).ok();
302 Err(Error::ResponseError(ResponseContent { status, content, entity }))
303 }
304}
305
306pub async fn nodes_scan_lvmscan(configuration: &configuration::Configuration, node: &str) -> Result<models::NodesScanLvmscanResponse, Error<NodesScanLvmscanError>> {
308 let p_path_node = node;
310
311 let uri_str = format!("{}/nodes/{node}/scan/lvm", configuration.base_path, node=crate::apis::urlencode(p_path_node));
312 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
313
314 if let Some(ref user_agent) = configuration.user_agent {
315 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
316 }
317 if let Some(ref apikey) = configuration.api_key {
318 let key = apikey.key.clone();
319 let value = match apikey.prefix {
320 Some(ref prefix) => format!("{} {}", prefix, key),
321 None => key,
322 };
323 req_builder = req_builder.header("Authorization", value);
324 };
325 if let Some(ref apikey) = configuration.api_key {
326 let key = apikey.key.clone();
327 let value = match apikey.prefix {
328 Some(ref prefix) => format!("{} {}", prefix, key),
329 None => key,
330 };
331 req_builder = req_builder.header("CSRFPreventionToken", value);
332 };
333
334 let req = req_builder.build()?;
335 let resp = configuration.client.execute(req).await?;
336
337 let status = resp.status();
338 let content_type = resp
339 .headers()
340 .get("content-type")
341 .and_then(|v| v.to_str().ok())
342 .unwrap_or("application/octet-stream");
343 let content_type = super::ContentType::from(content_type);
344
345 if !status.is_client_error() && !status.is_server_error() {
346 let content = resp.text().await?;
347 match content_type {
348 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
349 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesScanLvmscanResponse`"))),
350 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::NodesScanLvmscanResponse`")))),
351 }
352 } else {
353 let content = resp.text().await?;
354 let entity: Option<NodesScanLvmscanError> = serde_json::from_str(&content).ok();
355 Err(Error::ResponseError(ResponseContent { status, content, entity }))
356 }
357}
358
359pub async fn nodes_scan_lvmthinscan(configuration: &configuration::Configuration, node: &str, vg: &str) -> Result<models::NodesScanLvmthinscanResponse, Error<NodesScanLvmthinscanError>> {
361 let p_path_node = node;
363 let p_query_vg = vg;
364
365 let uri_str = format!("{}/nodes/{node}/scan/lvmthin", configuration.base_path, node=crate::apis::urlencode(p_path_node));
366 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
367
368 req_builder = req_builder.query(&[("vg", &p_query_vg.to_string())]);
369 if let Some(ref user_agent) = configuration.user_agent {
370 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
371 }
372 if let Some(ref apikey) = configuration.api_key {
373 let key = apikey.key.clone();
374 let value = match apikey.prefix {
375 Some(ref prefix) => format!("{} {}", prefix, key),
376 None => key,
377 };
378 req_builder = req_builder.header("Authorization", value);
379 };
380 if let Some(ref apikey) = configuration.api_key {
381 let key = apikey.key.clone();
382 let value = match apikey.prefix {
383 Some(ref prefix) => format!("{} {}", prefix, key),
384 None => key,
385 };
386 req_builder = req_builder.header("CSRFPreventionToken", value);
387 };
388
389 let req = req_builder.build()?;
390 let resp = configuration.client.execute(req).await?;
391
392 let status = resp.status();
393 let content_type = resp
394 .headers()
395 .get("content-type")
396 .and_then(|v| v.to_str().ok())
397 .unwrap_or("application/octet-stream");
398 let content_type = super::ContentType::from(content_type);
399
400 if !status.is_client_error() && !status.is_server_error() {
401 let content = resp.text().await?;
402 match content_type {
403 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
404 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesScanLvmthinscanResponse`"))),
405 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::NodesScanLvmthinscanResponse`")))),
406 }
407 } else {
408 let content = resp.text().await?;
409 let entity: Option<NodesScanLvmthinscanError> = serde_json::from_str(&content).ok();
410 Err(Error::ResponseError(ResponseContent { status, content, entity }))
411 }
412}
413
414pub async fn nodes_scan_nfsscan(configuration: &configuration::Configuration, node: &str, server: &str) -> Result<models::NodesScanNfsscanResponse, Error<NodesScanNfsscanError>> {
416 let p_path_node = node;
418 let p_query_server = server;
419
420 let uri_str = format!("{}/nodes/{node}/scan/nfs", configuration.base_path, node=crate::apis::urlencode(p_path_node));
421 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
422
423 req_builder = req_builder.query(&[("server", &p_query_server.to_string())]);
424 if let Some(ref user_agent) = configuration.user_agent {
425 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
426 }
427 if let Some(ref apikey) = configuration.api_key {
428 let key = apikey.key.clone();
429 let value = match apikey.prefix {
430 Some(ref prefix) => format!("{} {}", prefix, key),
431 None => key,
432 };
433 req_builder = req_builder.header("Authorization", value);
434 };
435 if let Some(ref apikey) = configuration.api_key {
436 let key = apikey.key.clone();
437 let value = match apikey.prefix {
438 Some(ref prefix) => format!("{} {}", prefix, key),
439 None => key,
440 };
441 req_builder = req_builder.header("CSRFPreventionToken", value);
442 };
443
444 let req = req_builder.build()?;
445 let resp = configuration.client.execute(req).await?;
446
447 let status = resp.status();
448 let content_type = resp
449 .headers()
450 .get("content-type")
451 .and_then(|v| v.to_str().ok())
452 .unwrap_or("application/octet-stream");
453 let content_type = super::ContentType::from(content_type);
454
455 if !status.is_client_error() && !status.is_server_error() {
456 let content = resp.text().await?;
457 match content_type {
458 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
459 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesScanNfsscanResponse`"))),
460 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::NodesScanNfsscanResponse`")))),
461 }
462 } else {
463 let content = resp.text().await?;
464 let entity: Option<NodesScanNfsscanError> = serde_json::from_str(&content).ok();
465 Err(Error::ResponseError(ResponseContent { status, content, entity }))
466 }
467}
468
469pub async fn nodes_scan_pbsscan(configuration: &configuration::Configuration, node: &str, password: &str, server: &str, username: &str, fingerprint: Option<&str>, port: Option<i32>) -> Result<models::NodesScanPbsscanResponse, Error<NodesScanPbsscanError>> {
471 let p_path_node = node;
473 let p_query_password = password;
474 let p_query_server = server;
475 let p_query_username = username;
476 let p_query_fingerprint = fingerprint;
477 let p_query_port = port;
478
479 let uri_str = format!("{}/nodes/{node}/scan/pbs", configuration.base_path, node=crate::apis::urlencode(p_path_node));
480 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
481
482 if let Some(ref param_value) = p_query_fingerprint {
483 req_builder = req_builder.query(&[("fingerprint", ¶m_value.to_string())]);
484 }
485 req_builder = req_builder.query(&[("password", &p_query_password.to_string())]);
486 if let Some(ref param_value) = p_query_port {
487 req_builder = req_builder.query(&[("port", ¶m_value.to_string())]);
488 }
489 req_builder = req_builder.query(&[("server", &p_query_server.to_string())]);
490 req_builder = req_builder.query(&[("username", &p_query_username.to_string())]);
491 if let Some(ref user_agent) = configuration.user_agent {
492 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
493 }
494 if let Some(ref apikey) = configuration.api_key {
495 let key = apikey.key.clone();
496 let value = match apikey.prefix {
497 Some(ref prefix) => format!("{} {}", prefix, key),
498 None => key,
499 };
500 req_builder = req_builder.header("Authorization", value);
501 };
502 if let Some(ref apikey) = configuration.api_key {
503 let key = apikey.key.clone();
504 let value = match apikey.prefix {
505 Some(ref prefix) => format!("{} {}", prefix, key),
506 None => key,
507 };
508 req_builder = req_builder.header("CSRFPreventionToken", value);
509 };
510
511 let req = req_builder.build()?;
512 let resp = configuration.client.execute(req).await?;
513
514 let status = resp.status();
515 let content_type = resp
516 .headers()
517 .get("content-type")
518 .and_then(|v| v.to_str().ok())
519 .unwrap_or("application/octet-stream");
520 let content_type = super::ContentType::from(content_type);
521
522 if !status.is_client_error() && !status.is_server_error() {
523 let content = resp.text().await?;
524 match content_type {
525 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
526 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesScanPbsscanResponse`"))),
527 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::NodesScanPbsscanResponse`")))),
528 }
529 } else {
530 let content = resp.text().await?;
531 let entity: Option<NodesScanPbsscanError> = serde_json::from_str(&content).ok();
532 Err(Error::ResponseError(ResponseContent { status, content, entity }))
533 }
534}
535
536pub async fn nodes_scan_zfsscan(configuration: &configuration::Configuration, node: &str) -> Result<models::NodesScanZfsscanResponse, Error<NodesScanZfsscanError>> {
538 let p_path_node = node;
540
541 let uri_str = format!("{}/nodes/{node}/scan/zfs", configuration.base_path, node=crate::apis::urlencode(p_path_node));
542 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
543
544 if let Some(ref user_agent) = configuration.user_agent {
545 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
546 }
547 if let Some(ref apikey) = configuration.api_key {
548 let key = apikey.key.clone();
549 let value = match apikey.prefix {
550 Some(ref prefix) => format!("{} {}", prefix, key),
551 None => key,
552 };
553 req_builder = req_builder.header("Authorization", value);
554 };
555 if let Some(ref apikey) = configuration.api_key {
556 let key = apikey.key.clone();
557 let value = match apikey.prefix {
558 Some(ref prefix) => format!("{} {}", prefix, key),
559 None => key,
560 };
561 req_builder = req_builder.header("CSRFPreventionToken", value);
562 };
563
564 let req = req_builder.build()?;
565 let resp = configuration.client.execute(req).await?;
566
567 let status = resp.status();
568 let content_type = resp
569 .headers()
570 .get("content-type")
571 .and_then(|v| v.to_str().ok())
572 .unwrap_or("application/octet-stream");
573 let content_type = super::ContentType::from(content_type);
574
575 if !status.is_client_error() && !status.is_server_error() {
576 let content = resp.text().await?;
577 match content_type {
578 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
579 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::NodesScanZfsscanResponse`"))),
580 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::NodesScanZfsscanResponse`")))),
581 }
582 } else {
583 let content = resp.text().await?;
584 let entity: Option<NodesScanZfsscanError> = serde_json::from_str(&content).ok();
585 Err(Error::ResponseError(ResponseContent { status, content, entity }))
586 }
587}
588