Skip to main content

clientapi_pbs/apis/
backup_upgrade_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 [`backup_upgrade_create_blob`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum BackupUpgradeCreateBlobError {
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 [`backup_upgrade_create_dynamic_chunk`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum BackupUpgradeCreateDynamicChunkError {
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 [`backup_upgrade_create_dynamic_close`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum BackupUpgradeCreateDynamicCloseError {
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 [`backup_upgrade_create_dynamic_index`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum BackupUpgradeCreateDynamicIndexError {
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 [`backup_upgrade_create_finish`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum BackupUpgradeCreateFinishError {
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 [`backup_upgrade_create_fixed_chunk`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum BackupUpgradeCreateFixedChunkError {
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 [`backup_upgrade_create_fixed_close`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum BackupUpgradeCreateFixedCloseError {
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 [`backup_upgrade_create_fixed_index`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum BackupUpgradeCreateFixedIndexError {
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 [`backup_upgrade_create_speedtest`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum BackupUpgradeCreateSpeedtestError {
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 [`backup_upgrade_get_previous`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum BackupUpgradeGetPreviousError {
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 [`backup_upgrade_get_previous_backup_time`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum BackupUpgradeGetPreviousBackupTimeError {
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 [`backup_upgrade_get_upgrade`]
173#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum BackupUpgradeGetUpgradeError {
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 [`backup_upgrade_update_dynamic_index`]
187#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum BackupUpgradeUpdateDynamicIndexError {
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 [`backup_upgrade_update_fixed_index`]
201#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum BackupUpgradeUpdateFixedIndexError {
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
215/// Upload binary blob file.
216pub async fn backup_upgrade_create_blob(configuration: &configuration::Configuration, backup_upgrade_create_blob_request: models::BackupUpgradeCreateBlobRequest) -> Result<models::BackupUpgradeCreateBlobResponse, Error<BackupUpgradeCreateBlobError>> {
217    // add a prefix to parameters to efficiently prevent name collisions
218    let p_body_backup_upgrade_create_blob_request = backup_upgrade_create_blob_request;
219
220    let uri_str = format!("{}/backup/_upgrade_/blob", configuration.base_path);
221    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
222
223    if let Some(ref user_agent) = configuration.user_agent {
224        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
225    }
226    if let Some(ref apikey) = configuration.api_key {
227        let key = apikey.key.clone();
228        let value = match apikey.prefix {
229            Some(ref prefix) => format!("{} {}", prefix, key),
230            None => key,
231        };
232        req_builder = req_builder.header("Authorization", value);
233    };
234    if let Some(ref apikey) = configuration.api_key {
235        let key = apikey.key.clone();
236        let value = match apikey.prefix {
237            Some(ref prefix) => format!("{} {}", prefix, key),
238            None => key,
239        };
240        req_builder = req_builder.header("CSRFPreventionToken", value);
241    };
242    req_builder = req_builder.json(&p_body_backup_upgrade_create_blob_request);
243
244    let req = req_builder.build()?;
245    let resp = configuration.client.execute(req).await?;
246
247    let status = resp.status();
248    let content_type = resp
249        .headers()
250        .get("content-type")
251        .and_then(|v| v.to_str().ok())
252        .unwrap_or("application/octet-stream");
253    let content_type = super::ContentType::from(content_type);
254
255    if !status.is_client_error() && !status.is_server_error() {
256        let content = resp.text().await?;
257        match content_type {
258            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
259            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BackupUpgradeCreateBlobResponse`"))),
260            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::BackupUpgradeCreateBlobResponse`")))),
261        }
262    } else {
263        let content = resp.text().await?;
264        let entity: Option<BackupUpgradeCreateBlobError> = serde_json::from_str(&content).ok();
265        Err(Error::ResponseError(ResponseContent { status, content, entity }))
266    }
267}
268
269/// Upload a new chunk.
270pub async fn backup_upgrade_create_dynamic_chunk(configuration: &configuration::Configuration, backup_upgrade_create_dynamic_chunk_request: models::BackupUpgradeCreateDynamicChunkRequest) -> Result<models::BackupUpgradeCreateDynamicChunkResponse, Error<BackupUpgradeCreateDynamicChunkError>> {
271    // add a prefix to parameters to efficiently prevent name collisions
272    let p_body_backup_upgrade_create_dynamic_chunk_request = backup_upgrade_create_dynamic_chunk_request;
273
274    let uri_str = format!("{}/backup/_upgrade_/dynamic_chunk", configuration.base_path);
275    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
276
277    if let Some(ref user_agent) = configuration.user_agent {
278        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
279    }
280    if let Some(ref apikey) = configuration.api_key {
281        let key = apikey.key.clone();
282        let value = match apikey.prefix {
283            Some(ref prefix) => format!("{} {}", prefix, key),
284            None => key,
285        };
286        req_builder = req_builder.header("Authorization", value);
287    };
288    if let Some(ref apikey) = configuration.api_key {
289        let key = apikey.key.clone();
290        let value = match apikey.prefix {
291            Some(ref prefix) => format!("{} {}", prefix, key),
292            None => key,
293        };
294        req_builder = req_builder.header("CSRFPreventionToken", value);
295    };
296    req_builder = req_builder.json(&p_body_backup_upgrade_create_dynamic_chunk_request);
297
298    let req = req_builder.build()?;
299    let resp = configuration.client.execute(req).await?;
300
301    let status = resp.status();
302    let content_type = resp
303        .headers()
304        .get("content-type")
305        .and_then(|v| v.to_str().ok())
306        .unwrap_or("application/octet-stream");
307    let content_type = super::ContentType::from(content_type);
308
309    if !status.is_client_error() && !status.is_server_error() {
310        let content = resp.text().await?;
311        match content_type {
312            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
313            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BackupUpgradeCreateDynamicChunkResponse`"))),
314            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::BackupUpgradeCreateDynamicChunkResponse`")))),
315        }
316    } else {
317        let content = resp.text().await?;
318        let entity: Option<BackupUpgradeCreateDynamicChunkError> = serde_json::from_str(&content).ok();
319        Err(Error::ResponseError(ResponseContent { status, content, entity }))
320    }
321}
322
323/// Close dynamic index writer.
324pub async fn backup_upgrade_create_dynamic_close(configuration: &configuration::Configuration, backup_upgrade_create_dynamic_close_request: models::BackupUpgradeCreateDynamicCloseRequest) -> Result<models::BackupUpgradeCreateDynamicCloseResponse, Error<BackupUpgradeCreateDynamicCloseError>> {
325    // add a prefix to parameters to efficiently prevent name collisions
326    let p_body_backup_upgrade_create_dynamic_close_request = backup_upgrade_create_dynamic_close_request;
327
328    let uri_str = format!("{}/backup/_upgrade_/dynamic_close", configuration.base_path);
329    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
330
331    if let Some(ref user_agent) = configuration.user_agent {
332        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
333    }
334    if let Some(ref apikey) = configuration.api_key {
335        let key = apikey.key.clone();
336        let value = match apikey.prefix {
337            Some(ref prefix) => format!("{} {}", prefix, key),
338            None => key,
339        };
340        req_builder = req_builder.header("Authorization", value);
341    };
342    if let Some(ref apikey) = configuration.api_key {
343        let key = apikey.key.clone();
344        let value = match apikey.prefix {
345            Some(ref prefix) => format!("{} {}", prefix, key),
346            None => key,
347        };
348        req_builder = req_builder.header("CSRFPreventionToken", value);
349    };
350    req_builder = req_builder.json(&p_body_backup_upgrade_create_dynamic_close_request);
351
352    let req = req_builder.build()?;
353    let resp = configuration.client.execute(req).await?;
354
355    let status = resp.status();
356    let content_type = resp
357        .headers()
358        .get("content-type")
359        .and_then(|v| v.to_str().ok())
360        .unwrap_or("application/octet-stream");
361    let content_type = super::ContentType::from(content_type);
362
363    if !status.is_client_error() && !status.is_server_error() {
364        let content = resp.text().await?;
365        match content_type {
366            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
367            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BackupUpgradeCreateDynamicCloseResponse`"))),
368            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::BackupUpgradeCreateDynamicCloseResponse`")))),
369        }
370    } else {
371        let content = resp.text().await?;
372        let entity: Option<BackupUpgradeCreateDynamicCloseError> = serde_json::from_str(&content).ok();
373        Err(Error::ResponseError(ResponseContent { status, content, entity }))
374    }
375}
376
377/// Create dynamic chunk index file.
378pub async fn backup_upgrade_create_dynamic_index(configuration: &configuration::Configuration, backup_upgrade_create_dynamic_index_request: models::BackupUpgradeCreateDynamicIndexRequest) -> Result<models::BackupUpgradeCreateDynamicIndexResponse, Error<BackupUpgradeCreateDynamicIndexError>> {
379    // add a prefix to parameters to efficiently prevent name collisions
380    let p_body_backup_upgrade_create_dynamic_index_request = backup_upgrade_create_dynamic_index_request;
381
382    let uri_str = format!("{}/backup/_upgrade_/dynamic_index", configuration.base_path);
383    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
384
385    if let Some(ref user_agent) = configuration.user_agent {
386        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
387    }
388    if let Some(ref apikey) = configuration.api_key {
389        let key = apikey.key.clone();
390        let value = match apikey.prefix {
391            Some(ref prefix) => format!("{} {}", prefix, key),
392            None => key,
393        };
394        req_builder = req_builder.header("Authorization", value);
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("CSRFPreventionToken", value);
403    };
404    req_builder = req_builder.json(&p_body_backup_upgrade_create_dynamic_index_request);
405
406    let req = req_builder.build()?;
407    let resp = configuration.client.execute(req).await?;
408
409    let status = resp.status();
410    let content_type = resp
411        .headers()
412        .get("content-type")
413        .and_then(|v| v.to_str().ok())
414        .unwrap_or("application/octet-stream");
415    let content_type = super::ContentType::from(content_type);
416
417    if !status.is_client_error() && !status.is_server_error() {
418        let content = resp.text().await?;
419        match content_type {
420            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
421            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BackupUpgradeCreateDynamicIndexResponse`"))),
422            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::BackupUpgradeCreateDynamicIndexResponse`")))),
423        }
424    } else {
425        let content = resp.text().await?;
426        let entity: Option<BackupUpgradeCreateDynamicIndexError> = serde_json::from_str(&content).ok();
427        Err(Error::ResponseError(ResponseContent { status, content, entity }))
428    }
429}
430
431/// Mark backup as finished.
432pub async fn backup_upgrade_create_finish(configuration: &configuration::Configuration, ) -> Result<models::BackupUpgradeCreateFinishResponse, Error<BackupUpgradeCreateFinishError>> {
433
434    let uri_str = format!("{}/backup/_upgrade_/finish", configuration.base_path);
435    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
436
437    if let Some(ref user_agent) = configuration.user_agent {
438        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
439    }
440    if let Some(ref apikey) = configuration.api_key {
441        let key = apikey.key.clone();
442        let value = match apikey.prefix {
443            Some(ref prefix) => format!("{} {}", prefix, key),
444            None => key,
445        };
446        req_builder = req_builder.header("Authorization", value);
447    };
448    if let Some(ref apikey) = configuration.api_key {
449        let key = apikey.key.clone();
450        let value = match apikey.prefix {
451            Some(ref prefix) => format!("{} {}", prefix, key),
452            None => key,
453        };
454        req_builder = req_builder.header("CSRFPreventionToken", value);
455    };
456
457    let req = req_builder.build()?;
458    let resp = configuration.client.execute(req).await?;
459
460    let status = resp.status();
461    let content_type = resp
462        .headers()
463        .get("content-type")
464        .and_then(|v| v.to_str().ok())
465        .unwrap_or("application/octet-stream");
466    let content_type = super::ContentType::from(content_type);
467
468    if !status.is_client_error() && !status.is_server_error() {
469        let content = resp.text().await?;
470        match content_type {
471            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
472            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BackupUpgradeCreateFinishResponse`"))),
473            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::BackupUpgradeCreateFinishResponse`")))),
474        }
475    } else {
476        let content = resp.text().await?;
477        let entity: Option<BackupUpgradeCreateFinishError> = serde_json::from_str(&content).ok();
478        Err(Error::ResponseError(ResponseContent { status, content, entity }))
479    }
480}
481
482/// Upload a new chunk.
483pub async fn backup_upgrade_create_fixed_chunk(configuration: &configuration::Configuration, backup_upgrade_create_fixed_chunk_request: models::BackupUpgradeCreateFixedChunkRequest) -> Result<models::BackupUpgradeCreateFixedChunkResponse, Error<BackupUpgradeCreateFixedChunkError>> {
484    // add a prefix to parameters to efficiently prevent name collisions
485    let p_body_backup_upgrade_create_fixed_chunk_request = backup_upgrade_create_fixed_chunk_request;
486
487    let uri_str = format!("{}/backup/_upgrade_/fixed_chunk", configuration.base_path);
488    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
489
490    if let Some(ref user_agent) = configuration.user_agent {
491        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
492    }
493    if let Some(ref apikey) = configuration.api_key {
494        let key = apikey.key.clone();
495        let value = match apikey.prefix {
496            Some(ref prefix) => format!("{} {}", prefix, key),
497            None => key,
498        };
499        req_builder = req_builder.header("Authorization", value);
500    };
501    if let Some(ref apikey) = configuration.api_key {
502        let key = apikey.key.clone();
503        let value = match apikey.prefix {
504            Some(ref prefix) => format!("{} {}", prefix, key),
505            None => key,
506        };
507        req_builder = req_builder.header("CSRFPreventionToken", value);
508    };
509    req_builder = req_builder.json(&p_body_backup_upgrade_create_fixed_chunk_request);
510
511    let req = req_builder.build()?;
512    let resp = configuration.client.execute(req).await?;
513
514    let status = resp.status();
515    let content_type = resp
516        .headers()
517        .get("content-type")
518        .and_then(|v| v.to_str().ok())
519        .unwrap_or("application/octet-stream");
520    let content_type = super::ContentType::from(content_type);
521
522    if !status.is_client_error() && !status.is_server_error() {
523        let content = resp.text().await?;
524        match content_type {
525            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
526            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BackupUpgradeCreateFixedChunkResponse`"))),
527            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BackupUpgradeCreateFixedChunkResponse`")))),
528        }
529    } else {
530        let content = resp.text().await?;
531        let entity: Option<BackupUpgradeCreateFixedChunkError> = serde_json::from_str(&content).ok();
532        Err(Error::ResponseError(ResponseContent { status, content, entity }))
533    }
534}
535
536/// Close fixed index writer.
537pub async fn backup_upgrade_create_fixed_close(configuration: &configuration::Configuration, backup_upgrade_create_fixed_close_request: models::BackupUpgradeCreateFixedCloseRequest) -> Result<models::BackupUpgradeCreateFixedCloseResponse, Error<BackupUpgradeCreateFixedCloseError>> {
538    // add a prefix to parameters to efficiently prevent name collisions
539    let p_body_backup_upgrade_create_fixed_close_request = backup_upgrade_create_fixed_close_request;
540
541    let uri_str = format!("{}/backup/_upgrade_/fixed_close", configuration.base_path);
542    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
543
544    if let Some(ref user_agent) = configuration.user_agent {
545        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
546    }
547    if let Some(ref apikey) = configuration.api_key {
548        let key = apikey.key.clone();
549        let value = match apikey.prefix {
550            Some(ref prefix) => format!("{} {}", prefix, key),
551            None => key,
552        };
553        req_builder = req_builder.header("Authorization", value);
554    };
555    if let Some(ref apikey) = configuration.api_key {
556        let key = apikey.key.clone();
557        let value = match apikey.prefix {
558            Some(ref prefix) => format!("{} {}", prefix, key),
559            None => key,
560        };
561        req_builder = req_builder.header("CSRFPreventionToken", value);
562    };
563    req_builder = req_builder.json(&p_body_backup_upgrade_create_fixed_close_request);
564
565    let req = req_builder.build()?;
566    let resp = configuration.client.execute(req).await?;
567
568    let status = resp.status();
569    let content_type = resp
570        .headers()
571        .get("content-type")
572        .and_then(|v| v.to_str().ok())
573        .unwrap_or("application/octet-stream");
574    let content_type = super::ContentType::from(content_type);
575
576    if !status.is_client_error() && !status.is_server_error() {
577        let content = resp.text().await?;
578        match content_type {
579            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
580            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BackupUpgradeCreateFixedCloseResponse`"))),
581            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::BackupUpgradeCreateFixedCloseResponse`")))),
582        }
583    } else {
584        let content = resp.text().await?;
585        let entity: Option<BackupUpgradeCreateFixedCloseError> = serde_json::from_str(&content).ok();
586        Err(Error::ResponseError(ResponseContent { status, content, entity }))
587    }
588}
589
590/// Create fixed chunk index file.
591pub async fn backup_upgrade_create_fixed_index(configuration: &configuration::Configuration, backup_upgrade_create_fixed_index_request: models::BackupUpgradeCreateFixedIndexRequest) -> Result<models::BackupUpgradeCreateFixedIndexResponse, Error<BackupUpgradeCreateFixedIndexError>> {
592    // add a prefix to parameters to efficiently prevent name collisions
593    let p_body_backup_upgrade_create_fixed_index_request = backup_upgrade_create_fixed_index_request;
594
595    let uri_str = format!("{}/backup/_upgrade_/fixed_index", configuration.base_path);
596    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
597
598    if let Some(ref user_agent) = configuration.user_agent {
599        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
600    }
601    if let Some(ref apikey) = configuration.api_key {
602        let key = apikey.key.clone();
603        let value = match apikey.prefix {
604            Some(ref prefix) => format!("{} {}", prefix, key),
605            None => key,
606        };
607        req_builder = req_builder.header("Authorization", value);
608    };
609    if let Some(ref apikey) = configuration.api_key {
610        let key = apikey.key.clone();
611        let value = match apikey.prefix {
612            Some(ref prefix) => format!("{} {}", prefix, key),
613            None => key,
614        };
615        req_builder = req_builder.header("CSRFPreventionToken", value);
616    };
617    req_builder = req_builder.json(&p_body_backup_upgrade_create_fixed_index_request);
618
619    let req = req_builder.build()?;
620    let resp = configuration.client.execute(req).await?;
621
622    let status = resp.status();
623    let content_type = resp
624        .headers()
625        .get("content-type")
626        .and_then(|v| v.to_str().ok())
627        .unwrap_or("application/octet-stream");
628    let content_type = super::ContentType::from(content_type);
629
630    if !status.is_client_error() && !status.is_server_error() {
631        let content = resp.text().await?;
632        match content_type {
633            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
634            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BackupUpgradeCreateFixedIndexResponse`"))),
635            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::BackupUpgradeCreateFixedIndexResponse`")))),
636        }
637    } else {
638        let content = resp.text().await?;
639        let entity: Option<BackupUpgradeCreateFixedIndexError> = serde_json::from_str(&content).ok();
640        Err(Error::ResponseError(ResponseContent { status, content, entity }))
641    }
642}
643
644/// Test upload speed.
645pub async fn backup_upgrade_create_speedtest(configuration: &configuration::Configuration, ) -> Result<models::BackupUpgradeCreateSpeedtestResponse, Error<BackupUpgradeCreateSpeedtestError>> {
646
647    let uri_str = format!("{}/backup/_upgrade_/speedtest", configuration.base_path);
648    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
649
650    if let Some(ref user_agent) = configuration.user_agent {
651        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
652    }
653    if let Some(ref apikey) = configuration.api_key {
654        let key = apikey.key.clone();
655        let value = match apikey.prefix {
656            Some(ref prefix) => format!("{} {}", prefix, key),
657            None => key,
658        };
659        req_builder = req_builder.header("Authorization", value);
660    };
661    if let Some(ref apikey) = configuration.api_key {
662        let key = apikey.key.clone();
663        let value = match apikey.prefix {
664            Some(ref prefix) => format!("{} {}", prefix, key),
665            None => key,
666        };
667        req_builder = req_builder.header("CSRFPreventionToken", value);
668    };
669
670    let req = req_builder.build()?;
671    let resp = configuration.client.execute(req).await?;
672
673    let status = resp.status();
674    let content_type = resp
675        .headers()
676        .get("content-type")
677        .and_then(|v| v.to_str().ok())
678        .unwrap_or("application/octet-stream");
679    let content_type = super::ContentType::from(content_type);
680
681    if !status.is_client_error() && !status.is_server_error() {
682        let content = resp.text().await?;
683        match content_type {
684            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
685            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BackupUpgradeCreateSpeedtestResponse`"))),
686            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::BackupUpgradeCreateSpeedtestResponse`")))),
687        }
688    } else {
689        let content = resp.text().await?;
690        let entity: Option<BackupUpgradeCreateSpeedtestError> = serde_json::from_str(&content).ok();
691        Err(Error::ResponseError(ResponseContent { status, content, entity }))
692    }
693}
694
695/// Download archive from previous backup.
696pub async fn backup_upgrade_get_previous(configuration: &configuration::Configuration, archive_name: &str) -> Result<models::BackupUpgradeGetPreviousResponse, Error<BackupUpgradeGetPreviousError>> {
697    // add a prefix to parameters to efficiently prevent name collisions
698    let p_query_archive_name = archive_name;
699
700    let uri_str = format!("{}/backup/_upgrade_/previous", configuration.base_path);
701    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
702
703    req_builder = req_builder.query(&[("archive-name", &p_query_archive_name.to_string())]);
704    if let Some(ref user_agent) = configuration.user_agent {
705        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
706    }
707    if let Some(ref apikey) = configuration.api_key {
708        let key = apikey.key.clone();
709        let value = match apikey.prefix {
710            Some(ref prefix) => format!("{} {}", prefix, key),
711            None => key,
712        };
713        req_builder = req_builder.header("Authorization", value);
714    };
715    if let Some(ref apikey) = configuration.api_key {
716        let key = apikey.key.clone();
717        let value = match apikey.prefix {
718            Some(ref prefix) => format!("{} {}", prefix, key),
719            None => key,
720        };
721        req_builder = req_builder.header("CSRFPreventionToken", value);
722    };
723
724    let req = req_builder.build()?;
725    let resp = configuration.client.execute(req).await?;
726
727    let status = resp.status();
728    let content_type = resp
729        .headers()
730        .get("content-type")
731        .and_then(|v| v.to_str().ok())
732        .unwrap_or("application/octet-stream");
733    let content_type = super::ContentType::from(content_type);
734
735    if !status.is_client_error() && !status.is_server_error() {
736        let content = resp.text().await?;
737        match content_type {
738            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
739            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BackupUpgradeGetPreviousResponse`"))),
740            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::BackupUpgradeGetPreviousResponse`")))),
741        }
742    } else {
743        let content = resp.text().await?;
744        let entity: Option<BackupUpgradeGetPreviousError> = serde_json::from_str(&content).ok();
745        Err(Error::ResponseError(ResponseContent { status, content, entity }))
746    }
747}
748
749/// Get previous backup time.
750pub async fn backup_upgrade_get_previous_backup_time(configuration: &configuration::Configuration, ) -> Result<models::BackupUpgradeGetPreviousBackupTimeResponse, Error<BackupUpgradeGetPreviousBackupTimeError>> {
751
752    let uri_str = format!("{}/backup/_upgrade_/previous_backup_time", configuration.base_path);
753    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
754
755    if let Some(ref user_agent) = configuration.user_agent {
756        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
757    }
758    if let Some(ref apikey) = configuration.api_key {
759        let key = apikey.key.clone();
760        let value = match apikey.prefix {
761            Some(ref prefix) => format!("{} {}", prefix, key),
762            None => key,
763        };
764        req_builder = req_builder.header("Authorization", value);
765    };
766    if let Some(ref apikey) = configuration.api_key {
767        let key = apikey.key.clone();
768        let value = match apikey.prefix {
769            Some(ref prefix) => format!("{} {}", prefix, key),
770            None => key,
771        };
772        req_builder = req_builder.header("CSRFPreventionToken", value);
773    };
774
775    let req = req_builder.build()?;
776    let resp = configuration.client.execute(req).await?;
777
778    let status = resp.status();
779    let content_type = resp
780        .headers()
781        .get("content-type")
782        .and_then(|v| v.to_str().ok())
783        .unwrap_or("application/octet-stream");
784    let content_type = super::ContentType::from(content_type);
785
786    if !status.is_client_error() && !status.is_server_error() {
787        let content = resp.text().await?;
788        match content_type {
789            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
790            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BackupUpgradeGetPreviousBackupTimeResponse`"))),
791            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::BackupUpgradeGetPreviousBackupTimeResponse`")))),
792        }
793    } else {
794        let content = resp.text().await?;
795        let entity: Option<BackupUpgradeGetPreviousBackupTimeError> = serde_json::from_str(&content).ok();
796        Err(Error::ResponseError(ResponseContent { status, content, entity }))
797    }
798}
799
800/// Directory index.
801pub async fn backup_upgrade_get_upgrade(configuration: &configuration::Configuration, ) -> Result<models::BackupUpgradeGetUpgradeResponse, Error<BackupUpgradeGetUpgradeError>> {
802
803    let uri_str = format!("{}/backup/_upgrade_", configuration.base_path);
804    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
805
806    if let Some(ref user_agent) = configuration.user_agent {
807        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
808    }
809    if let Some(ref apikey) = configuration.api_key {
810        let key = apikey.key.clone();
811        let value = match apikey.prefix {
812            Some(ref prefix) => format!("{} {}", prefix, key),
813            None => key,
814        };
815        req_builder = req_builder.header("Authorization", value);
816    };
817    if let Some(ref apikey) = configuration.api_key {
818        let key = apikey.key.clone();
819        let value = match apikey.prefix {
820            Some(ref prefix) => format!("{} {}", prefix, key),
821            None => key,
822        };
823        req_builder = req_builder.header("CSRFPreventionToken", value);
824    };
825
826    let req = req_builder.build()?;
827    let resp = configuration.client.execute(req).await?;
828
829    let status = resp.status();
830    let content_type = resp
831        .headers()
832        .get("content-type")
833        .and_then(|v| v.to_str().ok())
834        .unwrap_or("application/octet-stream");
835    let content_type = super::ContentType::from(content_type);
836
837    if !status.is_client_error() && !status.is_server_error() {
838        let content = resp.text().await?;
839        match content_type {
840            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
841            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BackupUpgradeGetUpgradeResponse`"))),
842            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::BackupUpgradeGetUpgradeResponse`")))),
843        }
844    } else {
845        let content = resp.text().await?;
846        let entity: Option<BackupUpgradeGetUpgradeError> = serde_json::from_str(&content).ok();
847        Err(Error::ResponseError(ResponseContent { status, content, entity }))
848    }
849}
850
851/// Append chunk to dynamic index writer.
852pub async fn backup_upgrade_update_dynamic_index(configuration: &configuration::Configuration, backup_upgrade_update_dynamic_index_request: models::BackupUpgradeUpdateDynamicIndexRequest) -> Result<models::BackupUpgradeUpdateDynamicIndexResponse, Error<BackupUpgradeUpdateDynamicIndexError>> {
853    // add a prefix to parameters to efficiently prevent name collisions
854    let p_body_backup_upgrade_update_dynamic_index_request = backup_upgrade_update_dynamic_index_request;
855
856    let uri_str = format!("{}/backup/_upgrade_/dynamic_index", configuration.base_path);
857    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
858
859    if let Some(ref user_agent) = configuration.user_agent {
860        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
861    }
862    if let Some(ref apikey) = configuration.api_key {
863        let key = apikey.key.clone();
864        let value = match apikey.prefix {
865            Some(ref prefix) => format!("{} {}", prefix, key),
866            None => key,
867        };
868        req_builder = req_builder.header("Authorization", value);
869    };
870    if let Some(ref apikey) = configuration.api_key {
871        let key = apikey.key.clone();
872        let value = match apikey.prefix {
873            Some(ref prefix) => format!("{} {}", prefix, key),
874            None => key,
875        };
876        req_builder = req_builder.header("CSRFPreventionToken", value);
877    };
878    req_builder = req_builder.json(&p_body_backup_upgrade_update_dynamic_index_request);
879
880    let req = req_builder.build()?;
881    let resp = configuration.client.execute(req).await?;
882
883    let status = resp.status();
884    let content_type = resp
885        .headers()
886        .get("content-type")
887        .and_then(|v| v.to_str().ok())
888        .unwrap_or("application/octet-stream");
889    let content_type = super::ContentType::from(content_type);
890
891    if !status.is_client_error() && !status.is_server_error() {
892        let content = resp.text().await?;
893        match content_type {
894            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
895            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BackupUpgradeUpdateDynamicIndexResponse`"))),
896            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::BackupUpgradeUpdateDynamicIndexResponse`")))),
897        }
898    } else {
899        let content = resp.text().await?;
900        let entity: Option<BackupUpgradeUpdateDynamicIndexError> = serde_json::from_str(&content).ok();
901        Err(Error::ResponseError(ResponseContent { status, content, entity }))
902    }
903}
904
905/// Append chunk to fixed index writer.
906pub async fn backup_upgrade_update_fixed_index(configuration: &configuration::Configuration, backup_upgrade_update_fixed_index_request: models::BackupUpgradeUpdateFixedIndexRequest) -> Result<models::BackupUpgradeUpdateFixedIndexResponse, Error<BackupUpgradeUpdateFixedIndexError>> {
907    // add a prefix to parameters to efficiently prevent name collisions
908    let p_body_backup_upgrade_update_fixed_index_request = backup_upgrade_update_fixed_index_request;
909
910    let uri_str = format!("{}/backup/_upgrade_/fixed_index", configuration.base_path);
911    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
912
913    if let Some(ref user_agent) = configuration.user_agent {
914        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
915    }
916    if let Some(ref apikey) = configuration.api_key {
917        let key = apikey.key.clone();
918        let value = match apikey.prefix {
919            Some(ref prefix) => format!("{} {}", prefix, key),
920            None => key,
921        };
922        req_builder = req_builder.header("Authorization", value);
923    };
924    if let Some(ref apikey) = configuration.api_key {
925        let key = apikey.key.clone();
926        let value = match apikey.prefix {
927            Some(ref prefix) => format!("{} {}", prefix, key),
928            None => key,
929        };
930        req_builder = req_builder.header("CSRFPreventionToken", value);
931    };
932    req_builder = req_builder.json(&p_body_backup_upgrade_update_fixed_index_request);
933
934    let req = req_builder.build()?;
935    let resp = configuration.client.execute(req).await?;
936
937    let status = resp.status();
938    let content_type = resp
939        .headers()
940        .get("content-type")
941        .and_then(|v| v.to_str().ok())
942        .unwrap_or("application/octet-stream");
943    let content_type = super::ContentType::from(content_type);
944
945    if !status.is_client_error() && !status.is_server_error() {
946        let content = resp.text().await?;
947        match content_type {
948            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
949            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BackupUpgradeUpdateFixedIndexResponse`"))),
950            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::BackupUpgradeUpdateFixedIndexResponse`")))),
951        }
952    } else {
953        let content = resp.text().await?;
954        let entity: Option<BackupUpgradeUpdateFixedIndexError> = serde_json::from_str(&content).ok();
955        Err(Error::ResponseError(ResponseContent { status, content, entity }))
956    }
957}
958