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 InstanceAccessError {
22 Status400(models::InstancesPut400Response),
23 Status403(models::InstancesGet403Response),
24 Status500(models::InstancesGet500Response),
25 UnknownValue(serde_json::Value),
26}
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
30#[serde(untagged)]
31pub enum InstanceBackupDeleteError {
32 Status400(models::InstancesPut400Response),
33 Status403(models::InstancesGet403Response),
34 Status500(models::InstancesGet500Response),
35 UnknownValue(serde_json::Value),
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum InstanceBackupExportError {
42 Status403(models::InstancesGet403Response),
43 Status500(models::InstancesGet500Response),
44 UnknownValue(serde_json::Value),
45}
46
47#[derive(Debug, Clone, Serialize, Deserialize)]
49#[serde(untagged)]
50pub enum InstanceBackupGetError {
51 Status403(models::InstancesGet403Response),
52 Status500(models::InstancesGet500Response),
53 UnknownValue(serde_json::Value),
54}
55
56#[derive(Debug, Clone, Serialize, Deserialize)]
58#[serde(untagged)]
59pub enum InstanceBackupPostError {
60 Status400(models::InstancesPut400Response),
61 Status403(models::InstancesGet403Response),
62 Status500(models::InstancesGet500Response),
63 UnknownValue(serde_json::Value),
64}
65
66#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum InstanceBackupsGetError {
70 Status403(models::InstancesGet403Response),
71 Status500(models::InstancesGet500Response),
72 UnknownValue(serde_json::Value),
73}
74
75#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum InstanceBackupsGetRecursion1Error {
79 Status403(models::InstancesGet403Response),
80 Status500(models::InstancesGet500Response),
81 UnknownValue(serde_json::Value),
82}
83
84#[derive(Debug, Clone, Serialize, Deserialize)]
86#[serde(untagged)]
87pub enum InstanceBackupsPostError {
88 Status400(models::InstancesPut400Response),
89 Status403(models::InstancesGet403Response),
90 Status500(models::InstancesGet500Response),
91 UnknownValue(serde_json::Value),
92}
93
94#[derive(Debug, Clone, Serialize, Deserialize)]
96#[serde(untagged)]
97pub enum InstanceBitmapsPostError {
98 Status400(models::InstancesPut400Response),
99 Status403(models::InstancesGet403Response),
100 Status500(models::InstancesGet500Response),
101 UnknownValue(serde_json::Value),
102}
103
104#[derive(Debug, Clone, Serialize, Deserialize)]
106#[serde(untagged)]
107pub enum InstanceConsoleDeleteError {
108 Status400(models::InstancesPut400Response),
109 Status403(models::InstancesGet403Response),
110 Status404(models::InstanceConsoleGet404Response),
111 Status500(models::InstancesGet500Response),
112 UnknownValue(serde_json::Value),
113}
114
115#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum InstanceConsoleGetError {
119 Status400(models::InstancesPut400Response),
120 Status403(models::InstancesGet403Response),
121 Status404(models::InstanceConsoleGet404Response),
122 Status500(models::InstancesGet500Response),
123 UnknownValue(serde_json::Value),
124}
125
126#[derive(Debug, Clone, Serialize, Deserialize)]
128#[serde(untagged)]
129pub enum InstanceConsolePostError {
130 Status400(models::InstancesPut400Response),
131 Status403(models::InstancesGet403Response),
132 Status500(models::InstancesGet500Response),
133 UnknownValue(serde_json::Value),
134}
135
136#[derive(Debug, Clone, Serialize, Deserialize)]
138#[serde(untagged)]
139pub enum InstanceDebugMemoryGetError {
140 Status400(models::InstancesPut400Response),
141 Status403(models::InstancesGet403Response),
142 Status404(models::InstanceConsoleGet404Response),
143 Status500(models::InstancesGet500Response),
144 UnknownValue(serde_json::Value),
145}
146
147#[derive(Debug, Clone, Serialize, Deserialize)]
149#[serde(untagged)]
150pub enum InstanceDebugRepairPostError {
151 Status400(models::InstancesPut400Response),
152 Status403(models::InstancesGet403Response),
153 Status404(models::InstanceConsoleGet404Response),
154 Status500(models::InstancesGet500Response),
155 UnknownValue(serde_json::Value),
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum InstanceDeleteError {
162 Status400(models::InstancesPut400Response),
163 Status403(models::InstancesGet403Response),
164 Status500(models::InstancesGet500Response),
165 UnknownValue(serde_json::Value),
166}
167
168#[derive(Debug, Clone, Serialize, Deserialize)]
170#[serde(untagged)]
171pub enum InstanceExecOutputDeleteError {
172 Status400(models::InstancesPut400Response),
173 Status403(models::InstancesGet403Response),
174 Status404(models::InstanceConsoleGet404Response),
175 Status500(models::InstancesGet500Response),
176 UnknownValue(serde_json::Value),
177}
178
179#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum InstanceExecOutputGetError {
183 Status400(models::InstancesPut400Response),
184 Status403(models::InstancesGet403Response),
185 Status404(models::InstanceConsoleGet404Response),
186 Status500(models::InstancesGet500Response),
187 UnknownValue(serde_json::Value),
188}
189
190#[derive(Debug, Clone, Serialize, Deserialize)]
192#[serde(untagged)]
193pub enum InstanceExecOutputsGetError {
194 Status403(models::InstancesGet403Response),
195 Status404(models::InstanceConsoleGet404Response),
196 Status500(models::InstancesGet500Response),
197 UnknownValue(serde_json::Value),
198}
199
200#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum InstanceExecPostError {
204 Status400(models::InstancesPut400Response),
205 Status403(models::InstancesGet403Response),
206 Status500(models::InstancesGet500Response),
207 UnknownValue(serde_json::Value),
208}
209
210#[derive(Debug, Clone, Serialize, Deserialize)]
212#[serde(untagged)]
213pub enum InstanceFilesDeleteError {
214 Status400(models::InstancesPut400Response),
215 Status403(models::InstancesGet403Response),
216 Status404(models::InstanceConsoleGet404Response),
217 Status500(models::InstancesGet500Response),
218 UnknownValue(serde_json::Value),
219}
220
221#[derive(Debug, Clone, Serialize, Deserialize)]
223#[serde(untagged)]
224pub enum InstanceFilesGetError {
225 Status400(models::InstancesPut400Response),
226 Status403(models::InstancesGet403Response),
227 Status404(models::InstanceConsoleGet404Response),
228 Status500(models::InstancesGet500Response),
229 UnknownValue(serde_json::Value),
230}
231
232#[derive(Debug, Clone, Serialize, Deserialize)]
234#[serde(untagged)]
235pub enum InstanceFilesHeadError {
236 Status400(models::InstancesPut400Response),
237 Status403(models::InstancesGet403Response),
238 Status404(models::InstanceConsoleGet404Response),
239 Status500(models::InstancesGet500Response),
240 UnknownValue(serde_json::Value),
241}
242
243#[derive(Debug, Clone, Serialize, Deserialize)]
245#[serde(untagged)]
246pub enum InstanceFilesPostError {
247 Status400(models::InstancesPut400Response),
248 Status403(models::InstancesGet403Response),
249 Status404(models::InstanceConsoleGet404Response),
250 Status500(models::InstancesGet500Response),
251 UnknownValue(serde_json::Value),
252}
253
254#[derive(Debug, Clone, Serialize, Deserialize)]
256#[serde(untagged)]
257pub enum InstanceGetError {
258 Status403(models::InstancesGet403Response),
259 Status500(models::InstancesGet500Response),
260 UnknownValue(serde_json::Value),
261}
262
263#[derive(Debug, Clone, Serialize, Deserialize)]
265#[serde(untagged)]
266pub enum InstanceGetRecursion1Error {
267 Status403(models::InstancesGet403Response),
268 Status500(models::InstancesGet500Response),
269 UnknownValue(serde_json::Value),
270}
271
272#[derive(Debug, Clone, Serialize, Deserialize)]
274#[serde(untagged)]
275pub enum InstanceLogDeleteError {
276 Status400(models::InstancesPut400Response),
277 Status403(models::InstancesGet403Response),
278 Status404(models::InstanceConsoleGet404Response),
279 Status500(models::InstancesGet500Response),
280 UnknownValue(serde_json::Value),
281}
282
283#[derive(Debug, Clone, Serialize, Deserialize)]
285#[serde(untagged)]
286pub enum InstanceLogGetError {
287 Status400(models::InstancesPut400Response),
288 Status403(models::InstancesGet403Response),
289 Status404(models::InstanceConsoleGet404Response),
290 Status500(models::InstancesGet500Response),
291 UnknownValue(serde_json::Value),
292}
293
294#[derive(Debug, Clone, Serialize, Deserialize)]
296#[serde(untagged)]
297pub enum InstanceLogsGetError {
298 Status403(models::InstancesGet403Response),
299 Status404(models::InstanceConsoleGet404Response),
300 Status500(models::InstancesGet500Response),
301 UnknownValue(serde_json::Value),
302}
303
304#[derive(Debug, Clone, Serialize, Deserialize)]
306#[serde(untagged)]
307pub enum InstanceMetadataGetError {
308 Status403(models::InstancesGet403Response),
309 Status500(models::InstancesGet500Response),
310 UnknownValue(serde_json::Value),
311}
312
313#[derive(Debug, Clone, Serialize, Deserialize)]
315#[serde(untagged)]
316pub enum InstanceMetadataPatchError {
317 Status400(models::InstancesPut400Response),
318 Status403(models::InstancesGet403Response),
319 Status412(models::InstanceMetadataPut412Response),
320 Status500(models::InstancesGet500Response),
321 UnknownValue(serde_json::Value),
322}
323
324#[derive(Debug, Clone, Serialize, Deserialize)]
326#[serde(untagged)]
327pub enum InstanceMetadataPutError {
328 Status400(models::InstancesPut400Response),
329 Status403(models::InstancesGet403Response),
330 Status412(models::InstanceMetadataPut412Response),
331 Status500(models::InstancesGet500Response),
332 UnknownValue(serde_json::Value),
333}
334
335#[derive(Debug, Clone, Serialize, Deserialize)]
337#[serde(untagged)]
338pub enum InstanceMetadataTemplatesDeleteError {
339 Status400(models::InstancesPut400Response),
340 Status403(models::InstancesGet403Response),
341 Status404(models::InstanceConsoleGet404Response),
342 Status500(models::InstancesGet500Response),
343 UnknownValue(serde_json::Value),
344}
345
346#[derive(Debug, Clone, Serialize, Deserialize)]
348#[serde(untagged)]
349pub enum InstanceMetadataTemplatesGetError {
350 Status400(models::InstancesPut400Response),
351 Status403(models::InstancesGet403Response),
352 Status404(models::InstanceConsoleGet404Response),
353 Status500(models::InstancesGet500Response),
354 UnknownValue(serde_json::Value),
355}
356
357#[derive(Debug, Clone, Serialize, Deserialize)]
359#[serde(untagged)]
360pub enum InstanceMetadataTemplatesPostError {
361 Status400(models::InstancesPut400Response),
362 Status403(models::InstancesGet403Response),
363 Status404(models::InstanceConsoleGet404Response),
364 Status500(models::InstancesGet500Response),
365 UnknownValue(serde_json::Value),
366}
367
368#[derive(Debug, Clone, Serialize, Deserialize)]
370#[serde(untagged)]
371pub enum InstancePatchError {
372 Status400(models::InstancesPut400Response),
373 Status403(models::InstancesGet403Response),
374 Status500(models::InstancesGet500Response),
375 UnknownValue(serde_json::Value),
376}
377
378#[derive(Debug, Clone, Serialize, Deserialize)]
380#[serde(untagged)]
381pub enum InstancePostError {
382 Status400(models::InstancesPut400Response),
383 Status403(models::InstancesGet403Response),
384 Status500(models::InstancesGet500Response),
385 UnknownValue(serde_json::Value),
386}
387
388#[derive(Debug, Clone, Serialize, Deserialize)]
390#[serde(untagged)]
391pub enum InstancePutError {
392 Status400(models::InstancesPut400Response),
393 Status403(models::InstancesGet403Response),
394 Status500(models::InstancesGet500Response),
395 UnknownValue(serde_json::Value),
396}
397
398#[derive(Debug, Clone, Serialize, Deserialize)]
400#[serde(untagged)]
401pub enum InstanceRebuildPostError {
402 Status400(models::InstancesPut400Response),
403 Status403(models::InstancesGet403Response),
404 Status404(models::InstanceConsoleGet404Response),
405 Status500(models::InstancesGet500Response),
406 UnknownValue(serde_json::Value),
407}
408
409#[derive(Debug, Clone, Serialize, Deserialize)]
411#[serde(untagged)]
412pub enum InstanceSftpError {
413 Status400(models::InstancesPut400Response),
414 Status403(models::InstancesGet403Response),
415 Status404(models::InstanceConsoleGet404Response),
416 Status500(models::InstancesGet500Response),
417 UnknownValue(serde_json::Value),
418}
419
420#[derive(Debug, Clone, Serialize, Deserialize)]
422#[serde(untagged)]
423pub enum InstanceSnapshotDeleteError {
424 Status400(models::InstancesPut400Response),
425 Status403(models::InstancesGet403Response),
426 Status500(models::InstancesGet500Response),
427 UnknownValue(serde_json::Value),
428}
429
430#[derive(Debug, Clone, Serialize, Deserialize)]
432#[serde(untagged)]
433pub enum InstanceSnapshotGetError {
434 Status403(models::InstancesGet403Response),
435 Status500(models::InstancesGet500Response),
436 UnknownValue(serde_json::Value),
437}
438
439#[derive(Debug, Clone, Serialize, Deserialize)]
441#[serde(untagged)]
442pub enum InstanceSnapshotPatchError {
443 Status400(models::InstancesPut400Response),
444 Status403(models::InstancesGet403Response),
445 Status500(models::InstancesGet500Response),
446 UnknownValue(serde_json::Value),
447}
448
449#[derive(Debug, Clone, Serialize, Deserialize)]
451#[serde(untagged)]
452pub enum InstanceSnapshotPostError {
453 Status400(models::InstancesPut400Response),
454 Status403(models::InstancesGet403Response),
455 Status500(models::InstancesGet500Response),
456 UnknownValue(serde_json::Value),
457}
458
459#[derive(Debug, Clone, Serialize, Deserialize)]
461#[serde(untagged)]
462pub enum InstanceSnapshotPutError {
463 Status400(models::InstancesPut400Response),
464 Status403(models::InstancesGet403Response),
465 Status500(models::InstancesGet500Response),
466 UnknownValue(serde_json::Value),
467}
468
469#[derive(Debug, Clone, Serialize, Deserialize)]
471#[serde(untagged)]
472pub enum InstanceSnapshotsGetError {
473 Status403(models::InstancesGet403Response),
474 Status500(models::InstancesGet500Response),
475 UnknownValue(serde_json::Value),
476}
477
478#[derive(Debug, Clone, Serialize, Deserialize)]
480#[serde(untagged)]
481pub enum InstanceSnapshotsGetRecursion1Error {
482 Status403(models::InstancesGet403Response),
483 Status500(models::InstancesGet500Response),
484 UnknownValue(serde_json::Value),
485}
486
487#[derive(Debug, Clone, Serialize, Deserialize)]
489#[serde(untagged)]
490pub enum InstanceSnapshotsPostError {
491 Status400(models::InstancesPut400Response),
492 Status403(models::InstancesGet403Response),
493 Status500(models::InstancesGet500Response),
494 UnknownValue(serde_json::Value),
495}
496
497#[derive(Debug, Clone, Serialize, Deserialize)]
499#[serde(untagged)]
500pub enum InstanceStateGetError {
501 Status400(models::InstancesPut400Response),
502 Status403(models::InstancesGet403Response),
503 Status500(models::InstancesGet500Response),
504 UnknownValue(serde_json::Value),
505}
506
507#[derive(Debug, Clone, Serialize, Deserialize)]
509#[serde(untagged)]
510pub enum InstanceStatePutError {
511 Status400(models::InstancesPut400Response),
512 Status403(models::InstancesGet403Response),
513 Status500(models::InstancesGet500Response),
514 UnknownValue(serde_json::Value),
515}
516
517#[derive(Debug, Clone, Serialize, Deserialize)]
519#[serde(untagged)]
520pub enum InstancesGetError {
521 Status403(models::InstancesGet403Response),
522 Status500(models::InstancesGet500Response),
523 UnknownValue(serde_json::Value),
524}
525
526#[derive(Debug, Clone, Serialize, Deserialize)]
528#[serde(untagged)]
529pub enum InstancesPostError {
530 Status400(models::InstancesPut400Response),
531 Status403(models::InstancesGet403Response),
532 Status500(models::InstancesGet500Response),
533 UnknownValue(serde_json::Value),
534}
535
536#[derive(Debug, Clone, Serialize, Deserialize)]
538#[serde(untagged)]
539pub enum InstancesPutError {
540 Status400(models::InstancesPut400Response),
541 Status403(models::InstancesGet403Response),
542 Status500(models::InstancesGet500Response),
543 UnknownValue(serde_json::Value),
544}
545
546
547pub async fn instance_access(configuration: &configuration::Configuration, name: &str, project: Option<&str>) -> Result<models::InstanceAccess200Response, Error<InstanceAccessError>> {
549 let p_path_name = name;
551 let p_query_project = project;
552
553 let uri_str = format!("{}/1.0/instances/{name}/access", configuration.base_path, name=crate::apis::urlencode(p_path_name));
554 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
555
556 if let Some(ref param_value) = p_query_project {
557 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
558 }
559 if let Some(ref user_agent) = configuration.user_agent {
560 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
561 }
562
563 let req = req_builder.build()?;
564 let resp = configuration.client.execute(req).await?;
565
566 let status = resp.status();
567 let content_type = resp
568 .headers()
569 .get("content-type")
570 .and_then(|v| v.to_str().ok())
571 .unwrap_or("application/octet-stream");
572 let content_type = super::ContentType::from(content_type);
573
574 if !status.is_client_error() && !status.is_server_error() {
575 let content = resp.text().await?;
576 match content_type {
577 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
578 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstanceAccess200Response`"))),
579 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::InstanceAccess200Response`")))),
580 }
581 } else {
582 let content = resp.text().await?;
583 let entity: Option<InstanceAccessError> = serde_json::from_str(&content).ok();
584 Err(Error::ResponseError(ResponseContent { status, content, entity }))
585 }
586}
587
588pub async fn instance_backup_delete(configuration: &configuration::Configuration, name: &str, backup: &str, project: Option<&str>) -> Result<models::InstancesPut202Response, Error<InstanceBackupDeleteError>> {
590 let p_path_name = name;
592 let p_path_backup = backup;
593 let p_query_project = project;
594
595 let uri_str = format!("{}/1.0/instances/{name}/backups/{backup}", configuration.base_path, name=crate::apis::urlencode(p_path_name), backup=crate::apis::urlencode(p_path_backup));
596 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
597
598 if let Some(ref param_value) = p_query_project {
599 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
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
605 let req = req_builder.build()?;
606 let resp = configuration.client.execute(req).await?;
607
608 let status = resp.status();
609 let content_type = resp
610 .headers()
611 .get("content-type")
612 .and_then(|v| v.to_str().ok())
613 .unwrap_or("application/octet-stream");
614 let content_type = super::ContentType::from(content_type);
615
616 if !status.is_client_error() && !status.is_server_error() {
617 let content = resp.text().await?;
618 match content_type {
619 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
620 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancesPut202Response`"))),
621 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::InstancesPut202Response`")))),
622 }
623 } else {
624 let content = resp.text().await?;
625 let entity: Option<InstanceBackupDeleteError> = serde_json::from_str(&content).ok();
626 Err(Error::ResponseError(ResponseContent { status, content, entity }))
627 }
628}
629
630pub async fn instance_backup_export(configuration: &configuration::Configuration, name: &str, backup: &str, project: Option<&str>) -> Result<(), Error<InstanceBackupExportError>> {
632 let p_path_name = name;
634 let p_path_backup = backup;
635 let p_query_project = project;
636
637 let uri_str = format!("{}/1.0/instances/{name}/backups/{backup}/export", configuration.base_path, name=crate::apis::urlencode(p_path_name), backup=crate::apis::urlencode(p_path_backup));
638 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
639
640 if let Some(ref param_value) = p_query_project {
641 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
642 }
643 if let Some(ref user_agent) = configuration.user_agent {
644 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
645 }
646
647 let req = req_builder.build()?;
648 let resp = configuration.client.execute(req).await?;
649
650 let status = resp.status();
651
652 if !status.is_client_error() && !status.is_server_error() {
653 Ok(())
654 } else {
655 let content = resp.text().await?;
656 let entity: Option<InstanceBackupExportError> = serde_json::from_str(&content).ok();
657 Err(Error::ResponseError(ResponseContent { status, content, entity }))
658 }
659}
660
661pub async fn instance_backup_get(configuration: &configuration::Configuration, name: &str, backup: &str, project: Option<&str>) -> Result<models::InstanceBackupGet200Response, Error<InstanceBackupGetError>> {
663 let p_path_name = name;
665 let p_path_backup = backup;
666 let p_query_project = project;
667
668 let uri_str = format!("{}/1.0/instances/{name}/backups/{backup}", configuration.base_path, name=crate::apis::urlencode(p_path_name), backup=crate::apis::urlencode(p_path_backup));
669 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
670
671 if let Some(ref param_value) = p_query_project {
672 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
673 }
674 if let Some(ref user_agent) = configuration.user_agent {
675 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
676 }
677
678 let req = req_builder.build()?;
679 let resp = configuration.client.execute(req).await?;
680
681 let status = resp.status();
682 let content_type = resp
683 .headers()
684 .get("content-type")
685 .and_then(|v| v.to_str().ok())
686 .unwrap_or("application/octet-stream");
687 let content_type = super::ContentType::from(content_type);
688
689 if !status.is_client_error() && !status.is_server_error() {
690 let content = resp.text().await?;
691 match content_type {
692 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
693 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstanceBackupGet200Response`"))),
694 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::InstanceBackupGet200Response`")))),
695 }
696 } else {
697 let content = resp.text().await?;
698 let entity: Option<InstanceBackupGetError> = serde_json::from_str(&content).ok();
699 Err(Error::ResponseError(ResponseContent { status, content, entity }))
700 }
701}
702
703pub async fn instance_backup_post(configuration: &configuration::Configuration, name: &str, backup: &str, project: Option<&str>, backup2: Option<models::InstanceBackupPost>) -> Result<models::InstancesPut202Response, Error<InstanceBackupPostError>> {
705 let p_path_name = name;
707 let p_path_backup = backup;
708 let p_query_project = project;
709 let p_body_backup = backup2;
710
711 let uri_str = format!("{}/1.0/instances/{name}/backups/{backup}", configuration.base_path, name=crate::apis::urlencode(p_path_name), backup=crate::apis::urlencode(p_path_backup));
712 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
713
714 if let Some(ref param_value) = p_query_project {
715 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
716 }
717 if let Some(ref user_agent) = configuration.user_agent {
718 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
719 }
720 req_builder = req_builder.json(&p_body_backup);
721
722 let req = req_builder.build()?;
723 let resp = configuration.client.execute(req).await?;
724
725 let status = resp.status();
726 let content_type = resp
727 .headers()
728 .get("content-type")
729 .and_then(|v| v.to_str().ok())
730 .unwrap_or("application/octet-stream");
731 let content_type = super::ContentType::from(content_type);
732
733 if !status.is_client_error() && !status.is_server_error() {
734 let content = resp.text().await?;
735 match content_type {
736 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
737 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancesPut202Response`"))),
738 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::InstancesPut202Response`")))),
739 }
740 } else {
741 let content = resp.text().await?;
742 let entity: Option<InstanceBackupPostError> = serde_json::from_str(&content).ok();
743 Err(Error::ResponseError(ResponseContent { status, content, entity }))
744 }
745}
746
747pub async fn instance_backups_get(configuration: &configuration::Configuration, name: &str, project: Option<&str>) -> Result<models::InstanceBackupsGet200Response, Error<InstanceBackupsGetError>> {
749 let p_path_name = name;
751 let p_query_project = project;
752
753 let uri_str = format!("{}/1.0/instances/{name}/backups", configuration.base_path, name=crate::apis::urlencode(p_path_name));
754 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
755
756 if let Some(ref param_value) = p_query_project {
757 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
758 }
759 if let Some(ref user_agent) = configuration.user_agent {
760 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
761 }
762
763 let req = req_builder.build()?;
764 let resp = configuration.client.execute(req).await?;
765
766 let status = resp.status();
767 let content_type = resp
768 .headers()
769 .get("content-type")
770 .and_then(|v| v.to_str().ok())
771 .unwrap_or("application/octet-stream");
772 let content_type = super::ContentType::from(content_type);
773
774 if !status.is_client_error() && !status.is_server_error() {
775 let content = resp.text().await?;
776 match content_type {
777 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
778 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstanceBackupsGet200Response`"))),
779 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::InstanceBackupsGet200Response`")))),
780 }
781 } else {
782 let content = resp.text().await?;
783 let entity: Option<InstanceBackupsGetError> = serde_json::from_str(&content).ok();
784 Err(Error::ResponseError(ResponseContent { status, content, entity }))
785 }
786}
787
788pub async fn instance_backups_get_recursion1(configuration: &configuration::Configuration, name: &str, project: Option<&str>) -> Result<models::InstanceBackupsGetRecursion1200Response, Error<InstanceBackupsGetRecursion1Error>> {
790 let p_path_name = name;
792 let p_query_project = project;
793
794 let uri_str = format!("{}/1.0/instances/{name}/backups?recursion=1", configuration.base_path, name=crate::apis::urlencode(p_path_name));
795 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
796
797 if let Some(ref param_value) = p_query_project {
798 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
799 }
800 if let Some(ref user_agent) = configuration.user_agent {
801 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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::InstanceBackupsGetRecursion1200Response`"))),
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::InstanceBackupsGetRecursion1200Response`")))),
821 }
822 } else {
823 let content = resp.text().await?;
824 let entity: Option<InstanceBackupsGetRecursion1Error> = serde_json::from_str(&content).ok();
825 Err(Error::ResponseError(ResponseContent { status, content, entity }))
826 }
827}
828
829pub async fn instance_backups_post(configuration: &configuration::Configuration, name: &str, project: Option<&str>, backup: Option<models::InstanceBackupsPost>) -> Result<models::InstancesPut202Response, Error<InstanceBackupsPostError>> {
831 let p_path_name = name;
833 let p_query_project = project;
834 let p_body_backup = backup;
835
836 let uri_str = format!("{}/1.0/instances/{name}/backups", configuration.base_path, name=crate::apis::urlencode(p_path_name));
837 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
838
839 if let Some(ref param_value) = p_query_project {
840 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
841 }
842 if let Some(ref user_agent) = configuration.user_agent {
843 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
844 }
845 req_builder = req_builder.json(&p_body_backup);
846
847 let req = req_builder.build()?;
848 let resp = configuration.client.execute(req).await?;
849
850 let status = resp.status();
851 let content_type = resp
852 .headers()
853 .get("content-type")
854 .and_then(|v| v.to_str().ok())
855 .unwrap_or("application/octet-stream");
856 let content_type = super::ContentType::from(content_type);
857
858 if !status.is_client_error() && !status.is_server_error() {
859 let content = resp.text().await?;
860 match content_type {
861 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
862 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancesPut202Response`"))),
863 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::InstancesPut202Response`")))),
864 }
865 } else {
866 let content = resp.text().await?;
867 let entity: Option<InstanceBackupsPostError> = serde_json::from_str(&content).ok();
868 Err(Error::ResponseError(ResponseContent { status, content, entity }))
869 }
870}
871
872pub async fn instance_bitmaps_post(configuration: &configuration::Configuration, name: &str, project: Option<&str>, bitmap: Option<models::StorageVolumeBitmapsPost>) -> Result<models::InstancesPut202Response, Error<InstanceBitmapsPostError>> {
874 let p_path_name = name;
876 let p_query_project = project;
877 let p_body_bitmap = bitmap;
878
879 let uri_str = format!("{}/1.0/instances/{name}/bitmaps", configuration.base_path, name=crate::apis::urlencode(p_path_name));
880 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
881
882 if let Some(ref param_value) = p_query_project {
883 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
884 }
885 if let Some(ref user_agent) = configuration.user_agent {
886 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
887 }
888 req_builder = req_builder.json(&p_body_bitmap);
889
890 let req = req_builder.build()?;
891 let resp = configuration.client.execute(req).await?;
892
893 let status = resp.status();
894 let content_type = resp
895 .headers()
896 .get("content-type")
897 .and_then(|v| v.to_str().ok())
898 .unwrap_or("application/octet-stream");
899 let content_type = super::ContentType::from(content_type);
900
901 if !status.is_client_error() && !status.is_server_error() {
902 let content = resp.text().await?;
903 match content_type {
904 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
905 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancesPut202Response`"))),
906 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::InstancesPut202Response`")))),
907 }
908 } else {
909 let content = resp.text().await?;
910 let entity: Option<InstanceBitmapsPostError> = serde_json::from_str(&content).ok();
911 Err(Error::ResponseError(ResponseContent { status, content, entity }))
912 }
913}
914
915pub async fn instance_console_delete(configuration: &configuration::Configuration, name: &str, project: Option<&str>) -> Result<models::InstancePatch200Response, Error<InstanceConsoleDeleteError>> {
917 let p_path_name = name;
919 let p_query_project = project;
920
921 let uri_str = format!("{}/1.0/instances/{name}/console", configuration.base_path, name=crate::apis::urlencode(p_path_name));
922 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
923
924 if let Some(ref param_value) = p_query_project {
925 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
926 }
927 if let Some(ref user_agent) = configuration.user_agent {
928 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
929 }
930
931 let req = req_builder.build()?;
932 let resp = configuration.client.execute(req).await?;
933
934 let status = resp.status();
935 let content_type = resp
936 .headers()
937 .get("content-type")
938 .and_then(|v| v.to_str().ok())
939 .unwrap_or("application/octet-stream");
940 let content_type = super::ContentType::from(content_type);
941
942 if !status.is_client_error() && !status.is_server_error() {
943 let content = resp.text().await?;
944 match content_type {
945 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
946 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancePatch200Response`"))),
947 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::InstancePatch200Response`")))),
948 }
949 } else {
950 let content = resp.text().await?;
951 let entity: Option<InstanceConsoleDeleteError> = serde_json::from_str(&content).ok();
952 Err(Error::ResponseError(ResponseContent { status, content, entity }))
953 }
954}
955
956pub async fn instance_console_get(configuration: &configuration::Configuration, name: &str, project: Option<&str>, r#type: Option<&str>) -> Result<(), Error<InstanceConsoleGetError>> {
958 let p_path_name = name;
960 let p_query_project = project;
961 let p_query_type = r#type;
962
963 let uri_str = format!("{}/1.0/instances/{name}/console", configuration.base_path, name=crate::apis::urlencode(p_path_name));
964 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
965
966 if let Some(ref param_value) = p_query_project {
967 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
968 }
969 if let Some(ref param_value) = p_query_type {
970 req_builder = req_builder.query(&[("type", ¶m_value.to_string())]);
971 }
972 if let Some(ref user_agent) = configuration.user_agent {
973 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
974 }
975
976 let req = req_builder.build()?;
977 let resp = configuration.client.execute(req).await?;
978
979 let status = resp.status();
980
981 if !status.is_client_error() && !status.is_server_error() {
982 Ok(())
983 } else {
984 let content = resp.text().await?;
985 let entity: Option<InstanceConsoleGetError> = serde_json::from_str(&content).ok();
986 Err(Error::ResponseError(ResponseContent { status, content, entity }))
987 }
988}
989
990pub async fn instance_console_post(configuration: &configuration::Configuration, name: &str, project: Option<&str>, console: Option<models::InstanceConsolePost>) -> Result<models::InstancesPut202Response, Error<InstanceConsolePostError>> {
992 let p_path_name = name;
994 let p_query_project = project;
995 let p_body_console = console;
996
997 let uri_str = format!("{}/1.0/instances/{name}/console", configuration.base_path, name=crate::apis::urlencode(p_path_name));
998 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
999
1000 if let Some(ref param_value) = p_query_project {
1001 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1002 }
1003 if let Some(ref user_agent) = configuration.user_agent {
1004 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1005 }
1006 req_builder = req_builder.json(&p_body_console);
1007
1008 let req = req_builder.build()?;
1009 let resp = configuration.client.execute(req).await?;
1010
1011 let status = resp.status();
1012 let content_type = resp
1013 .headers()
1014 .get("content-type")
1015 .and_then(|v| v.to_str().ok())
1016 .unwrap_or("application/octet-stream");
1017 let content_type = super::ContentType::from(content_type);
1018
1019 if !status.is_client_error() && !status.is_server_error() {
1020 let content = resp.text().await?;
1021 match content_type {
1022 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1023 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancesPut202Response`"))),
1024 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::InstancesPut202Response`")))),
1025 }
1026 } else {
1027 let content = resp.text().await?;
1028 let entity: Option<InstanceConsolePostError> = serde_json::from_str(&content).ok();
1029 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1030 }
1031}
1032
1033pub async fn instance_debug_memory_get(configuration: &configuration::Configuration, name: &str, project: Option<&str>, format: Option<&str>) -> Result<(), Error<InstanceDebugMemoryGetError>> {
1035 let p_path_name = name;
1037 let p_query_project = project;
1038 let p_query_format = format;
1039
1040 let uri_str = format!("{}/1.0/instances/{name}/debug/memory", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1041 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1042
1043 if let Some(ref param_value) = p_query_project {
1044 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1045 }
1046 if let Some(ref param_value) = p_query_format {
1047 req_builder = req_builder.query(&[("format", ¶m_value.to_string())]);
1048 }
1049 if let Some(ref user_agent) = configuration.user_agent {
1050 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1051 }
1052
1053 let req = req_builder.build()?;
1054 let resp = configuration.client.execute(req).await?;
1055
1056 let status = resp.status();
1057
1058 if !status.is_client_error() && !status.is_server_error() {
1059 Ok(())
1060 } else {
1061 let content = resp.text().await?;
1062 let entity: Option<InstanceDebugMemoryGetError> = serde_json::from_str(&content).ok();
1063 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1064 }
1065}
1066
1067pub async fn instance_debug_repair_post(configuration: &configuration::Configuration, name: &str, project: Option<&str>, state: Option<models::InstanceDebugRepairPost>) -> Result<models::InstancePatch200Response, Error<InstanceDebugRepairPostError>> {
1069 let p_path_name = name;
1071 let p_query_project = project;
1072 let p_body_state = state;
1073
1074 let uri_str = format!("{}/1.0/instances/{name}/debug/repair", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1075 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1076
1077 if let Some(ref param_value) = p_query_project {
1078 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1079 }
1080 if let Some(ref user_agent) = configuration.user_agent {
1081 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1082 }
1083 req_builder = req_builder.json(&p_body_state);
1084
1085 let req = req_builder.build()?;
1086 let resp = configuration.client.execute(req).await?;
1087
1088 let status = resp.status();
1089 let content_type = resp
1090 .headers()
1091 .get("content-type")
1092 .and_then(|v| v.to_str().ok())
1093 .unwrap_or("application/octet-stream");
1094 let content_type = super::ContentType::from(content_type);
1095
1096 if !status.is_client_error() && !status.is_server_error() {
1097 let content = resp.text().await?;
1098 match content_type {
1099 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1100 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancePatch200Response`"))),
1101 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::InstancePatch200Response`")))),
1102 }
1103 } else {
1104 let content = resp.text().await?;
1105 let entity: Option<InstanceDebugRepairPostError> = serde_json::from_str(&content).ok();
1106 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1107 }
1108}
1109
1110pub async fn instance_delete(configuration: &configuration::Configuration, name: &str, project: Option<&str>) -> Result<models::InstancesPut202Response, Error<InstanceDeleteError>> {
1112 let p_path_name = name;
1114 let p_query_project = project;
1115
1116 let uri_str = format!("{}/1.0/instances/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1117 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1118
1119 if let Some(ref param_value) = p_query_project {
1120 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1121 }
1122 if let Some(ref user_agent) = configuration.user_agent {
1123 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1124 }
1125
1126 let req = req_builder.build()?;
1127 let resp = configuration.client.execute(req).await?;
1128
1129 let status = resp.status();
1130 let content_type = resp
1131 .headers()
1132 .get("content-type")
1133 .and_then(|v| v.to_str().ok())
1134 .unwrap_or("application/octet-stream");
1135 let content_type = super::ContentType::from(content_type);
1136
1137 if !status.is_client_error() && !status.is_server_error() {
1138 let content = resp.text().await?;
1139 match content_type {
1140 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1141 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancesPut202Response`"))),
1142 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::InstancesPut202Response`")))),
1143 }
1144 } else {
1145 let content = resp.text().await?;
1146 let entity: Option<InstanceDeleteError> = serde_json::from_str(&content).ok();
1147 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1148 }
1149}
1150
1151pub async fn instance_exec_output_delete(configuration: &configuration::Configuration, name: &str, filename: &str, project: Option<&str>) -> Result<models::InstancePatch200Response, Error<InstanceExecOutputDeleteError>> {
1153 let p_path_name = name;
1155 let p_path_filename = filename;
1156 let p_query_project = project;
1157
1158 let uri_str = format!("{}/1.0/instances/{name}/logs/exec-output/{filename}", configuration.base_path, name=crate::apis::urlencode(p_path_name), filename=crate::apis::urlencode(p_path_filename));
1159 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1160
1161 if let Some(ref param_value) = p_query_project {
1162 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1163 }
1164 if let Some(ref user_agent) = configuration.user_agent {
1165 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1166 }
1167
1168 let req = req_builder.build()?;
1169 let resp = configuration.client.execute(req).await?;
1170
1171 let status = resp.status();
1172 let content_type = resp
1173 .headers()
1174 .get("content-type")
1175 .and_then(|v| v.to_str().ok())
1176 .unwrap_or("application/octet-stream");
1177 let content_type = super::ContentType::from(content_type);
1178
1179 if !status.is_client_error() && !status.is_server_error() {
1180 let content = resp.text().await?;
1181 match content_type {
1182 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1183 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancePatch200Response`"))),
1184 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::InstancePatch200Response`")))),
1185 }
1186 } else {
1187 let content = resp.text().await?;
1188 let entity: Option<InstanceExecOutputDeleteError> = serde_json::from_str(&content).ok();
1189 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1190 }
1191}
1192
1193pub async fn instance_exec_output_get(configuration: &configuration::Configuration, name: &str, filename: &str, project: Option<&str>) -> Result<(), Error<InstanceExecOutputGetError>> {
1195 let p_path_name = name;
1197 let p_path_filename = filename;
1198 let p_query_project = project;
1199
1200 let uri_str = format!("{}/1.0/instances/{name}/logs/exec-output/{filename}", configuration.base_path, name=crate::apis::urlencode(p_path_name), filename=crate::apis::urlencode(p_path_filename));
1201 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1202
1203 if let Some(ref param_value) = p_query_project {
1204 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1205 }
1206 if let Some(ref user_agent) = configuration.user_agent {
1207 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1208 }
1209
1210 let req = req_builder.build()?;
1211 let resp = configuration.client.execute(req).await?;
1212
1213 let status = resp.status();
1214
1215 if !status.is_client_error() && !status.is_server_error() {
1216 Ok(())
1217 } else {
1218 let content = resp.text().await?;
1219 let entity: Option<InstanceExecOutputGetError> = serde_json::from_str(&content).ok();
1220 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1221 }
1222}
1223
1224pub async fn instance_exec_outputs_get(configuration: &configuration::Configuration, name: &str, project: Option<&str>) -> Result<models::InstanceExecOutputsGet200Response, Error<InstanceExecOutputsGetError>> {
1226 let p_path_name = name;
1228 let p_query_project = project;
1229
1230 let uri_str = format!("{}/1.0/instances/{name}/logs/exec-output", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1231 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1232
1233 if let Some(ref param_value) = p_query_project {
1234 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1235 }
1236 if let Some(ref user_agent) = configuration.user_agent {
1237 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1238 }
1239
1240 let req = req_builder.build()?;
1241 let resp = configuration.client.execute(req).await?;
1242
1243 let status = resp.status();
1244 let content_type = resp
1245 .headers()
1246 .get("content-type")
1247 .and_then(|v| v.to_str().ok())
1248 .unwrap_or("application/octet-stream");
1249 let content_type = super::ContentType::from(content_type);
1250
1251 if !status.is_client_error() && !status.is_server_error() {
1252 let content = resp.text().await?;
1253 match content_type {
1254 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1255 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstanceExecOutputsGet200Response`"))),
1256 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::InstanceExecOutputsGet200Response`")))),
1257 }
1258 } else {
1259 let content = resp.text().await?;
1260 let entity: Option<InstanceExecOutputsGetError> = serde_json::from_str(&content).ok();
1261 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1262 }
1263}
1264
1265pub async fn instance_exec_post(configuration: &configuration::Configuration, name: &str, project: Option<&str>, exec: Option<models::InstanceExecPost>) -> Result<models::InstancesPut202Response, Error<InstanceExecPostError>> {
1267 let p_path_name = name;
1269 let p_query_project = project;
1270 let p_body_exec = exec;
1271
1272 let uri_str = format!("{}/1.0/instances/{name}/exec", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1273 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1274
1275 if let Some(ref param_value) = p_query_project {
1276 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1277 }
1278 if let Some(ref user_agent) = configuration.user_agent {
1279 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1280 }
1281 req_builder = req_builder.json(&p_body_exec);
1282
1283 let req = req_builder.build()?;
1284 let resp = configuration.client.execute(req).await?;
1285
1286 let status = resp.status();
1287 let content_type = resp
1288 .headers()
1289 .get("content-type")
1290 .and_then(|v| v.to_str().ok())
1291 .unwrap_or("application/octet-stream");
1292 let content_type = super::ContentType::from(content_type);
1293
1294 if !status.is_client_error() && !status.is_server_error() {
1295 let content = resp.text().await?;
1296 match content_type {
1297 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1298 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancesPut202Response`"))),
1299 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::InstancesPut202Response`")))),
1300 }
1301 } else {
1302 let content = resp.text().await?;
1303 let entity: Option<InstanceExecPostError> = serde_json::from_str(&content).ok();
1304 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1305 }
1306}
1307
1308pub async fn instance_files_delete(configuration: &configuration::Configuration, name: &str, path: Option<&str>, project: Option<&str>, x_incus_force: Option<&str>) -> Result<models::InstancePatch200Response, Error<InstanceFilesDeleteError>> {
1310 let p_path_name = name;
1312 let p_query_path = path;
1313 let p_query_project = project;
1314 let p_header_x_incus_force = x_incus_force;
1315
1316 let uri_str = format!("{}/1.0/instances/{name}/files", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1317 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1318
1319 if let Some(ref param_value) = p_query_path {
1320 req_builder = req_builder.query(&[("path", ¶m_value.to_string())]);
1321 }
1322 if let Some(ref param_value) = p_query_project {
1323 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1324 }
1325 if let Some(ref user_agent) = configuration.user_agent {
1326 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1327 }
1328 if let Some(param_value) = p_header_x_incus_force {
1329 req_builder = req_builder.header("X-Incus-force", param_value.to_string());
1330 }
1331
1332 let req = req_builder.build()?;
1333 let resp = configuration.client.execute(req).await?;
1334
1335 let status = resp.status();
1336 let content_type = resp
1337 .headers()
1338 .get("content-type")
1339 .and_then(|v| v.to_str().ok())
1340 .unwrap_or("application/octet-stream");
1341 let content_type = super::ContentType::from(content_type);
1342
1343 if !status.is_client_error() && !status.is_server_error() {
1344 let content = resp.text().await?;
1345 match content_type {
1346 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1347 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancePatch200Response`"))),
1348 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::InstancePatch200Response`")))),
1349 }
1350 } else {
1351 let content = resp.text().await?;
1352 let entity: Option<InstanceFilesDeleteError> = serde_json::from_str(&content).ok();
1353 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1354 }
1355}
1356
1357pub async fn instance_files_get(configuration: &configuration::Configuration, name: &str, path: Option<&str>, project: Option<&str>) -> Result<(), Error<InstanceFilesGetError>> {
1359 let p_path_name = name;
1361 let p_query_path = path;
1362 let p_query_project = project;
1363
1364 let uri_str = format!("{}/1.0/instances/{name}/files", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1365 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1366
1367 if let Some(ref param_value) = p_query_path {
1368 req_builder = req_builder.query(&[("path", ¶m_value.to_string())]);
1369 }
1370 if let Some(ref param_value) = p_query_project {
1371 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1372 }
1373 if let Some(ref user_agent) = configuration.user_agent {
1374 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1375 }
1376
1377 let req = req_builder.build()?;
1378 let resp = configuration.client.execute(req).await?;
1379
1380 let status = resp.status();
1381
1382 if !status.is_client_error() && !status.is_server_error() {
1383 Ok(())
1384 } else {
1385 let content = resp.text().await?;
1386 let entity: Option<InstanceFilesGetError> = serde_json::from_str(&content).ok();
1387 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1388 }
1389}
1390
1391pub async fn instance_files_head(configuration: &configuration::Configuration, name: &str, path: Option<&str>, project: Option<&str>) -> Result<(), Error<InstanceFilesHeadError>> {
1393 let p_path_name = name;
1395 let p_query_path = path;
1396 let p_query_project = project;
1397
1398 let uri_str = format!("{}/1.0/instances/{name}/files", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1399 let mut req_builder = configuration.client.request(reqwest::Method::HEAD, &uri_str);
1400
1401 if let Some(ref param_value) = p_query_path {
1402 req_builder = req_builder.query(&[("path", ¶m_value.to_string())]);
1403 }
1404 if let Some(ref param_value) = p_query_project {
1405 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1406 }
1407 if let Some(ref user_agent) = configuration.user_agent {
1408 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1409 }
1410
1411 let req = req_builder.build()?;
1412 let resp = configuration.client.execute(req).await?;
1413
1414 let status = resp.status();
1415
1416 if !status.is_client_error() && !status.is_server_error() {
1417 Ok(())
1418 } else {
1419 let content = resp.text().await?;
1420 let entity: Option<InstanceFilesHeadError> = serde_json::from_str(&content).ok();
1421 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1422 }
1423}
1424
1425pub async fn instance_files_post(configuration: &configuration::Configuration, name: &str, path: Option<&str>, project: Option<&str>, x_incus_uid: Option<&str>, x_incus_gid: Option<&str>, x_incus_mode: Option<&str>, x_incus_type: Option<&str>, x_incus_write: Option<&str>) -> Result<models::InstancePatch200Response, Error<InstanceFilesPostError>> {
1427 let p_path_name = name;
1429 let p_query_path = path;
1430 let p_query_project = project;
1431 let p_header_x_incus_uid = x_incus_uid;
1432 let p_header_x_incus_gid = x_incus_gid;
1433 let p_header_x_incus_mode = x_incus_mode;
1434 let p_header_x_incus_type = x_incus_type;
1435 let p_header_x_incus_write = x_incus_write;
1436
1437 let uri_str = format!("{}/1.0/instances/{name}/files", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1438 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1439
1440 if let Some(ref param_value) = p_query_path {
1441 req_builder = req_builder.query(&[("path", ¶m_value.to_string())]);
1442 }
1443 if let Some(ref param_value) = p_query_project {
1444 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1445 }
1446 if let Some(ref user_agent) = configuration.user_agent {
1447 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1448 }
1449 if let Some(param_value) = p_header_x_incus_uid {
1450 req_builder = req_builder.header("X-Incus-uid", param_value.to_string());
1451 }
1452 if let Some(param_value) = p_header_x_incus_gid {
1453 req_builder = req_builder.header("X-Incus-gid", param_value.to_string());
1454 }
1455 if let Some(param_value) = p_header_x_incus_mode {
1456 req_builder = req_builder.header("X-Incus-mode", param_value.to_string());
1457 }
1458 if let Some(param_value) = p_header_x_incus_type {
1459 req_builder = req_builder.header("X-Incus-type", param_value.to_string());
1460 }
1461 if let Some(param_value) = p_header_x_incus_write {
1462 req_builder = req_builder.header("X-Incus-write", param_value.to_string());
1463 }
1464
1465 let req = req_builder.build()?;
1466 let resp = configuration.client.execute(req).await?;
1467
1468 let status = resp.status();
1469 let content_type = resp
1470 .headers()
1471 .get("content-type")
1472 .and_then(|v| v.to_str().ok())
1473 .unwrap_or("application/octet-stream");
1474 let content_type = super::ContentType::from(content_type);
1475
1476 if !status.is_client_error() && !status.is_server_error() {
1477 let content = resp.text().await?;
1478 match content_type {
1479 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1480 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancePatch200Response`"))),
1481 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::InstancePatch200Response`")))),
1482 }
1483 } else {
1484 let content = resp.text().await?;
1485 let entity: Option<InstanceFilesPostError> = serde_json::from_str(&content).ok();
1486 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1487 }
1488}
1489
1490pub async fn instance_get(configuration: &configuration::Configuration, name: &str, project: Option<&str>) -> Result<models::InstanceGet200Response, Error<InstanceGetError>> {
1492 let p_path_name = name;
1494 let p_query_project = project;
1495
1496 let uri_str = format!("{}/1.0/instances/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1497 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1498
1499 if let Some(ref param_value) = p_query_project {
1500 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1501 }
1502 if let Some(ref user_agent) = configuration.user_agent {
1503 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1504 }
1505
1506 let req = req_builder.build()?;
1507 let resp = configuration.client.execute(req).await?;
1508
1509 let status = resp.status();
1510 let content_type = resp
1511 .headers()
1512 .get("content-type")
1513 .and_then(|v| v.to_str().ok())
1514 .unwrap_or("application/octet-stream");
1515 let content_type = super::ContentType::from(content_type);
1516
1517 if !status.is_client_error() && !status.is_server_error() {
1518 let content = resp.text().await?;
1519 match content_type {
1520 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1521 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstanceGet200Response`"))),
1522 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::InstanceGet200Response`")))),
1523 }
1524 } else {
1525 let content = resp.text().await?;
1526 let entity: Option<InstanceGetError> = serde_json::from_str(&content).ok();
1527 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1528 }
1529}
1530
1531pub async fn instance_get_recursion1(configuration: &configuration::Configuration, name: &str, project: Option<&str>) -> Result<models::InstanceGetRecursion1200Response, Error<InstanceGetRecursion1Error>> {
1533 let p_path_name = name;
1535 let p_query_project = project;
1536
1537 let uri_str = format!("{}/1.0/instances/{name}?recursion=1", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1538 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1539
1540 if let Some(ref param_value) = p_query_project {
1541 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1542 }
1543 if let Some(ref user_agent) = configuration.user_agent {
1544 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1545 }
1546
1547 let req = req_builder.build()?;
1548 let resp = configuration.client.execute(req).await?;
1549
1550 let status = resp.status();
1551 let content_type = resp
1552 .headers()
1553 .get("content-type")
1554 .and_then(|v| v.to_str().ok())
1555 .unwrap_or("application/octet-stream");
1556 let content_type = super::ContentType::from(content_type);
1557
1558 if !status.is_client_error() && !status.is_server_error() {
1559 let content = resp.text().await?;
1560 match content_type {
1561 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1562 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstanceGetRecursion1200Response`"))),
1563 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::InstanceGetRecursion1200Response`")))),
1564 }
1565 } else {
1566 let content = resp.text().await?;
1567 let entity: Option<InstanceGetRecursion1Error> = serde_json::from_str(&content).ok();
1568 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1569 }
1570}
1571
1572pub async fn instance_log_delete(configuration: &configuration::Configuration, name: &str, filename: &str, project: Option<&str>) -> Result<models::InstancePatch200Response, Error<InstanceLogDeleteError>> {
1574 let p_path_name = name;
1576 let p_path_filename = filename;
1577 let p_query_project = project;
1578
1579 let uri_str = format!("{}/1.0/instances/{name}/logs/{filename}", configuration.base_path, name=crate::apis::urlencode(p_path_name), filename=crate::apis::urlencode(p_path_filename));
1580 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1581
1582 if let Some(ref param_value) = p_query_project {
1583 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1584 }
1585 if let Some(ref user_agent) = configuration.user_agent {
1586 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1587 }
1588
1589 let req = req_builder.build()?;
1590 let resp = configuration.client.execute(req).await?;
1591
1592 let status = resp.status();
1593 let content_type = resp
1594 .headers()
1595 .get("content-type")
1596 .and_then(|v| v.to_str().ok())
1597 .unwrap_or("application/octet-stream");
1598 let content_type = super::ContentType::from(content_type);
1599
1600 if !status.is_client_error() && !status.is_server_error() {
1601 let content = resp.text().await?;
1602 match content_type {
1603 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1604 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancePatch200Response`"))),
1605 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::InstancePatch200Response`")))),
1606 }
1607 } else {
1608 let content = resp.text().await?;
1609 let entity: Option<InstanceLogDeleteError> = serde_json::from_str(&content).ok();
1610 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1611 }
1612}
1613
1614pub async fn instance_log_get(configuration: &configuration::Configuration, name: &str, filename: &str, project: Option<&str>) -> Result<(), Error<InstanceLogGetError>> {
1616 let p_path_name = name;
1618 let p_path_filename = filename;
1619 let p_query_project = project;
1620
1621 let uri_str = format!("{}/1.0/instances/{name}/logs/{filename}", configuration.base_path, name=crate::apis::urlencode(p_path_name), filename=crate::apis::urlencode(p_path_filename));
1622 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1623
1624 if let Some(ref param_value) = p_query_project {
1625 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1626 }
1627 if let Some(ref user_agent) = configuration.user_agent {
1628 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1629 }
1630
1631 let req = req_builder.build()?;
1632 let resp = configuration.client.execute(req).await?;
1633
1634 let status = resp.status();
1635
1636 if !status.is_client_error() && !status.is_server_error() {
1637 Ok(())
1638 } else {
1639 let content = resp.text().await?;
1640 let entity: Option<InstanceLogGetError> = serde_json::from_str(&content).ok();
1641 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1642 }
1643}
1644
1645pub async fn instance_logs_get(configuration: &configuration::Configuration, name: &str, project: Option<&str>) -> Result<models::InstanceLogsGet200Response, Error<InstanceLogsGetError>> {
1647 let p_path_name = name;
1649 let p_query_project = project;
1650
1651 let uri_str = format!("{}/1.0/instances/{name}/logs", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1652 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1653
1654 if let Some(ref param_value) = p_query_project {
1655 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1656 }
1657 if let Some(ref user_agent) = configuration.user_agent {
1658 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1659 }
1660
1661 let req = req_builder.build()?;
1662 let resp = configuration.client.execute(req).await?;
1663
1664 let status = resp.status();
1665 let content_type = resp
1666 .headers()
1667 .get("content-type")
1668 .and_then(|v| v.to_str().ok())
1669 .unwrap_or("application/octet-stream");
1670 let content_type = super::ContentType::from(content_type);
1671
1672 if !status.is_client_error() && !status.is_server_error() {
1673 let content = resp.text().await?;
1674 match content_type {
1675 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1676 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstanceLogsGet200Response`"))),
1677 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::InstanceLogsGet200Response`")))),
1678 }
1679 } else {
1680 let content = resp.text().await?;
1681 let entity: Option<InstanceLogsGetError> = serde_json::from_str(&content).ok();
1682 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1683 }
1684}
1685
1686pub async fn instance_metadata_get(configuration: &configuration::Configuration, name: &str, project: Option<&str>) -> Result<models::InstanceMetadataGet200Response, Error<InstanceMetadataGetError>> {
1688 let p_path_name = name;
1690 let p_query_project = project;
1691
1692 let uri_str = format!("{}/1.0/instances/{name}/metadata", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1693 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1694
1695 if let Some(ref param_value) = p_query_project {
1696 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1697 }
1698 if let Some(ref user_agent) = configuration.user_agent {
1699 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1700 }
1701
1702 let req = req_builder.build()?;
1703 let resp = configuration.client.execute(req).await?;
1704
1705 let status = resp.status();
1706 let content_type = resp
1707 .headers()
1708 .get("content-type")
1709 .and_then(|v| v.to_str().ok())
1710 .unwrap_or("application/octet-stream");
1711 let content_type = super::ContentType::from(content_type);
1712
1713 if !status.is_client_error() && !status.is_server_error() {
1714 let content = resp.text().await?;
1715 match content_type {
1716 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1717 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstanceMetadataGet200Response`"))),
1718 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::InstanceMetadataGet200Response`")))),
1719 }
1720 } else {
1721 let content = resp.text().await?;
1722 let entity: Option<InstanceMetadataGetError> = serde_json::from_str(&content).ok();
1723 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1724 }
1725}
1726
1727pub async fn instance_metadata_patch(configuration: &configuration::Configuration, name: &str, metadata: models::ImageMetadata, project: Option<&str>) -> Result<models::InstancePatch200Response, Error<InstanceMetadataPatchError>> {
1729 let p_path_name = name;
1731 let p_body_metadata = metadata;
1732 let p_query_project = project;
1733
1734 let uri_str = format!("{}/1.0/instances/{name}/metadata", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1735 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1736
1737 if let Some(ref param_value) = p_query_project {
1738 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1739 }
1740 if let Some(ref user_agent) = configuration.user_agent {
1741 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1742 }
1743 req_builder = req_builder.json(&p_body_metadata);
1744
1745 let req = req_builder.build()?;
1746 let resp = configuration.client.execute(req).await?;
1747
1748 let status = resp.status();
1749 let content_type = resp
1750 .headers()
1751 .get("content-type")
1752 .and_then(|v| v.to_str().ok())
1753 .unwrap_or("application/octet-stream");
1754 let content_type = super::ContentType::from(content_type);
1755
1756 if !status.is_client_error() && !status.is_server_error() {
1757 let content = resp.text().await?;
1758 match content_type {
1759 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1760 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancePatch200Response`"))),
1761 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::InstancePatch200Response`")))),
1762 }
1763 } else {
1764 let content = resp.text().await?;
1765 let entity: Option<InstanceMetadataPatchError> = serde_json::from_str(&content).ok();
1766 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1767 }
1768}
1769
1770pub async fn instance_metadata_put(configuration: &configuration::Configuration, name: &str, metadata: models::ImageMetadata, project: Option<&str>) -> Result<models::InstancePatch200Response, Error<InstanceMetadataPutError>> {
1772 let p_path_name = name;
1774 let p_body_metadata = metadata;
1775 let p_query_project = project;
1776
1777 let uri_str = format!("{}/1.0/instances/{name}/metadata", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1778 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1779
1780 if let Some(ref param_value) = p_query_project {
1781 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1782 }
1783 if let Some(ref user_agent) = configuration.user_agent {
1784 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1785 }
1786 req_builder = req_builder.json(&p_body_metadata);
1787
1788 let req = req_builder.build()?;
1789 let resp = configuration.client.execute(req).await?;
1790
1791 let status = resp.status();
1792 let content_type = resp
1793 .headers()
1794 .get("content-type")
1795 .and_then(|v| v.to_str().ok())
1796 .unwrap_or("application/octet-stream");
1797 let content_type = super::ContentType::from(content_type);
1798
1799 if !status.is_client_error() && !status.is_server_error() {
1800 let content = resp.text().await?;
1801 match content_type {
1802 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1803 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancePatch200Response`"))),
1804 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::InstancePatch200Response`")))),
1805 }
1806 } else {
1807 let content = resp.text().await?;
1808 let entity: Option<InstanceMetadataPutError> = serde_json::from_str(&content).ok();
1809 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1810 }
1811}
1812
1813pub async fn instance_metadata_templates_delete(configuration: &configuration::Configuration, name: &str, path: Option<&str>, project: Option<&str>) -> Result<models::InstancePatch200Response, Error<InstanceMetadataTemplatesDeleteError>> {
1815 let p_path_name = name;
1817 let p_query_path = path;
1818 let p_query_project = project;
1819
1820 let uri_str = format!("{}/1.0/instances/{name}/metadata/templates", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1821 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1822
1823 if let Some(ref param_value) = p_query_path {
1824 req_builder = req_builder.query(&[("path", ¶m_value.to_string())]);
1825 }
1826 if let Some(ref param_value) = p_query_project {
1827 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1828 }
1829 if let Some(ref user_agent) = configuration.user_agent {
1830 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1831 }
1832
1833 let req = req_builder.build()?;
1834 let resp = configuration.client.execute(req).await?;
1835
1836 let status = resp.status();
1837 let content_type = resp
1838 .headers()
1839 .get("content-type")
1840 .and_then(|v| v.to_str().ok())
1841 .unwrap_or("application/octet-stream");
1842 let content_type = super::ContentType::from(content_type);
1843
1844 if !status.is_client_error() && !status.is_server_error() {
1845 let content = resp.text().await?;
1846 match content_type {
1847 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1848 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancePatch200Response`"))),
1849 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::InstancePatch200Response`")))),
1850 }
1851 } else {
1852 let content = resp.text().await?;
1853 let entity: Option<InstanceMetadataTemplatesDeleteError> = serde_json::from_str(&content).ok();
1854 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1855 }
1856}
1857
1858pub async fn instance_metadata_templates_get(configuration: &configuration::Configuration, name: &str, project: Option<&str>, path: Option<&str>) -> Result<(), Error<InstanceMetadataTemplatesGetError>> {
1860 let p_path_name = name;
1862 let p_query_project = project;
1863 let p_query_path = path;
1864
1865 let uri_str = format!("{}/1.0/instances/{name}/metadata/templates", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1866 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1867
1868 if let Some(ref param_value) = p_query_project {
1869 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1870 }
1871 if let Some(ref param_value) = p_query_path {
1872 req_builder = req_builder.query(&[("path", ¶m_value.to_string())]);
1873 }
1874 if let Some(ref user_agent) = configuration.user_agent {
1875 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1876 }
1877
1878 let req = req_builder.build()?;
1879 let resp = configuration.client.execute(req).await?;
1880
1881 let status = resp.status();
1882
1883 if !status.is_client_error() && !status.is_server_error() {
1884 Ok(())
1885 } else {
1886 let content = resp.text().await?;
1887 let entity: Option<InstanceMetadataTemplatesGetError> = serde_json::from_str(&content).ok();
1888 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1889 }
1890}
1891
1892pub async fn instance_metadata_templates_post(configuration: &configuration::Configuration, name: &str, path: Option<&str>, project: Option<&str>) -> Result<models::InstancePatch200Response, Error<InstanceMetadataTemplatesPostError>> {
1894 let p_path_name = name;
1896 let p_query_path = path;
1897 let p_query_project = project;
1898
1899 let uri_str = format!("{}/1.0/instances/{name}/metadata/templates", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1900 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1901
1902 if let Some(ref param_value) = p_query_path {
1903 req_builder = req_builder.query(&[("path", ¶m_value.to_string())]);
1904 }
1905 if let Some(ref param_value) = p_query_project {
1906 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1907 }
1908 if let Some(ref user_agent) = configuration.user_agent {
1909 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1910 }
1911
1912 let req = req_builder.build()?;
1913 let resp = configuration.client.execute(req).await?;
1914
1915 let status = resp.status();
1916 let content_type = resp
1917 .headers()
1918 .get("content-type")
1919 .and_then(|v| v.to_str().ok())
1920 .unwrap_or("application/octet-stream");
1921 let content_type = super::ContentType::from(content_type);
1922
1923 if !status.is_client_error() && !status.is_server_error() {
1924 let content = resp.text().await?;
1925 match content_type {
1926 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1927 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancePatch200Response`"))),
1928 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::InstancePatch200Response`")))),
1929 }
1930 } else {
1931 let content = resp.text().await?;
1932 let entity: Option<InstanceMetadataTemplatesPostError> = serde_json::from_str(&content).ok();
1933 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1934 }
1935}
1936
1937pub async fn instance_patch(configuration: &configuration::Configuration, name: &str, project: Option<&str>, instance: Option<models::InstancePut>) -> Result<models::InstancePatch200Response, Error<InstancePatchError>> {
1939 let p_path_name = name;
1941 let p_query_project = project;
1942 let p_body_instance = instance;
1943
1944 let uri_str = format!("{}/1.0/instances/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1945 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1946
1947 if let Some(ref param_value) = p_query_project {
1948 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1949 }
1950 if let Some(ref user_agent) = configuration.user_agent {
1951 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1952 }
1953 req_builder = req_builder.json(&p_body_instance);
1954
1955 let req = req_builder.build()?;
1956 let resp = configuration.client.execute(req).await?;
1957
1958 let status = resp.status();
1959 let content_type = resp
1960 .headers()
1961 .get("content-type")
1962 .and_then(|v| v.to_str().ok())
1963 .unwrap_or("application/octet-stream");
1964 let content_type = super::ContentType::from(content_type);
1965
1966 if !status.is_client_error() && !status.is_server_error() {
1967 let content = resp.text().await?;
1968 match content_type {
1969 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1970 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancePatch200Response`"))),
1971 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::InstancePatch200Response`")))),
1972 }
1973 } else {
1974 let content = resp.text().await?;
1975 let entity: Option<InstancePatchError> = serde_json::from_str(&content).ok();
1976 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1977 }
1978}
1979
1980pub async fn instance_post(configuration: &configuration::Configuration, name: &str, project: Option<&str>, migration: Option<models::InstancePost>) -> Result<models::InstancesPut202Response, Error<InstancePostError>> {
1982 let p_path_name = name;
1984 let p_query_project = project;
1985 let p_body_migration = migration;
1986
1987 let uri_str = format!("{}/1.0/instances/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
1988 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1989
1990 if let Some(ref param_value) = p_query_project {
1991 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
1992 }
1993 if let Some(ref user_agent) = configuration.user_agent {
1994 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1995 }
1996 req_builder = req_builder.json(&p_body_migration);
1997
1998 let req = req_builder.build()?;
1999 let resp = configuration.client.execute(req).await?;
2000
2001 let status = resp.status();
2002 let content_type = resp
2003 .headers()
2004 .get("content-type")
2005 .and_then(|v| v.to_str().ok())
2006 .unwrap_or("application/octet-stream");
2007 let content_type = super::ContentType::from(content_type);
2008
2009 if !status.is_client_error() && !status.is_server_error() {
2010 let content = resp.text().await?;
2011 match content_type {
2012 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2013 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancesPut202Response`"))),
2014 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::InstancesPut202Response`")))),
2015 }
2016 } else {
2017 let content = resp.text().await?;
2018 let entity: Option<InstancePostError> = serde_json::from_str(&content).ok();
2019 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2020 }
2021}
2022
2023pub async fn instance_put(configuration: &configuration::Configuration, name: &str, project: Option<&str>, instance: Option<models::InstancePut>) -> Result<models::InstancesPut202Response, Error<InstancePutError>> {
2025 let p_path_name = name;
2027 let p_query_project = project;
2028 let p_body_instance = instance;
2029
2030 let uri_str = format!("{}/1.0/instances/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
2031 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2032
2033 if let Some(ref param_value) = p_query_project {
2034 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
2035 }
2036 if let Some(ref user_agent) = configuration.user_agent {
2037 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2038 }
2039 req_builder = req_builder.json(&p_body_instance);
2040
2041 let req = req_builder.build()?;
2042 let resp = configuration.client.execute(req).await?;
2043
2044 let status = resp.status();
2045 let content_type = resp
2046 .headers()
2047 .get("content-type")
2048 .and_then(|v| v.to_str().ok())
2049 .unwrap_or("application/octet-stream");
2050 let content_type = super::ContentType::from(content_type);
2051
2052 if !status.is_client_error() && !status.is_server_error() {
2053 let content = resp.text().await?;
2054 match content_type {
2055 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2056 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancesPut202Response`"))),
2057 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::InstancesPut202Response`")))),
2058 }
2059 } else {
2060 let content = resp.text().await?;
2061 let entity: Option<InstancePutError> = serde_json::from_str(&content).ok();
2062 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2063 }
2064}
2065
2066pub async fn instance_rebuild_post(configuration: &configuration::Configuration, name: &str, instance: models::InstanceRebuildPost, project: Option<&str>) -> Result<models::InstancePatch200Response, Error<InstanceRebuildPostError>> {
2068 let p_path_name = name;
2070 let p_body_instance = instance;
2071 let p_query_project = project;
2072
2073 let uri_str = format!("{}/1.0/instances/{name}/rebuild", configuration.base_path, name=crate::apis::urlencode(p_path_name));
2074 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2075
2076 if let Some(ref param_value) = p_query_project {
2077 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
2078 }
2079 if let Some(ref user_agent) = configuration.user_agent {
2080 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2081 }
2082 req_builder = req_builder.json(&p_body_instance);
2083
2084 let req = req_builder.build()?;
2085 let resp = configuration.client.execute(req).await?;
2086
2087 let status = resp.status();
2088 let content_type = resp
2089 .headers()
2090 .get("content-type")
2091 .and_then(|v| v.to_str().ok())
2092 .unwrap_or("application/octet-stream");
2093 let content_type = super::ContentType::from(content_type);
2094
2095 if !status.is_client_error() && !status.is_server_error() {
2096 let content = resp.text().await?;
2097 match content_type {
2098 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2099 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancePatch200Response`"))),
2100 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::InstancePatch200Response`")))),
2101 }
2102 } else {
2103 let content = resp.text().await?;
2104 let entity: Option<InstanceRebuildPostError> = serde_json::from_str(&content).ok();
2105 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2106 }
2107}
2108
2109pub async fn instance_sftp(configuration: &configuration::Configuration, name: &str) -> Result<(), Error<InstanceSftpError>> {
2111 let p_path_name = name;
2113
2114 let uri_str = format!("{}/1.0/instances/{name}/sftp", configuration.base_path, name=crate::apis::urlencode(p_path_name));
2115 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2116
2117 if let Some(ref user_agent) = configuration.user_agent {
2118 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2119 }
2120
2121 let req = req_builder.build()?;
2122 let resp = configuration.client.execute(req).await?;
2123
2124 let status = resp.status();
2125
2126 if !status.is_client_error() && !status.is_server_error() {
2127 Ok(())
2128 } else {
2129 let content = resp.text().await?;
2130 let entity: Option<InstanceSftpError> = serde_json::from_str(&content).ok();
2131 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2132 }
2133}
2134
2135pub async fn instance_snapshot_delete(configuration: &configuration::Configuration, name: &str, snapshot: &str, project: Option<&str>) -> Result<models::InstancesPut202Response, Error<InstanceSnapshotDeleteError>> {
2137 let p_path_name = name;
2139 let p_path_snapshot = snapshot;
2140 let p_query_project = project;
2141
2142 let uri_str = format!("{}/1.0/instances/{name}/snapshots/{snapshot}", configuration.base_path, name=crate::apis::urlencode(p_path_name), snapshot=crate::apis::urlencode(p_path_snapshot));
2143 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2144
2145 if let Some(ref param_value) = p_query_project {
2146 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
2147 }
2148 if let Some(ref user_agent) = configuration.user_agent {
2149 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2150 }
2151
2152 let req = req_builder.build()?;
2153 let resp = configuration.client.execute(req).await?;
2154
2155 let status = resp.status();
2156 let content_type = resp
2157 .headers()
2158 .get("content-type")
2159 .and_then(|v| v.to_str().ok())
2160 .unwrap_or("application/octet-stream");
2161 let content_type = super::ContentType::from(content_type);
2162
2163 if !status.is_client_error() && !status.is_server_error() {
2164 let content = resp.text().await?;
2165 match content_type {
2166 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2167 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancesPut202Response`"))),
2168 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::InstancesPut202Response`")))),
2169 }
2170 } else {
2171 let content = resp.text().await?;
2172 let entity: Option<InstanceSnapshotDeleteError> = serde_json::from_str(&content).ok();
2173 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2174 }
2175}
2176
2177pub async fn instance_snapshot_get(configuration: &configuration::Configuration, name: &str, snapshot: &str, project: Option<&str>) -> Result<models::InstanceSnapshotGet200Response, Error<InstanceSnapshotGetError>> {
2179 let p_path_name = name;
2181 let p_path_snapshot = snapshot;
2182 let p_query_project = project;
2183
2184 let uri_str = format!("{}/1.0/instances/{name}/snapshots/{snapshot}", configuration.base_path, name=crate::apis::urlencode(p_path_name), snapshot=crate::apis::urlencode(p_path_snapshot));
2185 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2186
2187 if let Some(ref param_value) = p_query_project {
2188 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
2189 }
2190 if let Some(ref user_agent) = configuration.user_agent {
2191 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2192 }
2193
2194 let req = req_builder.build()?;
2195 let resp = configuration.client.execute(req).await?;
2196
2197 let status = resp.status();
2198 let content_type = resp
2199 .headers()
2200 .get("content-type")
2201 .and_then(|v| v.to_str().ok())
2202 .unwrap_or("application/octet-stream");
2203 let content_type = super::ContentType::from(content_type);
2204
2205 if !status.is_client_error() && !status.is_server_error() {
2206 let content = resp.text().await?;
2207 match content_type {
2208 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2209 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstanceSnapshotGet200Response`"))),
2210 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::InstanceSnapshotGet200Response`")))),
2211 }
2212 } else {
2213 let content = resp.text().await?;
2214 let entity: Option<InstanceSnapshotGetError> = serde_json::from_str(&content).ok();
2215 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2216 }
2217}
2218
2219pub async fn instance_snapshot_patch(configuration: &configuration::Configuration, name: &str, snapshot: &str, project: Option<&str>, snapshot2: Option<models::InstanceSnapshotPut>) -> Result<models::InstancesPut202Response, Error<InstanceSnapshotPatchError>> {
2221 let p_path_name = name;
2223 let p_path_snapshot = snapshot;
2224 let p_query_project = project;
2225 let p_body_snapshot = snapshot2;
2226
2227 let uri_str = format!("{}/1.0/instances/{name}/snapshots/{snapshot}", configuration.base_path, name=crate::apis::urlencode(p_path_name), snapshot=crate::apis::urlencode(p_path_snapshot));
2228 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2229
2230 if let Some(ref param_value) = p_query_project {
2231 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
2232 }
2233 if let Some(ref user_agent) = configuration.user_agent {
2234 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2235 }
2236 req_builder = req_builder.json(&p_body_snapshot);
2237
2238 let req = req_builder.build()?;
2239 let resp = configuration.client.execute(req).await?;
2240
2241 let status = resp.status();
2242 let content_type = resp
2243 .headers()
2244 .get("content-type")
2245 .and_then(|v| v.to_str().ok())
2246 .unwrap_or("application/octet-stream");
2247 let content_type = super::ContentType::from(content_type);
2248
2249 if !status.is_client_error() && !status.is_server_error() {
2250 let content = resp.text().await?;
2251 match content_type {
2252 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2253 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancesPut202Response`"))),
2254 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::InstancesPut202Response`")))),
2255 }
2256 } else {
2257 let content = resp.text().await?;
2258 let entity: Option<InstanceSnapshotPatchError> = serde_json::from_str(&content).ok();
2259 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2260 }
2261}
2262
2263pub async fn instance_snapshot_post(configuration: &configuration::Configuration, name: &str, snapshot: &str, project: Option<&str>, snapshot2: Option<models::InstanceSnapshotPost>) -> Result<models::InstancesPut202Response, Error<InstanceSnapshotPostError>> {
2265 let p_path_name = name;
2267 let p_path_snapshot = snapshot;
2268 let p_query_project = project;
2269 let p_body_snapshot = snapshot2;
2270
2271 let uri_str = format!("{}/1.0/instances/{name}/snapshots/{snapshot}", configuration.base_path, name=crate::apis::urlencode(p_path_name), snapshot=crate::apis::urlencode(p_path_snapshot));
2272 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2273
2274 if let Some(ref param_value) = p_query_project {
2275 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
2276 }
2277 if let Some(ref user_agent) = configuration.user_agent {
2278 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2279 }
2280 req_builder = req_builder.json(&p_body_snapshot);
2281
2282 let req = req_builder.build()?;
2283 let resp = configuration.client.execute(req).await?;
2284
2285 let status = resp.status();
2286 let content_type = resp
2287 .headers()
2288 .get("content-type")
2289 .and_then(|v| v.to_str().ok())
2290 .unwrap_or("application/octet-stream");
2291 let content_type = super::ContentType::from(content_type);
2292
2293 if !status.is_client_error() && !status.is_server_error() {
2294 let content = resp.text().await?;
2295 match content_type {
2296 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2297 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancesPut202Response`"))),
2298 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::InstancesPut202Response`")))),
2299 }
2300 } else {
2301 let content = resp.text().await?;
2302 let entity: Option<InstanceSnapshotPostError> = serde_json::from_str(&content).ok();
2303 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2304 }
2305}
2306
2307pub async fn instance_snapshot_put(configuration: &configuration::Configuration, name: &str, snapshot: &str, project: Option<&str>, snapshot2: Option<models::InstanceSnapshotPut>) -> Result<models::InstancesPut202Response, Error<InstanceSnapshotPutError>> {
2309 let p_path_name = name;
2311 let p_path_snapshot = snapshot;
2312 let p_query_project = project;
2313 let p_body_snapshot = snapshot2;
2314
2315 let uri_str = format!("{}/1.0/instances/{name}/snapshots/{snapshot}", configuration.base_path, name=crate::apis::urlencode(p_path_name), snapshot=crate::apis::urlencode(p_path_snapshot));
2316 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2317
2318 if let Some(ref param_value) = p_query_project {
2319 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
2320 }
2321 if let Some(ref user_agent) = configuration.user_agent {
2322 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2323 }
2324 req_builder = req_builder.json(&p_body_snapshot);
2325
2326 let req = req_builder.build()?;
2327 let resp = configuration.client.execute(req).await?;
2328
2329 let status = resp.status();
2330 let content_type = resp
2331 .headers()
2332 .get("content-type")
2333 .and_then(|v| v.to_str().ok())
2334 .unwrap_or("application/octet-stream");
2335 let content_type = super::ContentType::from(content_type);
2336
2337 if !status.is_client_error() && !status.is_server_error() {
2338 let content = resp.text().await?;
2339 match content_type {
2340 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2341 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancesPut202Response`"))),
2342 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::InstancesPut202Response`")))),
2343 }
2344 } else {
2345 let content = resp.text().await?;
2346 let entity: Option<InstanceSnapshotPutError> = serde_json::from_str(&content).ok();
2347 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2348 }
2349}
2350
2351pub async fn instance_snapshots_get(configuration: &configuration::Configuration, name: &str, project: Option<&str>) -> Result<models::InstanceSnapshotsGet200Response, Error<InstanceSnapshotsGetError>> {
2353 let p_path_name = name;
2355 let p_query_project = project;
2356
2357 let uri_str = format!("{}/1.0/instances/{name}/snapshots", configuration.base_path, name=crate::apis::urlencode(p_path_name));
2358 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2359
2360 if let Some(ref param_value) = p_query_project {
2361 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
2362 }
2363 if let Some(ref user_agent) = configuration.user_agent {
2364 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2365 }
2366
2367 let req = req_builder.build()?;
2368 let resp = configuration.client.execute(req).await?;
2369
2370 let status = resp.status();
2371 let content_type = resp
2372 .headers()
2373 .get("content-type")
2374 .and_then(|v| v.to_str().ok())
2375 .unwrap_or("application/octet-stream");
2376 let content_type = super::ContentType::from(content_type);
2377
2378 if !status.is_client_error() && !status.is_server_error() {
2379 let content = resp.text().await?;
2380 match content_type {
2381 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2382 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstanceSnapshotsGet200Response`"))),
2383 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::InstanceSnapshotsGet200Response`")))),
2384 }
2385 } else {
2386 let content = resp.text().await?;
2387 let entity: Option<InstanceSnapshotsGetError> = serde_json::from_str(&content).ok();
2388 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2389 }
2390}
2391
2392pub async fn instance_snapshots_get_recursion1(configuration: &configuration::Configuration, name: &str, project: Option<&str>) -> Result<models::InstanceSnapshotsGetRecursion1200Response, Error<InstanceSnapshotsGetRecursion1Error>> {
2394 let p_path_name = name;
2396 let p_query_project = project;
2397
2398 let uri_str = format!("{}/1.0/instances/{name}/snapshots?recursion=1", configuration.base_path, name=crate::apis::urlencode(p_path_name));
2399 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2400
2401 if let Some(ref param_value) = p_query_project {
2402 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
2403 }
2404 if let Some(ref user_agent) = configuration.user_agent {
2405 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2406 }
2407
2408 let req = req_builder.build()?;
2409 let resp = configuration.client.execute(req).await?;
2410
2411 let status = resp.status();
2412 let content_type = resp
2413 .headers()
2414 .get("content-type")
2415 .and_then(|v| v.to_str().ok())
2416 .unwrap_or("application/octet-stream");
2417 let content_type = super::ContentType::from(content_type);
2418
2419 if !status.is_client_error() && !status.is_server_error() {
2420 let content = resp.text().await?;
2421 match content_type {
2422 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2423 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstanceSnapshotsGetRecursion1200Response`"))),
2424 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::InstanceSnapshotsGetRecursion1200Response`")))),
2425 }
2426 } else {
2427 let content = resp.text().await?;
2428 let entity: Option<InstanceSnapshotsGetRecursion1Error> = serde_json::from_str(&content).ok();
2429 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2430 }
2431}
2432
2433pub async fn instance_snapshots_post(configuration: &configuration::Configuration, name: &str, project: Option<&str>, snapshot: Option<models::InstanceSnapshotsPost>) -> Result<models::InstancesPut202Response, Error<InstanceSnapshotsPostError>> {
2435 let p_path_name = name;
2437 let p_query_project = project;
2438 let p_body_snapshot = snapshot;
2439
2440 let uri_str = format!("{}/1.0/instances/{name}/snapshots", configuration.base_path, name=crate::apis::urlencode(p_path_name));
2441 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2442
2443 if let Some(ref param_value) = p_query_project {
2444 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
2445 }
2446 if let Some(ref user_agent) = configuration.user_agent {
2447 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2448 }
2449 req_builder = req_builder.json(&p_body_snapshot);
2450
2451 let req = req_builder.build()?;
2452 let resp = configuration.client.execute(req).await?;
2453
2454 let status = resp.status();
2455 let content_type = resp
2456 .headers()
2457 .get("content-type")
2458 .and_then(|v| v.to_str().ok())
2459 .unwrap_or("application/octet-stream");
2460 let content_type = super::ContentType::from(content_type);
2461
2462 if !status.is_client_error() && !status.is_server_error() {
2463 let content = resp.text().await?;
2464 match content_type {
2465 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2466 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancesPut202Response`"))),
2467 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::InstancesPut202Response`")))),
2468 }
2469 } else {
2470 let content = resp.text().await?;
2471 let entity: Option<InstanceSnapshotsPostError> = serde_json::from_str(&content).ok();
2472 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2473 }
2474}
2475
2476pub async fn instance_state_get(configuration: &configuration::Configuration, name: &str, project: Option<&str>) -> Result<models::InstanceStateGet200Response, Error<InstanceStateGetError>> {
2478 let p_path_name = name;
2480 let p_query_project = project;
2481
2482 let uri_str = format!("{}/1.0/instances/{name}/state", configuration.base_path, name=crate::apis::urlencode(p_path_name));
2483 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2484
2485 if let Some(ref param_value) = p_query_project {
2486 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
2487 }
2488 if let Some(ref user_agent) = configuration.user_agent {
2489 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2490 }
2491
2492 let req = req_builder.build()?;
2493 let resp = configuration.client.execute(req).await?;
2494
2495 let status = resp.status();
2496 let content_type = resp
2497 .headers()
2498 .get("content-type")
2499 .and_then(|v| v.to_str().ok())
2500 .unwrap_or("application/octet-stream");
2501 let content_type = super::ContentType::from(content_type);
2502
2503 if !status.is_client_error() && !status.is_server_error() {
2504 let content = resp.text().await?;
2505 match content_type {
2506 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2507 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstanceStateGet200Response`"))),
2508 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::InstanceStateGet200Response`")))),
2509 }
2510 } else {
2511 let content = resp.text().await?;
2512 let entity: Option<InstanceStateGetError> = serde_json::from_str(&content).ok();
2513 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2514 }
2515}
2516
2517pub async fn instance_state_put(configuration: &configuration::Configuration, name: &str, project: Option<&str>, state: Option<models::InstanceStatePut>) -> Result<models::InstancesPut202Response, Error<InstanceStatePutError>> {
2519 let p_path_name = name;
2521 let p_query_project = project;
2522 let p_body_state = state;
2523
2524 let uri_str = format!("{}/1.0/instances/{name}/state", configuration.base_path, name=crate::apis::urlencode(p_path_name));
2525 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2526
2527 if let Some(ref param_value) = p_query_project {
2528 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
2529 }
2530 if let Some(ref user_agent) = configuration.user_agent {
2531 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2532 }
2533 req_builder = req_builder.json(&p_body_state);
2534
2535 let req = req_builder.build()?;
2536 let resp = configuration.client.execute(req).await?;
2537
2538 let status = resp.status();
2539 let content_type = resp
2540 .headers()
2541 .get("content-type")
2542 .and_then(|v| v.to_str().ok())
2543 .unwrap_or("application/octet-stream");
2544 let content_type = super::ContentType::from(content_type);
2545
2546 if !status.is_client_error() && !status.is_server_error() {
2547 let content = resp.text().await?;
2548 match content_type {
2549 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2550 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancesPut202Response`"))),
2551 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::InstancesPut202Response`")))),
2552 }
2553 } else {
2554 let content = resp.text().await?;
2555 let entity: Option<InstanceStatePutError> = serde_json::from_str(&content).ok();
2556 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2557 }
2558}
2559
2560pub async fn instances_get(configuration: &configuration::Configuration, project: Option<&str>, filter: Option<&str>, all_projects: Option<bool>) -> Result<models::InstancesGet200Response, Error<InstancesGetError>> {
2562 let p_query_project = project;
2564 let p_query_filter = filter;
2565 let p_query_all_projects = all_projects;
2566
2567 let uri_str = format!("{}/1.0/instances", configuration.base_path);
2568 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2569
2570 if let Some(ref param_value) = p_query_project {
2571 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
2572 }
2573 if let Some(ref param_value) = p_query_filter {
2574 req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
2575 }
2576 if let Some(ref param_value) = p_query_all_projects {
2577 req_builder = req_builder.query(&[("all-projects", ¶m_value.to_string())]);
2578 }
2579 if let Some(ref user_agent) = configuration.user_agent {
2580 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2581 }
2582
2583 let req = req_builder.build()?;
2584 let resp = configuration.client.execute(req).await?;
2585
2586 let status = resp.status();
2587 let content_type = resp
2588 .headers()
2589 .get("content-type")
2590 .and_then(|v| v.to_str().ok())
2591 .unwrap_or("application/octet-stream");
2592 let content_type = super::ContentType::from(content_type);
2593
2594 if !status.is_client_error() && !status.is_server_error() {
2595 let content = resp.text().await?;
2596 match content_type {
2597 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2598 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancesGet200Response`"))),
2599 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::InstancesGet200Response`")))),
2600 }
2601 } else {
2602 let content = resp.text().await?;
2603 let entity: Option<InstancesGetError> = serde_json::from_str(&content).ok();
2604 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2605 }
2606}
2607
2608pub async fn instances_post(configuration: &configuration::Configuration, project: Option<&str>, target: Option<&str>) -> Result<models::InstancesPut202Response, Error<InstancesPostError>> {
2610 let p_query_project = project;
2612 let p_query_target = target;
2613
2614 let uri_str = format!("{}/1.0/instances", configuration.base_path);
2615 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2616
2617 if let Some(ref param_value) = p_query_project {
2618 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
2619 }
2620 if let Some(ref param_value) = p_query_target {
2621 req_builder = req_builder.query(&[("target", ¶m_value.to_string())]);
2622 }
2623 if let Some(ref user_agent) = configuration.user_agent {
2624 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2625 }
2626
2627 let req = req_builder.build()?;
2628 let resp = configuration.client.execute(req).await?;
2629
2630 let status = resp.status();
2631 let content_type = resp
2632 .headers()
2633 .get("content-type")
2634 .and_then(|v| v.to_str().ok())
2635 .unwrap_or("application/octet-stream");
2636 let content_type = super::ContentType::from(content_type);
2637
2638 if !status.is_client_error() && !status.is_server_error() {
2639 let content = resp.text().await?;
2640 match content_type {
2641 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2642 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancesPut202Response`"))),
2643 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::InstancesPut202Response`")))),
2644 }
2645 } else {
2646 let content = resp.text().await?;
2647 let entity: Option<InstancesPostError> = serde_json::from_str(&content).ok();
2648 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2649 }
2650}
2651
2652pub async fn instances_put(configuration: &configuration::Configuration, project: Option<&str>, state: Option<models::InstancesPut>) -> Result<models::InstancesPut202Response, Error<InstancesPutError>> {
2654 let p_query_project = project;
2656 let p_body_state = state;
2657
2658 let uri_str = format!("{}/1.0/instances", configuration.base_path);
2659 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2660
2661 if let Some(ref param_value) = p_query_project {
2662 req_builder = req_builder.query(&[("project", ¶m_value.to_string())]);
2663 }
2664 if let Some(ref user_agent) = configuration.user_agent {
2665 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2666 }
2667 req_builder = req_builder.json(&p_body_state);
2668
2669 let req = req_builder.build()?;
2670 let resp = configuration.client.execute(req).await?;
2671
2672 let status = resp.status();
2673 let content_type = resp
2674 .headers()
2675 .get("content-type")
2676 .and_then(|v| v.to_str().ok())
2677 .unwrap_or("application/octet-stream");
2678 let content_type = super::ContentType::from(content_type);
2679
2680 if !status.is_client_error() && !status.is_server_error() {
2681 let content = resp.text().await?;
2682 match content_type {
2683 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2684 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::InstancesPut202Response`"))),
2685 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::InstancesPut202Response`")))),
2686 }
2687 } else {
2688 let content = resp.text().await?;
2689 let entity: Option<InstancesPutError> = serde_json::from_str(&content).ok();
2690 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2691 }
2692}
2693