Skip to main content

clientapi_pve/apis/
cluster_config_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_config_addnode`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum ClusterConfigAddnodeError {
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_config_create_config`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum ClusterConfigCreateConfigError {
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_config_delnode`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum ClusterConfigDelnodeError {
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_config_get_config`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum ClusterConfigGetConfigError {
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_config_join`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum ClusterConfigJoinError {
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_config_join_api_version`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum ClusterConfigJoinApiVersionError {
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_config_join_info`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum ClusterConfigJoinInfoError {
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_config_nodes`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum ClusterConfigNodesError {
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_config_status`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum ClusterConfigStatusError {
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_config_totem`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum ClusterConfigTotemError {
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
159/// Adds a node to the cluster configuration. This call is for internal use.
160pub async fn cluster_config_addnode(configuration: &configuration::Configuration, node: &str, cluster_config_addnode_request: Option<models::ClusterConfigAddnodeRequest>) -> Result<models::ClusterConfigAddnodeResponse, Error<ClusterConfigAddnodeError>> {
161    // add a prefix to parameters to efficiently prevent name collisions
162    let p_path_node = node;
163    let p_body_cluster_config_addnode_request = cluster_config_addnode_request;
164
165    let uri_str = format!("{}/cluster/config/nodes/{node}", configuration.base_path, node=crate::apis::urlencode(p_path_node));
166    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
167
168    if let Some(ref user_agent) = configuration.user_agent {
169        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
170    }
171    if let Some(ref apikey) = configuration.api_key {
172        let key = apikey.key.clone();
173        let value = match apikey.prefix {
174            Some(ref prefix) => format!("{} {}", prefix, key),
175            None => key,
176        };
177        req_builder = req_builder.header("Authorization", value);
178    };
179    if let Some(ref apikey) = configuration.api_key {
180        let key = apikey.key.clone();
181        let value = match apikey.prefix {
182            Some(ref prefix) => format!("{} {}", prefix, key),
183            None => key,
184        };
185        req_builder = req_builder.header("CSRFPreventionToken", value);
186    };
187    req_builder = req_builder.json(&p_body_cluster_config_addnode_request);
188
189    let req = req_builder.build()?;
190    let resp = configuration.client.execute(req).await?;
191
192    let status = resp.status();
193    let content_type = resp
194        .headers()
195        .get("content-type")
196        .and_then(|v| v.to_str().ok())
197        .unwrap_or("application/octet-stream");
198    let content_type = super::ContentType::from(content_type);
199
200    if !status.is_client_error() && !status.is_server_error() {
201        let content = resp.text().await?;
202        match content_type {
203            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
204            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterConfigAddnodeResponse`"))),
205            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::ClusterConfigAddnodeResponse`")))),
206        }
207    } else {
208        let content = resp.text().await?;
209        let entity: Option<ClusterConfigAddnodeError> = serde_json::from_str(&content).ok();
210        Err(Error::ResponseError(ResponseContent { status, content, entity }))
211    }
212}
213
214/// Generate new cluster configuration. If no links given, default to local IP address as link0.
215pub async fn cluster_config_create_config(configuration: &configuration::Configuration, cluster_config_create_config_request: models::ClusterConfigCreateConfigRequest) -> Result<models::ClusterConfigCreateConfigResponse, Error<ClusterConfigCreateConfigError>> {
216    // add a prefix to parameters to efficiently prevent name collisions
217    let p_body_cluster_config_create_config_request = cluster_config_create_config_request;
218
219    let uri_str = format!("{}/cluster/config", configuration.base_path);
220    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
221
222    if let Some(ref user_agent) = configuration.user_agent {
223        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
224    }
225    if let Some(ref apikey) = configuration.api_key {
226        let key = apikey.key.clone();
227        let value = match apikey.prefix {
228            Some(ref prefix) => format!("{} {}", prefix, key),
229            None => key,
230        };
231        req_builder = req_builder.header("Authorization", value);
232    };
233    if let Some(ref apikey) = configuration.api_key {
234        let key = apikey.key.clone();
235        let value = match apikey.prefix {
236            Some(ref prefix) => format!("{} {}", prefix, key),
237            None => key,
238        };
239        req_builder = req_builder.header("CSRFPreventionToken", value);
240    };
241    req_builder = req_builder.json(&p_body_cluster_config_create_config_request);
242
243    let req = req_builder.build()?;
244    let resp = configuration.client.execute(req).await?;
245
246    let status = resp.status();
247    let content_type = resp
248        .headers()
249        .get("content-type")
250        .and_then(|v| v.to_str().ok())
251        .unwrap_or("application/octet-stream");
252    let content_type = super::ContentType::from(content_type);
253
254    if !status.is_client_error() && !status.is_server_error() {
255        let content = resp.text().await?;
256        match content_type {
257            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
258            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterConfigCreateConfigResponse`"))),
259            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::ClusterConfigCreateConfigResponse`")))),
260        }
261    } else {
262        let content = resp.text().await?;
263        let entity: Option<ClusterConfigCreateConfigError> = serde_json::from_str(&content).ok();
264        Err(Error::ResponseError(ResponseContent { status, content, entity }))
265    }
266}
267
268/// Removes a node from the cluster configuration.
269pub async fn cluster_config_delnode(configuration: &configuration::Configuration, node: &str) -> Result<models::ClusterConfigDelnodeResponse, Error<ClusterConfigDelnodeError>> {
270    // add a prefix to parameters to efficiently prevent name collisions
271    let p_path_node = node;
272
273    let uri_str = format!("{}/cluster/config/nodes/{node}", configuration.base_path, node=crate::apis::urlencode(p_path_node));
274    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
275
276    if let Some(ref user_agent) = configuration.user_agent {
277        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
278    }
279    if let Some(ref apikey) = configuration.api_key {
280        let key = apikey.key.clone();
281        let value = match apikey.prefix {
282            Some(ref prefix) => format!("{} {}", prefix, key),
283            None => key,
284        };
285        req_builder = req_builder.header("Authorization", value);
286    };
287    if let Some(ref apikey) = configuration.api_key {
288        let key = apikey.key.clone();
289        let value = match apikey.prefix {
290            Some(ref prefix) => format!("{} {}", prefix, key),
291            None => key,
292        };
293        req_builder = req_builder.header("CSRFPreventionToken", value);
294    };
295
296    let req = req_builder.build()?;
297    let resp = configuration.client.execute(req).await?;
298
299    let status = resp.status();
300    let content_type = resp
301        .headers()
302        .get("content-type")
303        .and_then(|v| v.to_str().ok())
304        .unwrap_or("application/octet-stream");
305    let content_type = super::ContentType::from(content_type);
306
307    if !status.is_client_error() && !status.is_server_error() {
308        let content = resp.text().await?;
309        match content_type {
310            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
311            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterConfigDelnodeResponse`"))),
312            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::ClusterConfigDelnodeResponse`")))),
313        }
314    } else {
315        let content = resp.text().await?;
316        let entity: Option<ClusterConfigDelnodeError> = serde_json::from_str(&content).ok();
317        Err(Error::ResponseError(ResponseContent { status, content, entity }))
318    }
319}
320
321/// Directory index.
322pub async fn cluster_config_get_config(configuration: &configuration::Configuration, ) -> Result<models::ClusterConfigGetConfigResponse, Error<ClusterConfigGetConfigError>> {
323
324    let uri_str = format!("{}/cluster/config", configuration.base_path);
325    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
326
327    if let Some(ref user_agent) = configuration.user_agent {
328        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
329    }
330    if let Some(ref apikey) = configuration.api_key {
331        let key = apikey.key.clone();
332        let value = match apikey.prefix {
333            Some(ref prefix) => format!("{} {}", prefix, key),
334            None => key,
335        };
336        req_builder = req_builder.header("Authorization", value);
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("CSRFPreventionToken", value);
345    };
346
347    let req = req_builder.build()?;
348    let resp = configuration.client.execute(req).await?;
349
350    let status = resp.status();
351    let content_type = resp
352        .headers()
353        .get("content-type")
354        .and_then(|v| v.to_str().ok())
355        .unwrap_or("application/octet-stream");
356    let content_type = super::ContentType::from(content_type);
357
358    if !status.is_client_error() && !status.is_server_error() {
359        let content = resp.text().await?;
360        match content_type {
361            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
362            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterConfigGetConfigResponse`"))),
363            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::ClusterConfigGetConfigResponse`")))),
364        }
365    } else {
366        let content = resp.text().await?;
367        let entity: Option<ClusterConfigGetConfigError> = serde_json::from_str(&content).ok();
368        Err(Error::ResponseError(ResponseContent { status, content, entity }))
369    }
370}
371
372/// Joins this node into an existing cluster. If no links are given, default to IP resolved by node's hostname on single link (fallback fails for clusters with multiple links).
373pub async fn cluster_config_join(configuration: &configuration::Configuration, cluster_config_join_request: models::ClusterConfigJoinRequest) -> Result<models::ClusterConfigJoinResponse, Error<ClusterConfigJoinError>> {
374    // add a prefix to parameters to efficiently prevent name collisions
375    let p_body_cluster_config_join_request = cluster_config_join_request;
376
377    let uri_str = format!("{}/cluster/config/join", configuration.base_path);
378    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
379
380    if let Some(ref user_agent) = configuration.user_agent {
381        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
382    }
383    if let Some(ref apikey) = configuration.api_key {
384        let key = apikey.key.clone();
385        let value = match apikey.prefix {
386            Some(ref prefix) => format!("{} {}", prefix, key),
387            None => key,
388        };
389        req_builder = req_builder.header("Authorization", value);
390    };
391    if let Some(ref apikey) = configuration.api_key {
392        let key = apikey.key.clone();
393        let value = match apikey.prefix {
394            Some(ref prefix) => format!("{} {}", prefix, key),
395            None => key,
396        };
397        req_builder = req_builder.header("CSRFPreventionToken", value);
398    };
399    req_builder = req_builder.json(&p_body_cluster_config_join_request);
400
401    let req = req_builder.build()?;
402    let resp = configuration.client.execute(req).await?;
403
404    let status = resp.status();
405    let content_type = resp
406        .headers()
407        .get("content-type")
408        .and_then(|v| v.to_str().ok())
409        .unwrap_or("application/octet-stream");
410    let content_type = super::ContentType::from(content_type);
411
412    if !status.is_client_error() && !status.is_server_error() {
413        let content = resp.text().await?;
414        match content_type {
415            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
416            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterConfigJoinResponse`"))),
417            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::ClusterConfigJoinResponse`")))),
418        }
419    } else {
420        let content = resp.text().await?;
421        let entity: Option<ClusterConfigJoinError> = serde_json::from_str(&content).ok();
422        Err(Error::ResponseError(ResponseContent { status, content, entity }))
423    }
424}
425
426/// Return the version of the cluster join API available on this node.
427pub async fn cluster_config_join_api_version(configuration: &configuration::Configuration, ) -> Result<models::ClusterConfigJoinApiVersionResponse, Error<ClusterConfigJoinApiVersionError>> {
428
429    let uri_str = format!("{}/cluster/config/apiversion", configuration.base_path);
430    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
431
432    if let Some(ref user_agent) = configuration.user_agent {
433        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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("Authorization", value);
442    };
443    if let Some(ref apikey) = configuration.api_key {
444        let key = apikey.key.clone();
445        let value = match apikey.prefix {
446            Some(ref prefix) => format!("{} {}", prefix, key),
447            None => key,
448        };
449        req_builder = req_builder.header("CSRFPreventionToken", value);
450    };
451
452    let req = req_builder.build()?;
453    let resp = configuration.client.execute(req).await?;
454
455    let status = resp.status();
456    let content_type = resp
457        .headers()
458        .get("content-type")
459        .and_then(|v| v.to_str().ok())
460        .unwrap_or("application/octet-stream");
461    let content_type = super::ContentType::from(content_type);
462
463    if !status.is_client_error() && !status.is_server_error() {
464        let content = resp.text().await?;
465        match content_type {
466            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
467            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterConfigJoinApiVersionResponse`"))),
468            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::ClusterConfigJoinApiVersionResponse`")))),
469        }
470    } else {
471        let content = resp.text().await?;
472        let entity: Option<ClusterConfigJoinApiVersionError> = serde_json::from_str(&content).ok();
473        Err(Error::ResponseError(ResponseContent { status, content, entity }))
474    }
475}
476
477/// Get information needed to join this cluster over the connected node.
478pub async fn cluster_config_join_info(configuration: &configuration::Configuration, node: Option<&str>) -> Result<models::ClusterConfigJoinInfoResponse, Error<ClusterConfigJoinInfoError>> {
479    // add a prefix to parameters to efficiently prevent name collisions
480    let p_query_node = node;
481
482    let uri_str = format!("{}/cluster/config/join", configuration.base_path);
483    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
484
485    if let Some(ref param_value) = p_query_node {
486        req_builder = req_builder.query(&[("node", &param_value.to_string())]);
487    }
488    if let Some(ref user_agent) = configuration.user_agent {
489        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
490    }
491    if let Some(ref apikey) = configuration.api_key {
492        let key = apikey.key.clone();
493        let value = match apikey.prefix {
494            Some(ref prefix) => format!("{} {}", prefix, key),
495            None => key,
496        };
497        req_builder = req_builder.header("Authorization", value);
498    };
499    if let Some(ref apikey) = configuration.api_key {
500        let key = apikey.key.clone();
501        let value = match apikey.prefix {
502            Some(ref prefix) => format!("{} {}", prefix, key),
503            None => key,
504        };
505        req_builder = req_builder.header("CSRFPreventionToken", value);
506    };
507
508    let req = req_builder.build()?;
509    let resp = configuration.client.execute(req).await?;
510
511    let status = resp.status();
512    let content_type = resp
513        .headers()
514        .get("content-type")
515        .and_then(|v| v.to_str().ok())
516        .unwrap_or("application/octet-stream");
517    let content_type = super::ContentType::from(content_type);
518
519    if !status.is_client_error() && !status.is_server_error() {
520        let content = resp.text().await?;
521        match content_type {
522            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
523            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterConfigJoinInfoResponse`"))),
524            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::ClusterConfigJoinInfoResponse`")))),
525        }
526    } else {
527        let content = resp.text().await?;
528        let entity: Option<ClusterConfigJoinInfoError> = serde_json::from_str(&content).ok();
529        Err(Error::ResponseError(ResponseContent { status, content, entity }))
530    }
531}
532
533/// Corosync node list.
534pub async fn cluster_config_nodes(configuration: &configuration::Configuration, ) -> Result<models::ClusterConfigNodesResponse, Error<ClusterConfigNodesError>> {
535
536    let uri_str = format!("{}/cluster/config/nodes", configuration.base_path);
537    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
538
539    if let Some(ref user_agent) = configuration.user_agent {
540        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
541    }
542    if let Some(ref apikey) = configuration.api_key {
543        let key = apikey.key.clone();
544        let value = match apikey.prefix {
545            Some(ref prefix) => format!("{} {}", prefix, key),
546            None => key,
547        };
548        req_builder = req_builder.header("Authorization", value);
549    };
550    if let Some(ref apikey) = configuration.api_key {
551        let key = apikey.key.clone();
552        let value = match apikey.prefix {
553            Some(ref prefix) => format!("{} {}", prefix, key),
554            None => key,
555        };
556        req_builder = req_builder.header("CSRFPreventionToken", value);
557    };
558
559    let req = req_builder.build()?;
560    let resp = configuration.client.execute(req).await?;
561
562    let status = resp.status();
563    let content_type = resp
564        .headers()
565        .get("content-type")
566        .and_then(|v| v.to_str().ok())
567        .unwrap_or("application/octet-stream");
568    let content_type = super::ContentType::from(content_type);
569
570    if !status.is_client_error() && !status.is_server_error() {
571        let content = resp.text().await?;
572        match content_type {
573            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
574            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterConfigNodesResponse`"))),
575            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::ClusterConfigNodesResponse`")))),
576        }
577    } else {
578        let content = resp.text().await?;
579        let entity: Option<ClusterConfigNodesError> = serde_json::from_str(&content).ok();
580        Err(Error::ResponseError(ResponseContent { status, content, entity }))
581    }
582}
583
584/// Get QDevice status
585pub async fn cluster_config_status(configuration: &configuration::Configuration, ) -> Result<models::ClusterConfigStatusResponse, Error<ClusterConfigStatusError>> {
586
587    let uri_str = format!("{}/cluster/config/qdevice", configuration.base_path);
588    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
589
590    if let Some(ref user_agent) = configuration.user_agent {
591        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
592    }
593    if let Some(ref apikey) = configuration.api_key {
594        let key = apikey.key.clone();
595        let value = match apikey.prefix {
596            Some(ref prefix) => format!("{} {}", prefix, key),
597            None => key,
598        };
599        req_builder = req_builder.header("Authorization", value);
600    };
601    if let Some(ref apikey) = configuration.api_key {
602        let key = apikey.key.clone();
603        let value = match apikey.prefix {
604            Some(ref prefix) => format!("{} {}", prefix, key),
605            None => key,
606        };
607        req_builder = req_builder.header("CSRFPreventionToken", value);
608    };
609
610    let req = req_builder.build()?;
611    let resp = configuration.client.execute(req).await?;
612
613    let status = resp.status();
614    let content_type = resp
615        .headers()
616        .get("content-type")
617        .and_then(|v| v.to_str().ok())
618        .unwrap_or("application/octet-stream");
619    let content_type = super::ContentType::from(content_type);
620
621    if !status.is_client_error() && !status.is_server_error() {
622        let content = resp.text().await?;
623        match content_type {
624            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
625            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterConfigStatusResponse`"))),
626            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::ClusterConfigStatusResponse`")))),
627        }
628    } else {
629        let content = resp.text().await?;
630        let entity: Option<ClusterConfigStatusError> = serde_json::from_str(&content).ok();
631        Err(Error::ResponseError(ResponseContent { status, content, entity }))
632    }
633}
634
635/// Get corosync totem protocol settings.
636pub async fn cluster_config_totem(configuration: &configuration::Configuration, ) -> Result<models::ClusterConfigTotemResponse, Error<ClusterConfigTotemError>> {
637
638    let uri_str = format!("{}/cluster/config/totem", configuration.base_path);
639    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
640
641    if let Some(ref user_agent) = configuration.user_agent {
642        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
643    }
644    if let Some(ref apikey) = configuration.api_key {
645        let key = apikey.key.clone();
646        let value = match apikey.prefix {
647            Some(ref prefix) => format!("{} {}", prefix, key),
648            None => key,
649        };
650        req_builder = req_builder.header("Authorization", value);
651    };
652    if let Some(ref apikey) = configuration.api_key {
653        let key = apikey.key.clone();
654        let value = match apikey.prefix {
655            Some(ref prefix) => format!("{} {}", prefix, key),
656            None => key,
657        };
658        req_builder = req_builder.header("CSRFPreventionToken", value);
659    };
660
661    let req = req_builder.build()?;
662    let resp = configuration.client.execute(req).await?;
663
664    let status = resp.status();
665    let content_type = resp
666        .headers()
667        .get("content-type")
668        .and_then(|v| v.to_str().ok())
669        .unwrap_or("application/octet-stream");
670    let content_type = super::ContentType::from(content_type);
671
672    if !status.is_client_error() && !status.is_server_error() {
673        let content = resp.text().await?;
674        match content_type {
675            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
676            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterConfigTotemResponse`"))),
677            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::ClusterConfigTotemResponse`")))),
678        }
679    } else {
680        let content = resp.text().await?;
681        let entity: Option<ClusterConfigTotemError> = serde_json::from_str(&content).ok();
682        Err(Error::ResponseError(ResponseContent { status, content, entity }))
683    }
684}
685