Skip to main content

clientapi_pve/apis/
cluster_mapping_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 [`cluster_mapping_create_dir`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum ClusterMappingCreateDirError {
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 [`cluster_mapping_create_pci`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum ClusterMappingCreatePciError {
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 [`cluster_mapping_create_usb`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum ClusterMappingCreateUsbError {
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 [`cluster_mapping_delete_dir`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum ClusterMappingDeleteDirError {
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 [`cluster_mapping_delete_pci`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum ClusterMappingDeletePciError {
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 [`cluster_mapping_delete_usb`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum ClusterMappingDeleteUsbError {
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 [`cluster_mapping_get_dir`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum ClusterMappingGetDirError {
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 [`cluster_mapping_get_get_dir`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum ClusterMappingGetGetDirError {
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 [`cluster_mapping_get_get_pci`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum ClusterMappingGetGetPciError {
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 [`cluster_mapping_get_get_usb`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum ClusterMappingGetGetUsbError {
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 [`cluster_mapping_get_mapping`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum ClusterMappingGetMappingError {
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 [`cluster_mapping_get_pci`]
173#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum ClusterMappingGetPciError {
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 [`cluster_mapping_get_usb`]
187#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum ClusterMappingGetUsbError {
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 [`cluster_mapping_update_dir`]
201#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum ClusterMappingUpdateDirError {
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 [`cluster_mapping_update_pci`]
215#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum ClusterMappingUpdatePciError {
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 [`cluster_mapping_update_usb`]
229#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum ClusterMappingUpdateUsbError {
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
243/// Create a new directory mapping.
244pub async fn cluster_mapping_create_dir(configuration: &configuration::Configuration, cluster_mapping_create_dir_request: models::ClusterMappingCreateDirRequest) -> Result<models::ClusterMappingCreateDirResponse, Error<ClusterMappingCreateDirError>> {
245    // add a prefix to parameters to efficiently prevent name collisions
246    let p_body_cluster_mapping_create_dir_request = cluster_mapping_create_dir_request;
247
248    let uri_str = format!("{}/cluster/mapping/dir", configuration.base_path);
249    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
250
251    if let Some(ref user_agent) = configuration.user_agent {
252        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
253    }
254    if let Some(ref apikey) = configuration.api_key {
255        let key = apikey.key.clone();
256        let value = match apikey.prefix {
257            Some(ref prefix) => format!("{} {}", prefix, key),
258            None => key,
259        };
260        req_builder = req_builder.header("Authorization", value);
261    };
262    if let Some(ref apikey) = configuration.api_key {
263        let key = apikey.key.clone();
264        let value = match apikey.prefix {
265            Some(ref prefix) => format!("{} {}", prefix, key),
266            None => key,
267        };
268        req_builder = req_builder.header("CSRFPreventionToken", value);
269    };
270    req_builder = req_builder.json(&p_body_cluster_mapping_create_dir_request);
271
272    let req = req_builder.build()?;
273    let resp = configuration.client.execute(req).await?;
274
275    let status = resp.status();
276    let content_type = resp
277        .headers()
278        .get("content-type")
279        .and_then(|v| v.to_str().ok())
280        .unwrap_or("application/octet-stream");
281    let content_type = super::ContentType::from(content_type);
282
283    if !status.is_client_error() && !status.is_server_error() {
284        let content = resp.text().await?;
285        match content_type {
286            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
287            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterMappingCreateDirResponse`"))),
288            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::ClusterMappingCreateDirResponse`")))),
289        }
290    } else {
291        let content = resp.text().await?;
292        let entity: Option<ClusterMappingCreateDirError> = serde_json::from_str(&content).ok();
293        Err(Error::ResponseError(ResponseContent { status, content, entity }))
294    }
295}
296
297/// Create a new hardware mapping.
298pub async fn cluster_mapping_create_pci(configuration: &configuration::Configuration, cluster_mapping_create_pci_request: models::ClusterMappingCreatePciRequest) -> Result<models::ClusterMappingCreatePciResponse, Error<ClusterMappingCreatePciError>> {
299    // add a prefix to parameters to efficiently prevent name collisions
300    let p_body_cluster_mapping_create_pci_request = cluster_mapping_create_pci_request;
301
302    let uri_str = format!("{}/cluster/mapping/pci", configuration.base_path);
303    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
304
305    if let Some(ref user_agent) = configuration.user_agent {
306        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
307    }
308    if let Some(ref apikey) = configuration.api_key {
309        let key = apikey.key.clone();
310        let value = match apikey.prefix {
311            Some(ref prefix) => format!("{} {}", prefix, key),
312            None => key,
313        };
314        req_builder = req_builder.header("Authorization", value);
315    };
316    if let Some(ref apikey) = configuration.api_key {
317        let key = apikey.key.clone();
318        let value = match apikey.prefix {
319            Some(ref prefix) => format!("{} {}", prefix, key),
320            None => key,
321        };
322        req_builder = req_builder.header("CSRFPreventionToken", value);
323    };
324    req_builder = req_builder.json(&p_body_cluster_mapping_create_pci_request);
325
326    let req = req_builder.build()?;
327    let resp = configuration.client.execute(req).await?;
328
329    let status = resp.status();
330    let content_type = resp
331        .headers()
332        .get("content-type")
333        .and_then(|v| v.to_str().ok())
334        .unwrap_or("application/octet-stream");
335    let content_type = super::ContentType::from(content_type);
336
337    if !status.is_client_error() && !status.is_server_error() {
338        let content = resp.text().await?;
339        match content_type {
340            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
341            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterMappingCreatePciResponse`"))),
342            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::ClusterMappingCreatePciResponse`")))),
343        }
344    } else {
345        let content = resp.text().await?;
346        let entity: Option<ClusterMappingCreatePciError> = serde_json::from_str(&content).ok();
347        Err(Error::ResponseError(ResponseContent { status, content, entity }))
348    }
349}
350
351/// Create a new hardware mapping.
352pub async fn cluster_mapping_create_usb(configuration: &configuration::Configuration, cluster_mapping_create_usb_request: models::ClusterMappingCreateUsbRequest) -> Result<models::ClusterMappingCreateUsbResponse, Error<ClusterMappingCreateUsbError>> {
353    // add a prefix to parameters to efficiently prevent name collisions
354    let p_body_cluster_mapping_create_usb_request = cluster_mapping_create_usb_request;
355
356    let uri_str = format!("{}/cluster/mapping/usb", configuration.base_path);
357    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
358
359    if let Some(ref user_agent) = configuration.user_agent {
360        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
361    }
362    if let Some(ref apikey) = configuration.api_key {
363        let key = apikey.key.clone();
364        let value = match apikey.prefix {
365            Some(ref prefix) => format!("{} {}", prefix, key),
366            None => key,
367        };
368        req_builder = req_builder.header("Authorization", value);
369    };
370    if let Some(ref apikey) = configuration.api_key {
371        let key = apikey.key.clone();
372        let value = match apikey.prefix {
373            Some(ref prefix) => format!("{} {}", prefix, key),
374            None => key,
375        };
376        req_builder = req_builder.header("CSRFPreventionToken", value);
377    };
378    req_builder = req_builder.json(&p_body_cluster_mapping_create_usb_request);
379
380    let req = req_builder.build()?;
381    let resp = configuration.client.execute(req).await?;
382
383    let status = resp.status();
384    let content_type = resp
385        .headers()
386        .get("content-type")
387        .and_then(|v| v.to_str().ok())
388        .unwrap_or("application/octet-stream");
389    let content_type = super::ContentType::from(content_type);
390
391    if !status.is_client_error() && !status.is_server_error() {
392        let content = resp.text().await?;
393        match content_type {
394            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
395            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterMappingCreateUsbResponse`"))),
396            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::ClusterMappingCreateUsbResponse`")))),
397        }
398    } else {
399        let content = resp.text().await?;
400        let entity: Option<ClusterMappingCreateUsbError> = serde_json::from_str(&content).ok();
401        Err(Error::ResponseError(ResponseContent { status, content, entity }))
402    }
403}
404
405/// Remove directory mapping.
406pub async fn cluster_mapping_delete_dir(configuration: &configuration::Configuration, id: &str) -> Result<models::ClusterMappingDeleteDirResponse, Error<ClusterMappingDeleteDirError>> {
407    // add a prefix to parameters to efficiently prevent name collisions
408    let p_path_id = id;
409
410    let uri_str = format!("{}/cluster/mapping/dir/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
411    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
412
413    if let Some(ref user_agent) = configuration.user_agent {
414        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
415    }
416    if let Some(ref apikey) = configuration.api_key {
417        let key = apikey.key.clone();
418        let value = match apikey.prefix {
419            Some(ref prefix) => format!("{} {}", prefix, key),
420            None => key,
421        };
422        req_builder = req_builder.header("Authorization", value);
423    };
424    if let Some(ref apikey) = configuration.api_key {
425        let key = apikey.key.clone();
426        let value = match apikey.prefix {
427            Some(ref prefix) => format!("{} {}", prefix, key),
428            None => key,
429        };
430        req_builder = req_builder.header("CSRFPreventionToken", value);
431    };
432
433    let req = req_builder.build()?;
434    let resp = configuration.client.execute(req).await?;
435
436    let status = resp.status();
437    let content_type = resp
438        .headers()
439        .get("content-type")
440        .and_then(|v| v.to_str().ok())
441        .unwrap_or("application/octet-stream");
442    let content_type = super::ContentType::from(content_type);
443
444    if !status.is_client_error() && !status.is_server_error() {
445        let content = resp.text().await?;
446        match content_type {
447            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
448            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterMappingDeleteDirResponse`"))),
449            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::ClusterMappingDeleteDirResponse`")))),
450        }
451    } else {
452        let content = resp.text().await?;
453        let entity: Option<ClusterMappingDeleteDirError> = serde_json::from_str(&content).ok();
454        Err(Error::ResponseError(ResponseContent { status, content, entity }))
455    }
456}
457
458/// Remove Hardware Mapping.
459pub async fn cluster_mapping_delete_pci(configuration: &configuration::Configuration, id: &str) -> Result<models::ClusterMappingDeletePciResponse, Error<ClusterMappingDeletePciError>> {
460    // add a prefix to parameters to efficiently prevent name collisions
461    let p_path_id = id;
462
463    let uri_str = format!("{}/cluster/mapping/pci/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
464    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
465
466    if let Some(ref user_agent) = configuration.user_agent {
467        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
468    }
469    if let Some(ref apikey) = configuration.api_key {
470        let key = apikey.key.clone();
471        let value = match apikey.prefix {
472            Some(ref prefix) => format!("{} {}", prefix, key),
473            None => key,
474        };
475        req_builder = req_builder.header("Authorization", value);
476    };
477    if let Some(ref apikey) = configuration.api_key {
478        let key = apikey.key.clone();
479        let value = match apikey.prefix {
480            Some(ref prefix) => format!("{} {}", prefix, key),
481            None => key,
482        };
483        req_builder = req_builder.header("CSRFPreventionToken", value);
484    };
485
486    let req = req_builder.build()?;
487    let resp = configuration.client.execute(req).await?;
488
489    let status = resp.status();
490    let content_type = resp
491        .headers()
492        .get("content-type")
493        .and_then(|v| v.to_str().ok())
494        .unwrap_or("application/octet-stream");
495    let content_type = super::ContentType::from(content_type);
496
497    if !status.is_client_error() && !status.is_server_error() {
498        let content = resp.text().await?;
499        match content_type {
500            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
501            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterMappingDeletePciResponse`"))),
502            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::ClusterMappingDeletePciResponse`")))),
503        }
504    } else {
505        let content = resp.text().await?;
506        let entity: Option<ClusterMappingDeletePciError> = serde_json::from_str(&content).ok();
507        Err(Error::ResponseError(ResponseContent { status, content, entity }))
508    }
509}
510
511/// Remove Hardware Mapping.
512pub async fn cluster_mapping_delete_usb(configuration: &configuration::Configuration, id: &str) -> Result<models::ClusterMappingDeleteUsbResponse, Error<ClusterMappingDeleteUsbError>> {
513    // add a prefix to parameters to efficiently prevent name collisions
514    let p_path_id = id;
515
516    let uri_str = format!("{}/cluster/mapping/usb/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
517    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
518
519    if let Some(ref user_agent) = configuration.user_agent {
520        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
521    }
522    if let Some(ref apikey) = configuration.api_key {
523        let key = apikey.key.clone();
524        let value = match apikey.prefix {
525            Some(ref prefix) => format!("{} {}", prefix, key),
526            None => key,
527        };
528        req_builder = req_builder.header("Authorization", value);
529    };
530    if let Some(ref apikey) = configuration.api_key {
531        let key = apikey.key.clone();
532        let value = match apikey.prefix {
533            Some(ref prefix) => format!("{} {}", prefix, key),
534            None => key,
535        };
536        req_builder = req_builder.header("CSRFPreventionToken", value);
537    };
538
539    let req = req_builder.build()?;
540    let resp = configuration.client.execute(req).await?;
541
542    let status = resp.status();
543    let content_type = resp
544        .headers()
545        .get("content-type")
546        .and_then(|v| v.to_str().ok())
547        .unwrap_or("application/octet-stream");
548    let content_type = super::ContentType::from(content_type);
549
550    if !status.is_client_error() && !status.is_server_error() {
551        let content = resp.text().await?;
552        match content_type {
553            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
554            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterMappingDeleteUsbResponse`"))),
555            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::ClusterMappingDeleteUsbResponse`")))),
556        }
557    } else {
558        let content = resp.text().await?;
559        let entity: Option<ClusterMappingDeleteUsbError> = serde_json::from_str(&content).ok();
560        Err(Error::ResponseError(ResponseContent { status, content, entity }))
561    }
562}
563
564/// List directory mapping  Permissions: Only lists entries where you have 'Mapping.Modify', 'Mapping.Use' or 'Mapping.Audit' permissions on '/mapping/dir/<id>'.
565pub async fn cluster_mapping_get_dir(configuration: &configuration::Configuration, check_node: Option<&str>) -> Result<models::ClusterMappingGetDirResponse, Error<ClusterMappingGetDirError>> {
566    // add a prefix to parameters to efficiently prevent name collisions
567    let p_query_check_node = check_node;
568
569    let uri_str = format!("{}/cluster/mapping/dir", configuration.base_path);
570    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
571
572    if let Some(ref param_value) = p_query_check_node {
573        req_builder = req_builder.query(&[("check-node", &param_value.to_string())]);
574    }
575    if let Some(ref user_agent) = configuration.user_agent {
576        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
577    }
578    if let Some(ref apikey) = configuration.api_key {
579        let key = apikey.key.clone();
580        let value = match apikey.prefix {
581            Some(ref prefix) => format!("{} {}", prefix, key),
582            None => key,
583        };
584        req_builder = req_builder.header("Authorization", value);
585    };
586    if let Some(ref apikey) = configuration.api_key {
587        let key = apikey.key.clone();
588        let value = match apikey.prefix {
589            Some(ref prefix) => format!("{} {}", prefix, key),
590            None => key,
591        };
592        req_builder = req_builder.header("CSRFPreventionToken", value);
593    };
594
595    let req = req_builder.build()?;
596    let resp = configuration.client.execute(req).await?;
597
598    let status = resp.status();
599    let content_type = resp
600        .headers()
601        .get("content-type")
602        .and_then(|v| v.to_str().ok())
603        .unwrap_or("application/octet-stream");
604    let content_type = super::ContentType::from(content_type);
605
606    if !status.is_client_error() && !status.is_server_error() {
607        let content = resp.text().await?;
608        match content_type {
609            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
610            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterMappingGetDirResponse`"))),
611            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::ClusterMappingGetDirResponse`")))),
612        }
613    } else {
614        let content = resp.text().await?;
615        let entity: Option<ClusterMappingGetDirError> = serde_json::from_str(&content).ok();
616        Err(Error::ResponseError(ResponseContent { status, content, entity }))
617    }
618}
619
620/// Get directory mapping.
621pub async fn cluster_mapping_get_get_dir(configuration: &configuration::Configuration, id: &str) -> Result<models::ClusterMappingGetGetDirResponse, Error<ClusterMappingGetGetDirError>> {
622    // add a prefix to parameters to efficiently prevent name collisions
623    let p_path_id = id;
624
625    let uri_str = format!("{}/cluster/mapping/dir/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
626    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
627
628    if let Some(ref user_agent) = configuration.user_agent {
629        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
630    }
631    if let Some(ref apikey) = configuration.api_key {
632        let key = apikey.key.clone();
633        let value = match apikey.prefix {
634            Some(ref prefix) => format!("{} {}", prefix, key),
635            None => key,
636        };
637        req_builder = req_builder.header("Authorization", value);
638    };
639    if let Some(ref apikey) = configuration.api_key {
640        let key = apikey.key.clone();
641        let value = match apikey.prefix {
642            Some(ref prefix) => format!("{} {}", prefix, key),
643            None => key,
644        };
645        req_builder = req_builder.header("CSRFPreventionToken", value);
646    };
647
648    let req = req_builder.build()?;
649    let resp = configuration.client.execute(req).await?;
650
651    let status = resp.status();
652    let content_type = resp
653        .headers()
654        .get("content-type")
655        .and_then(|v| v.to_str().ok())
656        .unwrap_or("application/octet-stream");
657    let content_type = super::ContentType::from(content_type);
658
659    if !status.is_client_error() && !status.is_server_error() {
660        let content = resp.text().await?;
661        match content_type {
662            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
663            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterMappingGetGetDirResponse`"))),
664            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::ClusterMappingGetGetDirResponse`")))),
665        }
666    } else {
667        let content = resp.text().await?;
668        let entity: Option<ClusterMappingGetGetDirError> = serde_json::from_str(&content).ok();
669        Err(Error::ResponseError(ResponseContent { status, content, entity }))
670    }
671}
672
673/// Get PCI Mapping.
674pub async fn cluster_mapping_get_get_pci(configuration: &configuration::Configuration, id: &str) -> Result<models::ClusterMappingGetGetPciResponse, Error<ClusterMappingGetGetPciError>> {
675    // add a prefix to parameters to efficiently prevent name collisions
676    let p_path_id = id;
677
678    let uri_str = format!("{}/cluster/mapping/pci/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
679    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
680
681    if let Some(ref user_agent) = configuration.user_agent {
682        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
683    }
684    if let Some(ref apikey) = configuration.api_key {
685        let key = apikey.key.clone();
686        let value = match apikey.prefix {
687            Some(ref prefix) => format!("{} {}", prefix, key),
688            None => key,
689        };
690        req_builder = req_builder.header("Authorization", value);
691    };
692    if let Some(ref apikey) = configuration.api_key {
693        let key = apikey.key.clone();
694        let value = match apikey.prefix {
695            Some(ref prefix) => format!("{} {}", prefix, key),
696            None => key,
697        };
698        req_builder = req_builder.header("CSRFPreventionToken", value);
699    };
700
701    let req = req_builder.build()?;
702    let resp = configuration.client.execute(req).await?;
703
704    let status = resp.status();
705    let content_type = resp
706        .headers()
707        .get("content-type")
708        .and_then(|v| v.to_str().ok())
709        .unwrap_or("application/octet-stream");
710    let content_type = super::ContentType::from(content_type);
711
712    if !status.is_client_error() && !status.is_server_error() {
713        let content = resp.text().await?;
714        match content_type {
715            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
716            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterMappingGetGetPciResponse`"))),
717            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::ClusterMappingGetGetPciResponse`")))),
718        }
719    } else {
720        let content = resp.text().await?;
721        let entity: Option<ClusterMappingGetGetPciError> = serde_json::from_str(&content).ok();
722        Err(Error::ResponseError(ResponseContent { status, content, entity }))
723    }
724}
725
726/// Get USB Mapping.
727pub async fn cluster_mapping_get_get_usb(configuration: &configuration::Configuration, id: &str) -> Result<models::ClusterMappingGetGetUsbResponse, Error<ClusterMappingGetGetUsbError>> {
728    // add a prefix to parameters to efficiently prevent name collisions
729    let p_path_id = id;
730
731    let uri_str = format!("{}/cluster/mapping/usb/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
732    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
733
734    if let Some(ref user_agent) = configuration.user_agent {
735        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
736    }
737    if let Some(ref apikey) = configuration.api_key {
738        let key = apikey.key.clone();
739        let value = match apikey.prefix {
740            Some(ref prefix) => format!("{} {}", prefix, key),
741            None => key,
742        };
743        req_builder = req_builder.header("Authorization", value);
744    };
745    if let Some(ref apikey) = configuration.api_key {
746        let key = apikey.key.clone();
747        let value = match apikey.prefix {
748            Some(ref prefix) => format!("{} {}", prefix, key),
749            None => key,
750        };
751        req_builder = req_builder.header("CSRFPreventionToken", value);
752    };
753
754    let req = req_builder.build()?;
755    let resp = configuration.client.execute(req).await?;
756
757    let status = resp.status();
758    let content_type = resp
759        .headers()
760        .get("content-type")
761        .and_then(|v| v.to_str().ok())
762        .unwrap_or("application/octet-stream");
763    let content_type = super::ContentType::from(content_type);
764
765    if !status.is_client_error() && !status.is_server_error() {
766        let content = resp.text().await?;
767        match content_type {
768            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
769            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterMappingGetGetUsbResponse`"))),
770            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::ClusterMappingGetGetUsbResponse`")))),
771        }
772    } else {
773        let content = resp.text().await?;
774        let entity: Option<ClusterMappingGetGetUsbError> = serde_json::from_str(&content).ok();
775        Err(Error::ResponseError(ResponseContent { status, content, entity }))
776    }
777}
778
779/// List resource types.
780pub async fn cluster_mapping_get_mapping(configuration: &configuration::Configuration, ) -> Result<models::ClusterMappingGetMappingResponse, Error<ClusterMappingGetMappingError>> {
781
782    let uri_str = format!("{}/cluster/mapping", configuration.base_path);
783    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
784
785    if let Some(ref user_agent) = configuration.user_agent {
786        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
787    }
788    if let Some(ref apikey) = configuration.api_key {
789        let key = apikey.key.clone();
790        let value = match apikey.prefix {
791            Some(ref prefix) => format!("{} {}", prefix, key),
792            None => key,
793        };
794        req_builder = req_builder.header("Authorization", value);
795    };
796    if let Some(ref apikey) = configuration.api_key {
797        let key = apikey.key.clone();
798        let value = match apikey.prefix {
799            Some(ref prefix) => format!("{} {}", prefix, key),
800            None => key,
801        };
802        req_builder = req_builder.header("CSRFPreventionToken", value);
803    };
804
805    let req = req_builder.build()?;
806    let resp = configuration.client.execute(req).await?;
807
808    let status = resp.status();
809    let content_type = resp
810        .headers()
811        .get("content-type")
812        .and_then(|v| v.to_str().ok())
813        .unwrap_or("application/octet-stream");
814    let content_type = super::ContentType::from(content_type);
815
816    if !status.is_client_error() && !status.is_server_error() {
817        let content = resp.text().await?;
818        match content_type {
819            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
820            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterMappingGetMappingResponse`"))),
821            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::ClusterMappingGetMappingResponse`")))),
822        }
823    } else {
824        let content = resp.text().await?;
825        let entity: Option<ClusterMappingGetMappingError> = serde_json::from_str(&content).ok();
826        Err(Error::ResponseError(ResponseContent { status, content, entity }))
827    }
828}
829
830/// List PCI Hardware Mapping  Permissions: Only lists entries where you have 'Mapping.Modify', 'Mapping.Use' or 'Mapping.Audit' permissions on '/mapping/pci/<id>'.
831pub async fn cluster_mapping_get_pci(configuration: &configuration::Configuration, check_node: Option<&str>) -> Result<models::ClusterMappingGetPciResponse, Error<ClusterMappingGetPciError>> {
832    // add a prefix to parameters to efficiently prevent name collisions
833    let p_query_check_node = check_node;
834
835    let uri_str = format!("{}/cluster/mapping/pci", configuration.base_path);
836    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
837
838    if let Some(ref param_value) = p_query_check_node {
839        req_builder = req_builder.query(&[("check-node", &param_value.to_string())]);
840    }
841    if let Some(ref user_agent) = configuration.user_agent {
842        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
843    }
844    if let Some(ref apikey) = configuration.api_key {
845        let key = apikey.key.clone();
846        let value = match apikey.prefix {
847            Some(ref prefix) => format!("{} {}", prefix, key),
848            None => key,
849        };
850        req_builder = req_builder.header("Authorization", value);
851    };
852    if let Some(ref apikey) = configuration.api_key {
853        let key = apikey.key.clone();
854        let value = match apikey.prefix {
855            Some(ref prefix) => format!("{} {}", prefix, key),
856            None => key,
857        };
858        req_builder = req_builder.header("CSRFPreventionToken", value);
859    };
860
861    let req = req_builder.build()?;
862    let resp = configuration.client.execute(req).await?;
863
864    let status = resp.status();
865    let content_type = resp
866        .headers()
867        .get("content-type")
868        .and_then(|v| v.to_str().ok())
869        .unwrap_or("application/octet-stream");
870    let content_type = super::ContentType::from(content_type);
871
872    if !status.is_client_error() && !status.is_server_error() {
873        let content = resp.text().await?;
874        match content_type {
875            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
876            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterMappingGetPciResponse`"))),
877            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::ClusterMappingGetPciResponse`")))),
878        }
879    } else {
880        let content = resp.text().await?;
881        let entity: Option<ClusterMappingGetPciError> = serde_json::from_str(&content).ok();
882        Err(Error::ResponseError(ResponseContent { status, content, entity }))
883    }
884}
885
886/// List USB Hardware Mappings  Permissions: Only lists entries where you have 'Mapping.Modify', 'Mapping.Use' or 'Mapping.Audit' permissions on '/mapping/usb/<id>'.
887pub async fn cluster_mapping_get_usb(configuration: &configuration::Configuration, check_node: Option<&str>) -> Result<models::ClusterMappingGetUsbResponse, Error<ClusterMappingGetUsbError>> {
888    // add a prefix to parameters to efficiently prevent name collisions
889    let p_query_check_node = check_node;
890
891    let uri_str = format!("{}/cluster/mapping/usb", configuration.base_path);
892    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
893
894    if let Some(ref param_value) = p_query_check_node {
895        req_builder = req_builder.query(&[("check-node", &param_value.to_string())]);
896    }
897    if let Some(ref user_agent) = configuration.user_agent {
898        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
899    }
900    if let Some(ref apikey) = configuration.api_key {
901        let key = apikey.key.clone();
902        let value = match apikey.prefix {
903            Some(ref prefix) => format!("{} {}", prefix, key),
904            None => key,
905        };
906        req_builder = req_builder.header("Authorization", value);
907    };
908    if let Some(ref apikey) = configuration.api_key {
909        let key = apikey.key.clone();
910        let value = match apikey.prefix {
911            Some(ref prefix) => format!("{} {}", prefix, key),
912            None => key,
913        };
914        req_builder = req_builder.header("CSRFPreventionToken", value);
915    };
916
917    let req = req_builder.build()?;
918    let resp = configuration.client.execute(req).await?;
919
920    let status = resp.status();
921    let content_type = resp
922        .headers()
923        .get("content-type")
924        .and_then(|v| v.to_str().ok())
925        .unwrap_or("application/octet-stream");
926    let content_type = super::ContentType::from(content_type);
927
928    if !status.is_client_error() && !status.is_server_error() {
929        let content = resp.text().await?;
930        match content_type {
931            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
932            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterMappingGetUsbResponse`"))),
933            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::ClusterMappingGetUsbResponse`")))),
934        }
935    } else {
936        let content = resp.text().await?;
937        let entity: Option<ClusterMappingGetUsbError> = serde_json::from_str(&content).ok();
938        Err(Error::ResponseError(ResponseContent { status, content, entity }))
939    }
940}
941
942/// Update a directory mapping.
943pub async fn cluster_mapping_update_dir(configuration: &configuration::Configuration, id: &str, cluster_mapping_update_dir_request: Option<models::ClusterMappingUpdateDirRequest>) -> Result<models::ClusterMappingUpdateDirResponse, Error<ClusterMappingUpdateDirError>> {
944    // add a prefix to parameters to efficiently prevent name collisions
945    let p_path_id = id;
946    let p_body_cluster_mapping_update_dir_request = cluster_mapping_update_dir_request;
947
948    let uri_str = format!("{}/cluster/mapping/dir/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
949    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
950
951    if let Some(ref user_agent) = configuration.user_agent {
952        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
953    }
954    if let Some(ref apikey) = configuration.api_key {
955        let key = apikey.key.clone();
956        let value = match apikey.prefix {
957            Some(ref prefix) => format!("{} {}", prefix, key),
958            None => key,
959        };
960        req_builder = req_builder.header("Authorization", value);
961    };
962    if let Some(ref apikey) = configuration.api_key {
963        let key = apikey.key.clone();
964        let value = match apikey.prefix {
965            Some(ref prefix) => format!("{} {}", prefix, key),
966            None => key,
967        };
968        req_builder = req_builder.header("CSRFPreventionToken", value);
969    };
970    req_builder = req_builder.json(&p_body_cluster_mapping_update_dir_request);
971
972    let req = req_builder.build()?;
973    let resp = configuration.client.execute(req).await?;
974
975    let status = resp.status();
976    let content_type = resp
977        .headers()
978        .get("content-type")
979        .and_then(|v| v.to_str().ok())
980        .unwrap_or("application/octet-stream");
981    let content_type = super::ContentType::from(content_type);
982
983    if !status.is_client_error() && !status.is_server_error() {
984        let content = resp.text().await?;
985        match content_type {
986            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
987            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterMappingUpdateDirResponse`"))),
988            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::ClusterMappingUpdateDirResponse`")))),
989        }
990    } else {
991        let content = resp.text().await?;
992        let entity: Option<ClusterMappingUpdateDirError> = serde_json::from_str(&content).ok();
993        Err(Error::ResponseError(ResponseContent { status, content, entity }))
994    }
995}
996
997/// Update a hardware mapping.
998pub async fn cluster_mapping_update_pci(configuration: &configuration::Configuration, id: &str, cluster_mapping_update_pci_request: Option<models::ClusterMappingUpdatePciRequest>) -> Result<models::ClusterMappingUpdatePciResponse, Error<ClusterMappingUpdatePciError>> {
999    // add a prefix to parameters to efficiently prevent name collisions
1000    let p_path_id = id;
1001    let p_body_cluster_mapping_update_pci_request = cluster_mapping_update_pci_request;
1002
1003    let uri_str = format!("{}/cluster/mapping/pci/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
1004    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1005
1006    if let Some(ref user_agent) = configuration.user_agent {
1007        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1008    }
1009    if let Some(ref apikey) = configuration.api_key {
1010        let key = apikey.key.clone();
1011        let value = match apikey.prefix {
1012            Some(ref prefix) => format!("{} {}", prefix, key),
1013            None => key,
1014        };
1015        req_builder = req_builder.header("Authorization", value);
1016    };
1017    if let Some(ref apikey) = configuration.api_key {
1018        let key = apikey.key.clone();
1019        let value = match apikey.prefix {
1020            Some(ref prefix) => format!("{} {}", prefix, key),
1021            None => key,
1022        };
1023        req_builder = req_builder.header("CSRFPreventionToken", value);
1024    };
1025    req_builder = req_builder.json(&p_body_cluster_mapping_update_pci_request);
1026
1027    let req = req_builder.build()?;
1028    let resp = configuration.client.execute(req).await?;
1029
1030    let status = resp.status();
1031    let content_type = resp
1032        .headers()
1033        .get("content-type")
1034        .and_then(|v| v.to_str().ok())
1035        .unwrap_or("application/octet-stream");
1036    let content_type = super::ContentType::from(content_type);
1037
1038    if !status.is_client_error() && !status.is_server_error() {
1039        let content = resp.text().await?;
1040        match content_type {
1041            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1042            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterMappingUpdatePciResponse`"))),
1043            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::ClusterMappingUpdatePciResponse`")))),
1044        }
1045    } else {
1046        let content = resp.text().await?;
1047        let entity: Option<ClusterMappingUpdatePciError> = serde_json::from_str(&content).ok();
1048        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1049    }
1050}
1051
1052/// Update a hardware mapping.
1053pub async fn cluster_mapping_update_usb(configuration: &configuration::Configuration, id: &str, cluster_mapping_update_usb_request: models::ClusterMappingUpdateUsbRequest) -> Result<models::ClusterMappingUpdateUsbResponse, Error<ClusterMappingUpdateUsbError>> {
1054    // add a prefix to parameters to efficiently prevent name collisions
1055    let p_path_id = id;
1056    let p_body_cluster_mapping_update_usb_request = cluster_mapping_update_usb_request;
1057
1058    let uri_str = format!("{}/cluster/mapping/usb/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
1059    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1060
1061    if let Some(ref user_agent) = configuration.user_agent {
1062        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1063    }
1064    if let Some(ref apikey) = configuration.api_key {
1065        let key = apikey.key.clone();
1066        let value = match apikey.prefix {
1067            Some(ref prefix) => format!("{} {}", prefix, key),
1068            None => key,
1069        };
1070        req_builder = req_builder.header("Authorization", value);
1071    };
1072    if let Some(ref apikey) = configuration.api_key {
1073        let key = apikey.key.clone();
1074        let value = match apikey.prefix {
1075            Some(ref prefix) => format!("{} {}", prefix, key),
1076            None => key,
1077        };
1078        req_builder = req_builder.header("CSRFPreventionToken", value);
1079    };
1080    req_builder = req_builder.json(&p_body_cluster_mapping_update_usb_request);
1081
1082    let req = req_builder.build()?;
1083    let resp = configuration.client.execute(req).await?;
1084
1085    let status = resp.status();
1086    let content_type = resp
1087        .headers()
1088        .get("content-type")
1089        .and_then(|v| v.to_str().ok())
1090        .unwrap_or("application/octet-stream");
1091    let content_type = super::ContentType::from(content_type);
1092
1093    if !status.is_client_error() && !status.is_server_error() {
1094        let content = resp.text().await?;
1095        match content_type {
1096            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1097            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterMappingUpdateUsbResponse`"))),
1098            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::ClusterMappingUpdateUsbResponse`")))),
1099        }
1100    } else {
1101        let content = resp.text().await?;
1102        let entity: Option<ClusterMappingUpdateUsbError> = serde_json::from_str(&content).ok();
1103        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1104    }
1105}
1106