Skip to main content

clientapi_pbs/apis/
config_access_api.rs

1/*
2 * Proxmox Backup Server API
3 *
4 * Generated from apidoc.js. NOT an official Proxmox specification. See https://pbs.proxmox.com/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 [`config_access_create_ad`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum ConfigAccessCreateAdError {
22    Status400(models::PbsError),
23    Status401(models::PbsError),
24    Status403(models::PbsError),
25    Status404(models::PbsError),
26    Status500(models::PbsError),
27    Status501(models::PbsError),
28    Status503(models::PbsError),
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`config_access_create_ldap`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum ConfigAccessCreateLdapError {
36    Status400(models::PbsError),
37    Status401(models::PbsError),
38    Status403(models::PbsError),
39    Status404(models::PbsError),
40    Status500(models::PbsError),
41    Status501(models::PbsError),
42    Status503(models::PbsError),
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`config_access_create_openid`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum ConfigAccessCreateOpenidError {
50    Status400(models::PbsError),
51    Status401(models::PbsError),
52    Status403(models::PbsError),
53    Status404(models::PbsError),
54    Status500(models::PbsError),
55    Status501(models::PbsError),
56    Status503(models::PbsError),
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`config_access_delete_ad`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum ConfigAccessDeleteAdError {
64    Status400(models::PbsError),
65    Status401(models::PbsError),
66    Status403(models::PbsError),
67    Status404(models::PbsError),
68    Status500(models::PbsError),
69    Status501(models::PbsError),
70    Status503(models::PbsError),
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`config_access_delete_ldap`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum ConfigAccessDeleteLdapError {
78    Status400(models::PbsError),
79    Status401(models::PbsError),
80    Status403(models::PbsError),
81    Status404(models::PbsError),
82    Status500(models::PbsError),
83    Status501(models::PbsError),
84    Status503(models::PbsError),
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`config_access_delete_openid`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum ConfigAccessDeleteOpenidError {
92    Status400(models::PbsError),
93    Status401(models::PbsError),
94    Status403(models::PbsError),
95    Status404(models::PbsError),
96    Status500(models::PbsError),
97    Status501(models::PbsError),
98    Status503(models::PbsError),
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`config_access_get_access`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum ConfigAccessGetAccessError {
106    Status400(models::PbsError),
107    Status401(models::PbsError),
108    Status403(models::PbsError),
109    Status404(models::PbsError),
110    Status500(models::PbsError),
111    Status501(models::PbsError),
112    Status503(models::PbsError),
113    UnknownValue(serde_json::Value),
114}
115
116/// struct for typed errors of method [`config_access_get_ad`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum ConfigAccessGetAdError {
120    Status400(models::PbsError),
121    Status401(models::PbsError),
122    Status403(models::PbsError),
123    Status404(models::PbsError),
124    Status500(models::PbsError),
125    Status501(models::PbsError),
126    Status503(models::PbsError),
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`config_access_get_config_access_ad_by_realm`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum ConfigAccessGetConfigAccessAdByRealmError {
134    Status400(models::PbsError),
135    Status401(models::PbsError),
136    Status403(models::PbsError),
137    Status404(models::PbsError),
138    Status500(models::PbsError),
139    Status501(models::PbsError),
140    Status503(models::PbsError),
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`config_access_get_config_access_ldap_by_realm`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum ConfigAccessGetConfigAccessLdapByRealmError {
148    Status400(models::PbsError),
149    Status401(models::PbsError),
150    Status403(models::PbsError),
151    Status404(models::PbsError),
152    Status500(models::PbsError),
153    Status501(models::PbsError),
154    Status503(models::PbsError),
155    UnknownValue(serde_json::Value),
156}
157
158/// struct for typed errors of method [`config_access_get_config_access_openid_by_realm`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum ConfigAccessGetConfigAccessOpenidByRealmError {
162    Status400(models::PbsError),
163    Status401(models::PbsError),
164    Status403(models::PbsError),
165    Status404(models::PbsError),
166    Status500(models::PbsError),
167    Status501(models::PbsError),
168    Status503(models::PbsError),
169    UnknownValue(serde_json::Value),
170}
171
172/// struct for typed errors of method [`config_access_get_ldap`]
173#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum ConfigAccessGetLdapError {
176    Status400(models::PbsError),
177    Status401(models::PbsError),
178    Status403(models::PbsError),
179    Status404(models::PbsError),
180    Status500(models::PbsError),
181    Status501(models::PbsError),
182    Status503(models::PbsError),
183    UnknownValue(serde_json::Value),
184}
185
186/// struct for typed errors of method [`config_access_get_openid`]
187#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum ConfigAccessGetOpenidError {
190    Status400(models::PbsError),
191    Status401(models::PbsError),
192    Status403(models::PbsError),
193    Status404(models::PbsError),
194    Status500(models::PbsError),
195    Status501(models::PbsError),
196    Status503(models::PbsError),
197    UnknownValue(serde_json::Value),
198}
199
200/// struct for typed errors of method [`config_access_get_pam`]
201#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum ConfigAccessGetPamError {
204    Status400(models::PbsError),
205    Status401(models::PbsError),
206    Status403(models::PbsError),
207    Status404(models::PbsError),
208    Status500(models::PbsError),
209    Status501(models::PbsError),
210    Status503(models::PbsError),
211    UnknownValue(serde_json::Value),
212}
213
214/// struct for typed errors of method [`config_access_get_pbs`]
215#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum ConfigAccessGetPbsError {
218    Status400(models::PbsError),
219    Status401(models::PbsError),
220    Status403(models::PbsError),
221    Status404(models::PbsError),
222    Status500(models::PbsError),
223    Status501(models::PbsError),
224    Status503(models::PbsError),
225    UnknownValue(serde_json::Value),
226}
227
228/// struct for typed errors of method [`config_access_get_tfa`]
229#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum ConfigAccessGetTfaError {
232    Status400(models::PbsError),
233    Status401(models::PbsError),
234    Status403(models::PbsError),
235    Status404(models::PbsError),
236    Status500(models::PbsError),
237    Status501(models::PbsError),
238    Status503(models::PbsError),
239    UnknownValue(serde_json::Value),
240}
241
242/// struct for typed errors of method [`config_access_get_webauthn`]
243#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum ConfigAccessGetWebauthnError {
246    Status400(models::PbsError),
247    Status401(models::PbsError),
248    Status403(models::PbsError),
249    Status404(models::PbsError),
250    Status500(models::PbsError),
251    Status501(models::PbsError),
252    Status503(models::PbsError),
253    UnknownValue(serde_json::Value),
254}
255
256/// struct for typed errors of method [`config_access_update_ad`]
257#[derive(Debug, Clone, Serialize, Deserialize)]
258#[serde(untagged)]
259pub enum ConfigAccessUpdateAdError {
260    Status400(models::PbsError),
261    Status401(models::PbsError),
262    Status403(models::PbsError),
263    Status404(models::PbsError),
264    Status500(models::PbsError),
265    Status501(models::PbsError),
266    Status503(models::PbsError),
267    UnknownValue(serde_json::Value),
268}
269
270/// struct for typed errors of method [`config_access_update_ldap`]
271#[derive(Debug, Clone, Serialize, Deserialize)]
272#[serde(untagged)]
273pub enum ConfigAccessUpdateLdapError {
274    Status400(models::PbsError),
275    Status401(models::PbsError),
276    Status403(models::PbsError),
277    Status404(models::PbsError),
278    Status500(models::PbsError),
279    Status501(models::PbsError),
280    Status503(models::PbsError),
281    UnknownValue(serde_json::Value),
282}
283
284/// struct for typed errors of method [`config_access_update_openid`]
285#[derive(Debug, Clone, Serialize, Deserialize)]
286#[serde(untagged)]
287pub enum ConfigAccessUpdateOpenidError {
288    Status400(models::PbsError),
289    Status401(models::PbsError),
290    Status403(models::PbsError),
291    Status404(models::PbsError),
292    Status500(models::PbsError),
293    Status501(models::PbsError),
294    Status503(models::PbsError),
295    UnknownValue(serde_json::Value),
296}
297
298/// struct for typed errors of method [`config_access_update_pam`]
299#[derive(Debug, Clone, Serialize, Deserialize)]
300#[serde(untagged)]
301pub enum ConfigAccessUpdatePamError {
302    Status400(models::PbsError),
303    Status401(models::PbsError),
304    Status403(models::PbsError),
305    Status404(models::PbsError),
306    Status500(models::PbsError),
307    Status501(models::PbsError),
308    Status503(models::PbsError),
309    UnknownValue(serde_json::Value),
310}
311
312/// struct for typed errors of method [`config_access_update_pbs`]
313#[derive(Debug, Clone, Serialize, Deserialize)]
314#[serde(untagged)]
315pub enum ConfigAccessUpdatePbsError {
316    Status400(models::PbsError),
317    Status401(models::PbsError),
318    Status403(models::PbsError),
319    Status404(models::PbsError),
320    Status500(models::PbsError),
321    Status501(models::PbsError),
322    Status503(models::PbsError),
323    UnknownValue(serde_json::Value),
324}
325
326/// struct for typed errors of method [`config_access_update_webauthn`]
327#[derive(Debug, Clone, Serialize, Deserialize)]
328#[serde(untagged)]
329pub enum ConfigAccessUpdateWebauthnError {
330    Status400(models::PbsError),
331    Status401(models::PbsError),
332    Status403(models::PbsError),
333    Status404(models::PbsError),
334    Status500(models::PbsError),
335    Status501(models::PbsError),
336    Status503(models::PbsError),
337    UnknownValue(serde_json::Value),
338}
339
340
341/// Create a new AD realm
342pub async fn config_access_create_ad(configuration: &configuration::Configuration, config_access_create_ad_request: models::ConfigAccessCreateAdRequest) -> Result<models::ConfigAccessCreateAdResponse, Error<ConfigAccessCreateAdError>> {
343    // add a prefix to parameters to efficiently prevent name collisions
344    let p_body_config_access_create_ad_request = config_access_create_ad_request;
345
346    let uri_str = format!("{}/config/access/ad", configuration.base_path);
347    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
348
349    if let Some(ref user_agent) = configuration.user_agent {
350        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
351    }
352    if let Some(ref apikey) = configuration.api_key {
353        let key = apikey.key.clone();
354        let value = match apikey.prefix {
355            Some(ref prefix) => format!("{} {}", prefix, key),
356            None => key,
357        };
358        req_builder = req_builder.header("Authorization", value);
359    };
360    if let Some(ref apikey) = configuration.api_key {
361        let key = apikey.key.clone();
362        let value = match apikey.prefix {
363            Some(ref prefix) => format!("{} {}", prefix, key),
364            None => key,
365        };
366        req_builder = req_builder.header("CSRFPreventionToken", value);
367    };
368    req_builder = req_builder.json(&p_body_config_access_create_ad_request);
369
370    let req = req_builder.build()?;
371    let resp = configuration.client.execute(req).await?;
372
373    let status = resp.status();
374    let content_type = resp
375        .headers()
376        .get("content-type")
377        .and_then(|v| v.to_str().ok())
378        .unwrap_or("application/octet-stream");
379    let content_type = super::ContentType::from(content_type);
380
381    if !status.is_client_error() && !status.is_server_error() {
382        let content = resp.text().await?;
383        match content_type {
384            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
385            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessCreateAdResponse`"))),
386            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::ConfigAccessCreateAdResponse`")))),
387        }
388    } else {
389        let content = resp.text().await?;
390        let entity: Option<ConfigAccessCreateAdError> = serde_json::from_str(&content).ok();
391        Err(Error::ResponseError(ResponseContent { status, content, entity }))
392    }
393}
394
395/// Create a new LDAP realm
396pub async fn config_access_create_ldap(configuration: &configuration::Configuration, config_access_create_ldap_request: models::ConfigAccessCreateLdapRequest) -> Result<models::ConfigAccessCreateLdapResponse, Error<ConfigAccessCreateLdapError>> {
397    // add a prefix to parameters to efficiently prevent name collisions
398    let p_body_config_access_create_ldap_request = config_access_create_ldap_request;
399
400    let uri_str = format!("{}/config/access/ldap", configuration.base_path);
401    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
402
403    if let Some(ref user_agent) = configuration.user_agent {
404        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
405    }
406    if let Some(ref apikey) = configuration.api_key {
407        let key = apikey.key.clone();
408        let value = match apikey.prefix {
409            Some(ref prefix) => format!("{} {}", prefix, key),
410            None => key,
411        };
412        req_builder = req_builder.header("Authorization", value);
413    };
414    if let Some(ref apikey) = configuration.api_key {
415        let key = apikey.key.clone();
416        let value = match apikey.prefix {
417            Some(ref prefix) => format!("{} {}", prefix, key),
418            None => key,
419        };
420        req_builder = req_builder.header("CSRFPreventionToken", value);
421    };
422    req_builder = req_builder.json(&p_body_config_access_create_ldap_request);
423
424    let req = req_builder.build()?;
425    let resp = configuration.client.execute(req).await?;
426
427    let status = resp.status();
428    let content_type = resp
429        .headers()
430        .get("content-type")
431        .and_then(|v| v.to_str().ok())
432        .unwrap_or("application/octet-stream");
433    let content_type = super::ContentType::from(content_type);
434
435    if !status.is_client_error() && !status.is_server_error() {
436        let content = resp.text().await?;
437        match content_type {
438            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
439            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessCreateLdapResponse`"))),
440            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::ConfigAccessCreateLdapResponse`")))),
441        }
442    } else {
443        let content = resp.text().await?;
444        let entity: Option<ConfigAccessCreateLdapError> = serde_json::from_str(&content).ok();
445        Err(Error::ResponseError(ResponseContent { status, content, entity }))
446    }
447}
448
449/// Create a new OpenId realm
450pub async fn config_access_create_openid(configuration: &configuration::Configuration, config_access_create_openid_request: models::ConfigAccessCreateOpenidRequest) -> Result<models::ConfigAccessCreateOpenidResponse, Error<ConfigAccessCreateOpenidError>> {
451    // add a prefix to parameters to efficiently prevent name collisions
452    let p_body_config_access_create_openid_request = config_access_create_openid_request;
453
454    let uri_str = format!("{}/config/access/openid", configuration.base_path);
455    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
456
457    if let Some(ref user_agent) = configuration.user_agent {
458        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
459    }
460    if let Some(ref apikey) = configuration.api_key {
461        let key = apikey.key.clone();
462        let value = match apikey.prefix {
463            Some(ref prefix) => format!("{} {}", prefix, key),
464            None => key,
465        };
466        req_builder = req_builder.header("Authorization", value);
467    };
468    if let Some(ref apikey) = configuration.api_key {
469        let key = apikey.key.clone();
470        let value = match apikey.prefix {
471            Some(ref prefix) => format!("{} {}", prefix, key),
472            None => key,
473        };
474        req_builder = req_builder.header("CSRFPreventionToken", value);
475    };
476    req_builder = req_builder.json(&p_body_config_access_create_openid_request);
477
478    let req = req_builder.build()?;
479    let resp = configuration.client.execute(req).await?;
480
481    let status = resp.status();
482    let content_type = resp
483        .headers()
484        .get("content-type")
485        .and_then(|v| v.to_str().ok())
486        .unwrap_or("application/octet-stream");
487    let content_type = super::ContentType::from(content_type);
488
489    if !status.is_client_error() && !status.is_server_error() {
490        let content = resp.text().await?;
491        match content_type {
492            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
493            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessCreateOpenidResponse`"))),
494            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::ConfigAccessCreateOpenidResponse`")))),
495        }
496    } else {
497        let content = resp.text().await?;
498        let entity: Option<ConfigAccessCreateOpenidError> = serde_json::from_str(&content).ok();
499        Err(Error::ResponseError(ResponseContent { status, content, entity }))
500    }
501}
502
503/// Remove an LDAP realm configuration
504pub async fn config_access_delete_ad(configuration: &configuration::Configuration, realm: &str, digest: Option<&str>) -> Result<models::ConfigAccessDeleteAdResponse, Error<ConfigAccessDeleteAdError>> {
505    // add a prefix to parameters to efficiently prevent name collisions
506    let p_path_realm = realm;
507    let p_query_digest = digest;
508
509    let uri_str = format!("{}/config/access/ad/{realm}", configuration.base_path, realm=crate::apis::urlencode(p_path_realm));
510    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
511
512    if let Some(ref param_value) = p_query_digest {
513        req_builder = req_builder.query(&[("digest", &param_value.to_string())]);
514    }
515    if let Some(ref user_agent) = configuration.user_agent {
516        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
517    }
518    if let Some(ref apikey) = configuration.api_key {
519        let key = apikey.key.clone();
520        let value = match apikey.prefix {
521            Some(ref prefix) => format!("{} {}", prefix, key),
522            None => key,
523        };
524        req_builder = req_builder.header("Authorization", value);
525    };
526    if let Some(ref apikey) = configuration.api_key {
527        let key = apikey.key.clone();
528        let value = match apikey.prefix {
529            Some(ref prefix) => format!("{} {}", prefix, key),
530            None => key,
531        };
532        req_builder = req_builder.header("CSRFPreventionToken", value);
533    };
534
535    let req = req_builder.build()?;
536    let resp = configuration.client.execute(req).await?;
537
538    let status = resp.status();
539    let content_type = resp
540        .headers()
541        .get("content-type")
542        .and_then(|v| v.to_str().ok())
543        .unwrap_or("application/octet-stream");
544    let content_type = super::ContentType::from(content_type);
545
546    if !status.is_client_error() && !status.is_server_error() {
547        let content = resp.text().await?;
548        match content_type {
549            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
550            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessDeleteAdResponse`"))),
551            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::ConfigAccessDeleteAdResponse`")))),
552        }
553    } else {
554        let content = resp.text().await?;
555        let entity: Option<ConfigAccessDeleteAdError> = serde_json::from_str(&content).ok();
556        Err(Error::ResponseError(ResponseContent { status, content, entity }))
557    }
558}
559
560/// Remove an LDAP realm configuration
561pub async fn config_access_delete_ldap(configuration: &configuration::Configuration, realm: &str, digest: Option<&str>) -> Result<models::ConfigAccessDeleteLdapResponse, Error<ConfigAccessDeleteLdapError>> {
562    // add a prefix to parameters to efficiently prevent name collisions
563    let p_path_realm = realm;
564    let p_query_digest = digest;
565
566    let uri_str = format!("{}/config/access/ldap/{realm}", configuration.base_path, realm=crate::apis::urlencode(p_path_realm));
567    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
568
569    if let Some(ref param_value) = p_query_digest {
570        req_builder = req_builder.query(&[("digest", &param_value.to_string())]);
571    }
572    if let Some(ref user_agent) = configuration.user_agent {
573        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
574    }
575    if let Some(ref apikey) = configuration.api_key {
576        let key = apikey.key.clone();
577        let value = match apikey.prefix {
578            Some(ref prefix) => format!("{} {}", prefix, key),
579            None => key,
580        };
581        req_builder = req_builder.header("Authorization", value);
582    };
583    if let Some(ref apikey) = configuration.api_key {
584        let key = apikey.key.clone();
585        let value = match apikey.prefix {
586            Some(ref prefix) => format!("{} {}", prefix, key),
587            None => key,
588        };
589        req_builder = req_builder.header("CSRFPreventionToken", value);
590    };
591
592    let req = req_builder.build()?;
593    let resp = configuration.client.execute(req).await?;
594
595    let status = resp.status();
596    let content_type = resp
597        .headers()
598        .get("content-type")
599        .and_then(|v| v.to_str().ok())
600        .unwrap_or("application/octet-stream");
601    let content_type = super::ContentType::from(content_type);
602
603    if !status.is_client_error() && !status.is_server_error() {
604        let content = resp.text().await?;
605        match content_type {
606            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
607            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessDeleteLdapResponse`"))),
608            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::ConfigAccessDeleteLdapResponse`")))),
609        }
610    } else {
611        let content = resp.text().await?;
612        let entity: Option<ConfigAccessDeleteLdapError> = serde_json::from_str(&content).ok();
613        Err(Error::ResponseError(ResponseContent { status, content, entity }))
614    }
615}
616
617/// Remove a OpenID realm configuration
618pub async fn config_access_delete_openid(configuration: &configuration::Configuration, realm: &str, digest: Option<&str>) -> Result<models::ConfigAccessDeleteOpenidResponse, Error<ConfigAccessDeleteOpenidError>> {
619    // add a prefix to parameters to efficiently prevent name collisions
620    let p_path_realm = realm;
621    let p_query_digest = digest;
622
623    let uri_str = format!("{}/config/access/openid/{realm}", configuration.base_path, realm=crate::apis::urlencode(p_path_realm));
624    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
625
626    if let Some(ref param_value) = p_query_digest {
627        req_builder = req_builder.query(&[("digest", &param_value.to_string())]);
628    }
629    if let Some(ref user_agent) = configuration.user_agent {
630        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
631    }
632    if let Some(ref apikey) = configuration.api_key {
633        let key = apikey.key.clone();
634        let value = match apikey.prefix {
635            Some(ref prefix) => format!("{} {}", prefix, key),
636            None => key,
637        };
638        req_builder = req_builder.header("Authorization", value);
639    };
640    if let Some(ref apikey) = configuration.api_key {
641        let key = apikey.key.clone();
642        let value = match apikey.prefix {
643            Some(ref prefix) => format!("{} {}", prefix, key),
644            None => key,
645        };
646        req_builder = req_builder.header("CSRFPreventionToken", value);
647    };
648
649    let req = req_builder.build()?;
650    let resp = configuration.client.execute(req).await?;
651
652    let status = resp.status();
653    let content_type = resp
654        .headers()
655        .get("content-type")
656        .and_then(|v| v.to_str().ok())
657        .unwrap_or("application/octet-stream");
658    let content_type = super::ContentType::from(content_type);
659
660    if !status.is_client_error() && !status.is_server_error() {
661        let content = resp.text().await?;
662        match content_type {
663            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
664            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessDeleteOpenidResponse`"))),
665            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::ConfigAccessDeleteOpenidResponse`")))),
666        }
667    } else {
668        let content = resp.text().await?;
669        let entity: Option<ConfigAccessDeleteOpenidError> = serde_json::from_str(&content).ok();
670        Err(Error::ResponseError(ResponseContent { status, content, entity }))
671    }
672}
673
674/// Directory index.
675pub async fn config_access_get_access(configuration: &configuration::Configuration, ) -> Result<models::ConfigAccessGetAccessResponse, Error<ConfigAccessGetAccessError>> {
676
677    let uri_str = format!("{}/config/access", configuration.base_path);
678    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
679
680    if let Some(ref user_agent) = configuration.user_agent {
681        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
682    }
683    if let Some(ref apikey) = configuration.api_key {
684        let key = apikey.key.clone();
685        let value = match apikey.prefix {
686            Some(ref prefix) => format!("{} {}", prefix, key),
687            None => key,
688        };
689        req_builder = req_builder.header("Authorization", value);
690    };
691    if let Some(ref apikey) = configuration.api_key {
692        let key = apikey.key.clone();
693        let value = match apikey.prefix {
694            Some(ref prefix) => format!("{} {}", prefix, key),
695            None => key,
696        };
697        req_builder = req_builder.header("CSRFPreventionToken", value);
698    };
699
700    let req = req_builder.build()?;
701    let resp = configuration.client.execute(req).await?;
702
703    let status = resp.status();
704    let content_type = resp
705        .headers()
706        .get("content-type")
707        .and_then(|v| v.to_str().ok())
708        .unwrap_or("application/octet-stream");
709    let content_type = super::ContentType::from(content_type);
710
711    if !status.is_client_error() && !status.is_server_error() {
712        let content = resp.text().await?;
713        match content_type {
714            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
715            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessGetAccessResponse`"))),
716            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::ConfigAccessGetAccessResponse`")))),
717        }
718    } else {
719        let content = resp.text().await?;
720        let entity: Option<ConfigAccessGetAccessError> = serde_json::from_str(&content).ok();
721        Err(Error::ResponseError(ResponseContent { status, content, entity }))
722    }
723}
724
725/// List configured AD realms
726pub async fn config_access_get_ad(configuration: &configuration::Configuration, ) -> Result<models::ConfigAccessGetAdResponse, Error<ConfigAccessGetAdError>> {
727
728    let uri_str = format!("{}/config/access/ad", configuration.base_path);
729    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
730
731    if let Some(ref user_agent) = configuration.user_agent {
732        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
733    }
734    if let Some(ref apikey) = configuration.api_key {
735        let key = apikey.key.clone();
736        let value = match apikey.prefix {
737            Some(ref prefix) => format!("{} {}", prefix, key),
738            None => key,
739        };
740        req_builder = req_builder.header("Authorization", value);
741    };
742    if let Some(ref apikey) = configuration.api_key {
743        let key = apikey.key.clone();
744        let value = match apikey.prefix {
745            Some(ref prefix) => format!("{} {}", prefix, key),
746            None => key,
747        };
748        req_builder = req_builder.header("CSRFPreventionToken", value);
749    };
750
751    let req = req_builder.build()?;
752    let resp = configuration.client.execute(req).await?;
753
754    let status = resp.status();
755    let content_type = resp
756        .headers()
757        .get("content-type")
758        .and_then(|v| v.to_str().ok())
759        .unwrap_or("application/octet-stream");
760    let content_type = super::ContentType::from(content_type);
761
762    if !status.is_client_error() && !status.is_server_error() {
763        let content = resp.text().await?;
764        match content_type {
765            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
766            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessGetAdResponse`"))),
767            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::ConfigAccessGetAdResponse`")))),
768        }
769    } else {
770        let content = resp.text().await?;
771        let entity: Option<ConfigAccessGetAdError> = serde_json::from_str(&content).ok();
772        Err(Error::ResponseError(ResponseContent { status, content, entity }))
773    }
774}
775
776/// Read the AD realm configuration
777pub async fn config_access_get_config_access_ad_by_realm(configuration: &configuration::Configuration, realm: &str) -> Result<models::ConfigAccessGetConfigAccessAdByRealmResponse, Error<ConfigAccessGetConfigAccessAdByRealmError>> {
778    // add a prefix to parameters to efficiently prevent name collisions
779    let p_path_realm = realm;
780
781    let uri_str = format!("{}/config/access/ad/{realm}", configuration.base_path, realm=crate::apis::urlencode(p_path_realm));
782    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
783
784    if let Some(ref user_agent) = configuration.user_agent {
785        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
786    }
787    if let Some(ref apikey) = configuration.api_key {
788        let key = apikey.key.clone();
789        let value = match apikey.prefix {
790            Some(ref prefix) => format!("{} {}", prefix, key),
791            None => key,
792        };
793        req_builder = req_builder.header("Authorization", value);
794    };
795    if let Some(ref apikey) = configuration.api_key {
796        let key = apikey.key.clone();
797        let value = match apikey.prefix {
798            Some(ref prefix) => format!("{} {}", prefix, key),
799            None => key,
800        };
801        req_builder = req_builder.header("CSRFPreventionToken", value);
802    };
803
804    let req = req_builder.build()?;
805    let resp = configuration.client.execute(req).await?;
806
807    let status = resp.status();
808    let content_type = resp
809        .headers()
810        .get("content-type")
811        .and_then(|v| v.to_str().ok())
812        .unwrap_or("application/octet-stream");
813    let content_type = super::ContentType::from(content_type);
814
815    if !status.is_client_error() && !status.is_server_error() {
816        let content = resp.text().await?;
817        match content_type {
818            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
819            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessGetConfigAccessAdByRealmResponse`"))),
820            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::ConfigAccessGetConfigAccessAdByRealmResponse`")))),
821        }
822    } else {
823        let content = resp.text().await?;
824        let entity: Option<ConfigAccessGetConfigAccessAdByRealmError> = serde_json::from_str(&content).ok();
825        Err(Error::ResponseError(ResponseContent { status, content, entity }))
826    }
827}
828
829/// Read the LDAP realm configuration
830pub async fn config_access_get_config_access_ldap_by_realm(configuration: &configuration::Configuration, realm: &str) -> Result<models::ConfigAccessGetConfigAccessLdapByRealmResponse, Error<ConfigAccessGetConfigAccessLdapByRealmError>> {
831    // add a prefix to parameters to efficiently prevent name collisions
832    let p_path_realm = realm;
833
834    let uri_str = format!("{}/config/access/ldap/{realm}", configuration.base_path, realm=crate::apis::urlencode(p_path_realm));
835    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
836
837    if let Some(ref user_agent) = configuration.user_agent {
838        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
839    }
840    if let Some(ref apikey) = configuration.api_key {
841        let key = apikey.key.clone();
842        let value = match apikey.prefix {
843            Some(ref prefix) => format!("{} {}", prefix, key),
844            None => key,
845        };
846        req_builder = req_builder.header("Authorization", value);
847    };
848    if let Some(ref apikey) = configuration.api_key {
849        let key = apikey.key.clone();
850        let value = match apikey.prefix {
851            Some(ref prefix) => format!("{} {}", prefix, key),
852            None => key,
853        };
854        req_builder = req_builder.header("CSRFPreventionToken", value);
855    };
856
857    let req = req_builder.build()?;
858    let resp = configuration.client.execute(req).await?;
859
860    let status = resp.status();
861    let content_type = resp
862        .headers()
863        .get("content-type")
864        .and_then(|v| v.to_str().ok())
865        .unwrap_or("application/octet-stream");
866    let content_type = super::ContentType::from(content_type);
867
868    if !status.is_client_error() && !status.is_server_error() {
869        let content = resp.text().await?;
870        match content_type {
871            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
872            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessGetConfigAccessLdapByRealmResponse`"))),
873            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::ConfigAccessGetConfigAccessLdapByRealmResponse`")))),
874        }
875    } else {
876        let content = resp.text().await?;
877        let entity: Option<ConfigAccessGetConfigAccessLdapByRealmError> = serde_json::from_str(&content).ok();
878        Err(Error::ResponseError(ResponseContent { status, content, entity }))
879    }
880}
881
882/// Read the OpenID realm configuration
883pub async fn config_access_get_config_access_openid_by_realm(configuration: &configuration::Configuration, realm: &str) -> Result<models::ConfigAccessGetConfigAccessOpenidByRealmResponse, Error<ConfigAccessGetConfigAccessOpenidByRealmError>> {
884    // add a prefix to parameters to efficiently prevent name collisions
885    let p_path_realm = realm;
886
887    let uri_str = format!("{}/config/access/openid/{realm}", configuration.base_path, realm=crate::apis::urlencode(p_path_realm));
888    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
889
890    if let Some(ref user_agent) = configuration.user_agent {
891        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
892    }
893    if let Some(ref apikey) = configuration.api_key {
894        let key = apikey.key.clone();
895        let value = match apikey.prefix {
896            Some(ref prefix) => format!("{} {}", prefix, key),
897            None => key,
898        };
899        req_builder = req_builder.header("Authorization", value);
900    };
901    if let Some(ref apikey) = configuration.api_key {
902        let key = apikey.key.clone();
903        let value = match apikey.prefix {
904            Some(ref prefix) => format!("{} {}", prefix, key),
905            None => key,
906        };
907        req_builder = req_builder.header("CSRFPreventionToken", value);
908    };
909
910    let req = req_builder.build()?;
911    let resp = configuration.client.execute(req).await?;
912
913    let status = resp.status();
914    let content_type = resp
915        .headers()
916        .get("content-type")
917        .and_then(|v| v.to_str().ok())
918        .unwrap_or("application/octet-stream");
919    let content_type = super::ContentType::from(content_type);
920
921    if !status.is_client_error() && !status.is_server_error() {
922        let content = resp.text().await?;
923        match content_type {
924            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
925            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessGetConfigAccessOpenidByRealmResponse`"))),
926            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::ConfigAccessGetConfigAccessOpenidByRealmResponse`")))),
927        }
928    } else {
929        let content = resp.text().await?;
930        let entity: Option<ConfigAccessGetConfigAccessOpenidByRealmError> = serde_json::from_str(&content).ok();
931        Err(Error::ResponseError(ResponseContent { status, content, entity }))
932    }
933}
934
935/// List configured LDAP realms
936pub async fn config_access_get_ldap(configuration: &configuration::Configuration, ) -> Result<models::ConfigAccessGetLdapResponse, Error<ConfigAccessGetLdapError>> {
937
938    let uri_str = format!("{}/config/access/ldap", configuration.base_path);
939    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
940
941    if let Some(ref user_agent) = configuration.user_agent {
942        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
943    }
944    if let Some(ref apikey) = configuration.api_key {
945        let key = apikey.key.clone();
946        let value = match apikey.prefix {
947            Some(ref prefix) => format!("{} {}", prefix, key),
948            None => key,
949        };
950        req_builder = req_builder.header("Authorization", value);
951    };
952    if let Some(ref apikey) = configuration.api_key {
953        let key = apikey.key.clone();
954        let value = match apikey.prefix {
955            Some(ref prefix) => format!("{} {}", prefix, key),
956            None => key,
957        };
958        req_builder = req_builder.header("CSRFPreventionToken", value);
959    };
960
961    let req = req_builder.build()?;
962    let resp = configuration.client.execute(req).await?;
963
964    let status = resp.status();
965    let content_type = resp
966        .headers()
967        .get("content-type")
968        .and_then(|v| v.to_str().ok())
969        .unwrap_or("application/octet-stream");
970    let content_type = super::ContentType::from(content_type);
971
972    if !status.is_client_error() && !status.is_server_error() {
973        let content = resp.text().await?;
974        match content_type {
975            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
976            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessGetLdapResponse`"))),
977            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::ConfigAccessGetLdapResponse`")))),
978        }
979    } else {
980        let content = resp.text().await?;
981        let entity: Option<ConfigAccessGetLdapError> = serde_json::from_str(&content).ok();
982        Err(Error::ResponseError(ResponseContent { status, content, entity }))
983    }
984}
985
986/// List configured OpenId realms
987pub async fn config_access_get_openid(configuration: &configuration::Configuration, ) -> Result<models::ConfigAccessGetOpenidResponse, Error<ConfigAccessGetOpenidError>> {
988
989    let uri_str = format!("{}/config/access/openid", configuration.base_path);
990    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
991
992    if let Some(ref user_agent) = configuration.user_agent {
993        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
994    }
995    if let Some(ref apikey) = configuration.api_key {
996        let key = apikey.key.clone();
997        let value = match apikey.prefix {
998            Some(ref prefix) => format!("{} {}", prefix, key),
999            None => key,
1000        };
1001        req_builder = req_builder.header("Authorization", value);
1002    };
1003    if let Some(ref apikey) = configuration.api_key {
1004        let key = apikey.key.clone();
1005        let value = match apikey.prefix {
1006            Some(ref prefix) => format!("{} {}", prefix, key),
1007            None => key,
1008        };
1009        req_builder = req_builder.header("CSRFPreventionToken", value);
1010    };
1011
1012    let req = req_builder.build()?;
1013    let resp = configuration.client.execute(req).await?;
1014
1015    let status = resp.status();
1016    let content_type = resp
1017        .headers()
1018        .get("content-type")
1019        .and_then(|v| v.to_str().ok())
1020        .unwrap_or("application/octet-stream");
1021    let content_type = super::ContentType::from(content_type);
1022
1023    if !status.is_client_error() && !status.is_server_error() {
1024        let content = resp.text().await?;
1025        match content_type {
1026            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1027            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessGetOpenidResponse`"))),
1028            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::ConfigAccessGetOpenidResponse`")))),
1029        }
1030    } else {
1031        let content = resp.text().await?;
1032        let entity: Option<ConfigAccessGetOpenidError> = serde_json::from_str(&content).ok();
1033        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1034    }
1035}
1036
1037/// Read the PAM realm configuration
1038pub async fn config_access_get_pam(configuration: &configuration::Configuration, ) -> Result<models::ConfigAccessGetPamResponse, Error<ConfigAccessGetPamError>> {
1039
1040    let uri_str = format!("{}/config/access/pam", configuration.base_path);
1041    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1042
1043    if let Some(ref user_agent) = configuration.user_agent {
1044        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1045    }
1046    if let Some(ref apikey) = configuration.api_key {
1047        let key = apikey.key.clone();
1048        let value = match apikey.prefix {
1049            Some(ref prefix) => format!("{} {}", prefix, key),
1050            None => key,
1051        };
1052        req_builder = req_builder.header("Authorization", value);
1053    };
1054    if let Some(ref apikey) = configuration.api_key {
1055        let key = apikey.key.clone();
1056        let value = match apikey.prefix {
1057            Some(ref prefix) => format!("{} {}", prefix, key),
1058            None => key,
1059        };
1060        req_builder = req_builder.header("CSRFPreventionToken", value);
1061    };
1062
1063    let req = req_builder.build()?;
1064    let resp = configuration.client.execute(req).await?;
1065
1066    let status = resp.status();
1067    let content_type = resp
1068        .headers()
1069        .get("content-type")
1070        .and_then(|v| v.to_str().ok())
1071        .unwrap_or("application/octet-stream");
1072    let content_type = super::ContentType::from(content_type);
1073
1074    if !status.is_client_error() && !status.is_server_error() {
1075        let content = resp.text().await?;
1076        match content_type {
1077            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1078            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessGetPamResponse`"))),
1079            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::ConfigAccessGetPamResponse`")))),
1080        }
1081    } else {
1082        let content = resp.text().await?;
1083        let entity: Option<ConfigAccessGetPamError> = serde_json::from_str(&content).ok();
1084        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1085    }
1086}
1087
1088/// Read the Proxmox Backup authentication server realm configuration
1089pub async fn config_access_get_pbs(configuration: &configuration::Configuration, ) -> Result<models::ConfigAccessGetPbsResponse, Error<ConfigAccessGetPbsError>> {
1090
1091    let uri_str = format!("{}/config/access/pbs", configuration.base_path);
1092    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1093
1094    if let Some(ref user_agent) = configuration.user_agent {
1095        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1096    }
1097    if let Some(ref apikey) = configuration.api_key {
1098        let key = apikey.key.clone();
1099        let value = match apikey.prefix {
1100            Some(ref prefix) => format!("{} {}", prefix, key),
1101            None => key,
1102        };
1103        req_builder = req_builder.header("Authorization", value);
1104    };
1105    if let Some(ref apikey) = configuration.api_key {
1106        let key = apikey.key.clone();
1107        let value = match apikey.prefix {
1108            Some(ref prefix) => format!("{} {}", prefix, key),
1109            None => key,
1110        };
1111        req_builder = req_builder.header("CSRFPreventionToken", value);
1112    };
1113
1114    let req = req_builder.build()?;
1115    let resp = configuration.client.execute(req).await?;
1116
1117    let status = resp.status();
1118    let content_type = resp
1119        .headers()
1120        .get("content-type")
1121        .and_then(|v| v.to_str().ok())
1122        .unwrap_or("application/octet-stream");
1123    let content_type = super::ContentType::from(content_type);
1124
1125    if !status.is_client_error() && !status.is_server_error() {
1126        let content = resp.text().await?;
1127        match content_type {
1128            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1129            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessGetPbsResponse`"))),
1130            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::ConfigAccessGetPbsResponse`")))),
1131        }
1132    } else {
1133        let content = resp.text().await?;
1134        let entity: Option<ConfigAccessGetPbsError> = serde_json::from_str(&content).ok();
1135        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1136    }
1137}
1138
1139/// Directory index.
1140pub async fn config_access_get_tfa(configuration: &configuration::Configuration, ) -> Result<models::ConfigAccessGetTfaResponse, Error<ConfigAccessGetTfaError>> {
1141
1142    let uri_str = format!("{}/config/access/tfa", configuration.base_path);
1143    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1144
1145    if let Some(ref user_agent) = configuration.user_agent {
1146        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1147    }
1148    if let Some(ref apikey) = configuration.api_key {
1149        let key = apikey.key.clone();
1150        let value = match apikey.prefix {
1151            Some(ref prefix) => format!("{} {}", prefix, key),
1152            None => key,
1153        };
1154        req_builder = req_builder.header("Authorization", value);
1155    };
1156    if let Some(ref apikey) = configuration.api_key {
1157        let key = apikey.key.clone();
1158        let value = match apikey.prefix {
1159            Some(ref prefix) => format!("{} {}", prefix, key),
1160            None => key,
1161        };
1162        req_builder = req_builder.header("CSRFPreventionToken", value);
1163    };
1164
1165    let req = req_builder.build()?;
1166    let resp = configuration.client.execute(req).await?;
1167
1168    let status = resp.status();
1169    let content_type = resp
1170        .headers()
1171        .get("content-type")
1172        .and_then(|v| v.to_str().ok())
1173        .unwrap_or("application/octet-stream");
1174    let content_type = super::ContentType::from(content_type);
1175
1176    if !status.is_client_error() && !status.is_server_error() {
1177        let content = resp.text().await?;
1178        match content_type {
1179            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1180            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessGetTfaResponse`"))),
1181            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::ConfigAccessGetTfaResponse`")))),
1182        }
1183    } else {
1184        let content = resp.text().await?;
1185        let entity: Option<ConfigAccessGetTfaError> = serde_json::from_str(&content).ok();
1186        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1187    }
1188}
1189
1190/// Get the TFA configuration.
1191pub async fn config_access_get_webauthn(configuration: &configuration::Configuration, ) -> Result<models::ConfigAccessGetWebauthnResponse, Error<ConfigAccessGetWebauthnError>> {
1192
1193    let uri_str = format!("{}/config/access/tfa/webauthn", configuration.base_path);
1194    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1195
1196    if let Some(ref user_agent) = configuration.user_agent {
1197        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1198    }
1199    if let Some(ref apikey) = configuration.api_key {
1200        let key = apikey.key.clone();
1201        let value = match apikey.prefix {
1202            Some(ref prefix) => format!("{} {}", prefix, key),
1203            None => key,
1204        };
1205        req_builder = req_builder.header("Authorization", value);
1206    };
1207    if let Some(ref apikey) = configuration.api_key {
1208        let key = apikey.key.clone();
1209        let value = match apikey.prefix {
1210            Some(ref prefix) => format!("{} {}", prefix, key),
1211            None => key,
1212        };
1213        req_builder = req_builder.header("CSRFPreventionToken", value);
1214    };
1215
1216    let req = req_builder.build()?;
1217    let resp = configuration.client.execute(req).await?;
1218
1219    let status = resp.status();
1220    let content_type = resp
1221        .headers()
1222        .get("content-type")
1223        .and_then(|v| v.to_str().ok())
1224        .unwrap_or("application/octet-stream");
1225    let content_type = super::ContentType::from(content_type);
1226
1227    if !status.is_client_error() && !status.is_server_error() {
1228        let content = resp.text().await?;
1229        match content_type {
1230            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1231            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessGetWebauthnResponse`"))),
1232            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::ConfigAccessGetWebauthnResponse`")))),
1233        }
1234    } else {
1235        let content = resp.text().await?;
1236        let entity: Option<ConfigAccessGetWebauthnError> = serde_json::from_str(&content).ok();
1237        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1238    }
1239}
1240
1241/// Update an AD realm configuration
1242pub async fn config_access_update_ad(configuration: &configuration::Configuration, realm: &str, config_access_update_ad_request: Option<models::ConfigAccessUpdateAdRequest>) -> Result<models::ConfigAccessUpdateAdResponse, Error<ConfigAccessUpdateAdError>> {
1243    // add a prefix to parameters to efficiently prevent name collisions
1244    let p_path_realm = realm;
1245    let p_body_config_access_update_ad_request = config_access_update_ad_request;
1246
1247    let uri_str = format!("{}/config/access/ad/{realm}", configuration.base_path, realm=crate::apis::urlencode(p_path_realm));
1248    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1249
1250    if let Some(ref user_agent) = configuration.user_agent {
1251        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1252    }
1253    if let Some(ref apikey) = configuration.api_key {
1254        let key = apikey.key.clone();
1255        let value = match apikey.prefix {
1256            Some(ref prefix) => format!("{} {}", prefix, key),
1257            None => key,
1258        };
1259        req_builder = req_builder.header("Authorization", value);
1260    };
1261    if let Some(ref apikey) = configuration.api_key {
1262        let key = apikey.key.clone();
1263        let value = match apikey.prefix {
1264            Some(ref prefix) => format!("{} {}", prefix, key),
1265            None => key,
1266        };
1267        req_builder = req_builder.header("CSRFPreventionToken", value);
1268    };
1269    req_builder = req_builder.json(&p_body_config_access_update_ad_request);
1270
1271    let req = req_builder.build()?;
1272    let resp = configuration.client.execute(req).await?;
1273
1274    let status = resp.status();
1275    let content_type = resp
1276        .headers()
1277        .get("content-type")
1278        .and_then(|v| v.to_str().ok())
1279        .unwrap_or("application/octet-stream");
1280    let content_type = super::ContentType::from(content_type);
1281
1282    if !status.is_client_error() && !status.is_server_error() {
1283        let content = resp.text().await?;
1284        match content_type {
1285            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1286            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessUpdateAdResponse`"))),
1287            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::ConfigAccessUpdateAdResponse`")))),
1288        }
1289    } else {
1290        let content = resp.text().await?;
1291        let entity: Option<ConfigAccessUpdateAdError> = serde_json::from_str(&content).ok();
1292        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1293    }
1294}
1295
1296/// Update an LDAP realm configuration
1297pub async fn config_access_update_ldap(configuration: &configuration::Configuration, realm: &str, config_access_update_ldap_request: Option<models::ConfigAccessUpdateLdapRequest>) -> Result<models::ConfigAccessUpdateLdapResponse, Error<ConfigAccessUpdateLdapError>> {
1298    // add a prefix to parameters to efficiently prevent name collisions
1299    let p_path_realm = realm;
1300    let p_body_config_access_update_ldap_request = config_access_update_ldap_request;
1301
1302    let uri_str = format!("{}/config/access/ldap/{realm}", configuration.base_path, realm=crate::apis::urlencode(p_path_realm));
1303    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1304
1305    if let Some(ref user_agent) = configuration.user_agent {
1306        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1307    }
1308    if let Some(ref apikey) = configuration.api_key {
1309        let key = apikey.key.clone();
1310        let value = match apikey.prefix {
1311            Some(ref prefix) => format!("{} {}", prefix, key),
1312            None => key,
1313        };
1314        req_builder = req_builder.header("Authorization", value);
1315    };
1316    if let Some(ref apikey) = configuration.api_key {
1317        let key = apikey.key.clone();
1318        let value = match apikey.prefix {
1319            Some(ref prefix) => format!("{} {}", prefix, key),
1320            None => key,
1321        };
1322        req_builder = req_builder.header("CSRFPreventionToken", value);
1323    };
1324    req_builder = req_builder.json(&p_body_config_access_update_ldap_request);
1325
1326    let req = req_builder.build()?;
1327    let resp = configuration.client.execute(req).await?;
1328
1329    let status = resp.status();
1330    let content_type = resp
1331        .headers()
1332        .get("content-type")
1333        .and_then(|v| v.to_str().ok())
1334        .unwrap_or("application/octet-stream");
1335    let content_type = super::ContentType::from(content_type);
1336
1337    if !status.is_client_error() && !status.is_server_error() {
1338        let content = resp.text().await?;
1339        match content_type {
1340            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1341            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessUpdateLdapResponse`"))),
1342            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::ConfigAccessUpdateLdapResponse`")))),
1343        }
1344    } else {
1345        let content = resp.text().await?;
1346        let entity: Option<ConfigAccessUpdateLdapError> = serde_json::from_str(&content).ok();
1347        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1348    }
1349}
1350
1351/// Update an OpenID realm configuration
1352pub async fn config_access_update_openid(configuration: &configuration::Configuration, realm: &str, config_access_update_openid_request: Option<models::ConfigAccessUpdateOpenidRequest>) -> Result<models::ConfigAccessUpdateOpenidResponse, Error<ConfigAccessUpdateOpenidError>> {
1353    // add a prefix to parameters to efficiently prevent name collisions
1354    let p_path_realm = realm;
1355    let p_body_config_access_update_openid_request = config_access_update_openid_request;
1356
1357    let uri_str = format!("{}/config/access/openid/{realm}", configuration.base_path, realm=crate::apis::urlencode(p_path_realm));
1358    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1359
1360    if let Some(ref user_agent) = configuration.user_agent {
1361        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1362    }
1363    if let Some(ref apikey) = configuration.api_key {
1364        let key = apikey.key.clone();
1365        let value = match apikey.prefix {
1366            Some(ref prefix) => format!("{} {}", prefix, key),
1367            None => key,
1368        };
1369        req_builder = req_builder.header("Authorization", value);
1370    };
1371    if let Some(ref apikey) = configuration.api_key {
1372        let key = apikey.key.clone();
1373        let value = match apikey.prefix {
1374            Some(ref prefix) => format!("{} {}", prefix, key),
1375            None => key,
1376        };
1377        req_builder = req_builder.header("CSRFPreventionToken", value);
1378    };
1379    req_builder = req_builder.json(&p_body_config_access_update_openid_request);
1380
1381    let req = req_builder.build()?;
1382    let resp = configuration.client.execute(req).await?;
1383
1384    let status = resp.status();
1385    let content_type = resp
1386        .headers()
1387        .get("content-type")
1388        .and_then(|v| v.to_str().ok())
1389        .unwrap_or("application/octet-stream");
1390    let content_type = super::ContentType::from(content_type);
1391
1392    if !status.is_client_error() && !status.is_server_error() {
1393        let content = resp.text().await?;
1394        match content_type {
1395            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1396            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessUpdateOpenidResponse`"))),
1397            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::ConfigAccessUpdateOpenidResponse`")))),
1398        }
1399    } else {
1400        let content = resp.text().await?;
1401        let entity: Option<ConfigAccessUpdateOpenidError> = serde_json::from_str(&content).ok();
1402        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1403    }
1404}
1405
1406/// Update the PAM realm configuration
1407pub async fn config_access_update_pam(configuration: &configuration::Configuration, config_access_update_pam_request: Option<models::ConfigAccessUpdatePamRequest>) -> Result<models::ConfigAccessUpdatePamResponse, Error<ConfigAccessUpdatePamError>> {
1408    // add a prefix to parameters to efficiently prevent name collisions
1409    let p_body_config_access_update_pam_request = config_access_update_pam_request;
1410
1411    let uri_str = format!("{}/config/access/pam", configuration.base_path);
1412    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1413
1414    if let Some(ref user_agent) = configuration.user_agent {
1415        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1416    }
1417    if let Some(ref apikey) = configuration.api_key {
1418        let key = apikey.key.clone();
1419        let value = match apikey.prefix {
1420            Some(ref prefix) => format!("{} {}", prefix, key),
1421            None => key,
1422        };
1423        req_builder = req_builder.header("Authorization", value);
1424    };
1425    if let Some(ref apikey) = configuration.api_key {
1426        let key = apikey.key.clone();
1427        let value = match apikey.prefix {
1428            Some(ref prefix) => format!("{} {}", prefix, key),
1429            None => key,
1430        };
1431        req_builder = req_builder.header("CSRFPreventionToken", value);
1432    };
1433    req_builder = req_builder.json(&p_body_config_access_update_pam_request);
1434
1435    let req = req_builder.build()?;
1436    let resp = configuration.client.execute(req).await?;
1437
1438    let status = resp.status();
1439    let content_type = resp
1440        .headers()
1441        .get("content-type")
1442        .and_then(|v| v.to_str().ok())
1443        .unwrap_or("application/octet-stream");
1444    let content_type = super::ContentType::from(content_type);
1445
1446    if !status.is_client_error() && !status.is_server_error() {
1447        let content = resp.text().await?;
1448        match content_type {
1449            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1450            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessUpdatePamResponse`"))),
1451            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::ConfigAccessUpdatePamResponse`")))),
1452        }
1453    } else {
1454        let content = resp.text().await?;
1455        let entity: Option<ConfigAccessUpdatePamError> = serde_json::from_str(&content).ok();
1456        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1457    }
1458}
1459
1460/// Update the Proxmox Backup authentication server realm configuration
1461pub async fn config_access_update_pbs(configuration: &configuration::Configuration, config_access_update_pam_request: Option<models::ConfigAccessUpdatePamRequest>) -> Result<models::ConfigAccessUpdatePbsResponse, Error<ConfigAccessUpdatePbsError>> {
1462    // add a prefix to parameters to efficiently prevent name collisions
1463    let p_body_config_access_update_pam_request = config_access_update_pam_request;
1464
1465    let uri_str = format!("{}/config/access/pbs", configuration.base_path);
1466    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1467
1468    if let Some(ref user_agent) = configuration.user_agent {
1469        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1470    }
1471    if let Some(ref apikey) = configuration.api_key {
1472        let key = apikey.key.clone();
1473        let value = match apikey.prefix {
1474            Some(ref prefix) => format!("{} {}", prefix, key),
1475            None => key,
1476        };
1477        req_builder = req_builder.header("Authorization", value);
1478    };
1479    if let Some(ref apikey) = configuration.api_key {
1480        let key = apikey.key.clone();
1481        let value = match apikey.prefix {
1482            Some(ref prefix) => format!("{} {}", prefix, key),
1483            None => key,
1484        };
1485        req_builder = req_builder.header("CSRFPreventionToken", value);
1486    };
1487    req_builder = req_builder.json(&p_body_config_access_update_pam_request);
1488
1489    let req = req_builder.build()?;
1490    let resp = configuration.client.execute(req).await?;
1491
1492    let status = resp.status();
1493    let content_type = resp
1494        .headers()
1495        .get("content-type")
1496        .and_then(|v| v.to_str().ok())
1497        .unwrap_or("application/octet-stream");
1498    let content_type = super::ContentType::from(content_type);
1499
1500    if !status.is_client_error() && !status.is_server_error() {
1501        let content = resp.text().await?;
1502        match content_type {
1503            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1504            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessUpdatePbsResponse`"))),
1505            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::ConfigAccessUpdatePbsResponse`")))),
1506        }
1507    } else {
1508        let content = resp.text().await?;
1509        let entity: Option<ConfigAccessUpdatePbsError> = serde_json::from_str(&content).ok();
1510        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1511    }
1512}
1513
1514/// Update the TFA configuration.
1515pub async fn config_access_update_webauthn(configuration: &configuration::Configuration, config_access_update_webauthn_request: Option<models::ConfigAccessUpdateWebauthnRequest>) -> Result<models::ConfigAccessUpdateWebauthnResponse, Error<ConfigAccessUpdateWebauthnError>> {
1516    // add a prefix to parameters to efficiently prevent name collisions
1517    let p_body_config_access_update_webauthn_request = config_access_update_webauthn_request;
1518
1519    let uri_str = format!("{}/config/access/tfa/webauthn", configuration.base_path);
1520    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1521
1522    if let Some(ref user_agent) = configuration.user_agent {
1523        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1524    }
1525    if let Some(ref apikey) = configuration.api_key {
1526        let key = apikey.key.clone();
1527        let value = match apikey.prefix {
1528            Some(ref prefix) => format!("{} {}", prefix, key),
1529            None => key,
1530        };
1531        req_builder = req_builder.header("Authorization", value);
1532    };
1533    if let Some(ref apikey) = configuration.api_key {
1534        let key = apikey.key.clone();
1535        let value = match apikey.prefix {
1536            Some(ref prefix) => format!("{} {}", prefix, key),
1537            None => key,
1538        };
1539        req_builder = req_builder.header("CSRFPreventionToken", value);
1540    };
1541    req_builder = req_builder.json(&p_body_config_access_update_webauthn_request);
1542
1543    let req = req_builder.build()?;
1544    let resp = configuration.client.execute(req).await?;
1545
1546    let status = resp.status();
1547    let content_type = resp
1548        .headers()
1549        .get("content-type")
1550        .and_then(|v| v.to_str().ok())
1551        .unwrap_or("application/octet-stream");
1552    let content_type = super::ContentType::from(content_type);
1553
1554    if !status.is_client_error() && !status.is_server_error() {
1555        let content = resp.text().await?;
1556        match content_type {
1557            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1558            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ConfigAccessUpdateWebauthnResponse`"))),
1559            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::ConfigAccessUpdateWebauthnResponse`")))),
1560        }
1561    } else {
1562        let content = resp.text().await?;
1563        let entity: Option<ConfigAccessUpdateWebauthnError> = serde_json::from_str(&content).ok();
1564        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1565    }
1566}
1567