1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum ClusterAcmeAccountIndexError {
22 Status400(models::PveError),
23 Status401(models::PveError),
24 Status403(models::PveError),
25 Status404(models::PveError),
26 Status500(models::PveError),
27 Status501(models::PveError),
28 Status503(models::PveError),
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum ClusterAcmeAddPluginError {
36 Status400(models::PveError),
37 Status401(models::PveError),
38 Status403(models::PveError),
39 Status404(models::PveError),
40 Status500(models::PveError),
41 Status501(models::PveError),
42 Status503(models::PveError),
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum ClusterAcmeChallengeschemaError {
50 Status400(models::PveError),
51 Status401(models::PveError),
52 Status403(models::PveError),
53 Status404(models::PveError),
54 Status500(models::PveError),
55 Status501(models::PveError),
56 Status503(models::PveError),
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum ClusterAcmeDeactivateAccountError {
64 Status400(models::PveError),
65 Status401(models::PveError),
66 Status403(models::PveError),
67 Status404(models::PveError),
68 Status500(models::PveError),
69 Status501(models::PveError),
70 Status503(models::PveError),
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum ClusterAcmeDeletePluginError {
78 Status400(models::PveError),
79 Status401(models::PveError),
80 Status403(models::PveError),
81 Status404(models::PveError),
82 Status500(models::PveError),
83 Status501(models::PveError),
84 Status503(models::PveError),
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum ClusterAcmeGetAccountError {
92 Status400(models::PveError),
93 Status401(models::PveError),
94 Status403(models::PveError),
95 Status404(models::PveError),
96 Status500(models::PveError),
97 Status501(models::PveError),
98 Status503(models::PveError),
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum ClusterAcmeGetAcmeError {
106 Status400(models::PveError),
107 Status401(models::PveError),
108 Status403(models::PveError),
109 Status404(models::PveError),
110 Status500(models::PveError),
111 Status501(models::PveError),
112 Status503(models::PveError),
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum ClusterAcmeGetDirectoriesError {
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#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum ClusterAcmeGetMetaError {
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#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum ClusterAcmeGetPluginConfigError {
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#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum ClusterAcmeGetPluginsError {
162 Status400(models::PveError),
163 Status401(models::PveError),
164 Status403(models::PveError),
165 Status404(models::PveError),
166 Status500(models::PveError),
167 Status501(models::PveError),
168 Status503(models::PveError),
169 UnknownValue(serde_json::Value),
170}
171
172#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum ClusterAcmeGetTosError {
176 Status400(models::PveError),
177 Status401(models::PveError),
178 Status403(models::PveError),
179 Status404(models::PveError),
180 Status500(models::PveError),
181 Status501(models::PveError),
182 Status503(models::PveError),
183 UnknownValue(serde_json::Value),
184}
185
186#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum ClusterAcmeRegisterAccountError {
190 Status400(models::PveError),
191 Status401(models::PveError),
192 Status403(models::PveError),
193 Status404(models::PveError),
194 Status500(models::PveError),
195 Status501(models::PveError),
196 Status503(models::PveError),
197 UnknownValue(serde_json::Value),
198}
199
200#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum ClusterAcmeUpdateAccountError {
204 Status400(models::PveError),
205 Status401(models::PveError),
206 Status403(models::PveError),
207 Status404(models::PveError),
208 Status500(models::PveError),
209 Status501(models::PveError),
210 Status503(models::PveError),
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum ClusterAcmeUpdatePluginError {
218 Status400(models::PveError),
219 Status401(models::PveError),
220 Status403(models::PveError),
221 Status404(models::PveError),
222 Status500(models::PveError),
223 Status501(models::PveError),
224 Status503(models::PveError),
225 UnknownValue(serde_json::Value),
226}
227
228
229pub async fn cluster_acme_account_index(configuration: &configuration::Configuration, ) -> Result<models::ClusterAcmeAccountIndexResponse, Error<ClusterAcmeAccountIndexError>> {
231
232 let uri_str = format!("{}/cluster/acme/account", configuration.base_path);
233 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
234
235 if let Some(ref user_agent) = configuration.user_agent {
236 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
237 }
238 if let Some(ref apikey) = configuration.api_key {
239 let key = apikey.key.clone();
240 let value = match apikey.prefix {
241 Some(ref prefix) => format!("{} {}", prefix, key),
242 None => key,
243 };
244 req_builder = req_builder.header("Authorization", value);
245 };
246 if let Some(ref apikey) = configuration.api_key {
247 let key = apikey.key.clone();
248 let value = match apikey.prefix {
249 Some(ref prefix) => format!("{} {}", prefix, key),
250 None => key,
251 };
252 req_builder = req_builder.header("CSRFPreventionToken", value);
253 };
254
255 let req = req_builder.build()?;
256 let resp = configuration.client.execute(req).await?;
257
258 let status = resp.status();
259 let content_type = resp
260 .headers()
261 .get("content-type")
262 .and_then(|v| v.to_str().ok())
263 .unwrap_or("application/octet-stream");
264 let content_type = super::ContentType::from(content_type);
265
266 if !status.is_client_error() && !status.is_server_error() {
267 let content = resp.text().await?;
268 match content_type {
269 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
270 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterAcmeAccountIndexResponse`"))),
271 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::ClusterAcmeAccountIndexResponse`")))),
272 }
273 } else {
274 let content = resp.text().await?;
275 let entity: Option<ClusterAcmeAccountIndexError> = serde_json::from_str(&content).ok();
276 Err(Error::ResponseError(ResponseContent { status, content, entity }))
277 }
278}
279
280pub async fn cluster_acme_add_plugin(configuration: &configuration::Configuration, cluster_acme_add_plugin_request: models::ClusterAcmeAddPluginRequest) -> Result<models::ClusterAcmeAddPluginResponse, Error<ClusterAcmeAddPluginError>> {
282 let p_body_cluster_acme_add_plugin_request = cluster_acme_add_plugin_request;
284
285 let uri_str = format!("{}/cluster/acme/plugins", configuration.base_path);
286 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
287
288 if let Some(ref user_agent) = configuration.user_agent {
289 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
290 }
291 if let Some(ref apikey) = configuration.api_key {
292 let key = apikey.key.clone();
293 let value = match apikey.prefix {
294 Some(ref prefix) => format!("{} {}", prefix, key),
295 None => key,
296 };
297 req_builder = req_builder.header("Authorization", value);
298 };
299 if let Some(ref apikey) = configuration.api_key {
300 let key = apikey.key.clone();
301 let value = match apikey.prefix {
302 Some(ref prefix) => format!("{} {}", prefix, key),
303 None => key,
304 };
305 req_builder = req_builder.header("CSRFPreventionToken", value);
306 };
307 req_builder = req_builder.json(&p_body_cluster_acme_add_plugin_request);
308
309 let req = req_builder.build()?;
310 let resp = configuration.client.execute(req).await?;
311
312 let status = resp.status();
313 let content_type = resp
314 .headers()
315 .get("content-type")
316 .and_then(|v| v.to_str().ok())
317 .unwrap_or("application/octet-stream");
318 let content_type = super::ContentType::from(content_type);
319
320 if !status.is_client_error() && !status.is_server_error() {
321 let content = resp.text().await?;
322 match content_type {
323 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
324 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterAcmeAddPluginResponse`"))),
325 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::ClusterAcmeAddPluginResponse`")))),
326 }
327 } else {
328 let content = resp.text().await?;
329 let entity: Option<ClusterAcmeAddPluginError> = serde_json::from_str(&content).ok();
330 Err(Error::ResponseError(ResponseContent { status, content, entity }))
331 }
332}
333
334pub async fn cluster_acme_challengeschema(configuration: &configuration::Configuration, ) -> Result<models::ClusterAcmeChallengeschemaResponse, Error<ClusterAcmeChallengeschemaError>> {
336
337 let uri_str = format!("{}/cluster/acme/challenge-schema", configuration.base_path);
338 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
339
340 if let Some(ref user_agent) = configuration.user_agent {
341 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
342 }
343 if let Some(ref apikey) = configuration.api_key {
344 let key = apikey.key.clone();
345 let value = match apikey.prefix {
346 Some(ref prefix) => format!("{} {}", prefix, key),
347 None => key,
348 };
349 req_builder = req_builder.header("Authorization", value);
350 };
351 if let Some(ref apikey) = configuration.api_key {
352 let key = apikey.key.clone();
353 let value = match apikey.prefix {
354 Some(ref prefix) => format!("{} {}", prefix, key),
355 None => key,
356 };
357 req_builder = req_builder.header("CSRFPreventionToken", value);
358 };
359
360 let req = req_builder.build()?;
361 let resp = configuration.client.execute(req).await?;
362
363 let status = resp.status();
364 let content_type = resp
365 .headers()
366 .get("content-type")
367 .and_then(|v| v.to_str().ok())
368 .unwrap_or("application/octet-stream");
369 let content_type = super::ContentType::from(content_type);
370
371 if !status.is_client_error() && !status.is_server_error() {
372 let content = resp.text().await?;
373 match content_type {
374 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
375 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterAcmeChallengeschemaResponse`"))),
376 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::ClusterAcmeChallengeschemaResponse`")))),
377 }
378 } else {
379 let content = resp.text().await?;
380 let entity: Option<ClusterAcmeChallengeschemaError> = serde_json::from_str(&content).ok();
381 Err(Error::ResponseError(ResponseContent { status, content, entity }))
382 }
383}
384
385pub async fn cluster_acme_deactivate_account(configuration: &configuration::Configuration, name: &str) -> Result<models::ClusterAcmeDeactivateAccountResponse, Error<ClusterAcmeDeactivateAccountError>> {
387 let p_path_name = name;
389
390 let uri_str = format!("{}/cluster/acme/account/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
391 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
392
393 if let Some(ref user_agent) = configuration.user_agent {
394 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
395 }
396 if let Some(ref apikey) = configuration.api_key {
397 let key = apikey.key.clone();
398 let value = match apikey.prefix {
399 Some(ref prefix) => format!("{} {}", prefix, key),
400 None => key,
401 };
402 req_builder = req_builder.header("Authorization", value);
403 };
404 if let Some(ref apikey) = configuration.api_key {
405 let key = apikey.key.clone();
406 let value = match apikey.prefix {
407 Some(ref prefix) => format!("{} {}", prefix, key),
408 None => key,
409 };
410 req_builder = req_builder.header("CSRFPreventionToken", value);
411 };
412
413 let req = req_builder.build()?;
414 let resp = configuration.client.execute(req).await?;
415
416 let status = resp.status();
417 let content_type = resp
418 .headers()
419 .get("content-type")
420 .and_then(|v| v.to_str().ok())
421 .unwrap_or("application/octet-stream");
422 let content_type = super::ContentType::from(content_type);
423
424 if !status.is_client_error() && !status.is_server_error() {
425 let content = resp.text().await?;
426 match content_type {
427 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
428 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterAcmeDeactivateAccountResponse`"))),
429 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::ClusterAcmeDeactivateAccountResponse`")))),
430 }
431 } else {
432 let content = resp.text().await?;
433 let entity: Option<ClusterAcmeDeactivateAccountError> = serde_json::from_str(&content).ok();
434 Err(Error::ResponseError(ResponseContent { status, content, entity }))
435 }
436}
437
438pub async fn cluster_acme_delete_plugin(configuration: &configuration::Configuration, id: &str) -> Result<models::ClusterAcmeDeletePluginResponse, Error<ClusterAcmeDeletePluginError>> {
440 let p_path_id = id;
442
443 let uri_str = format!("{}/cluster/acme/plugins/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
444 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
445
446 if let Some(ref user_agent) = configuration.user_agent {
447 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
448 }
449 if let Some(ref apikey) = configuration.api_key {
450 let key = apikey.key.clone();
451 let value = match apikey.prefix {
452 Some(ref prefix) => format!("{} {}", prefix, key),
453 None => key,
454 };
455 req_builder = req_builder.header("Authorization", value);
456 };
457 if let Some(ref apikey) = configuration.api_key {
458 let key = apikey.key.clone();
459 let value = match apikey.prefix {
460 Some(ref prefix) => format!("{} {}", prefix, key),
461 None => key,
462 };
463 req_builder = req_builder.header("CSRFPreventionToken", value);
464 };
465
466 let req = req_builder.build()?;
467 let resp = configuration.client.execute(req).await?;
468
469 let status = resp.status();
470 let content_type = resp
471 .headers()
472 .get("content-type")
473 .and_then(|v| v.to_str().ok())
474 .unwrap_or("application/octet-stream");
475 let content_type = super::ContentType::from(content_type);
476
477 if !status.is_client_error() && !status.is_server_error() {
478 let content = resp.text().await?;
479 match content_type {
480 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
481 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterAcmeDeletePluginResponse`"))),
482 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ClusterAcmeDeletePluginResponse`")))),
483 }
484 } else {
485 let content = resp.text().await?;
486 let entity: Option<ClusterAcmeDeletePluginError> = serde_json::from_str(&content).ok();
487 Err(Error::ResponseError(ResponseContent { status, content, entity }))
488 }
489}
490
491pub async fn cluster_acme_get_account(configuration: &configuration::Configuration, name: &str) -> Result<models::ClusterAcmeGetAccountResponse, Error<ClusterAcmeGetAccountError>> {
493 let p_path_name = name;
495
496 let uri_str = format!("{}/cluster/acme/account/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
497 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
498
499 if let Some(ref user_agent) = configuration.user_agent {
500 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
501 }
502 if let Some(ref apikey) = configuration.api_key {
503 let key = apikey.key.clone();
504 let value = match apikey.prefix {
505 Some(ref prefix) => format!("{} {}", prefix, key),
506 None => key,
507 };
508 req_builder = req_builder.header("Authorization", value);
509 };
510 if let Some(ref apikey) = configuration.api_key {
511 let key = apikey.key.clone();
512 let value = match apikey.prefix {
513 Some(ref prefix) => format!("{} {}", prefix, key),
514 None => key,
515 };
516 req_builder = req_builder.header("CSRFPreventionToken", value);
517 };
518
519 let req = req_builder.build()?;
520 let resp = configuration.client.execute(req).await?;
521
522 let status = resp.status();
523 let content_type = resp
524 .headers()
525 .get("content-type")
526 .and_then(|v| v.to_str().ok())
527 .unwrap_or("application/octet-stream");
528 let content_type = super::ContentType::from(content_type);
529
530 if !status.is_client_error() && !status.is_server_error() {
531 let content = resp.text().await?;
532 match content_type {
533 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
534 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterAcmeGetAccountResponse`"))),
535 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::ClusterAcmeGetAccountResponse`")))),
536 }
537 } else {
538 let content = resp.text().await?;
539 let entity: Option<ClusterAcmeGetAccountError> = serde_json::from_str(&content).ok();
540 Err(Error::ResponseError(ResponseContent { status, content, entity }))
541 }
542}
543
544pub async fn cluster_acme_get_acme(configuration: &configuration::Configuration, ) -> Result<models::ClusterAcmeGetAcmeResponse, Error<ClusterAcmeGetAcmeError>> {
546
547 let uri_str = format!("{}/cluster/acme", configuration.base_path);
548 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
549
550 if let Some(ref user_agent) = configuration.user_agent {
551 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
552 }
553 if let Some(ref apikey) = configuration.api_key {
554 let key = apikey.key.clone();
555 let value = match apikey.prefix {
556 Some(ref prefix) => format!("{} {}", prefix, key),
557 None => key,
558 };
559 req_builder = req_builder.header("Authorization", value);
560 };
561 if let Some(ref apikey) = configuration.api_key {
562 let key = apikey.key.clone();
563 let value = match apikey.prefix {
564 Some(ref prefix) => format!("{} {}", prefix, key),
565 None => key,
566 };
567 req_builder = req_builder.header("CSRFPreventionToken", value);
568 };
569
570 let req = req_builder.build()?;
571 let resp = configuration.client.execute(req).await?;
572
573 let status = resp.status();
574 let content_type = resp
575 .headers()
576 .get("content-type")
577 .and_then(|v| v.to_str().ok())
578 .unwrap_or("application/octet-stream");
579 let content_type = super::ContentType::from(content_type);
580
581 if !status.is_client_error() && !status.is_server_error() {
582 let content = resp.text().await?;
583 match content_type {
584 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
585 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterAcmeGetAcmeResponse`"))),
586 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::ClusterAcmeGetAcmeResponse`")))),
587 }
588 } else {
589 let content = resp.text().await?;
590 let entity: Option<ClusterAcmeGetAcmeError> = serde_json::from_str(&content).ok();
591 Err(Error::ResponseError(ResponseContent { status, content, entity }))
592 }
593}
594
595pub async fn cluster_acme_get_directories(configuration: &configuration::Configuration, ) -> Result<models::ClusterAcmeGetDirectoriesResponse, Error<ClusterAcmeGetDirectoriesError>> {
597
598 let uri_str = format!("{}/cluster/acme/directories", configuration.base_path);
599 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
600
601 if let Some(ref user_agent) = configuration.user_agent {
602 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
603 }
604 if let Some(ref apikey) = configuration.api_key {
605 let key = apikey.key.clone();
606 let value = match apikey.prefix {
607 Some(ref prefix) => format!("{} {}", prefix, key),
608 None => key,
609 };
610 req_builder = req_builder.header("Authorization", value);
611 };
612 if let Some(ref apikey) = configuration.api_key {
613 let key = apikey.key.clone();
614 let value = match apikey.prefix {
615 Some(ref prefix) => format!("{} {}", prefix, key),
616 None => key,
617 };
618 req_builder = req_builder.header("CSRFPreventionToken", value);
619 };
620
621 let req = req_builder.build()?;
622 let resp = configuration.client.execute(req).await?;
623
624 let status = resp.status();
625 let content_type = resp
626 .headers()
627 .get("content-type")
628 .and_then(|v| v.to_str().ok())
629 .unwrap_or("application/octet-stream");
630 let content_type = super::ContentType::from(content_type);
631
632 if !status.is_client_error() && !status.is_server_error() {
633 let content = resp.text().await?;
634 match content_type {
635 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
636 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterAcmeGetDirectoriesResponse`"))),
637 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::ClusterAcmeGetDirectoriesResponse`")))),
638 }
639 } else {
640 let content = resp.text().await?;
641 let entity: Option<ClusterAcmeGetDirectoriesError> = serde_json::from_str(&content).ok();
642 Err(Error::ResponseError(ResponseContent { status, content, entity }))
643 }
644}
645
646pub async fn cluster_acme_get_meta(configuration: &configuration::Configuration, directory: Option<&str>) -> Result<models::ClusterAcmeGetMetaResponse, Error<ClusterAcmeGetMetaError>> {
648 let p_query_directory = directory;
650
651 let uri_str = format!("{}/cluster/acme/meta", configuration.base_path);
652 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
653
654 if let Some(ref param_value) = p_query_directory {
655 req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]);
656 }
657 if let Some(ref user_agent) = configuration.user_agent {
658 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
659 }
660 if let Some(ref apikey) = configuration.api_key {
661 let key = apikey.key.clone();
662 let value = match apikey.prefix {
663 Some(ref prefix) => format!("{} {}", prefix, key),
664 None => key,
665 };
666 req_builder = req_builder.header("Authorization", value);
667 };
668 if let Some(ref apikey) = configuration.api_key {
669 let key = apikey.key.clone();
670 let value = match apikey.prefix {
671 Some(ref prefix) => format!("{} {}", prefix, key),
672 None => key,
673 };
674 req_builder = req_builder.header("CSRFPreventionToken", value);
675 };
676
677 let req = req_builder.build()?;
678 let resp = configuration.client.execute(req).await?;
679
680 let status = resp.status();
681 let content_type = resp
682 .headers()
683 .get("content-type")
684 .and_then(|v| v.to_str().ok())
685 .unwrap_or("application/octet-stream");
686 let content_type = super::ContentType::from(content_type);
687
688 if !status.is_client_error() && !status.is_server_error() {
689 let content = resp.text().await?;
690 match content_type {
691 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
692 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterAcmeGetMetaResponse`"))),
693 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::ClusterAcmeGetMetaResponse`")))),
694 }
695 } else {
696 let content = resp.text().await?;
697 let entity: Option<ClusterAcmeGetMetaError> = serde_json::from_str(&content).ok();
698 Err(Error::ResponseError(ResponseContent { status, content, entity }))
699 }
700}
701
702pub async fn cluster_acme_get_plugin_config(configuration: &configuration::Configuration, id: &str) -> Result<models::ClusterAcmeGetPluginConfigResponse, Error<ClusterAcmeGetPluginConfigError>> {
704 let p_path_id = id;
706
707 let uri_str = format!("{}/cluster/acme/plugins/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
708 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
709
710 if let Some(ref user_agent) = configuration.user_agent {
711 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
712 }
713 if let Some(ref apikey) = configuration.api_key {
714 let key = apikey.key.clone();
715 let value = match apikey.prefix {
716 Some(ref prefix) => format!("{} {}", prefix, key),
717 None => key,
718 };
719 req_builder = req_builder.header("Authorization", value);
720 };
721 if let Some(ref apikey) = configuration.api_key {
722 let key = apikey.key.clone();
723 let value = match apikey.prefix {
724 Some(ref prefix) => format!("{} {}", prefix, key),
725 None => key,
726 };
727 req_builder = req_builder.header("CSRFPreventionToken", value);
728 };
729
730 let req = req_builder.build()?;
731 let resp = configuration.client.execute(req).await?;
732
733 let status = resp.status();
734 let content_type = resp
735 .headers()
736 .get("content-type")
737 .and_then(|v| v.to_str().ok())
738 .unwrap_or("application/octet-stream");
739 let content_type = super::ContentType::from(content_type);
740
741 if !status.is_client_error() && !status.is_server_error() {
742 let content = resp.text().await?;
743 match content_type {
744 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
745 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterAcmeGetPluginConfigResponse`"))),
746 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::ClusterAcmeGetPluginConfigResponse`")))),
747 }
748 } else {
749 let content = resp.text().await?;
750 let entity: Option<ClusterAcmeGetPluginConfigError> = serde_json::from_str(&content).ok();
751 Err(Error::ResponseError(ResponseContent { status, content, entity }))
752 }
753}
754
755pub async fn cluster_acme_get_plugins(configuration: &configuration::Configuration, r#type: Option<models::PveClusterAcmeTypeEnum>) -> Result<models::ClusterAcmeGetPluginsResponse, Error<ClusterAcmeGetPluginsError>> {
757 let p_query_type = r#type;
759
760 let uri_str = format!("{}/cluster/acme/plugins", configuration.base_path);
761 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
762
763 if let Some(ref param_value) = p_query_type {
764 req_builder = req_builder.query(&[("type", ¶m_value.to_string())]);
765 }
766 if let Some(ref user_agent) = configuration.user_agent {
767 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
768 }
769 if let Some(ref apikey) = configuration.api_key {
770 let key = apikey.key.clone();
771 let value = match apikey.prefix {
772 Some(ref prefix) => format!("{} {}", prefix, key),
773 None => key,
774 };
775 req_builder = req_builder.header("Authorization", value);
776 };
777 if let Some(ref apikey) = configuration.api_key {
778 let key = apikey.key.clone();
779 let value = match apikey.prefix {
780 Some(ref prefix) => format!("{} {}", prefix, key),
781 None => key,
782 };
783 req_builder = req_builder.header("CSRFPreventionToken", value);
784 };
785
786 let req = req_builder.build()?;
787 let resp = configuration.client.execute(req).await?;
788
789 let status = resp.status();
790 let content_type = resp
791 .headers()
792 .get("content-type")
793 .and_then(|v| v.to_str().ok())
794 .unwrap_or("application/octet-stream");
795 let content_type = super::ContentType::from(content_type);
796
797 if !status.is_client_error() && !status.is_server_error() {
798 let content = resp.text().await?;
799 match content_type {
800 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
801 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterAcmeGetPluginsResponse`"))),
802 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::ClusterAcmeGetPluginsResponse`")))),
803 }
804 } else {
805 let content = resp.text().await?;
806 let entity: Option<ClusterAcmeGetPluginsError> = serde_json::from_str(&content).ok();
807 Err(Error::ResponseError(ResponseContent { status, content, entity }))
808 }
809}
810
811pub async fn cluster_acme_get_tos(configuration: &configuration::Configuration, directory: Option<&str>) -> Result<models::ClusterAcmeGetTosResponse, Error<ClusterAcmeGetTosError>> {
813 let p_query_directory = directory;
815
816 let uri_str = format!("{}/cluster/acme/tos", configuration.base_path);
817 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
818
819 if let Some(ref param_value) = p_query_directory {
820 req_builder = req_builder.query(&[("directory", ¶m_value.to_string())]);
821 }
822 if let Some(ref user_agent) = configuration.user_agent {
823 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
824 }
825 if let Some(ref apikey) = configuration.api_key {
826 let key = apikey.key.clone();
827 let value = match apikey.prefix {
828 Some(ref prefix) => format!("{} {}", prefix, key),
829 None => key,
830 };
831 req_builder = req_builder.header("Authorization", value);
832 };
833 if let Some(ref apikey) = configuration.api_key {
834 let key = apikey.key.clone();
835 let value = match apikey.prefix {
836 Some(ref prefix) => format!("{} {}", prefix, key),
837 None => key,
838 };
839 req_builder = req_builder.header("CSRFPreventionToken", value);
840 };
841
842 let req = req_builder.build()?;
843 let resp = configuration.client.execute(req).await?;
844
845 let status = resp.status();
846 let content_type = resp
847 .headers()
848 .get("content-type")
849 .and_then(|v| v.to_str().ok())
850 .unwrap_or("application/octet-stream");
851 let content_type = super::ContentType::from(content_type);
852
853 if !status.is_client_error() && !status.is_server_error() {
854 let content = resp.text().await?;
855 match content_type {
856 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
857 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterAcmeGetTosResponse`"))),
858 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::ClusterAcmeGetTosResponse`")))),
859 }
860 } else {
861 let content = resp.text().await?;
862 let entity: Option<ClusterAcmeGetTosError> = serde_json::from_str(&content).ok();
863 Err(Error::ResponseError(ResponseContent { status, content, entity }))
864 }
865}
866
867pub async fn cluster_acme_register_account(configuration: &configuration::Configuration, cluster_acme_register_account_request: models::ClusterAcmeRegisterAccountRequest) -> Result<models::ClusterAcmeRegisterAccountResponse, Error<ClusterAcmeRegisterAccountError>> {
869 let p_body_cluster_acme_register_account_request = cluster_acme_register_account_request;
871
872 let uri_str = format!("{}/cluster/acme/account", configuration.base_path);
873 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
874
875 if let Some(ref user_agent) = configuration.user_agent {
876 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
877 }
878 if let Some(ref apikey) = configuration.api_key {
879 let key = apikey.key.clone();
880 let value = match apikey.prefix {
881 Some(ref prefix) => format!("{} {}", prefix, key),
882 None => key,
883 };
884 req_builder = req_builder.header("Authorization", value);
885 };
886 if let Some(ref apikey) = configuration.api_key {
887 let key = apikey.key.clone();
888 let value = match apikey.prefix {
889 Some(ref prefix) => format!("{} {}", prefix, key),
890 None => key,
891 };
892 req_builder = req_builder.header("CSRFPreventionToken", value);
893 };
894 req_builder = req_builder.json(&p_body_cluster_acme_register_account_request);
895
896 let req = req_builder.build()?;
897 let resp = configuration.client.execute(req).await?;
898
899 let status = resp.status();
900 let content_type = resp
901 .headers()
902 .get("content-type")
903 .and_then(|v| v.to_str().ok())
904 .unwrap_or("application/octet-stream");
905 let content_type = super::ContentType::from(content_type);
906
907 if !status.is_client_error() && !status.is_server_error() {
908 let content = resp.text().await?;
909 match content_type {
910 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
911 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterAcmeRegisterAccountResponse`"))),
912 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::ClusterAcmeRegisterAccountResponse`")))),
913 }
914 } else {
915 let content = resp.text().await?;
916 let entity: Option<ClusterAcmeRegisterAccountError> = serde_json::from_str(&content).ok();
917 Err(Error::ResponseError(ResponseContent { status, content, entity }))
918 }
919}
920
921pub async fn cluster_acme_update_account(configuration: &configuration::Configuration, name: &str, cluster_acme_update_account_request: Option<models::ClusterAcmeUpdateAccountRequest>) -> Result<models::ClusterAcmeUpdateAccountResponse, Error<ClusterAcmeUpdateAccountError>> {
923 let p_path_name = name;
925 let p_body_cluster_acme_update_account_request = cluster_acme_update_account_request;
926
927 let uri_str = format!("{}/cluster/acme/account/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
928 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
929
930 if let Some(ref user_agent) = configuration.user_agent {
931 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
932 }
933 if let Some(ref apikey) = configuration.api_key {
934 let key = apikey.key.clone();
935 let value = match apikey.prefix {
936 Some(ref prefix) => format!("{} {}", prefix, key),
937 None => key,
938 };
939 req_builder = req_builder.header("Authorization", value);
940 };
941 if let Some(ref apikey) = configuration.api_key {
942 let key = apikey.key.clone();
943 let value = match apikey.prefix {
944 Some(ref prefix) => format!("{} {}", prefix, key),
945 None => key,
946 };
947 req_builder = req_builder.header("CSRFPreventionToken", value);
948 };
949 req_builder = req_builder.json(&p_body_cluster_acme_update_account_request);
950
951 let req = req_builder.build()?;
952 let resp = configuration.client.execute(req).await?;
953
954 let status = resp.status();
955 let content_type = resp
956 .headers()
957 .get("content-type")
958 .and_then(|v| v.to_str().ok())
959 .unwrap_or("application/octet-stream");
960 let content_type = super::ContentType::from(content_type);
961
962 if !status.is_client_error() && !status.is_server_error() {
963 let content = resp.text().await?;
964 match content_type {
965 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
966 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterAcmeUpdateAccountResponse`"))),
967 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::ClusterAcmeUpdateAccountResponse`")))),
968 }
969 } else {
970 let content = resp.text().await?;
971 let entity: Option<ClusterAcmeUpdateAccountError> = serde_json::from_str(&content).ok();
972 Err(Error::ResponseError(ResponseContent { status, content, entity }))
973 }
974}
975
976pub async fn cluster_acme_update_plugin(configuration: &configuration::Configuration, id: &str, cluster_acme_update_plugin_request: Option<models::ClusterAcmeUpdatePluginRequest>) -> Result<models::ClusterAcmeUpdatePluginResponse, Error<ClusterAcmeUpdatePluginError>> {
978 let p_path_id = id;
980 let p_body_cluster_acme_update_plugin_request = cluster_acme_update_plugin_request;
981
982 let uri_str = format!("{}/cluster/acme/plugins/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
983 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
984
985 if let Some(ref user_agent) = configuration.user_agent {
986 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
987 }
988 if let Some(ref apikey) = configuration.api_key {
989 let key = apikey.key.clone();
990 let value = match apikey.prefix {
991 Some(ref prefix) => format!("{} {}", prefix, key),
992 None => key,
993 };
994 req_builder = req_builder.header("Authorization", value);
995 };
996 if let Some(ref apikey) = configuration.api_key {
997 let key = apikey.key.clone();
998 let value = match apikey.prefix {
999 Some(ref prefix) => format!("{} {}", prefix, key),
1000 None => key,
1001 };
1002 req_builder = req_builder.header("CSRFPreventionToken", value);
1003 };
1004 req_builder = req_builder.json(&p_body_cluster_acme_update_plugin_request);
1005
1006 let req = req_builder.build()?;
1007 let resp = configuration.client.execute(req).await?;
1008
1009 let status = resp.status();
1010 let content_type = resp
1011 .headers()
1012 .get("content-type")
1013 .and_then(|v| v.to_str().ok())
1014 .unwrap_or("application/octet-stream");
1015 let content_type = super::ContentType::from(content_type);
1016
1017 if !status.is_client_error() && !status.is_server_error() {
1018 let content = resp.text().await?;
1019 match content_type {
1020 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1021 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterAcmeUpdatePluginResponse`"))),
1022 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::ClusterAcmeUpdatePluginResponse`")))),
1023 }
1024 } else {
1025 let content = resp.text().await?;
1026 let entity: Option<ClusterAcmeUpdatePluginError> = serde_json::from_str(&content).ok();
1027 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1028 }
1029}
1030