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 QemuAgentError {
22 Status400(models::PveError),
23 Status401(models::PveError),
24 Status403(models::PveError),
25 Status404(models::PveError),
26 Status500(models::PveError),
27 Status501(models::PveError),
28 Status503(models::PveError),
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum QemuCloneVmError {
36 Status400(models::PveError),
37 Status401(models::PveError),
38 Status403(models::PveError),
39 Status404(models::PveError),
40 Status500(models::PveError),
41 Status501(models::PveError),
42 Status503(models::PveError),
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum QemuCloudinitGeneratedConfigDumpError {
50 Status400(models::PveError),
51 Status401(models::PveError),
52 Status403(models::PveError),
53 Status404(models::PveError),
54 Status500(models::PveError),
55 Status501(models::PveError),
56 Status503(models::PveError),
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum QemuCloudinitPendingError {
64 Status400(models::PveError),
65 Status401(models::PveError),
66 Status403(models::PveError),
67 Status404(models::PveError),
68 Status500(models::PveError),
69 Status501(models::PveError),
70 Status503(models::PveError),
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum QemuCloudinitUpdateError {
78 Status400(models::PveError),
79 Status401(models::PveError),
80 Status403(models::PveError),
81 Status404(models::PveError),
82 Status500(models::PveError),
83 Status501(models::PveError),
84 Status503(models::PveError),
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum QemuCreateAliasError {
92 Status400(models::PveError),
93 Status401(models::PveError),
94 Status403(models::PveError),
95 Status404(models::PveError),
96 Status500(models::PveError),
97 Status501(models::PveError),
98 Status503(models::PveError),
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum QemuCreateIpError {
106 Status400(models::PveError),
107 Status401(models::PveError),
108 Status403(models::PveError),
109 Status404(models::PveError),
110 Status500(models::PveError),
111 Status501(models::PveError),
112 Status503(models::PveError),
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum QemuCreateIpsetError {
120 Status400(models::PveError),
121 Status401(models::PveError),
122 Status403(models::PveError),
123 Status404(models::PveError),
124 Status500(models::PveError),
125 Status501(models::PveError),
126 Status503(models::PveError),
127 UnknownValue(serde_json::Value),
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum QemuCreateRuleError {
134 Status400(models::PveError),
135 Status401(models::PveError),
136 Status403(models::PveError),
137 Status404(models::PveError),
138 Status500(models::PveError),
139 Status501(models::PveError),
140 Status503(models::PveError),
141 UnknownValue(serde_json::Value),
142}
143
144#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum QemuCreateVmError {
148 Status400(models::PveError),
149 Status401(models::PveError),
150 Status403(models::PveError),
151 Status404(models::PveError),
152 Status500(models::PveError),
153 Status501(models::PveError),
154 Status503(models::PveError),
155 UnknownValue(serde_json::Value),
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum QemuDbusVmstateError {
162 Status400(models::PveError),
163 Status401(models::PveError),
164 Status403(models::PveError),
165 Status404(models::PveError),
166 Status500(models::PveError),
167 Status501(models::PveError),
168 Status503(models::PveError),
169 UnknownValue(serde_json::Value),
170}
171
172#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum QemuDeleteIpsetError {
176 Status400(models::PveError),
177 Status401(models::PveError),
178 Status403(models::PveError),
179 Status404(models::PveError),
180 Status500(models::PveError),
181 Status501(models::PveError),
182 Status503(models::PveError),
183 UnknownValue(serde_json::Value),
184}
185
186#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum QemuDeleteRuleError {
190 Status400(models::PveError),
191 Status401(models::PveError),
192 Status403(models::PveError),
193 Status404(models::PveError),
194 Status500(models::PveError),
195 Status501(models::PveError),
196 Status503(models::PveError),
197 UnknownValue(serde_json::Value),
198}
199
200#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum QemuDelsnapshotError {
204 Status400(models::PveError),
205 Status401(models::PveError),
206 Status403(models::PveError),
207 Status404(models::PveError),
208 Status500(models::PveError),
209 Status501(models::PveError),
210 Status503(models::PveError),
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum QemuDestroyVmError {
218 Status400(models::PveError),
219 Status401(models::PveError),
220 Status403(models::PveError),
221 Status404(models::PveError),
222 Status500(models::PveError),
223 Status501(models::PveError),
224 Status503(models::PveError),
225 UnknownValue(serde_json::Value),
226}
227
228#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum QemuExecError {
232 Status400(models::PveError),
233 Status401(models::PveError),
234 Status403(models::PveError),
235 Status404(models::PveError),
236 Status500(models::PveError),
237 Status501(models::PveError),
238 Status503(models::PveError),
239 UnknownValue(serde_json::Value),
240}
241
242#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum QemuExecStatusError {
246 Status400(models::PveError),
247 Status401(models::PveError),
248 Status403(models::PveError),
249 Status404(models::PveError),
250 Status500(models::PveError),
251 Status501(models::PveError),
252 Status503(models::PveError),
253 UnknownValue(serde_json::Value),
254}
255
256#[derive(Debug, Clone, Serialize, Deserialize)]
258#[serde(untagged)]
259pub enum QemuFileReadError {
260 Status400(models::PveError),
261 Status401(models::PveError),
262 Status403(models::PveError),
263 Status404(models::PveError),
264 Status500(models::PveError),
265 Status501(models::PveError),
266 Status503(models::PveError),
267 UnknownValue(serde_json::Value),
268}
269
270#[derive(Debug, Clone, Serialize, Deserialize)]
272#[serde(untagged)]
273pub enum QemuFileWriteError {
274 Status400(models::PveError),
275 Status401(models::PveError),
276 Status403(models::PveError),
277 Status404(models::PveError),
278 Status500(models::PveError),
279 Status501(models::PveError),
280 Status503(models::PveError),
281 UnknownValue(serde_json::Value),
282}
283
284#[derive(Debug, Clone, Serialize, Deserialize)]
286#[serde(untagged)]
287pub enum QemuFsfreezeFreezeError {
288 Status400(models::PveError),
289 Status401(models::PveError),
290 Status403(models::PveError),
291 Status404(models::PveError),
292 Status500(models::PveError),
293 Status501(models::PveError),
294 Status503(models::PveError),
295 UnknownValue(serde_json::Value),
296}
297
298#[derive(Debug, Clone, Serialize, Deserialize)]
300#[serde(untagged)]
301pub enum QemuFsfreezeStatusError {
302 Status400(models::PveError),
303 Status401(models::PveError),
304 Status403(models::PveError),
305 Status404(models::PveError),
306 Status500(models::PveError),
307 Status501(models::PveError),
308 Status503(models::PveError),
309 UnknownValue(serde_json::Value),
310}
311
312#[derive(Debug, Clone, Serialize, Deserialize)]
314#[serde(untagged)]
315pub enum QemuFsfreezeThawError {
316 Status400(models::PveError),
317 Status401(models::PveError),
318 Status403(models::PveError),
319 Status404(models::PveError),
320 Status500(models::PveError),
321 Status501(models::PveError),
322 Status503(models::PveError),
323 UnknownValue(serde_json::Value),
324}
325
326#[derive(Debug, Clone, Serialize, Deserialize)]
328#[serde(untagged)]
329pub enum QemuFstrimError {
330 Status400(models::PveError),
331 Status401(models::PveError),
332 Status403(models::PveError),
333 Status404(models::PveError),
334 Status500(models::PveError),
335 Status501(models::PveError),
336 Status503(models::PveError),
337 UnknownValue(serde_json::Value),
338}
339
340#[derive(Debug, Clone, Serialize, Deserialize)]
342#[serde(untagged)]
343pub enum QemuGetAgentError {
344 Status400(models::PveError),
345 Status401(models::PveError),
346 Status403(models::PveError),
347 Status404(models::PveError),
348 Status500(models::PveError),
349 Status501(models::PveError),
350 Status503(models::PveError),
351 UnknownValue(serde_json::Value),
352}
353
354#[derive(Debug, Clone, Serialize, Deserialize)]
356#[serde(untagged)]
357pub enum QemuGetAliasesError {
358 Status400(models::PveError),
359 Status401(models::PveError),
360 Status403(models::PveError),
361 Status404(models::PveError),
362 Status500(models::PveError),
363 Status501(models::PveError),
364 Status503(models::PveError),
365 UnknownValue(serde_json::Value),
366}
367
368#[derive(Debug, Clone, Serialize, Deserialize)]
370#[serde(untagged)]
371pub enum QemuGetFirewallError {
372 Status400(models::PveError),
373 Status401(models::PveError),
374 Status403(models::PveError),
375 Status404(models::PveError),
376 Status500(models::PveError),
377 Status501(models::PveError),
378 Status503(models::PveError),
379 UnknownValue(serde_json::Value),
380}
381
382#[derive(Debug, Clone, Serialize, Deserialize)]
384#[serde(untagged)]
385pub enum QemuGetFsinfoError {
386 Status400(models::PveError),
387 Status401(models::PveError),
388 Status403(models::PveError),
389 Status404(models::PveError),
390 Status500(models::PveError),
391 Status501(models::PveError),
392 Status503(models::PveError),
393 UnknownValue(serde_json::Value),
394}
395
396#[derive(Debug, Clone, Serialize, Deserialize)]
398#[serde(untagged)]
399pub enum QemuGetHostNameError {
400 Status400(models::PveError),
401 Status401(models::PveError),
402 Status403(models::PveError),
403 Status404(models::PveError),
404 Status500(models::PveError),
405 Status501(models::PveError),
406 Status503(models::PveError),
407 UnknownValue(serde_json::Value),
408}
409
410#[derive(Debug, Clone, Serialize, Deserialize)]
412#[serde(untagged)]
413pub enum QemuGetIpsetError {
414 Status400(models::PveError),
415 Status401(models::PveError),
416 Status403(models::PveError),
417 Status404(models::PveError),
418 Status500(models::PveError),
419 Status501(models::PveError),
420 Status503(models::PveError),
421 UnknownValue(serde_json::Value),
422}
423
424#[derive(Debug, Clone, Serialize, Deserialize)]
426#[serde(untagged)]
427pub enum QemuGetMemoryBlockInfoError {
428 Status400(models::PveError),
429 Status401(models::PveError),
430 Status403(models::PveError),
431 Status404(models::PveError),
432 Status500(models::PveError),
433 Status501(models::PveError),
434 Status503(models::PveError),
435 UnknownValue(serde_json::Value),
436}
437
438#[derive(Debug, Clone, Serialize, Deserialize)]
440#[serde(untagged)]
441pub enum QemuGetMemoryBlocksError {
442 Status400(models::PveError),
443 Status401(models::PveError),
444 Status403(models::PveError),
445 Status404(models::PveError),
446 Status500(models::PveError),
447 Status501(models::PveError),
448 Status503(models::PveError),
449 UnknownValue(serde_json::Value),
450}
451
452#[derive(Debug, Clone, Serialize, Deserialize)]
454#[serde(untagged)]
455pub enum QemuGetOptionsError {
456 Status400(models::PveError),
457 Status401(models::PveError),
458 Status403(models::PveError),
459 Status404(models::PveError),
460 Status500(models::PveError),
461 Status501(models::PveError),
462 Status503(models::PveError),
463 UnknownValue(serde_json::Value),
464}
465
466#[derive(Debug, Clone, Serialize, Deserialize)]
468#[serde(untagged)]
469pub enum QemuGetOsinfoError {
470 Status400(models::PveError),
471 Status401(models::PveError),
472 Status403(models::PveError),
473 Status404(models::PveError),
474 Status500(models::PveError),
475 Status501(models::PveError),
476 Status503(models::PveError),
477 UnknownValue(serde_json::Value),
478}
479
480#[derive(Debug, Clone, Serialize, Deserialize)]
482#[serde(untagged)]
483pub enum QemuGetRuleError {
484 Status400(models::PveError),
485 Status401(models::PveError),
486 Status403(models::PveError),
487 Status404(models::PveError),
488 Status500(models::PveError),
489 Status501(models::PveError),
490 Status503(models::PveError),
491 UnknownValue(serde_json::Value),
492}
493
494#[derive(Debug, Clone, Serialize, Deserialize)]
496#[serde(untagged)]
497pub enum QemuGetRulesError {
498 Status400(models::PveError),
499 Status401(models::PveError),
500 Status403(models::PveError),
501 Status404(models::PveError),
502 Status500(models::PveError),
503 Status501(models::PveError),
504 Status503(models::PveError),
505 UnknownValue(serde_json::Value),
506}
507
508#[derive(Debug, Clone, Serialize, Deserialize)]
510#[serde(untagged)]
511pub enum QemuGetSnapshotConfigError {
512 Status400(models::PveError),
513 Status401(models::PveError),
514 Status403(models::PveError),
515 Status404(models::PveError),
516 Status500(models::PveError),
517 Status501(models::PveError),
518 Status503(models::PveError),
519 UnknownValue(serde_json::Value),
520}
521
522#[derive(Debug, Clone, Serialize, Deserialize)]
524#[serde(untagged)]
525pub enum QemuGetTimeError {
526 Status400(models::PveError),
527 Status401(models::PveError),
528 Status403(models::PveError),
529 Status404(models::PveError),
530 Status500(models::PveError),
531 Status501(models::PveError),
532 Status503(models::PveError),
533 UnknownValue(serde_json::Value),
534}
535
536#[derive(Debug, Clone, Serialize, Deserialize)]
538#[serde(untagged)]
539pub enum QemuGetTimezoneError {
540 Status400(models::PveError),
541 Status401(models::PveError),
542 Status403(models::PveError),
543 Status404(models::PveError),
544 Status500(models::PveError),
545 Status501(models::PveError),
546 Status503(models::PveError),
547 UnknownValue(serde_json::Value),
548}
549
550#[derive(Debug, Clone, Serialize, Deserialize)]
552#[serde(untagged)]
553pub enum QemuGetUsersError {
554 Status400(models::PveError),
555 Status401(models::PveError),
556 Status403(models::PveError),
557 Status404(models::PveError),
558 Status500(models::PveError),
559 Status501(models::PveError),
560 Status503(models::PveError),
561 UnknownValue(serde_json::Value),
562}
563
564#[derive(Debug, Clone, Serialize, Deserialize)]
566#[serde(untagged)]
567pub enum QemuGetVcpusError {
568 Status400(models::PveError),
569 Status401(models::PveError),
570 Status403(models::PveError),
571 Status404(models::PveError),
572 Status500(models::PveError),
573 Status501(models::PveError),
574 Status503(models::PveError),
575 UnknownValue(serde_json::Value),
576}
577
578#[derive(Debug, Clone, Serialize, Deserialize)]
580#[serde(untagged)]
581pub enum QemuInfoError {
582 Status400(models::PveError),
583 Status401(models::PveError),
584 Status403(models::PveError),
585 Status404(models::PveError),
586 Status500(models::PveError),
587 Status501(models::PveError),
588 Status503(models::PveError),
589 UnknownValue(serde_json::Value),
590}
591
592#[derive(Debug, Clone, Serialize, Deserialize)]
594#[serde(untagged)]
595pub enum QemuIpsetIndexError {
596 Status400(models::PveError),
597 Status401(models::PveError),
598 Status403(models::PveError),
599 Status404(models::PveError),
600 Status500(models::PveError),
601 Status501(models::PveError),
602 Status503(models::PveError),
603 UnknownValue(serde_json::Value),
604}
605
606#[derive(Debug, Clone, Serialize, Deserialize)]
608#[serde(untagged)]
609pub enum QemuLogError {
610 Status400(models::PveError),
611 Status401(models::PveError),
612 Status403(models::PveError),
613 Status404(models::PveError),
614 Status500(models::PveError),
615 Status501(models::PveError),
616 Status503(models::PveError),
617 UnknownValue(serde_json::Value),
618}
619
620#[derive(Debug, Clone, Serialize, Deserialize)]
622#[serde(untagged)]
623pub enum QemuMigrateVmError {
624 Status400(models::PveError),
625 Status401(models::PveError),
626 Status403(models::PveError),
627 Status404(models::PveError),
628 Status500(models::PveError),
629 Status501(models::PveError),
630 Status503(models::PveError),
631 UnknownValue(serde_json::Value),
632}
633
634#[derive(Debug, Clone, Serialize, Deserialize)]
636#[serde(untagged)]
637pub enum QemuMigrateVmPreconditionError {
638 Status400(models::PveError),
639 Status401(models::PveError),
640 Status403(models::PveError),
641 Status404(models::PveError),
642 Status500(models::PveError),
643 Status501(models::PveError),
644 Status503(models::PveError),
645 UnknownValue(serde_json::Value),
646}
647
648#[derive(Debug, Clone, Serialize, Deserialize)]
650#[serde(untagged)]
651pub enum QemuMonitorError {
652 Status400(models::PveError),
653 Status401(models::PveError),
654 Status403(models::PveError),
655 Status404(models::PveError),
656 Status500(models::PveError),
657 Status501(models::PveError),
658 Status503(models::PveError),
659 UnknownValue(serde_json::Value),
660}
661
662#[derive(Debug, Clone, Serialize, Deserialize)]
664#[serde(untagged)]
665pub enum QemuMoveVmDiskError {
666 Status400(models::PveError),
667 Status401(models::PveError),
668 Status403(models::PveError),
669 Status404(models::PveError),
670 Status500(models::PveError),
671 Status501(models::PveError),
672 Status503(models::PveError),
673 UnknownValue(serde_json::Value),
674}
675
676#[derive(Debug, Clone, Serialize, Deserialize)]
678#[serde(untagged)]
679pub enum QemuMtunnelError {
680 Status400(models::PveError),
681 Status401(models::PveError),
682 Status403(models::PveError),
683 Status404(models::PveError),
684 Status500(models::PveError),
685 Status501(models::PveError),
686 Status503(models::PveError),
687 UnknownValue(serde_json::Value),
688}
689
690#[derive(Debug, Clone, Serialize, Deserialize)]
692#[serde(untagged)]
693pub enum QemuMtunnelwebsocketError {
694 Status400(models::PveError),
695 Status401(models::PveError),
696 Status403(models::PveError),
697 Status404(models::PveError),
698 Status500(models::PveError),
699 Status501(models::PveError),
700 Status503(models::PveError),
701 UnknownValue(serde_json::Value),
702}
703
704#[derive(Debug, Clone, Serialize, Deserialize)]
706#[serde(untagged)]
707pub enum QemuNetworkGetInterfacesError {
708 Status400(models::PveError),
709 Status401(models::PveError),
710 Status403(models::PveError),
711 Status404(models::PveError),
712 Status500(models::PveError),
713 Status501(models::PveError),
714 Status503(models::PveError),
715 UnknownValue(serde_json::Value),
716}
717
718#[derive(Debug, Clone, Serialize, Deserialize)]
720#[serde(untagged)]
721pub enum QemuPingError {
722 Status400(models::PveError),
723 Status401(models::PveError),
724 Status403(models::PveError),
725 Status404(models::PveError),
726 Status500(models::PveError),
727 Status501(models::PveError),
728 Status503(models::PveError),
729 UnknownValue(serde_json::Value),
730}
731
732#[derive(Debug, Clone, Serialize, Deserialize)]
734#[serde(untagged)]
735pub enum QemuReadAliasError {
736 Status400(models::PveError),
737 Status401(models::PveError),
738 Status403(models::PveError),
739 Status404(models::PveError),
740 Status500(models::PveError),
741 Status501(models::PveError),
742 Status503(models::PveError),
743 UnknownValue(serde_json::Value),
744}
745
746#[derive(Debug, Clone, Serialize, Deserialize)]
748#[serde(untagged)]
749pub enum QemuReadIpError {
750 Status400(models::PveError),
751 Status401(models::PveError),
752 Status403(models::PveError),
753 Status404(models::PveError),
754 Status500(models::PveError),
755 Status501(models::PveError),
756 Status503(models::PveError),
757 UnknownValue(serde_json::Value),
758}
759
760#[derive(Debug, Clone, Serialize, Deserialize)]
762#[serde(untagged)]
763pub enum QemuRefsError {
764 Status400(models::PveError),
765 Status401(models::PveError),
766 Status403(models::PveError),
767 Status404(models::PveError),
768 Status500(models::PveError),
769 Status501(models::PveError),
770 Status503(models::PveError),
771 UnknownValue(serde_json::Value),
772}
773
774#[derive(Debug, Clone, Serialize, Deserialize)]
776#[serde(untagged)]
777pub enum QemuRemoteMigrateVmError {
778 Status400(models::PveError),
779 Status401(models::PveError),
780 Status403(models::PveError),
781 Status404(models::PveError),
782 Status500(models::PveError),
783 Status501(models::PveError),
784 Status503(models::PveError),
785 UnknownValue(serde_json::Value),
786}
787
788#[derive(Debug, Clone, Serialize, Deserialize)]
790#[serde(untagged)]
791pub enum QemuRemoveAliasError {
792 Status400(models::PveError),
793 Status401(models::PveError),
794 Status403(models::PveError),
795 Status404(models::PveError),
796 Status500(models::PveError),
797 Status501(models::PveError),
798 Status503(models::PveError),
799 UnknownValue(serde_json::Value),
800}
801
802#[derive(Debug, Clone, Serialize, Deserialize)]
804#[serde(untagged)]
805pub enum QemuRemoveIpError {
806 Status400(models::PveError),
807 Status401(models::PveError),
808 Status403(models::PveError),
809 Status404(models::PveError),
810 Status500(models::PveError),
811 Status501(models::PveError),
812 Status503(models::PveError),
813 UnknownValue(serde_json::Value),
814}
815
816#[derive(Debug, Clone, Serialize, Deserialize)]
818#[serde(untagged)]
819pub enum QemuResizeVmError {
820 Status400(models::PveError),
821 Status401(models::PveError),
822 Status403(models::PveError),
823 Status404(models::PveError),
824 Status500(models::PveError),
825 Status501(models::PveError),
826 Status503(models::PveError),
827 UnknownValue(serde_json::Value),
828}
829
830#[derive(Debug, Clone, Serialize, Deserialize)]
832#[serde(untagged)]
833pub enum QemuRollbackError {
834 Status400(models::PveError),
835 Status401(models::PveError),
836 Status403(models::PveError),
837 Status404(models::PveError),
838 Status500(models::PveError),
839 Status501(models::PveError),
840 Status503(models::PveError),
841 UnknownValue(serde_json::Value),
842}
843
844#[derive(Debug, Clone, Serialize, Deserialize)]
846#[serde(untagged)]
847pub enum QemuRrdError {
848 Status400(models::PveError),
849 Status401(models::PveError),
850 Status403(models::PveError),
851 Status404(models::PveError),
852 Status500(models::PveError),
853 Status501(models::PveError),
854 Status503(models::PveError),
855 UnknownValue(serde_json::Value),
856}
857
858#[derive(Debug, Clone, Serialize, Deserialize)]
860#[serde(untagged)]
861pub enum QemuRrddataError {
862 Status400(models::PveError),
863 Status401(models::PveError),
864 Status403(models::PveError),
865 Status404(models::PveError),
866 Status500(models::PveError),
867 Status501(models::PveError),
868 Status503(models::PveError),
869 UnknownValue(serde_json::Value),
870}
871
872#[derive(Debug, Clone, Serialize, Deserialize)]
874#[serde(untagged)]
875pub enum QemuSetOptionsError {
876 Status400(models::PveError),
877 Status401(models::PveError),
878 Status403(models::PveError),
879 Status404(models::PveError),
880 Status500(models::PveError),
881 Status501(models::PveError),
882 Status503(models::PveError),
883 UnknownValue(serde_json::Value),
884}
885
886#[derive(Debug, Clone, Serialize, Deserialize)]
888#[serde(untagged)]
889pub enum QemuSetUserPasswordError {
890 Status400(models::PveError),
891 Status401(models::PveError),
892 Status403(models::PveError),
893 Status404(models::PveError),
894 Status500(models::PveError),
895 Status501(models::PveError),
896 Status503(models::PveError),
897 UnknownValue(serde_json::Value),
898}
899
900#[derive(Debug, Clone, Serialize, Deserialize)]
902#[serde(untagged)]
903pub enum QemuShutdownError {
904 Status400(models::PveError),
905 Status401(models::PveError),
906 Status403(models::PveError),
907 Status404(models::PveError),
908 Status500(models::PveError),
909 Status501(models::PveError),
910 Status503(models::PveError),
911 UnknownValue(serde_json::Value),
912}
913
914#[derive(Debug, Clone, Serialize, Deserialize)]
916#[serde(untagged)]
917pub enum QemuSnapshotError {
918 Status400(models::PveError),
919 Status401(models::PveError),
920 Status403(models::PveError),
921 Status404(models::PveError),
922 Status500(models::PveError),
923 Status501(models::PveError),
924 Status503(models::PveError),
925 UnknownValue(serde_json::Value),
926}
927
928#[derive(Debug, Clone, Serialize, Deserialize)]
930#[serde(untagged)]
931pub enum QemuSnapshotCmdIdxError {
932 Status400(models::PveError),
933 Status401(models::PveError),
934 Status403(models::PveError),
935 Status404(models::PveError),
936 Status500(models::PveError),
937 Status501(models::PveError),
938 Status503(models::PveError),
939 UnknownValue(serde_json::Value),
940}
941
942#[derive(Debug, Clone, Serialize, Deserialize)]
944#[serde(untagged)]
945pub enum QemuSnapshotListError {
946 Status400(models::PveError),
947 Status401(models::PveError),
948 Status403(models::PveError),
949 Status404(models::PveError),
950 Status500(models::PveError),
951 Status501(models::PveError),
952 Status503(models::PveError),
953 UnknownValue(serde_json::Value),
954}
955
956#[derive(Debug, Clone, Serialize, Deserialize)]
958#[serde(untagged)]
959pub enum QemuSpiceproxyError {
960 Status400(models::PveError),
961 Status401(models::PveError),
962 Status403(models::PveError),
963 Status404(models::PveError),
964 Status500(models::PveError),
965 Status501(models::PveError),
966 Status503(models::PveError),
967 UnknownValue(serde_json::Value),
968}
969
970#[derive(Debug, Clone, Serialize, Deserialize)]
972#[serde(untagged)]
973pub enum QemuSuspendDiskError {
974 Status400(models::PveError),
975 Status401(models::PveError),
976 Status403(models::PveError),
977 Status404(models::PveError),
978 Status500(models::PveError),
979 Status501(models::PveError),
980 Status503(models::PveError),
981 UnknownValue(serde_json::Value),
982}
983
984#[derive(Debug, Clone, Serialize, Deserialize)]
986#[serde(untagged)]
987pub enum QemuSuspendHybridError {
988 Status400(models::PveError),
989 Status401(models::PveError),
990 Status403(models::PveError),
991 Status404(models::PveError),
992 Status500(models::PveError),
993 Status501(models::PveError),
994 Status503(models::PveError),
995 UnknownValue(serde_json::Value),
996}
997
998#[derive(Debug, Clone, Serialize, Deserialize)]
1000#[serde(untagged)]
1001pub enum QemuSuspendRamError {
1002 Status400(models::PveError),
1003 Status401(models::PveError),
1004 Status403(models::PveError),
1005 Status404(models::PveError),
1006 Status500(models::PveError),
1007 Status501(models::PveError),
1008 Status503(models::PveError),
1009 UnknownValue(serde_json::Value),
1010}
1011
1012#[derive(Debug, Clone, Serialize, Deserialize)]
1014#[serde(untagged)]
1015pub enum QemuTemplateError {
1016 Status400(models::PveError),
1017 Status401(models::PveError),
1018 Status403(models::PveError),
1019 Status404(models::PveError),
1020 Status500(models::PveError),
1021 Status501(models::PveError),
1022 Status503(models::PveError),
1023 UnknownValue(serde_json::Value),
1024}
1025
1026#[derive(Debug, Clone, Serialize, Deserialize)]
1028#[serde(untagged)]
1029pub enum QemuTermproxyError {
1030 Status400(models::PveError),
1031 Status401(models::PveError),
1032 Status403(models::PveError),
1033 Status404(models::PveError),
1034 Status500(models::PveError),
1035 Status501(models::PveError),
1036 Status503(models::PveError),
1037 UnknownValue(serde_json::Value),
1038}
1039
1040#[derive(Debug, Clone, Serialize, Deserialize)]
1042#[serde(untagged)]
1043pub enum QemuUnlinkError {
1044 Status400(models::PveError),
1045 Status401(models::PveError),
1046 Status403(models::PveError),
1047 Status404(models::PveError),
1048 Status500(models::PveError),
1049 Status501(models::PveError),
1050 Status503(models::PveError),
1051 UnknownValue(serde_json::Value),
1052}
1053
1054#[derive(Debug, Clone, Serialize, Deserialize)]
1056#[serde(untagged)]
1057pub enum QemuUpdateAliasError {
1058 Status400(models::PveError),
1059 Status401(models::PveError),
1060 Status403(models::PveError),
1061 Status404(models::PveError),
1062 Status500(models::PveError),
1063 Status501(models::PveError),
1064 Status503(models::PveError),
1065 UnknownValue(serde_json::Value),
1066}
1067
1068#[derive(Debug, Clone, Serialize, Deserialize)]
1070#[serde(untagged)]
1071pub enum QemuUpdateIpError {
1072 Status400(models::PveError),
1073 Status401(models::PveError),
1074 Status403(models::PveError),
1075 Status404(models::PveError),
1076 Status500(models::PveError),
1077 Status501(models::PveError),
1078 Status503(models::PveError),
1079 UnknownValue(serde_json::Value),
1080}
1081
1082#[derive(Debug, Clone, Serialize, Deserialize)]
1084#[serde(untagged)]
1085pub enum QemuUpdateRuleError {
1086 Status400(models::PveError),
1087 Status401(models::PveError),
1088 Status403(models::PveError),
1089 Status404(models::PveError),
1090 Status500(models::PveError),
1091 Status501(models::PveError),
1092 Status503(models::PveError),
1093 UnknownValue(serde_json::Value),
1094}
1095
1096#[derive(Debug, Clone, Serialize, Deserialize)]
1098#[serde(untagged)]
1099pub enum QemuUpdateSnapshotConfigError {
1100 Status400(models::PveError),
1101 Status401(models::PveError),
1102 Status403(models::PveError),
1103 Status404(models::PveError),
1104 Status500(models::PveError),
1105 Status501(models::PveError),
1106 Status503(models::PveError),
1107 UnknownValue(serde_json::Value),
1108}
1109
1110#[derive(Debug, Clone, Serialize, Deserialize)]
1112#[serde(untagged)]
1113pub enum QemuUpdateVmError {
1114 Status400(models::PveError),
1115 Status401(models::PveError),
1116 Status403(models::PveError),
1117 Status404(models::PveError),
1118 Status500(models::PveError),
1119 Status501(models::PveError),
1120 Status503(models::PveError),
1121 UnknownValue(serde_json::Value),
1122}
1123
1124#[derive(Debug, Clone, Serialize, Deserialize)]
1126#[serde(untagged)]
1127pub enum QemuUpdateVmAsyncOpError {
1128 Status400(models::PveError),
1129 Status401(models::PveError),
1130 Status403(models::PveError),
1131 Status404(models::PveError),
1132 Status500(models::PveError),
1133 Status501(models::PveError),
1134 Status503(models::PveError),
1135 UnknownValue(serde_json::Value),
1136}
1137
1138#[derive(Debug, Clone, Serialize, Deserialize)]
1140#[serde(untagged)]
1141pub enum QemuVmConfigError {
1142 Status400(models::PveError),
1143 Status401(models::PveError),
1144 Status403(models::PveError),
1145 Status404(models::PveError),
1146 Status500(models::PveError),
1147 Status501(models::PveError),
1148 Status503(models::PveError),
1149 UnknownValue(serde_json::Value),
1150}
1151
1152#[derive(Debug, Clone, Serialize, Deserialize)]
1154#[serde(untagged)]
1155pub enum QemuVmFeatureError {
1156 Status400(models::PveError),
1157 Status401(models::PveError),
1158 Status403(models::PveError),
1159 Status404(models::PveError),
1160 Status500(models::PveError),
1161 Status501(models::PveError),
1162 Status503(models::PveError),
1163 UnknownValue(serde_json::Value),
1164}
1165
1166#[derive(Debug, Clone, Serialize, Deserialize)]
1168#[serde(untagged)]
1169pub enum QemuVmPendingError {
1170 Status400(models::PveError),
1171 Status401(models::PveError),
1172 Status403(models::PveError),
1173 Status404(models::PveError),
1174 Status500(models::PveError),
1175 Status501(models::PveError),
1176 Status503(models::PveError),
1177 UnknownValue(serde_json::Value),
1178}
1179
1180#[derive(Debug, Clone, Serialize, Deserialize)]
1182#[serde(untagged)]
1183pub enum QemuVmRebootError {
1184 Status400(models::PveError),
1185 Status401(models::PveError),
1186 Status403(models::PveError),
1187 Status404(models::PveError),
1188 Status500(models::PveError),
1189 Status501(models::PveError),
1190 Status503(models::PveError),
1191 UnknownValue(serde_json::Value),
1192}
1193
1194#[derive(Debug, Clone, Serialize, Deserialize)]
1196#[serde(untagged)]
1197pub enum QemuVmResetError {
1198 Status400(models::PveError),
1199 Status401(models::PveError),
1200 Status403(models::PveError),
1201 Status404(models::PveError),
1202 Status500(models::PveError),
1203 Status501(models::PveError),
1204 Status503(models::PveError),
1205 UnknownValue(serde_json::Value),
1206}
1207
1208#[derive(Debug, Clone, Serialize, Deserialize)]
1210#[serde(untagged)]
1211pub enum QemuVmResumeError {
1212 Status400(models::PveError),
1213 Status401(models::PveError),
1214 Status403(models::PveError),
1215 Status404(models::PveError),
1216 Status500(models::PveError),
1217 Status501(models::PveError),
1218 Status503(models::PveError),
1219 UnknownValue(serde_json::Value),
1220}
1221
1222#[derive(Debug, Clone, Serialize, Deserialize)]
1224#[serde(untagged)]
1225pub enum QemuVmSendkeyError {
1226 Status400(models::PveError),
1227 Status401(models::PveError),
1228 Status403(models::PveError),
1229 Status404(models::PveError),
1230 Status500(models::PveError),
1231 Status501(models::PveError),
1232 Status503(models::PveError),
1233 UnknownValue(serde_json::Value),
1234}
1235
1236#[derive(Debug, Clone, Serialize, Deserialize)]
1238#[serde(untagged)]
1239pub enum QemuVmShutdownError {
1240 Status400(models::PveError),
1241 Status401(models::PveError),
1242 Status403(models::PveError),
1243 Status404(models::PveError),
1244 Status500(models::PveError),
1245 Status501(models::PveError),
1246 Status503(models::PveError),
1247 UnknownValue(serde_json::Value),
1248}
1249
1250#[derive(Debug, Clone, Serialize, Deserialize)]
1252#[serde(untagged)]
1253pub enum QemuVmStartError {
1254 Status400(models::PveError),
1255 Status401(models::PveError),
1256 Status403(models::PveError),
1257 Status404(models::PveError),
1258 Status500(models::PveError),
1259 Status501(models::PveError),
1260 Status503(models::PveError),
1261 UnknownValue(serde_json::Value),
1262}
1263
1264#[derive(Debug, Clone, Serialize, Deserialize)]
1266#[serde(untagged)]
1267pub enum QemuVmStatusError {
1268 Status400(models::PveError),
1269 Status401(models::PveError),
1270 Status403(models::PveError),
1271 Status404(models::PveError),
1272 Status500(models::PveError),
1273 Status501(models::PveError),
1274 Status503(models::PveError),
1275 UnknownValue(serde_json::Value),
1276}
1277
1278#[derive(Debug, Clone, Serialize, Deserialize)]
1280#[serde(untagged)]
1281pub enum QemuVmStopError {
1282 Status400(models::PveError),
1283 Status401(models::PveError),
1284 Status403(models::PveError),
1285 Status404(models::PveError),
1286 Status500(models::PveError),
1287 Status501(models::PveError),
1288 Status503(models::PveError),
1289 UnknownValue(serde_json::Value),
1290}
1291
1292#[derive(Debug, Clone, Serialize, Deserialize)]
1294#[serde(untagged)]
1295pub enum QemuVmSuspendError {
1296 Status400(models::PveError),
1297 Status401(models::PveError),
1298 Status403(models::PveError),
1299 Status404(models::PveError),
1300 Status500(models::PveError),
1301 Status501(models::PveError),
1302 Status503(models::PveError),
1303 UnknownValue(serde_json::Value),
1304}
1305
1306#[derive(Debug, Clone, Serialize, Deserialize)]
1308#[serde(untagged)]
1309pub enum QemuVmcmdidxError {
1310 Status400(models::PveError),
1311 Status401(models::PveError),
1312 Status403(models::PveError),
1313 Status404(models::PveError),
1314 Status500(models::PveError),
1315 Status501(models::PveError),
1316 Status503(models::PveError),
1317 UnknownValue(serde_json::Value),
1318}
1319
1320#[derive(Debug, Clone, Serialize, Deserialize)]
1322#[serde(untagged)]
1323pub enum QemuVmdiridxError {
1324 Status400(models::PveError),
1325 Status401(models::PveError),
1326 Status403(models::PveError),
1327 Status404(models::PveError),
1328 Status500(models::PveError),
1329 Status501(models::PveError),
1330 Status503(models::PveError),
1331 UnknownValue(serde_json::Value),
1332}
1333
1334#[derive(Debug, Clone, Serialize, Deserialize)]
1336#[serde(untagged)]
1337pub enum QemuVmlistError {
1338 Status400(models::PveError),
1339 Status401(models::PveError),
1340 Status403(models::PveError),
1341 Status404(models::PveError),
1342 Status500(models::PveError),
1343 Status501(models::PveError),
1344 Status503(models::PveError),
1345 UnknownValue(serde_json::Value),
1346}
1347
1348#[derive(Debug, Clone, Serialize, Deserialize)]
1350#[serde(untagged)]
1351pub enum QemuVncproxyError {
1352 Status400(models::PveError),
1353 Status401(models::PveError),
1354 Status403(models::PveError),
1355 Status404(models::PveError),
1356 Status500(models::PveError),
1357 Status501(models::PveError),
1358 Status503(models::PveError),
1359 UnknownValue(serde_json::Value),
1360}
1361
1362#[derive(Debug, Clone, Serialize, Deserialize)]
1364#[serde(untagged)]
1365pub enum QemuVncwebsocketError {
1366 Status400(models::PveError),
1367 Status401(models::PveError),
1368 Status403(models::PveError),
1369 Status404(models::PveError),
1370 Status500(models::PveError),
1371 Status501(models::PveError),
1372 Status503(models::PveError),
1373 UnknownValue(serde_json::Value),
1374}
1375
1376
1377pub async fn qemu_agent(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_agent_request: models::QemuAgentRequest) -> Result<models::QemuAgentResponse, Error<QemuAgentError>> {
1379 let p_path_node = node;
1381 let p_path_vmid = vmid;
1382 let p_body_qemu_agent_request = qemu_agent_request;
1383
1384 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1385 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1386
1387 if let Some(ref user_agent) = configuration.user_agent {
1388 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1389 }
1390 if let Some(ref apikey) = configuration.api_key {
1391 let key = apikey.key.clone();
1392 let value = match apikey.prefix {
1393 Some(ref prefix) => format!("{} {}", prefix, key),
1394 None => key,
1395 };
1396 req_builder = req_builder.header("Authorization", value);
1397 };
1398 if let Some(ref apikey) = configuration.api_key {
1399 let key = apikey.key.clone();
1400 let value = match apikey.prefix {
1401 Some(ref prefix) => format!("{} {}", prefix, key),
1402 None => key,
1403 };
1404 req_builder = req_builder.header("CSRFPreventionToken", value);
1405 };
1406 req_builder = req_builder.json(&p_body_qemu_agent_request);
1407
1408 let req = req_builder.build()?;
1409 let resp = configuration.client.execute(req).await?;
1410
1411 let status = resp.status();
1412 let content_type = resp
1413 .headers()
1414 .get("content-type")
1415 .and_then(|v| v.to_str().ok())
1416 .unwrap_or("application/octet-stream");
1417 let content_type = super::ContentType::from(content_type);
1418
1419 if !status.is_client_error() && !status.is_server_error() {
1420 let content = resp.text().await?;
1421 match content_type {
1422 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1423 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuAgentResponse`"))),
1424 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::QemuAgentResponse`")))),
1425 }
1426 } else {
1427 let content = resp.text().await?;
1428 let entity: Option<QemuAgentError> = serde_json::from_str(&content).ok();
1429 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1430 }
1431}
1432
1433pub async fn qemu_clone_vm(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_clone_vm_request: models::QemuCloneVmRequest) -> Result<models::QemuCloneVmResponse, Error<QemuCloneVmError>> {
1435 let p_path_node = node;
1437 let p_path_vmid = vmid;
1438 let p_body_qemu_clone_vm_request = qemu_clone_vm_request;
1439
1440 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/clone", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1441 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1442
1443 if let Some(ref user_agent) = configuration.user_agent {
1444 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1445 }
1446 if let Some(ref apikey) = configuration.api_key {
1447 let key = apikey.key.clone();
1448 let value = match apikey.prefix {
1449 Some(ref prefix) => format!("{} {}", prefix, key),
1450 None => key,
1451 };
1452 req_builder = req_builder.header("Authorization", value);
1453 };
1454 if let Some(ref apikey) = configuration.api_key {
1455 let key = apikey.key.clone();
1456 let value = match apikey.prefix {
1457 Some(ref prefix) => format!("{} {}", prefix, key),
1458 None => key,
1459 };
1460 req_builder = req_builder.header("CSRFPreventionToken", value);
1461 };
1462 req_builder = req_builder.json(&p_body_qemu_clone_vm_request);
1463
1464 let req = req_builder.build()?;
1465 let resp = configuration.client.execute(req).await?;
1466
1467 let status = resp.status();
1468 let content_type = resp
1469 .headers()
1470 .get("content-type")
1471 .and_then(|v| v.to_str().ok())
1472 .unwrap_or("application/octet-stream");
1473 let content_type = super::ContentType::from(content_type);
1474
1475 if !status.is_client_error() && !status.is_server_error() {
1476 let content = resp.text().await?;
1477 match content_type {
1478 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1479 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuCloneVmResponse`"))),
1480 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::QemuCloneVmResponse`")))),
1481 }
1482 } else {
1483 let content = resp.text().await?;
1484 let entity: Option<QemuCloneVmError> = serde_json::from_str(&content).ok();
1485 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1486 }
1487}
1488
1489pub async fn qemu_cloudinit_generated_config_dump(configuration: &configuration::Configuration, node: &str, r#type: models::PveQemuTypeEnum2, vmid: i32) -> Result<models::QemuCloudinitGeneratedConfigDumpResponse, Error<QemuCloudinitGeneratedConfigDumpError>> {
1491 let p_path_node = node;
1493 let p_query_type = r#type;
1494 let p_path_vmid = vmid;
1495
1496 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/cloudinit/dump", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1497 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1498
1499 req_builder = req_builder.query(&[("type", &p_query_type.to_string())]);
1500 if let Some(ref user_agent) = configuration.user_agent {
1501 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1502 }
1503 if let Some(ref apikey) = configuration.api_key {
1504 let key = apikey.key.clone();
1505 let value = match apikey.prefix {
1506 Some(ref prefix) => format!("{} {}", prefix, key),
1507 None => key,
1508 };
1509 req_builder = req_builder.header("Authorization", value);
1510 };
1511 if let Some(ref apikey) = configuration.api_key {
1512 let key = apikey.key.clone();
1513 let value = match apikey.prefix {
1514 Some(ref prefix) => format!("{} {}", prefix, key),
1515 None => key,
1516 };
1517 req_builder = req_builder.header("CSRFPreventionToken", value);
1518 };
1519
1520 let req = req_builder.build()?;
1521 let resp = configuration.client.execute(req).await?;
1522
1523 let status = resp.status();
1524 let content_type = resp
1525 .headers()
1526 .get("content-type")
1527 .and_then(|v| v.to_str().ok())
1528 .unwrap_or("application/octet-stream");
1529 let content_type = super::ContentType::from(content_type);
1530
1531 if !status.is_client_error() && !status.is_server_error() {
1532 let content = resp.text().await?;
1533 match content_type {
1534 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1535 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuCloudinitGeneratedConfigDumpResponse`"))),
1536 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::QemuCloudinitGeneratedConfigDumpResponse`")))),
1537 }
1538 } else {
1539 let content = resp.text().await?;
1540 let entity: Option<QemuCloudinitGeneratedConfigDumpError> = serde_json::from_str(&content).ok();
1541 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1542 }
1543}
1544
1545pub async fn qemu_cloudinit_pending(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuCloudinitPendingResponse, Error<QemuCloudinitPendingError>> {
1547 let p_path_node = node;
1549 let p_path_vmid = vmid;
1550
1551 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/cloudinit", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1552 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1553
1554 if let Some(ref user_agent) = configuration.user_agent {
1555 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1556 }
1557 if let Some(ref apikey) = configuration.api_key {
1558 let key = apikey.key.clone();
1559 let value = match apikey.prefix {
1560 Some(ref prefix) => format!("{} {}", prefix, key),
1561 None => key,
1562 };
1563 req_builder = req_builder.header("Authorization", value);
1564 };
1565 if let Some(ref apikey) = configuration.api_key {
1566 let key = apikey.key.clone();
1567 let value = match apikey.prefix {
1568 Some(ref prefix) => format!("{} {}", prefix, key),
1569 None => key,
1570 };
1571 req_builder = req_builder.header("CSRFPreventionToken", value);
1572 };
1573
1574 let req = req_builder.build()?;
1575 let resp = configuration.client.execute(req).await?;
1576
1577 let status = resp.status();
1578 let content_type = resp
1579 .headers()
1580 .get("content-type")
1581 .and_then(|v| v.to_str().ok())
1582 .unwrap_or("application/octet-stream");
1583 let content_type = super::ContentType::from(content_type);
1584
1585 if !status.is_client_error() && !status.is_server_error() {
1586 let content = resp.text().await?;
1587 match content_type {
1588 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1589 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuCloudinitPendingResponse`"))),
1590 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::QemuCloudinitPendingResponse`")))),
1591 }
1592 } else {
1593 let content = resp.text().await?;
1594 let entity: Option<QemuCloudinitPendingError> = serde_json::from_str(&content).ok();
1595 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1596 }
1597}
1598
1599pub async fn qemu_cloudinit_update(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuCloudinitUpdateResponse, Error<QemuCloudinitUpdateError>> {
1601 let p_path_node = node;
1603 let p_path_vmid = vmid;
1604
1605 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/cloudinit", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1606 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1607
1608 if let Some(ref user_agent) = configuration.user_agent {
1609 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1610 }
1611 if let Some(ref apikey) = configuration.api_key {
1612 let key = apikey.key.clone();
1613 let value = match apikey.prefix {
1614 Some(ref prefix) => format!("{} {}", prefix, key),
1615 None => key,
1616 };
1617 req_builder = req_builder.header("Authorization", value);
1618 };
1619 if let Some(ref apikey) = configuration.api_key {
1620 let key = apikey.key.clone();
1621 let value = match apikey.prefix {
1622 Some(ref prefix) => format!("{} {}", prefix, key),
1623 None => key,
1624 };
1625 req_builder = req_builder.header("CSRFPreventionToken", value);
1626 };
1627
1628 let req = req_builder.build()?;
1629 let resp = configuration.client.execute(req).await?;
1630
1631 let status = resp.status();
1632 let content_type = resp
1633 .headers()
1634 .get("content-type")
1635 .and_then(|v| v.to_str().ok())
1636 .unwrap_or("application/octet-stream");
1637 let content_type = super::ContentType::from(content_type);
1638
1639 if !status.is_client_error() && !status.is_server_error() {
1640 let content = resp.text().await?;
1641 match content_type {
1642 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1643 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuCloudinitUpdateResponse`"))),
1644 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::QemuCloudinitUpdateResponse`")))),
1645 }
1646 } else {
1647 let content = resp.text().await?;
1648 let entity: Option<QemuCloudinitUpdateError> = serde_json::from_str(&content).ok();
1649 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1650 }
1651}
1652
1653pub async fn qemu_create_alias(configuration: &configuration::Configuration, node: &str, vmid: i32, cluster_firewall_create_alias_request: models::ClusterFirewallCreateAliasRequest) -> Result<models::QemuCreateAliasResponse, Error<QemuCreateAliasError>> {
1655 let p_path_node = node;
1657 let p_path_vmid = vmid;
1658 let p_body_cluster_firewall_create_alias_request = cluster_firewall_create_alias_request;
1659
1660 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/aliases", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1661 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1662
1663 if let Some(ref user_agent) = configuration.user_agent {
1664 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1665 }
1666 if let Some(ref apikey) = configuration.api_key {
1667 let key = apikey.key.clone();
1668 let value = match apikey.prefix {
1669 Some(ref prefix) => format!("{} {}", prefix, key),
1670 None => key,
1671 };
1672 req_builder = req_builder.header("Authorization", value);
1673 };
1674 if let Some(ref apikey) = configuration.api_key {
1675 let key = apikey.key.clone();
1676 let value = match apikey.prefix {
1677 Some(ref prefix) => format!("{} {}", prefix, key),
1678 None => key,
1679 };
1680 req_builder = req_builder.header("CSRFPreventionToken", value);
1681 };
1682 req_builder = req_builder.json(&p_body_cluster_firewall_create_alias_request);
1683
1684 let req = req_builder.build()?;
1685 let resp = configuration.client.execute(req).await?;
1686
1687 let status = resp.status();
1688 let content_type = resp
1689 .headers()
1690 .get("content-type")
1691 .and_then(|v| v.to_str().ok())
1692 .unwrap_or("application/octet-stream");
1693 let content_type = super::ContentType::from(content_type);
1694
1695 if !status.is_client_error() && !status.is_server_error() {
1696 let content = resp.text().await?;
1697 match content_type {
1698 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1699 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuCreateAliasResponse`"))),
1700 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::QemuCreateAliasResponse`")))),
1701 }
1702 } else {
1703 let content = resp.text().await?;
1704 let entity: Option<QemuCreateAliasError> = serde_json::from_str(&content).ok();
1705 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1706 }
1707}
1708
1709pub async fn qemu_create_ip(configuration: &configuration::Configuration, name: &str, node: &str, vmid: i32, cluster_firewall_create_ip_request: models::ClusterFirewallCreateIpRequest) -> Result<models::QemuCreateIpResponse, Error<QemuCreateIpError>> {
1711 let p_path_name = name;
1713 let p_path_node = node;
1714 let p_path_vmid = vmid;
1715 let p_body_cluster_firewall_create_ip_request = cluster_firewall_create_ip_request;
1716
1717 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/ipset/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name), node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1718 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1719
1720 if let Some(ref user_agent) = configuration.user_agent {
1721 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1722 }
1723 if let Some(ref apikey) = configuration.api_key {
1724 let key = apikey.key.clone();
1725 let value = match apikey.prefix {
1726 Some(ref prefix) => format!("{} {}", prefix, key),
1727 None => key,
1728 };
1729 req_builder = req_builder.header("Authorization", value);
1730 };
1731 if let Some(ref apikey) = configuration.api_key {
1732 let key = apikey.key.clone();
1733 let value = match apikey.prefix {
1734 Some(ref prefix) => format!("{} {}", prefix, key),
1735 None => key,
1736 };
1737 req_builder = req_builder.header("CSRFPreventionToken", value);
1738 };
1739 req_builder = req_builder.json(&p_body_cluster_firewall_create_ip_request);
1740
1741 let req = req_builder.build()?;
1742 let resp = configuration.client.execute(req).await?;
1743
1744 let status = resp.status();
1745 let content_type = resp
1746 .headers()
1747 .get("content-type")
1748 .and_then(|v| v.to_str().ok())
1749 .unwrap_or("application/octet-stream");
1750 let content_type = super::ContentType::from(content_type);
1751
1752 if !status.is_client_error() && !status.is_server_error() {
1753 let content = resp.text().await?;
1754 match content_type {
1755 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1756 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuCreateIpResponse`"))),
1757 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::QemuCreateIpResponse`")))),
1758 }
1759 } else {
1760 let content = resp.text().await?;
1761 let entity: Option<QemuCreateIpError> = serde_json::from_str(&content).ok();
1762 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1763 }
1764}
1765
1766pub async fn qemu_create_ipset(configuration: &configuration::Configuration, node: &str, vmid: i32, cluster_firewall_create_ipset_request: models::ClusterFirewallCreateIpsetRequest) -> Result<models::QemuCreateIpsetResponse, Error<QemuCreateIpsetError>> {
1768 let p_path_node = node;
1770 let p_path_vmid = vmid;
1771 let p_body_cluster_firewall_create_ipset_request = cluster_firewall_create_ipset_request;
1772
1773 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/ipset", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1774 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1775
1776 if let Some(ref user_agent) = configuration.user_agent {
1777 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1778 }
1779 if let Some(ref apikey) = configuration.api_key {
1780 let key = apikey.key.clone();
1781 let value = match apikey.prefix {
1782 Some(ref prefix) => format!("{} {}", prefix, key),
1783 None => key,
1784 };
1785 req_builder = req_builder.header("Authorization", value);
1786 };
1787 if let Some(ref apikey) = configuration.api_key {
1788 let key = apikey.key.clone();
1789 let value = match apikey.prefix {
1790 Some(ref prefix) => format!("{} {}", prefix, key),
1791 None => key,
1792 };
1793 req_builder = req_builder.header("CSRFPreventionToken", value);
1794 };
1795 req_builder = req_builder.json(&p_body_cluster_firewall_create_ipset_request);
1796
1797 let req = req_builder.build()?;
1798 let resp = configuration.client.execute(req).await?;
1799
1800 let status = resp.status();
1801 let content_type = resp
1802 .headers()
1803 .get("content-type")
1804 .and_then(|v| v.to_str().ok())
1805 .unwrap_or("application/octet-stream");
1806 let content_type = super::ContentType::from(content_type);
1807
1808 if !status.is_client_error() && !status.is_server_error() {
1809 let content = resp.text().await?;
1810 match content_type {
1811 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1812 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuCreateIpsetResponse`"))),
1813 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::QemuCreateIpsetResponse`")))),
1814 }
1815 } else {
1816 let content = resp.text().await?;
1817 let entity: Option<QemuCreateIpsetError> = serde_json::from_str(&content).ok();
1818 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1819 }
1820}
1821
1822pub async fn qemu_create_rule(configuration: &configuration::Configuration, node: &str, vmid: i32, cluster_firewall_create_rule_request: models::ClusterFirewallCreateRuleRequest) -> Result<models::QemuCreateRuleResponse, Error<QemuCreateRuleError>> {
1824 let p_path_node = node;
1826 let p_path_vmid = vmid;
1827 let p_body_cluster_firewall_create_rule_request = cluster_firewall_create_rule_request;
1828
1829 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/rules", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1830 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1831
1832 if let Some(ref user_agent) = configuration.user_agent {
1833 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1834 }
1835 if let Some(ref apikey) = configuration.api_key {
1836 let key = apikey.key.clone();
1837 let value = match apikey.prefix {
1838 Some(ref prefix) => format!("{} {}", prefix, key),
1839 None => key,
1840 };
1841 req_builder = req_builder.header("Authorization", value);
1842 };
1843 if let Some(ref apikey) = configuration.api_key {
1844 let key = apikey.key.clone();
1845 let value = match apikey.prefix {
1846 Some(ref prefix) => format!("{} {}", prefix, key),
1847 None => key,
1848 };
1849 req_builder = req_builder.header("CSRFPreventionToken", value);
1850 };
1851 req_builder = req_builder.json(&p_body_cluster_firewall_create_rule_request);
1852
1853 let req = req_builder.build()?;
1854 let resp = configuration.client.execute(req).await?;
1855
1856 let status = resp.status();
1857 let content_type = resp
1858 .headers()
1859 .get("content-type")
1860 .and_then(|v| v.to_str().ok())
1861 .unwrap_or("application/octet-stream");
1862 let content_type = super::ContentType::from(content_type);
1863
1864 if !status.is_client_error() && !status.is_server_error() {
1865 let content = resp.text().await?;
1866 match content_type {
1867 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1868 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuCreateRuleResponse`"))),
1869 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::QemuCreateRuleResponse`")))),
1870 }
1871 } else {
1872 let content = resp.text().await?;
1873 let entity: Option<QemuCreateRuleError> = serde_json::from_str(&content).ok();
1874 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1875 }
1876}
1877
1878pub async fn qemu_create_vm(configuration: &configuration::Configuration, node: &str, qemu_create_vm_request: models::QemuCreateVmRequest) -> Result<models::QemuCreateVmResponse, Error<QemuCreateVmError>> {
1880 let p_path_node = node;
1882 let p_body_qemu_create_vm_request = qemu_create_vm_request;
1883
1884 let uri_str = format!("{}/nodes/{node}/qemu", configuration.base_path, node=crate::apis::urlencode(p_path_node));
1885 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1886
1887 if let Some(ref user_agent) = configuration.user_agent {
1888 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1889 }
1890 if let Some(ref apikey) = configuration.api_key {
1891 let key = apikey.key.clone();
1892 let value = match apikey.prefix {
1893 Some(ref prefix) => format!("{} {}", prefix, key),
1894 None => key,
1895 };
1896 req_builder = req_builder.header("Authorization", value);
1897 };
1898 if let Some(ref apikey) = configuration.api_key {
1899 let key = apikey.key.clone();
1900 let value = match apikey.prefix {
1901 Some(ref prefix) => format!("{} {}", prefix, key),
1902 None => key,
1903 };
1904 req_builder = req_builder.header("CSRFPreventionToken", value);
1905 };
1906 req_builder = req_builder.json(&p_body_qemu_create_vm_request);
1907
1908 let req = req_builder.build()?;
1909 let resp = configuration.client.execute(req).await?;
1910
1911 let status = resp.status();
1912 let content_type = resp
1913 .headers()
1914 .get("content-type")
1915 .and_then(|v| v.to_str().ok())
1916 .unwrap_or("application/octet-stream");
1917 let content_type = super::ContentType::from(content_type);
1918
1919 if !status.is_client_error() && !status.is_server_error() {
1920 let content = resp.text().await?;
1921 match content_type {
1922 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1923 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuCreateVmResponse`"))),
1924 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::QemuCreateVmResponse`")))),
1925 }
1926 } else {
1927 let content = resp.text().await?;
1928 let entity: Option<QemuCreateVmError> = serde_json::from_str(&content).ok();
1929 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1930 }
1931}
1932
1933pub async fn qemu_dbus_vmstate(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_dbus_vmstate_request: models::QemuDbusVmstateRequest) -> Result<models::QemuDbusVmstateResponse, Error<QemuDbusVmstateError>> {
1935 let p_path_node = node;
1937 let p_path_vmid = vmid;
1938 let p_body_qemu_dbus_vmstate_request = qemu_dbus_vmstate_request;
1939
1940 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/dbus-vmstate", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1941 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1942
1943 if let Some(ref user_agent) = configuration.user_agent {
1944 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1945 }
1946 if let Some(ref apikey) = configuration.api_key {
1947 let key = apikey.key.clone();
1948 let value = match apikey.prefix {
1949 Some(ref prefix) => format!("{} {}", prefix, key),
1950 None => key,
1951 };
1952 req_builder = req_builder.header("Authorization", value);
1953 };
1954 if let Some(ref apikey) = configuration.api_key {
1955 let key = apikey.key.clone();
1956 let value = match apikey.prefix {
1957 Some(ref prefix) => format!("{} {}", prefix, key),
1958 None => key,
1959 };
1960 req_builder = req_builder.header("CSRFPreventionToken", value);
1961 };
1962 req_builder = req_builder.json(&p_body_qemu_dbus_vmstate_request);
1963
1964 let req = req_builder.build()?;
1965 let resp = configuration.client.execute(req).await?;
1966
1967 let status = resp.status();
1968 let content_type = resp
1969 .headers()
1970 .get("content-type")
1971 .and_then(|v| v.to_str().ok())
1972 .unwrap_or("application/octet-stream");
1973 let content_type = super::ContentType::from(content_type);
1974
1975 if !status.is_client_error() && !status.is_server_error() {
1976 let content = resp.text().await?;
1977 match content_type {
1978 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1979 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuDbusVmstateResponse`"))),
1980 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::QemuDbusVmstateResponse`")))),
1981 }
1982 } else {
1983 let content = resp.text().await?;
1984 let entity: Option<QemuDbusVmstateError> = serde_json::from_str(&content).ok();
1985 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1986 }
1987}
1988
1989pub async fn qemu_delete_ipset(configuration: &configuration::Configuration, name: &str, node: &str, vmid: i32, force: Option<&str>) -> Result<models::QemuDeleteIpsetResponse, Error<QemuDeleteIpsetError>> {
1991 let p_path_name = name;
1993 let p_path_node = node;
1994 let p_path_vmid = vmid;
1995 let p_query_force = force;
1996
1997 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/ipset/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name), node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1998 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1999
2000 if let Some(ref param_value) = p_query_force {
2001 req_builder = req_builder.query(&[("force", ¶m_value.to_string())]);
2002 }
2003 if let Some(ref user_agent) = configuration.user_agent {
2004 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2005 }
2006 if let Some(ref apikey) = configuration.api_key {
2007 let key = apikey.key.clone();
2008 let value = match apikey.prefix {
2009 Some(ref prefix) => format!("{} {}", prefix, key),
2010 None => key,
2011 };
2012 req_builder = req_builder.header("Authorization", value);
2013 };
2014 if let Some(ref apikey) = configuration.api_key {
2015 let key = apikey.key.clone();
2016 let value = match apikey.prefix {
2017 Some(ref prefix) => format!("{} {}", prefix, key),
2018 None => key,
2019 };
2020 req_builder = req_builder.header("CSRFPreventionToken", value);
2021 };
2022
2023 let req = req_builder.build()?;
2024 let resp = configuration.client.execute(req).await?;
2025
2026 let status = resp.status();
2027 let content_type = resp
2028 .headers()
2029 .get("content-type")
2030 .and_then(|v| v.to_str().ok())
2031 .unwrap_or("application/octet-stream");
2032 let content_type = super::ContentType::from(content_type);
2033
2034 if !status.is_client_error() && !status.is_server_error() {
2035 let content = resp.text().await?;
2036 match content_type {
2037 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2038 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuDeleteIpsetResponse`"))),
2039 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::QemuDeleteIpsetResponse`")))),
2040 }
2041 } else {
2042 let content = resp.text().await?;
2043 let entity: Option<QemuDeleteIpsetError> = serde_json::from_str(&content).ok();
2044 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2045 }
2046}
2047
2048pub async fn qemu_delete_rule(configuration: &configuration::Configuration, node: &str, pos: i64, vmid: i32, digest: Option<&str>) -> Result<models::QemuDeleteRuleResponse, Error<QemuDeleteRuleError>> {
2050 let p_path_node = node;
2052 let p_path_pos = pos;
2053 let p_path_vmid = vmid;
2054 let p_query_digest = digest;
2055
2056 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/rules/{pos}", configuration.base_path, node=crate::apis::urlencode(p_path_node), pos=p_path_pos, vmid=p_path_vmid);
2057 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2058
2059 if let Some(ref param_value) = p_query_digest {
2060 req_builder = req_builder.query(&[("digest", ¶m_value.to_string())]);
2061 }
2062 if let Some(ref user_agent) = configuration.user_agent {
2063 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2064 }
2065 if let Some(ref apikey) = configuration.api_key {
2066 let key = apikey.key.clone();
2067 let value = match apikey.prefix {
2068 Some(ref prefix) => format!("{} {}", prefix, key),
2069 None => key,
2070 };
2071 req_builder = req_builder.header("Authorization", value);
2072 };
2073 if let Some(ref apikey) = configuration.api_key {
2074 let key = apikey.key.clone();
2075 let value = match apikey.prefix {
2076 Some(ref prefix) => format!("{} {}", prefix, key),
2077 None => key,
2078 };
2079 req_builder = req_builder.header("CSRFPreventionToken", value);
2080 };
2081
2082 let req = req_builder.build()?;
2083 let resp = configuration.client.execute(req).await?;
2084
2085 let status = resp.status();
2086 let content_type = resp
2087 .headers()
2088 .get("content-type")
2089 .and_then(|v| v.to_str().ok())
2090 .unwrap_or("application/octet-stream");
2091 let content_type = super::ContentType::from(content_type);
2092
2093 if !status.is_client_error() && !status.is_server_error() {
2094 let content = resp.text().await?;
2095 match content_type {
2096 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2097 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuDeleteRuleResponse`"))),
2098 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::QemuDeleteRuleResponse`")))),
2099 }
2100 } else {
2101 let content = resp.text().await?;
2102 let entity: Option<QemuDeleteRuleError> = serde_json::from_str(&content).ok();
2103 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2104 }
2105}
2106
2107pub async fn qemu_delsnapshot(configuration: &configuration::Configuration, node: &str, snapname: &str, vmid: i32, force: Option<&str>) -> Result<models::QemuDelsnapshotResponse, Error<QemuDelsnapshotError>> {
2109 let p_path_node = node;
2111 let p_path_snapname = snapname;
2112 let p_path_vmid = vmid;
2113 let p_query_force = force;
2114
2115 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/snapshot/{snapname}", configuration.base_path, node=crate::apis::urlencode(p_path_node), snapname=crate::apis::urlencode(p_path_snapname), vmid=p_path_vmid);
2116 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2117
2118 if let Some(ref param_value) = p_query_force {
2119 req_builder = req_builder.query(&[("force", ¶m_value.to_string())]);
2120 }
2121 if let Some(ref user_agent) = configuration.user_agent {
2122 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2123 }
2124 if let Some(ref apikey) = configuration.api_key {
2125 let key = apikey.key.clone();
2126 let value = match apikey.prefix {
2127 Some(ref prefix) => format!("{} {}", prefix, key),
2128 None => key,
2129 };
2130 req_builder = req_builder.header("Authorization", value);
2131 };
2132 if let Some(ref apikey) = configuration.api_key {
2133 let key = apikey.key.clone();
2134 let value = match apikey.prefix {
2135 Some(ref prefix) => format!("{} {}", prefix, key),
2136 None => key,
2137 };
2138 req_builder = req_builder.header("CSRFPreventionToken", value);
2139 };
2140
2141 let req = req_builder.build()?;
2142 let resp = configuration.client.execute(req).await?;
2143
2144 let status = resp.status();
2145 let content_type = resp
2146 .headers()
2147 .get("content-type")
2148 .and_then(|v| v.to_str().ok())
2149 .unwrap_or("application/octet-stream");
2150 let content_type = super::ContentType::from(content_type);
2151
2152 if !status.is_client_error() && !status.is_server_error() {
2153 let content = resp.text().await?;
2154 match content_type {
2155 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2156 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuDelsnapshotResponse`"))),
2157 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::QemuDelsnapshotResponse`")))),
2158 }
2159 } else {
2160 let content = resp.text().await?;
2161 let entity: Option<QemuDelsnapshotError> = serde_json::from_str(&content).ok();
2162 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2163 }
2164}
2165
2166pub async fn qemu_destroy_vm(configuration: &configuration::Configuration, node: &str, vmid: i32, destroy_unreferenced_disks: Option<&str>, purge: Option<&str>, skiplock: Option<&str>) -> Result<models::QemuDestroyVmResponse, Error<QemuDestroyVmError>> {
2168 let p_path_node = node;
2170 let p_path_vmid = vmid;
2171 let p_query_destroy_unreferenced_disks = destroy_unreferenced_disks;
2172 let p_query_purge = purge;
2173 let p_query_skiplock = skiplock;
2174
2175 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2176 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2177
2178 if let Some(ref param_value) = p_query_destroy_unreferenced_disks {
2179 req_builder = req_builder.query(&[("destroy-unreferenced-disks", ¶m_value.to_string())]);
2180 }
2181 if let Some(ref param_value) = p_query_purge {
2182 req_builder = req_builder.query(&[("purge", ¶m_value.to_string())]);
2183 }
2184 if let Some(ref param_value) = p_query_skiplock {
2185 req_builder = req_builder.query(&[("skiplock", ¶m_value.to_string())]);
2186 }
2187 if let Some(ref user_agent) = configuration.user_agent {
2188 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2189 }
2190 if let Some(ref apikey) = configuration.api_key {
2191 let key = apikey.key.clone();
2192 let value = match apikey.prefix {
2193 Some(ref prefix) => format!("{} {}", prefix, key),
2194 None => key,
2195 };
2196 req_builder = req_builder.header("Authorization", value);
2197 };
2198 if let Some(ref apikey) = configuration.api_key {
2199 let key = apikey.key.clone();
2200 let value = match apikey.prefix {
2201 Some(ref prefix) => format!("{} {}", prefix, key),
2202 None => key,
2203 };
2204 req_builder = req_builder.header("CSRFPreventionToken", value);
2205 };
2206
2207 let req = req_builder.build()?;
2208 let resp = configuration.client.execute(req).await?;
2209
2210 let status = resp.status();
2211 let content_type = resp
2212 .headers()
2213 .get("content-type")
2214 .and_then(|v| v.to_str().ok())
2215 .unwrap_or("application/octet-stream");
2216 let content_type = super::ContentType::from(content_type);
2217
2218 if !status.is_client_error() && !status.is_server_error() {
2219 let content = resp.text().await?;
2220 match content_type {
2221 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2222 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuDestroyVmResponse`"))),
2223 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::QemuDestroyVmResponse`")))),
2224 }
2225 } else {
2226 let content = resp.text().await?;
2227 let entity: Option<QemuDestroyVmError> = serde_json::from_str(&content).ok();
2228 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2229 }
2230}
2231
2232pub async fn qemu_exec(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_exec_request: models::QemuExecRequest) -> Result<models::QemuExecResponse, Error<QemuExecError>> {
2234 let p_path_node = node;
2236 let p_path_vmid = vmid;
2237 let p_body_qemu_exec_request = qemu_exec_request;
2238
2239 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/exec", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2240 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2241
2242 if let Some(ref user_agent) = configuration.user_agent {
2243 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2244 }
2245 if let Some(ref apikey) = configuration.api_key {
2246 let key = apikey.key.clone();
2247 let value = match apikey.prefix {
2248 Some(ref prefix) => format!("{} {}", prefix, key),
2249 None => key,
2250 };
2251 req_builder = req_builder.header("Authorization", value);
2252 };
2253 if let Some(ref apikey) = configuration.api_key {
2254 let key = apikey.key.clone();
2255 let value = match apikey.prefix {
2256 Some(ref prefix) => format!("{} {}", prefix, key),
2257 None => key,
2258 };
2259 req_builder = req_builder.header("CSRFPreventionToken", value);
2260 };
2261 req_builder = req_builder.json(&p_body_qemu_exec_request);
2262
2263 let req = req_builder.build()?;
2264 let resp = configuration.client.execute(req).await?;
2265
2266 let status = resp.status();
2267 let content_type = resp
2268 .headers()
2269 .get("content-type")
2270 .and_then(|v| v.to_str().ok())
2271 .unwrap_or("application/octet-stream");
2272 let content_type = super::ContentType::from(content_type);
2273
2274 if !status.is_client_error() && !status.is_server_error() {
2275 let content = resp.text().await?;
2276 match content_type {
2277 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2278 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuExecResponse`"))),
2279 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::QemuExecResponse`")))),
2280 }
2281 } else {
2282 let content = resp.text().await?;
2283 let entity: Option<QemuExecError> = serde_json::from_str(&content).ok();
2284 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2285 }
2286}
2287
2288pub async fn qemu_exec_status(configuration: &configuration::Configuration, node: &str, pid: i64, vmid: i32) -> Result<models::QemuExecStatusResponse, Error<QemuExecStatusError>> {
2290 let p_path_node = node;
2292 let p_query_pid = pid;
2293 let p_path_vmid = vmid;
2294
2295 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/exec-status", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2296 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2297
2298 req_builder = req_builder.query(&[("pid", &p_query_pid.to_string())]);
2299 if let Some(ref user_agent) = configuration.user_agent {
2300 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2301 }
2302 if let Some(ref apikey) = configuration.api_key {
2303 let key = apikey.key.clone();
2304 let value = match apikey.prefix {
2305 Some(ref prefix) => format!("{} {}", prefix, key),
2306 None => key,
2307 };
2308 req_builder = req_builder.header("Authorization", value);
2309 };
2310 if let Some(ref apikey) = configuration.api_key {
2311 let key = apikey.key.clone();
2312 let value = match apikey.prefix {
2313 Some(ref prefix) => format!("{} {}", prefix, key),
2314 None => key,
2315 };
2316 req_builder = req_builder.header("CSRFPreventionToken", value);
2317 };
2318
2319 let req = req_builder.build()?;
2320 let resp = configuration.client.execute(req).await?;
2321
2322 let status = resp.status();
2323 let content_type = resp
2324 .headers()
2325 .get("content-type")
2326 .and_then(|v| v.to_str().ok())
2327 .unwrap_or("application/octet-stream");
2328 let content_type = super::ContentType::from(content_type);
2329
2330 if !status.is_client_error() && !status.is_server_error() {
2331 let content = resp.text().await?;
2332 match content_type {
2333 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2334 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuExecStatusResponse`"))),
2335 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::QemuExecStatusResponse`")))),
2336 }
2337 } else {
2338 let content = resp.text().await?;
2339 let entity: Option<QemuExecStatusError> = serde_json::from_str(&content).ok();
2340 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2341 }
2342}
2343
2344pub async fn qemu_file_read(configuration: &configuration::Configuration, file: &str, node: &str, vmid: i32, count: Option<i32>, decode: Option<&str>, offset: Option<i64>) -> Result<models::QemuFileReadResponse, Error<QemuFileReadError>> {
2346 let p_query_file = file;
2348 let p_path_node = node;
2349 let p_path_vmid = vmid;
2350 let p_query_count = count;
2351 let p_query_decode = decode;
2352 let p_query_offset = offset;
2353
2354 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/file-read", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2355 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2356
2357 if let Some(ref param_value) = p_query_count {
2358 req_builder = req_builder.query(&[("count", ¶m_value.to_string())]);
2359 }
2360 if let Some(ref param_value) = p_query_decode {
2361 req_builder = req_builder.query(&[("decode", ¶m_value.to_string())]);
2362 }
2363 req_builder = req_builder.query(&[("file", &p_query_file.to_string())]);
2364 if let Some(ref param_value) = p_query_offset {
2365 req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
2366 }
2367 if let Some(ref user_agent) = configuration.user_agent {
2368 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2369 }
2370 if let Some(ref apikey) = configuration.api_key {
2371 let key = apikey.key.clone();
2372 let value = match apikey.prefix {
2373 Some(ref prefix) => format!("{} {}", prefix, key),
2374 None => key,
2375 };
2376 req_builder = req_builder.header("Authorization", value);
2377 };
2378 if let Some(ref apikey) = configuration.api_key {
2379 let key = apikey.key.clone();
2380 let value = match apikey.prefix {
2381 Some(ref prefix) => format!("{} {}", prefix, key),
2382 None => key,
2383 };
2384 req_builder = req_builder.header("CSRFPreventionToken", value);
2385 };
2386
2387 let req = req_builder.build()?;
2388 let resp = configuration.client.execute(req).await?;
2389
2390 let status = resp.status();
2391 let content_type = resp
2392 .headers()
2393 .get("content-type")
2394 .and_then(|v| v.to_str().ok())
2395 .unwrap_or("application/octet-stream");
2396 let content_type = super::ContentType::from(content_type);
2397
2398 if !status.is_client_error() && !status.is_server_error() {
2399 let content = resp.text().await?;
2400 match content_type {
2401 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2402 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuFileReadResponse`"))),
2403 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::QemuFileReadResponse`")))),
2404 }
2405 } else {
2406 let content = resp.text().await?;
2407 let entity: Option<QemuFileReadError> = serde_json::from_str(&content).ok();
2408 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2409 }
2410}
2411
2412pub async fn qemu_file_write(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_file_write_request: models::QemuFileWriteRequest) -> Result<models::QemuFileWriteResponse, Error<QemuFileWriteError>> {
2414 let p_path_node = node;
2416 let p_path_vmid = vmid;
2417 let p_body_qemu_file_write_request = qemu_file_write_request;
2418
2419 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/file-write", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2420 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2421
2422 if let Some(ref user_agent) = configuration.user_agent {
2423 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2424 }
2425 if let Some(ref apikey) = configuration.api_key {
2426 let key = apikey.key.clone();
2427 let value = match apikey.prefix {
2428 Some(ref prefix) => format!("{} {}", prefix, key),
2429 None => key,
2430 };
2431 req_builder = req_builder.header("Authorization", value);
2432 };
2433 if let Some(ref apikey) = configuration.api_key {
2434 let key = apikey.key.clone();
2435 let value = match apikey.prefix {
2436 Some(ref prefix) => format!("{} {}", prefix, key),
2437 None => key,
2438 };
2439 req_builder = req_builder.header("CSRFPreventionToken", value);
2440 };
2441 req_builder = req_builder.json(&p_body_qemu_file_write_request);
2442
2443 let req = req_builder.build()?;
2444 let resp = configuration.client.execute(req).await?;
2445
2446 let status = resp.status();
2447 let content_type = resp
2448 .headers()
2449 .get("content-type")
2450 .and_then(|v| v.to_str().ok())
2451 .unwrap_or("application/octet-stream");
2452 let content_type = super::ContentType::from(content_type);
2453
2454 if !status.is_client_error() && !status.is_server_error() {
2455 let content = resp.text().await?;
2456 match content_type {
2457 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2458 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuFileWriteResponse`"))),
2459 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::QemuFileWriteResponse`")))),
2460 }
2461 } else {
2462 let content = resp.text().await?;
2463 let entity: Option<QemuFileWriteError> = serde_json::from_str(&content).ok();
2464 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2465 }
2466}
2467
2468pub async fn qemu_fsfreeze_freeze(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuFsfreezeFreezeResponse, Error<QemuFsfreezeFreezeError>> {
2470 let p_path_node = node;
2472 let p_path_vmid = vmid;
2473
2474 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/fsfreeze-freeze", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2475 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2476
2477 if let Some(ref user_agent) = configuration.user_agent {
2478 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2479 }
2480 if let Some(ref apikey) = configuration.api_key {
2481 let key = apikey.key.clone();
2482 let value = match apikey.prefix {
2483 Some(ref prefix) => format!("{} {}", prefix, key),
2484 None => key,
2485 };
2486 req_builder = req_builder.header("Authorization", value);
2487 };
2488 if let Some(ref apikey) = configuration.api_key {
2489 let key = apikey.key.clone();
2490 let value = match apikey.prefix {
2491 Some(ref prefix) => format!("{} {}", prefix, key),
2492 None => key,
2493 };
2494 req_builder = req_builder.header("CSRFPreventionToken", value);
2495 };
2496
2497 let req = req_builder.build()?;
2498 let resp = configuration.client.execute(req).await?;
2499
2500 let status = resp.status();
2501 let content_type = resp
2502 .headers()
2503 .get("content-type")
2504 .and_then(|v| v.to_str().ok())
2505 .unwrap_or("application/octet-stream");
2506 let content_type = super::ContentType::from(content_type);
2507
2508 if !status.is_client_error() && !status.is_server_error() {
2509 let content = resp.text().await?;
2510 match content_type {
2511 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2512 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuFsfreezeFreezeResponse`"))),
2513 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::QemuFsfreezeFreezeResponse`")))),
2514 }
2515 } else {
2516 let content = resp.text().await?;
2517 let entity: Option<QemuFsfreezeFreezeError> = serde_json::from_str(&content).ok();
2518 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2519 }
2520}
2521
2522pub async fn qemu_fsfreeze_status(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuFsfreezeStatusResponse, Error<QemuFsfreezeStatusError>> {
2524 let p_path_node = node;
2526 let p_path_vmid = vmid;
2527
2528 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/fsfreeze-status", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2529 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2530
2531 if let Some(ref user_agent) = configuration.user_agent {
2532 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2533 }
2534 if let Some(ref apikey) = configuration.api_key {
2535 let key = apikey.key.clone();
2536 let value = match apikey.prefix {
2537 Some(ref prefix) => format!("{} {}", prefix, key),
2538 None => key,
2539 };
2540 req_builder = req_builder.header("Authorization", value);
2541 };
2542 if let Some(ref apikey) = configuration.api_key {
2543 let key = apikey.key.clone();
2544 let value = match apikey.prefix {
2545 Some(ref prefix) => format!("{} {}", prefix, key),
2546 None => key,
2547 };
2548 req_builder = req_builder.header("CSRFPreventionToken", value);
2549 };
2550
2551 let req = req_builder.build()?;
2552 let resp = configuration.client.execute(req).await?;
2553
2554 let status = resp.status();
2555 let content_type = resp
2556 .headers()
2557 .get("content-type")
2558 .and_then(|v| v.to_str().ok())
2559 .unwrap_or("application/octet-stream");
2560 let content_type = super::ContentType::from(content_type);
2561
2562 if !status.is_client_error() && !status.is_server_error() {
2563 let content = resp.text().await?;
2564 match content_type {
2565 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2566 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuFsfreezeStatusResponse`"))),
2567 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::QemuFsfreezeStatusResponse`")))),
2568 }
2569 } else {
2570 let content = resp.text().await?;
2571 let entity: Option<QemuFsfreezeStatusError> = serde_json::from_str(&content).ok();
2572 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2573 }
2574}
2575
2576pub async fn qemu_fsfreeze_thaw(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuFsfreezeThawResponse, Error<QemuFsfreezeThawError>> {
2578 let p_path_node = node;
2580 let p_path_vmid = vmid;
2581
2582 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/fsfreeze-thaw", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2583 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2584
2585 if let Some(ref user_agent) = configuration.user_agent {
2586 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2587 }
2588 if let Some(ref apikey) = configuration.api_key {
2589 let key = apikey.key.clone();
2590 let value = match apikey.prefix {
2591 Some(ref prefix) => format!("{} {}", prefix, key),
2592 None => key,
2593 };
2594 req_builder = req_builder.header("Authorization", value);
2595 };
2596 if let Some(ref apikey) = configuration.api_key {
2597 let key = apikey.key.clone();
2598 let value = match apikey.prefix {
2599 Some(ref prefix) => format!("{} {}", prefix, key),
2600 None => key,
2601 };
2602 req_builder = req_builder.header("CSRFPreventionToken", value);
2603 };
2604
2605 let req = req_builder.build()?;
2606 let resp = configuration.client.execute(req).await?;
2607
2608 let status = resp.status();
2609 let content_type = resp
2610 .headers()
2611 .get("content-type")
2612 .and_then(|v| v.to_str().ok())
2613 .unwrap_or("application/octet-stream");
2614 let content_type = super::ContentType::from(content_type);
2615
2616 if !status.is_client_error() && !status.is_server_error() {
2617 let content = resp.text().await?;
2618 match content_type {
2619 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2620 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuFsfreezeThawResponse`"))),
2621 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::QemuFsfreezeThawResponse`")))),
2622 }
2623 } else {
2624 let content = resp.text().await?;
2625 let entity: Option<QemuFsfreezeThawError> = serde_json::from_str(&content).ok();
2626 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2627 }
2628}
2629
2630pub async fn qemu_fstrim(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuFstrimResponse, Error<QemuFstrimError>> {
2632 let p_path_node = node;
2634 let p_path_vmid = vmid;
2635
2636 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/fstrim", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2637 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2638
2639 if let Some(ref user_agent) = configuration.user_agent {
2640 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2641 }
2642 if let Some(ref apikey) = configuration.api_key {
2643 let key = apikey.key.clone();
2644 let value = match apikey.prefix {
2645 Some(ref prefix) => format!("{} {}", prefix, key),
2646 None => key,
2647 };
2648 req_builder = req_builder.header("Authorization", value);
2649 };
2650 if let Some(ref apikey) = configuration.api_key {
2651 let key = apikey.key.clone();
2652 let value = match apikey.prefix {
2653 Some(ref prefix) => format!("{} {}", prefix, key),
2654 None => key,
2655 };
2656 req_builder = req_builder.header("CSRFPreventionToken", value);
2657 };
2658
2659 let req = req_builder.build()?;
2660 let resp = configuration.client.execute(req).await?;
2661
2662 let status = resp.status();
2663 let content_type = resp
2664 .headers()
2665 .get("content-type")
2666 .and_then(|v| v.to_str().ok())
2667 .unwrap_or("application/octet-stream");
2668 let content_type = super::ContentType::from(content_type);
2669
2670 if !status.is_client_error() && !status.is_server_error() {
2671 let content = resp.text().await?;
2672 match content_type {
2673 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2674 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuFstrimResponse`"))),
2675 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::QemuFstrimResponse`")))),
2676 }
2677 } else {
2678 let content = resp.text().await?;
2679 let entity: Option<QemuFstrimError> = serde_json::from_str(&content).ok();
2680 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2681 }
2682}
2683
2684pub async fn qemu_get_agent(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuGetAgentResponse, Error<QemuGetAgentError>> {
2686 let p_path_node = node;
2688 let p_path_vmid = vmid;
2689
2690 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2691 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2692
2693 if let Some(ref user_agent) = configuration.user_agent {
2694 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2695 }
2696 if let Some(ref apikey) = configuration.api_key {
2697 let key = apikey.key.clone();
2698 let value = match apikey.prefix {
2699 Some(ref prefix) => format!("{} {}", prefix, key),
2700 None => key,
2701 };
2702 req_builder = req_builder.header("Authorization", value);
2703 };
2704 if let Some(ref apikey) = configuration.api_key {
2705 let key = apikey.key.clone();
2706 let value = match apikey.prefix {
2707 Some(ref prefix) => format!("{} {}", prefix, key),
2708 None => key,
2709 };
2710 req_builder = req_builder.header("CSRFPreventionToken", value);
2711 };
2712
2713 let req = req_builder.build()?;
2714 let resp = configuration.client.execute(req).await?;
2715
2716 let status = resp.status();
2717 let content_type = resp
2718 .headers()
2719 .get("content-type")
2720 .and_then(|v| v.to_str().ok())
2721 .unwrap_or("application/octet-stream");
2722 let content_type = super::ContentType::from(content_type);
2723
2724 if !status.is_client_error() && !status.is_server_error() {
2725 let content = resp.text().await?;
2726 match content_type {
2727 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2728 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuGetAgentResponse`"))),
2729 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::QemuGetAgentResponse`")))),
2730 }
2731 } else {
2732 let content = resp.text().await?;
2733 let entity: Option<QemuGetAgentError> = serde_json::from_str(&content).ok();
2734 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2735 }
2736}
2737
2738pub async fn qemu_get_aliases(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuGetAliasesResponse, Error<QemuGetAliasesError>> {
2740 let p_path_node = node;
2742 let p_path_vmid = vmid;
2743
2744 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/aliases", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2745 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2746
2747 if let Some(ref user_agent) = configuration.user_agent {
2748 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2749 }
2750 if let Some(ref apikey) = configuration.api_key {
2751 let key = apikey.key.clone();
2752 let value = match apikey.prefix {
2753 Some(ref prefix) => format!("{} {}", prefix, key),
2754 None => key,
2755 };
2756 req_builder = req_builder.header("Authorization", value);
2757 };
2758 if let Some(ref apikey) = configuration.api_key {
2759 let key = apikey.key.clone();
2760 let value = match apikey.prefix {
2761 Some(ref prefix) => format!("{} {}", prefix, key),
2762 None => key,
2763 };
2764 req_builder = req_builder.header("CSRFPreventionToken", value);
2765 };
2766
2767 let req = req_builder.build()?;
2768 let resp = configuration.client.execute(req).await?;
2769
2770 let status = resp.status();
2771 let content_type = resp
2772 .headers()
2773 .get("content-type")
2774 .and_then(|v| v.to_str().ok())
2775 .unwrap_or("application/octet-stream");
2776 let content_type = super::ContentType::from(content_type);
2777
2778 if !status.is_client_error() && !status.is_server_error() {
2779 let content = resp.text().await?;
2780 match content_type {
2781 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2782 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuGetAliasesResponse`"))),
2783 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::QemuGetAliasesResponse`")))),
2784 }
2785 } else {
2786 let content = resp.text().await?;
2787 let entity: Option<QemuGetAliasesError> = serde_json::from_str(&content).ok();
2788 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2789 }
2790}
2791
2792pub async fn qemu_get_firewall(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuGetFirewallResponse, Error<QemuGetFirewallError>> {
2794 let p_path_node = node;
2796 let p_path_vmid = vmid;
2797
2798 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2799 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2800
2801 if let Some(ref user_agent) = configuration.user_agent {
2802 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2803 }
2804 if let Some(ref apikey) = configuration.api_key {
2805 let key = apikey.key.clone();
2806 let value = match apikey.prefix {
2807 Some(ref prefix) => format!("{} {}", prefix, key),
2808 None => key,
2809 };
2810 req_builder = req_builder.header("Authorization", value);
2811 };
2812 if let Some(ref apikey) = configuration.api_key {
2813 let key = apikey.key.clone();
2814 let value = match apikey.prefix {
2815 Some(ref prefix) => format!("{} {}", prefix, key),
2816 None => key,
2817 };
2818 req_builder = req_builder.header("CSRFPreventionToken", value);
2819 };
2820
2821 let req = req_builder.build()?;
2822 let resp = configuration.client.execute(req).await?;
2823
2824 let status = resp.status();
2825 let content_type = resp
2826 .headers()
2827 .get("content-type")
2828 .and_then(|v| v.to_str().ok())
2829 .unwrap_or("application/octet-stream");
2830 let content_type = super::ContentType::from(content_type);
2831
2832 if !status.is_client_error() && !status.is_server_error() {
2833 let content = resp.text().await?;
2834 match content_type {
2835 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2836 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuGetFirewallResponse`"))),
2837 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::QemuGetFirewallResponse`")))),
2838 }
2839 } else {
2840 let content = resp.text().await?;
2841 let entity: Option<QemuGetFirewallError> = serde_json::from_str(&content).ok();
2842 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2843 }
2844}
2845
2846pub async fn qemu_get_fsinfo(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuGetFsinfoResponse, Error<QemuGetFsinfoError>> {
2848 let p_path_node = node;
2850 let p_path_vmid = vmid;
2851
2852 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/get-fsinfo", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2853 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2854
2855 if let Some(ref user_agent) = configuration.user_agent {
2856 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2857 }
2858 if let Some(ref apikey) = configuration.api_key {
2859 let key = apikey.key.clone();
2860 let value = match apikey.prefix {
2861 Some(ref prefix) => format!("{} {}", prefix, key),
2862 None => key,
2863 };
2864 req_builder = req_builder.header("Authorization", value);
2865 };
2866 if let Some(ref apikey) = configuration.api_key {
2867 let key = apikey.key.clone();
2868 let value = match apikey.prefix {
2869 Some(ref prefix) => format!("{} {}", prefix, key),
2870 None => key,
2871 };
2872 req_builder = req_builder.header("CSRFPreventionToken", value);
2873 };
2874
2875 let req = req_builder.build()?;
2876 let resp = configuration.client.execute(req).await?;
2877
2878 let status = resp.status();
2879 let content_type = resp
2880 .headers()
2881 .get("content-type")
2882 .and_then(|v| v.to_str().ok())
2883 .unwrap_or("application/octet-stream");
2884 let content_type = super::ContentType::from(content_type);
2885
2886 if !status.is_client_error() && !status.is_server_error() {
2887 let content = resp.text().await?;
2888 match content_type {
2889 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2890 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuGetFsinfoResponse`"))),
2891 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::QemuGetFsinfoResponse`")))),
2892 }
2893 } else {
2894 let content = resp.text().await?;
2895 let entity: Option<QemuGetFsinfoError> = serde_json::from_str(&content).ok();
2896 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2897 }
2898}
2899
2900pub async fn qemu_get_host_name(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuGetHostNameResponse, Error<QemuGetHostNameError>> {
2902 let p_path_node = node;
2904 let p_path_vmid = vmid;
2905
2906 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/get-host-name", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2907 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2908
2909 if let Some(ref user_agent) = configuration.user_agent {
2910 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2911 }
2912 if let Some(ref apikey) = configuration.api_key {
2913 let key = apikey.key.clone();
2914 let value = match apikey.prefix {
2915 Some(ref prefix) => format!("{} {}", prefix, key),
2916 None => key,
2917 };
2918 req_builder = req_builder.header("Authorization", value);
2919 };
2920 if let Some(ref apikey) = configuration.api_key {
2921 let key = apikey.key.clone();
2922 let value = match apikey.prefix {
2923 Some(ref prefix) => format!("{} {}", prefix, key),
2924 None => key,
2925 };
2926 req_builder = req_builder.header("CSRFPreventionToken", value);
2927 };
2928
2929 let req = req_builder.build()?;
2930 let resp = configuration.client.execute(req).await?;
2931
2932 let status = resp.status();
2933 let content_type = resp
2934 .headers()
2935 .get("content-type")
2936 .and_then(|v| v.to_str().ok())
2937 .unwrap_or("application/octet-stream");
2938 let content_type = super::ContentType::from(content_type);
2939
2940 if !status.is_client_error() && !status.is_server_error() {
2941 let content = resp.text().await?;
2942 match content_type {
2943 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2944 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuGetHostNameResponse`"))),
2945 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::QemuGetHostNameResponse`")))),
2946 }
2947 } else {
2948 let content = resp.text().await?;
2949 let entity: Option<QemuGetHostNameError> = serde_json::from_str(&content).ok();
2950 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2951 }
2952}
2953
2954pub async fn qemu_get_ipset(configuration: &configuration::Configuration, name: &str, node: &str, vmid: i32) -> Result<models::QemuGetIpsetResponse, Error<QemuGetIpsetError>> {
2956 let p_path_name = name;
2958 let p_path_node = node;
2959 let p_path_vmid = vmid;
2960
2961 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/ipset/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name), node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2962 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2963
2964 if let Some(ref user_agent) = configuration.user_agent {
2965 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2966 }
2967 if let Some(ref apikey) = configuration.api_key {
2968 let key = apikey.key.clone();
2969 let value = match apikey.prefix {
2970 Some(ref prefix) => format!("{} {}", prefix, key),
2971 None => key,
2972 };
2973 req_builder = req_builder.header("Authorization", value);
2974 };
2975 if let Some(ref apikey) = configuration.api_key {
2976 let key = apikey.key.clone();
2977 let value = match apikey.prefix {
2978 Some(ref prefix) => format!("{} {}", prefix, key),
2979 None => key,
2980 };
2981 req_builder = req_builder.header("CSRFPreventionToken", value);
2982 };
2983
2984 let req = req_builder.build()?;
2985 let resp = configuration.client.execute(req).await?;
2986
2987 let status = resp.status();
2988 let content_type = resp
2989 .headers()
2990 .get("content-type")
2991 .and_then(|v| v.to_str().ok())
2992 .unwrap_or("application/octet-stream");
2993 let content_type = super::ContentType::from(content_type);
2994
2995 if !status.is_client_error() && !status.is_server_error() {
2996 let content = resp.text().await?;
2997 match content_type {
2998 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2999 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuGetIpsetResponse`"))),
3000 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::QemuGetIpsetResponse`")))),
3001 }
3002 } else {
3003 let content = resp.text().await?;
3004 let entity: Option<QemuGetIpsetError> = serde_json::from_str(&content).ok();
3005 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3006 }
3007}
3008
3009pub async fn qemu_get_memory_block_info(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuGetMemoryBlockInfoResponse, Error<QemuGetMemoryBlockInfoError>> {
3011 let p_path_node = node;
3013 let p_path_vmid = vmid;
3014
3015 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/get-memory-block-info", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3016 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3017
3018 if let Some(ref user_agent) = configuration.user_agent {
3019 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3020 }
3021 if let Some(ref apikey) = configuration.api_key {
3022 let key = apikey.key.clone();
3023 let value = match apikey.prefix {
3024 Some(ref prefix) => format!("{} {}", prefix, key),
3025 None => key,
3026 };
3027 req_builder = req_builder.header("Authorization", value);
3028 };
3029 if let Some(ref apikey) = configuration.api_key {
3030 let key = apikey.key.clone();
3031 let value = match apikey.prefix {
3032 Some(ref prefix) => format!("{} {}", prefix, key),
3033 None => key,
3034 };
3035 req_builder = req_builder.header("CSRFPreventionToken", value);
3036 };
3037
3038 let req = req_builder.build()?;
3039 let resp = configuration.client.execute(req).await?;
3040
3041 let status = resp.status();
3042 let content_type = resp
3043 .headers()
3044 .get("content-type")
3045 .and_then(|v| v.to_str().ok())
3046 .unwrap_or("application/octet-stream");
3047 let content_type = super::ContentType::from(content_type);
3048
3049 if !status.is_client_error() && !status.is_server_error() {
3050 let content = resp.text().await?;
3051 match content_type {
3052 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3053 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuGetMemoryBlockInfoResponse`"))),
3054 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::QemuGetMemoryBlockInfoResponse`")))),
3055 }
3056 } else {
3057 let content = resp.text().await?;
3058 let entity: Option<QemuGetMemoryBlockInfoError> = serde_json::from_str(&content).ok();
3059 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3060 }
3061}
3062
3063pub async fn qemu_get_memory_blocks(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuGetMemoryBlocksResponse, Error<QemuGetMemoryBlocksError>> {
3065 let p_path_node = node;
3067 let p_path_vmid = vmid;
3068
3069 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/get-memory-blocks", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3070 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3071
3072 if let Some(ref user_agent) = configuration.user_agent {
3073 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3074 }
3075 if let Some(ref apikey) = configuration.api_key {
3076 let key = apikey.key.clone();
3077 let value = match apikey.prefix {
3078 Some(ref prefix) => format!("{} {}", prefix, key),
3079 None => key,
3080 };
3081 req_builder = req_builder.header("Authorization", value);
3082 };
3083 if let Some(ref apikey) = configuration.api_key {
3084 let key = apikey.key.clone();
3085 let value = match apikey.prefix {
3086 Some(ref prefix) => format!("{} {}", prefix, key),
3087 None => key,
3088 };
3089 req_builder = req_builder.header("CSRFPreventionToken", value);
3090 };
3091
3092 let req = req_builder.build()?;
3093 let resp = configuration.client.execute(req).await?;
3094
3095 let status = resp.status();
3096 let content_type = resp
3097 .headers()
3098 .get("content-type")
3099 .and_then(|v| v.to_str().ok())
3100 .unwrap_or("application/octet-stream");
3101 let content_type = super::ContentType::from(content_type);
3102
3103 if !status.is_client_error() && !status.is_server_error() {
3104 let content = resp.text().await?;
3105 match content_type {
3106 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3107 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuGetMemoryBlocksResponse`"))),
3108 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::QemuGetMemoryBlocksResponse`")))),
3109 }
3110 } else {
3111 let content = resp.text().await?;
3112 let entity: Option<QemuGetMemoryBlocksError> = serde_json::from_str(&content).ok();
3113 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3114 }
3115}
3116
3117pub async fn qemu_get_options(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuGetOptionsResponse, Error<QemuGetOptionsError>> {
3119 let p_path_node = node;
3121 let p_path_vmid = vmid;
3122
3123 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/options", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3124 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3125
3126 if let Some(ref user_agent) = configuration.user_agent {
3127 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3128 }
3129 if let Some(ref apikey) = configuration.api_key {
3130 let key = apikey.key.clone();
3131 let value = match apikey.prefix {
3132 Some(ref prefix) => format!("{} {}", prefix, key),
3133 None => key,
3134 };
3135 req_builder = req_builder.header("Authorization", value);
3136 };
3137 if let Some(ref apikey) = configuration.api_key {
3138 let key = apikey.key.clone();
3139 let value = match apikey.prefix {
3140 Some(ref prefix) => format!("{} {}", prefix, key),
3141 None => key,
3142 };
3143 req_builder = req_builder.header("CSRFPreventionToken", value);
3144 };
3145
3146 let req = req_builder.build()?;
3147 let resp = configuration.client.execute(req).await?;
3148
3149 let status = resp.status();
3150 let content_type = resp
3151 .headers()
3152 .get("content-type")
3153 .and_then(|v| v.to_str().ok())
3154 .unwrap_or("application/octet-stream");
3155 let content_type = super::ContentType::from(content_type);
3156
3157 if !status.is_client_error() && !status.is_server_error() {
3158 let content = resp.text().await?;
3159 match content_type {
3160 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3161 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuGetOptionsResponse`"))),
3162 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::QemuGetOptionsResponse`")))),
3163 }
3164 } else {
3165 let content = resp.text().await?;
3166 let entity: Option<QemuGetOptionsError> = serde_json::from_str(&content).ok();
3167 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3168 }
3169}
3170
3171pub async fn qemu_get_osinfo(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuGetOsinfoResponse, Error<QemuGetOsinfoError>> {
3173 let p_path_node = node;
3175 let p_path_vmid = vmid;
3176
3177 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/get-osinfo", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3178 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3179
3180 if let Some(ref user_agent) = configuration.user_agent {
3181 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3182 }
3183 if let Some(ref apikey) = configuration.api_key {
3184 let key = apikey.key.clone();
3185 let value = match apikey.prefix {
3186 Some(ref prefix) => format!("{} {}", prefix, key),
3187 None => key,
3188 };
3189 req_builder = req_builder.header("Authorization", value);
3190 };
3191 if let Some(ref apikey) = configuration.api_key {
3192 let key = apikey.key.clone();
3193 let value = match apikey.prefix {
3194 Some(ref prefix) => format!("{} {}", prefix, key),
3195 None => key,
3196 };
3197 req_builder = req_builder.header("CSRFPreventionToken", value);
3198 };
3199
3200 let req = req_builder.build()?;
3201 let resp = configuration.client.execute(req).await?;
3202
3203 let status = resp.status();
3204 let content_type = resp
3205 .headers()
3206 .get("content-type")
3207 .and_then(|v| v.to_str().ok())
3208 .unwrap_or("application/octet-stream");
3209 let content_type = super::ContentType::from(content_type);
3210
3211 if !status.is_client_error() && !status.is_server_error() {
3212 let content = resp.text().await?;
3213 match content_type {
3214 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3215 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuGetOsinfoResponse`"))),
3216 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::QemuGetOsinfoResponse`")))),
3217 }
3218 } else {
3219 let content = resp.text().await?;
3220 let entity: Option<QemuGetOsinfoError> = serde_json::from_str(&content).ok();
3221 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3222 }
3223}
3224
3225pub async fn qemu_get_rule(configuration: &configuration::Configuration, node: &str, pos: i64, vmid: i32) -> Result<models::QemuGetRuleResponse, Error<QemuGetRuleError>> {
3227 let p_path_node = node;
3229 let p_path_pos = pos;
3230 let p_path_vmid = vmid;
3231
3232 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/rules/{pos}", configuration.base_path, node=crate::apis::urlencode(p_path_node), pos=p_path_pos, vmid=p_path_vmid);
3233 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3234
3235 if let Some(ref user_agent) = configuration.user_agent {
3236 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3237 }
3238 if let Some(ref apikey) = configuration.api_key {
3239 let key = apikey.key.clone();
3240 let value = match apikey.prefix {
3241 Some(ref prefix) => format!("{} {}", prefix, key),
3242 None => key,
3243 };
3244 req_builder = req_builder.header("Authorization", value);
3245 };
3246 if let Some(ref apikey) = configuration.api_key {
3247 let key = apikey.key.clone();
3248 let value = match apikey.prefix {
3249 Some(ref prefix) => format!("{} {}", prefix, key),
3250 None => key,
3251 };
3252 req_builder = req_builder.header("CSRFPreventionToken", value);
3253 };
3254
3255 let req = req_builder.build()?;
3256 let resp = configuration.client.execute(req).await?;
3257
3258 let status = resp.status();
3259 let content_type = resp
3260 .headers()
3261 .get("content-type")
3262 .and_then(|v| v.to_str().ok())
3263 .unwrap_or("application/octet-stream");
3264 let content_type = super::ContentType::from(content_type);
3265
3266 if !status.is_client_error() && !status.is_server_error() {
3267 let content = resp.text().await?;
3268 match content_type {
3269 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3270 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuGetRuleResponse`"))),
3271 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::QemuGetRuleResponse`")))),
3272 }
3273 } else {
3274 let content = resp.text().await?;
3275 let entity: Option<QemuGetRuleError> = serde_json::from_str(&content).ok();
3276 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3277 }
3278}
3279
3280pub async fn qemu_get_rules(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuGetRulesResponse, Error<QemuGetRulesError>> {
3282 let p_path_node = node;
3284 let p_path_vmid = vmid;
3285
3286 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/rules", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3287 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3288
3289 if let Some(ref user_agent) = configuration.user_agent {
3290 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3291 }
3292 if let Some(ref apikey) = configuration.api_key {
3293 let key = apikey.key.clone();
3294 let value = match apikey.prefix {
3295 Some(ref prefix) => format!("{} {}", prefix, key),
3296 None => key,
3297 };
3298 req_builder = req_builder.header("Authorization", value);
3299 };
3300 if let Some(ref apikey) = configuration.api_key {
3301 let key = apikey.key.clone();
3302 let value = match apikey.prefix {
3303 Some(ref prefix) => format!("{} {}", prefix, key),
3304 None => key,
3305 };
3306 req_builder = req_builder.header("CSRFPreventionToken", value);
3307 };
3308
3309 let req = req_builder.build()?;
3310 let resp = configuration.client.execute(req).await?;
3311
3312 let status = resp.status();
3313 let content_type = resp
3314 .headers()
3315 .get("content-type")
3316 .and_then(|v| v.to_str().ok())
3317 .unwrap_or("application/octet-stream");
3318 let content_type = super::ContentType::from(content_type);
3319
3320 if !status.is_client_error() && !status.is_server_error() {
3321 let content = resp.text().await?;
3322 match content_type {
3323 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3324 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuGetRulesResponse`"))),
3325 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::QemuGetRulesResponse`")))),
3326 }
3327 } else {
3328 let content = resp.text().await?;
3329 let entity: Option<QemuGetRulesError> = serde_json::from_str(&content).ok();
3330 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3331 }
3332}
3333
3334pub async fn qemu_get_snapshot_config(configuration: &configuration::Configuration, node: &str, snapname: &str, vmid: i32) -> Result<models::QemuGetSnapshotConfigResponse, Error<QemuGetSnapshotConfigError>> {
3336 let p_path_node = node;
3338 let p_path_snapname = snapname;
3339 let p_path_vmid = vmid;
3340
3341 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/snapshot/{snapname}/config", configuration.base_path, node=crate::apis::urlencode(p_path_node), snapname=crate::apis::urlencode(p_path_snapname), vmid=p_path_vmid);
3342 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3343
3344 if let Some(ref user_agent) = configuration.user_agent {
3345 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3346 }
3347 if let Some(ref apikey) = configuration.api_key {
3348 let key = apikey.key.clone();
3349 let value = match apikey.prefix {
3350 Some(ref prefix) => format!("{} {}", prefix, key),
3351 None => key,
3352 };
3353 req_builder = req_builder.header("Authorization", value);
3354 };
3355 if let Some(ref apikey) = configuration.api_key {
3356 let key = apikey.key.clone();
3357 let value = match apikey.prefix {
3358 Some(ref prefix) => format!("{} {}", prefix, key),
3359 None => key,
3360 };
3361 req_builder = req_builder.header("CSRFPreventionToken", value);
3362 };
3363
3364 let req = req_builder.build()?;
3365 let resp = configuration.client.execute(req).await?;
3366
3367 let status = resp.status();
3368 let content_type = resp
3369 .headers()
3370 .get("content-type")
3371 .and_then(|v| v.to_str().ok())
3372 .unwrap_or("application/octet-stream");
3373 let content_type = super::ContentType::from(content_type);
3374
3375 if !status.is_client_error() && !status.is_server_error() {
3376 let content = resp.text().await?;
3377 match content_type {
3378 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3379 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuGetSnapshotConfigResponse`"))),
3380 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::QemuGetSnapshotConfigResponse`")))),
3381 }
3382 } else {
3383 let content = resp.text().await?;
3384 let entity: Option<QemuGetSnapshotConfigError> = serde_json::from_str(&content).ok();
3385 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3386 }
3387}
3388
3389pub async fn qemu_get_time(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuGetTimeResponse, Error<QemuGetTimeError>> {
3391 let p_path_node = node;
3393 let p_path_vmid = vmid;
3394
3395 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/get-time", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3396 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3397
3398 if let Some(ref user_agent) = configuration.user_agent {
3399 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3400 }
3401 if let Some(ref apikey) = configuration.api_key {
3402 let key = apikey.key.clone();
3403 let value = match apikey.prefix {
3404 Some(ref prefix) => format!("{} {}", prefix, key),
3405 None => key,
3406 };
3407 req_builder = req_builder.header("Authorization", value);
3408 };
3409 if let Some(ref apikey) = configuration.api_key {
3410 let key = apikey.key.clone();
3411 let value = match apikey.prefix {
3412 Some(ref prefix) => format!("{} {}", prefix, key),
3413 None => key,
3414 };
3415 req_builder = req_builder.header("CSRFPreventionToken", value);
3416 };
3417
3418 let req = req_builder.build()?;
3419 let resp = configuration.client.execute(req).await?;
3420
3421 let status = resp.status();
3422 let content_type = resp
3423 .headers()
3424 .get("content-type")
3425 .and_then(|v| v.to_str().ok())
3426 .unwrap_or("application/octet-stream");
3427 let content_type = super::ContentType::from(content_type);
3428
3429 if !status.is_client_error() && !status.is_server_error() {
3430 let content = resp.text().await?;
3431 match content_type {
3432 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3433 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuGetTimeResponse`"))),
3434 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::QemuGetTimeResponse`")))),
3435 }
3436 } else {
3437 let content = resp.text().await?;
3438 let entity: Option<QemuGetTimeError> = serde_json::from_str(&content).ok();
3439 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3440 }
3441}
3442
3443pub async fn qemu_get_timezone(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuGetTimezoneResponse, Error<QemuGetTimezoneError>> {
3445 let p_path_node = node;
3447 let p_path_vmid = vmid;
3448
3449 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/get-timezone", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3450 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3451
3452 if let Some(ref user_agent) = configuration.user_agent {
3453 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3454 }
3455 if let Some(ref apikey) = configuration.api_key {
3456 let key = apikey.key.clone();
3457 let value = match apikey.prefix {
3458 Some(ref prefix) => format!("{} {}", prefix, key),
3459 None => key,
3460 };
3461 req_builder = req_builder.header("Authorization", value);
3462 };
3463 if let Some(ref apikey) = configuration.api_key {
3464 let key = apikey.key.clone();
3465 let value = match apikey.prefix {
3466 Some(ref prefix) => format!("{} {}", prefix, key),
3467 None => key,
3468 };
3469 req_builder = req_builder.header("CSRFPreventionToken", value);
3470 };
3471
3472 let req = req_builder.build()?;
3473 let resp = configuration.client.execute(req).await?;
3474
3475 let status = resp.status();
3476 let content_type = resp
3477 .headers()
3478 .get("content-type")
3479 .and_then(|v| v.to_str().ok())
3480 .unwrap_or("application/octet-stream");
3481 let content_type = super::ContentType::from(content_type);
3482
3483 if !status.is_client_error() && !status.is_server_error() {
3484 let content = resp.text().await?;
3485 match content_type {
3486 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3487 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuGetTimezoneResponse`"))),
3488 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::QemuGetTimezoneResponse`")))),
3489 }
3490 } else {
3491 let content = resp.text().await?;
3492 let entity: Option<QemuGetTimezoneError> = serde_json::from_str(&content).ok();
3493 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3494 }
3495}
3496
3497pub async fn qemu_get_users(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuGetUsersResponse, Error<QemuGetUsersError>> {
3499 let p_path_node = node;
3501 let p_path_vmid = vmid;
3502
3503 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/get-users", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3504 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3505
3506 if let Some(ref user_agent) = configuration.user_agent {
3507 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3508 }
3509 if let Some(ref apikey) = configuration.api_key {
3510 let key = apikey.key.clone();
3511 let value = match apikey.prefix {
3512 Some(ref prefix) => format!("{} {}", prefix, key),
3513 None => key,
3514 };
3515 req_builder = req_builder.header("Authorization", value);
3516 };
3517 if let Some(ref apikey) = configuration.api_key {
3518 let key = apikey.key.clone();
3519 let value = match apikey.prefix {
3520 Some(ref prefix) => format!("{} {}", prefix, key),
3521 None => key,
3522 };
3523 req_builder = req_builder.header("CSRFPreventionToken", value);
3524 };
3525
3526 let req = req_builder.build()?;
3527 let resp = configuration.client.execute(req).await?;
3528
3529 let status = resp.status();
3530 let content_type = resp
3531 .headers()
3532 .get("content-type")
3533 .and_then(|v| v.to_str().ok())
3534 .unwrap_or("application/octet-stream");
3535 let content_type = super::ContentType::from(content_type);
3536
3537 if !status.is_client_error() && !status.is_server_error() {
3538 let content = resp.text().await?;
3539 match content_type {
3540 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3541 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuGetUsersResponse`"))),
3542 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::QemuGetUsersResponse`")))),
3543 }
3544 } else {
3545 let content = resp.text().await?;
3546 let entity: Option<QemuGetUsersError> = serde_json::from_str(&content).ok();
3547 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3548 }
3549}
3550
3551pub async fn qemu_get_vcpus(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuGetVcpusResponse, Error<QemuGetVcpusError>> {
3553 let p_path_node = node;
3555 let p_path_vmid = vmid;
3556
3557 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/get-vcpus", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3558 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3559
3560 if let Some(ref user_agent) = configuration.user_agent {
3561 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3562 }
3563 if let Some(ref apikey) = configuration.api_key {
3564 let key = apikey.key.clone();
3565 let value = match apikey.prefix {
3566 Some(ref prefix) => format!("{} {}", prefix, key),
3567 None => key,
3568 };
3569 req_builder = req_builder.header("Authorization", value);
3570 };
3571 if let Some(ref apikey) = configuration.api_key {
3572 let key = apikey.key.clone();
3573 let value = match apikey.prefix {
3574 Some(ref prefix) => format!("{} {}", prefix, key),
3575 None => key,
3576 };
3577 req_builder = req_builder.header("CSRFPreventionToken", value);
3578 };
3579
3580 let req = req_builder.build()?;
3581 let resp = configuration.client.execute(req).await?;
3582
3583 let status = resp.status();
3584 let content_type = resp
3585 .headers()
3586 .get("content-type")
3587 .and_then(|v| v.to_str().ok())
3588 .unwrap_or("application/octet-stream");
3589 let content_type = super::ContentType::from(content_type);
3590
3591 if !status.is_client_error() && !status.is_server_error() {
3592 let content = resp.text().await?;
3593 match content_type {
3594 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3595 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuGetVcpusResponse`"))),
3596 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::QemuGetVcpusResponse`")))),
3597 }
3598 } else {
3599 let content = resp.text().await?;
3600 let entity: Option<QemuGetVcpusError> = serde_json::from_str(&content).ok();
3601 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3602 }
3603}
3604
3605pub async fn qemu_info(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuInfoResponse, Error<QemuInfoError>> {
3607 let p_path_node = node;
3609 let p_path_vmid = vmid;
3610
3611 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/info", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3612 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3613
3614 if let Some(ref user_agent) = configuration.user_agent {
3615 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3616 }
3617 if let Some(ref apikey) = configuration.api_key {
3618 let key = apikey.key.clone();
3619 let value = match apikey.prefix {
3620 Some(ref prefix) => format!("{} {}", prefix, key),
3621 None => key,
3622 };
3623 req_builder = req_builder.header("Authorization", value);
3624 };
3625 if let Some(ref apikey) = configuration.api_key {
3626 let key = apikey.key.clone();
3627 let value = match apikey.prefix {
3628 Some(ref prefix) => format!("{} {}", prefix, key),
3629 None => key,
3630 };
3631 req_builder = req_builder.header("CSRFPreventionToken", value);
3632 };
3633
3634 let req = req_builder.build()?;
3635 let resp = configuration.client.execute(req).await?;
3636
3637 let status = resp.status();
3638 let content_type = resp
3639 .headers()
3640 .get("content-type")
3641 .and_then(|v| v.to_str().ok())
3642 .unwrap_or("application/octet-stream");
3643 let content_type = super::ContentType::from(content_type);
3644
3645 if !status.is_client_error() && !status.is_server_error() {
3646 let content = resp.text().await?;
3647 match content_type {
3648 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3649 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuInfoResponse`"))),
3650 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::QemuInfoResponse`")))),
3651 }
3652 } else {
3653 let content = resp.text().await?;
3654 let entity: Option<QemuInfoError> = serde_json::from_str(&content).ok();
3655 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3656 }
3657}
3658
3659pub async fn qemu_ipset_index(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuIpsetIndexResponse, Error<QemuIpsetIndexError>> {
3661 let p_path_node = node;
3663 let p_path_vmid = vmid;
3664
3665 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/ipset", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3666 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3667
3668 if let Some(ref user_agent) = configuration.user_agent {
3669 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3670 }
3671 if let Some(ref apikey) = configuration.api_key {
3672 let key = apikey.key.clone();
3673 let value = match apikey.prefix {
3674 Some(ref prefix) => format!("{} {}", prefix, key),
3675 None => key,
3676 };
3677 req_builder = req_builder.header("Authorization", value);
3678 };
3679 if let Some(ref apikey) = configuration.api_key {
3680 let key = apikey.key.clone();
3681 let value = match apikey.prefix {
3682 Some(ref prefix) => format!("{} {}", prefix, key),
3683 None => key,
3684 };
3685 req_builder = req_builder.header("CSRFPreventionToken", value);
3686 };
3687
3688 let req = req_builder.build()?;
3689 let resp = configuration.client.execute(req).await?;
3690
3691 let status = resp.status();
3692 let content_type = resp
3693 .headers()
3694 .get("content-type")
3695 .and_then(|v| v.to_str().ok())
3696 .unwrap_or("application/octet-stream");
3697 let content_type = super::ContentType::from(content_type);
3698
3699 if !status.is_client_error() && !status.is_server_error() {
3700 let content = resp.text().await?;
3701 match content_type {
3702 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3703 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuIpsetIndexResponse`"))),
3704 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::QemuIpsetIndexResponse`")))),
3705 }
3706 } else {
3707 let content = resp.text().await?;
3708 let entity: Option<QemuIpsetIndexError> = serde_json::from_str(&content).ok();
3709 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3710 }
3711}
3712
3713pub async fn qemu_log(configuration: &configuration::Configuration, node: &str, vmid: i32, limit: Option<i64>, since: Option<i64>, start: Option<i64>, until: Option<i64>) -> Result<models::QemuLogResponse, Error<QemuLogError>> {
3715 let p_path_node = node;
3717 let p_path_vmid = vmid;
3718 let p_query_limit = limit;
3719 let p_query_since = since;
3720 let p_query_start = start;
3721 let p_query_until = until;
3722
3723 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/log", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3724 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3725
3726 if let Some(ref param_value) = p_query_limit {
3727 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
3728 }
3729 if let Some(ref param_value) = p_query_since {
3730 req_builder = req_builder.query(&[("since", ¶m_value.to_string())]);
3731 }
3732 if let Some(ref param_value) = p_query_start {
3733 req_builder = req_builder.query(&[("start", ¶m_value.to_string())]);
3734 }
3735 if let Some(ref param_value) = p_query_until {
3736 req_builder = req_builder.query(&[("until", ¶m_value.to_string())]);
3737 }
3738 if let Some(ref user_agent) = configuration.user_agent {
3739 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3740 }
3741 if let Some(ref apikey) = configuration.api_key {
3742 let key = apikey.key.clone();
3743 let value = match apikey.prefix {
3744 Some(ref prefix) => format!("{} {}", prefix, key),
3745 None => key,
3746 };
3747 req_builder = req_builder.header("Authorization", value);
3748 };
3749 if let Some(ref apikey) = configuration.api_key {
3750 let key = apikey.key.clone();
3751 let value = match apikey.prefix {
3752 Some(ref prefix) => format!("{} {}", prefix, key),
3753 None => key,
3754 };
3755 req_builder = req_builder.header("CSRFPreventionToken", value);
3756 };
3757
3758 let req = req_builder.build()?;
3759 let resp = configuration.client.execute(req).await?;
3760
3761 let status = resp.status();
3762 let content_type = resp
3763 .headers()
3764 .get("content-type")
3765 .and_then(|v| v.to_str().ok())
3766 .unwrap_or("application/octet-stream");
3767 let content_type = super::ContentType::from(content_type);
3768
3769 if !status.is_client_error() && !status.is_server_error() {
3770 let content = resp.text().await?;
3771 match content_type {
3772 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3773 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuLogResponse`"))),
3774 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::QemuLogResponse`")))),
3775 }
3776 } else {
3777 let content = resp.text().await?;
3778 let entity: Option<QemuLogError> = serde_json::from_str(&content).ok();
3779 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3780 }
3781}
3782
3783pub async fn qemu_migrate_vm(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_migrate_vm_request: models::QemuMigrateVmRequest) -> Result<models::QemuMigrateVmResponse, Error<QemuMigrateVmError>> {
3785 let p_path_node = node;
3787 let p_path_vmid = vmid;
3788 let p_body_qemu_migrate_vm_request = qemu_migrate_vm_request;
3789
3790 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/migrate", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3791 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3792
3793 if let Some(ref user_agent) = configuration.user_agent {
3794 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3795 }
3796 if let Some(ref apikey) = configuration.api_key {
3797 let key = apikey.key.clone();
3798 let value = match apikey.prefix {
3799 Some(ref prefix) => format!("{} {}", prefix, key),
3800 None => key,
3801 };
3802 req_builder = req_builder.header("Authorization", value);
3803 };
3804 if let Some(ref apikey) = configuration.api_key {
3805 let key = apikey.key.clone();
3806 let value = match apikey.prefix {
3807 Some(ref prefix) => format!("{} {}", prefix, key),
3808 None => key,
3809 };
3810 req_builder = req_builder.header("CSRFPreventionToken", value);
3811 };
3812 req_builder = req_builder.json(&p_body_qemu_migrate_vm_request);
3813
3814 let req = req_builder.build()?;
3815 let resp = configuration.client.execute(req).await?;
3816
3817 let status = resp.status();
3818 let content_type = resp
3819 .headers()
3820 .get("content-type")
3821 .and_then(|v| v.to_str().ok())
3822 .unwrap_or("application/octet-stream");
3823 let content_type = super::ContentType::from(content_type);
3824
3825 if !status.is_client_error() && !status.is_server_error() {
3826 let content = resp.text().await?;
3827 match content_type {
3828 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3829 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuMigrateVmResponse`"))),
3830 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::QemuMigrateVmResponse`")))),
3831 }
3832 } else {
3833 let content = resp.text().await?;
3834 let entity: Option<QemuMigrateVmError> = serde_json::from_str(&content).ok();
3835 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3836 }
3837}
3838
3839pub async fn qemu_migrate_vm_precondition(configuration: &configuration::Configuration, node: &str, vmid: i32, target: Option<&str>) -> Result<models::QemuMigrateVmPreconditionResponse, Error<QemuMigrateVmPreconditionError>> {
3841 let p_path_node = node;
3843 let p_path_vmid = vmid;
3844 let p_query_target = target;
3845
3846 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/migrate", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3847 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3848
3849 if let Some(ref param_value) = p_query_target {
3850 req_builder = req_builder.query(&[("target", ¶m_value.to_string())]);
3851 }
3852 if let Some(ref user_agent) = configuration.user_agent {
3853 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3854 }
3855 if let Some(ref apikey) = configuration.api_key {
3856 let key = apikey.key.clone();
3857 let value = match apikey.prefix {
3858 Some(ref prefix) => format!("{} {}", prefix, key),
3859 None => key,
3860 };
3861 req_builder = req_builder.header("Authorization", value);
3862 };
3863 if let Some(ref apikey) = configuration.api_key {
3864 let key = apikey.key.clone();
3865 let value = match apikey.prefix {
3866 Some(ref prefix) => format!("{} {}", prefix, key),
3867 None => key,
3868 };
3869 req_builder = req_builder.header("CSRFPreventionToken", value);
3870 };
3871
3872 let req = req_builder.build()?;
3873 let resp = configuration.client.execute(req).await?;
3874
3875 let status = resp.status();
3876 let content_type = resp
3877 .headers()
3878 .get("content-type")
3879 .and_then(|v| v.to_str().ok())
3880 .unwrap_or("application/octet-stream");
3881 let content_type = super::ContentType::from(content_type);
3882
3883 if !status.is_client_error() && !status.is_server_error() {
3884 let content = resp.text().await?;
3885 match content_type {
3886 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3887 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuMigrateVmPreconditionResponse`"))),
3888 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::QemuMigrateVmPreconditionResponse`")))),
3889 }
3890 } else {
3891 let content = resp.text().await?;
3892 let entity: Option<QemuMigrateVmPreconditionError> = serde_json::from_str(&content).ok();
3893 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3894 }
3895}
3896
3897pub async fn qemu_monitor(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_monitor_request: models::QemuMonitorRequest) -> Result<models::QemuMonitorResponse, Error<QemuMonitorError>> {
3899 let p_path_node = node;
3901 let p_path_vmid = vmid;
3902 let p_body_qemu_monitor_request = qemu_monitor_request;
3903
3904 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/monitor", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3905 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3906
3907 if let Some(ref user_agent) = configuration.user_agent {
3908 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3909 }
3910 if let Some(ref apikey) = configuration.api_key {
3911 let key = apikey.key.clone();
3912 let value = match apikey.prefix {
3913 Some(ref prefix) => format!("{} {}", prefix, key),
3914 None => key,
3915 };
3916 req_builder = req_builder.header("Authorization", value);
3917 };
3918 if let Some(ref apikey) = configuration.api_key {
3919 let key = apikey.key.clone();
3920 let value = match apikey.prefix {
3921 Some(ref prefix) => format!("{} {}", prefix, key),
3922 None => key,
3923 };
3924 req_builder = req_builder.header("CSRFPreventionToken", value);
3925 };
3926 req_builder = req_builder.json(&p_body_qemu_monitor_request);
3927
3928 let req = req_builder.build()?;
3929 let resp = configuration.client.execute(req).await?;
3930
3931 let status = resp.status();
3932 let content_type = resp
3933 .headers()
3934 .get("content-type")
3935 .and_then(|v| v.to_str().ok())
3936 .unwrap_or("application/octet-stream");
3937 let content_type = super::ContentType::from(content_type);
3938
3939 if !status.is_client_error() && !status.is_server_error() {
3940 let content = resp.text().await?;
3941 match content_type {
3942 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3943 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuMonitorResponse`"))),
3944 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::QemuMonitorResponse`")))),
3945 }
3946 } else {
3947 let content = resp.text().await?;
3948 let entity: Option<QemuMonitorError> = serde_json::from_str(&content).ok();
3949 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3950 }
3951}
3952
3953pub async fn qemu_move_vm_disk(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_move_vm_disk_request: models::QemuMoveVmDiskRequest) -> Result<models::QemuMoveVmDiskResponse, Error<QemuMoveVmDiskError>> {
3955 let p_path_node = node;
3957 let p_path_vmid = vmid;
3958 let p_body_qemu_move_vm_disk_request = qemu_move_vm_disk_request;
3959
3960 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/move_disk", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3961 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3962
3963 if let Some(ref user_agent) = configuration.user_agent {
3964 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3965 }
3966 if let Some(ref apikey) = configuration.api_key {
3967 let key = apikey.key.clone();
3968 let value = match apikey.prefix {
3969 Some(ref prefix) => format!("{} {}", prefix, key),
3970 None => key,
3971 };
3972 req_builder = req_builder.header("Authorization", value);
3973 };
3974 if let Some(ref apikey) = configuration.api_key {
3975 let key = apikey.key.clone();
3976 let value = match apikey.prefix {
3977 Some(ref prefix) => format!("{} {}", prefix, key),
3978 None => key,
3979 };
3980 req_builder = req_builder.header("CSRFPreventionToken", value);
3981 };
3982 req_builder = req_builder.json(&p_body_qemu_move_vm_disk_request);
3983
3984 let req = req_builder.build()?;
3985 let resp = configuration.client.execute(req).await?;
3986
3987 let status = resp.status();
3988 let content_type = resp
3989 .headers()
3990 .get("content-type")
3991 .and_then(|v| v.to_str().ok())
3992 .unwrap_or("application/octet-stream");
3993 let content_type = super::ContentType::from(content_type);
3994
3995 if !status.is_client_error() && !status.is_server_error() {
3996 let content = resp.text().await?;
3997 match content_type {
3998 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3999 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuMoveVmDiskResponse`"))),
4000 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::QemuMoveVmDiskResponse`")))),
4001 }
4002 } else {
4003 let content = resp.text().await?;
4004 let entity: Option<QemuMoveVmDiskError> = serde_json::from_str(&content).ok();
4005 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4006 }
4007}
4008
4009pub async fn qemu_mtunnel(configuration: &configuration::Configuration, node: &str, vmid: i32, lxc_mtunnel_request: Option<models::LxcMtunnelRequest>) -> Result<models::QemuMtunnelResponse, Error<QemuMtunnelError>> {
4011 let p_path_node = node;
4013 let p_path_vmid = vmid;
4014 let p_body_lxc_mtunnel_request = lxc_mtunnel_request;
4015
4016 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/mtunnel", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4017 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4018
4019 if let Some(ref user_agent) = configuration.user_agent {
4020 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4021 }
4022 if let Some(ref apikey) = configuration.api_key {
4023 let key = apikey.key.clone();
4024 let value = match apikey.prefix {
4025 Some(ref prefix) => format!("{} {}", prefix, key),
4026 None => key,
4027 };
4028 req_builder = req_builder.header("Authorization", value);
4029 };
4030 if let Some(ref apikey) = configuration.api_key {
4031 let key = apikey.key.clone();
4032 let value = match apikey.prefix {
4033 Some(ref prefix) => format!("{} {}", prefix, key),
4034 None => key,
4035 };
4036 req_builder = req_builder.header("CSRFPreventionToken", value);
4037 };
4038 req_builder = req_builder.json(&p_body_lxc_mtunnel_request);
4039
4040 let req = req_builder.build()?;
4041 let resp = configuration.client.execute(req).await?;
4042
4043 let status = resp.status();
4044 let content_type = resp
4045 .headers()
4046 .get("content-type")
4047 .and_then(|v| v.to_str().ok())
4048 .unwrap_or("application/octet-stream");
4049 let content_type = super::ContentType::from(content_type);
4050
4051 if !status.is_client_error() && !status.is_server_error() {
4052 let content = resp.text().await?;
4053 match content_type {
4054 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4055 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuMtunnelResponse`"))),
4056 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::QemuMtunnelResponse`")))),
4057 }
4058 } else {
4059 let content = resp.text().await?;
4060 let entity: Option<QemuMtunnelError> = serde_json::from_str(&content).ok();
4061 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4062 }
4063}
4064
4065pub async fn qemu_mtunnelwebsocket(configuration: &configuration::Configuration, node: &str, socket: &str, ticket: &str, vmid: i32) -> Result<models::QemuMtunnelwebsocketResponse, Error<QemuMtunnelwebsocketError>> {
4067 let p_path_node = node;
4069 let p_query_socket = socket;
4070 let p_query_ticket = ticket;
4071 let p_path_vmid = vmid;
4072
4073 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/mtunnelwebsocket", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4074 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4075
4076 req_builder = req_builder.query(&[("socket", &p_query_socket.to_string())]);
4077 req_builder = req_builder.query(&[("ticket", &p_query_ticket.to_string())]);
4078 if let Some(ref user_agent) = configuration.user_agent {
4079 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4080 }
4081 if let Some(ref apikey) = configuration.api_key {
4082 let key = apikey.key.clone();
4083 let value = match apikey.prefix {
4084 Some(ref prefix) => format!("{} {}", prefix, key),
4085 None => key,
4086 };
4087 req_builder = req_builder.header("Authorization", value);
4088 };
4089 if let Some(ref apikey) = configuration.api_key {
4090 let key = apikey.key.clone();
4091 let value = match apikey.prefix {
4092 Some(ref prefix) => format!("{} {}", prefix, key),
4093 None => key,
4094 };
4095 req_builder = req_builder.header("CSRFPreventionToken", value);
4096 };
4097
4098 let req = req_builder.build()?;
4099 let resp = configuration.client.execute(req).await?;
4100
4101 let status = resp.status();
4102 let content_type = resp
4103 .headers()
4104 .get("content-type")
4105 .and_then(|v| v.to_str().ok())
4106 .unwrap_or("application/octet-stream");
4107 let content_type = super::ContentType::from(content_type);
4108
4109 if !status.is_client_error() && !status.is_server_error() {
4110 let content = resp.text().await?;
4111 match content_type {
4112 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4113 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuMtunnelwebsocketResponse`"))),
4114 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::QemuMtunnelwebsocketResponse`")))),
4115 }
4116 } else {
4117 let content = resp.text().await?;
4118 let entity: Option<QemuMtunnelwebsocketError> = serde_json::from_str(&content).ok();
4119 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4120 }
4121}
4122
4123pub async fn qemu_network_get_interfaces(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuNetworkGetInterfacesResponse, Error<QemuNetworkGetInterfacesError>> {
4125 let p_path_node = node;
4127 let p_path_vmid = vmid;
4128
4129 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/network-get-interfaces", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4130 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4131
4132 if let Some(ref user_agent) = configuration.user_agent {
4133 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4134 }
4135 if let Some(ref apikey) = configuration.api_key {
4136 let key = apikey.key.clone();
4137 let value = match apikey.prefix {
4138 Some(ref prefix) => format!("{} {}", prefix, key),
4139 None => key,
4140 };
4141 req_builder = req_builder.header("Authorization", value);
4142 };
4143 if let Some(ref apikey) = configuration.api_key {
4144 let key = apikey.key.clone();
4145 let value = match apikey.prefix {
4146 Some(ref prefix) => format!("{} {}", prefix, key),
4147 None => key,
4148 };
4149 req_builder = req_builder.header("CSRFPreventionToken", value);
4150 };
4151
4152 let req = req_builder.build()?;
4153 let resp = configuration.client.execute(req).await?;
4154
4155 let status = resp.status();
4156 let content_type = resp
4157 .headers()
4158 .get("content-type")
4159 .and_then(|v| v.to_str().ok())
4160 .unwrap_or("application/octet-stream");
4161 let content_type = super::ContentType::from(content_type);
4162
4163 if !status.is_client_error() && !status.is_server_error() {
4164 let content = resp.text().await?;
4165 match content_type {
4166 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4167 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuNetworkGetInterfacesResponse`"))),
4168 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::QemuNetworkGetInterfacesResponse`")))),
4169 }
4170 } else {
4171 let content = resp.text().await?;
4172 let entity: Option<QemuNetworkGetInterfacesError> = serde_json::from_str(&content).ok();
4173 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4174 }
4175}
4176
4177pub async fn qemu_ping(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuPingResponse, Error<QemuPingError>> {
4179 let p_path_node = node;
4181 let p_path_vmid = vmid;
4182
4183 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/ping", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4184 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4185
4186 if let Some(ref user_agent) = configuration.user_agent {
4187 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4188 }
4189 if let Some(ref apikey) = configuration.api_key {
4190 let key = apikey.key.clone();
4191 let value = match apikey.prefix {
4192 Some(ref prefix) => format!("{} {}", prefix, key),
4193 None => key,
4194 };
4195 req_builder = req_builder.header("Authorization", value);
4196 };
4197 if let Some(ref apikey) = configuration.api_key {
4198 let key = apikey.key.clone();
4199 let value = match apikey.prefix {
4200 Some(ref prefix) => format!("{} {}", prefix, key),
4201 None => key,
4202 };
4203 req_builder = req_builder.header("CSRFPreventionToken", value);
4204 };
4205
4206 let req = req_builder.build()?;
4207 let resp = configuration.client.execute(req).await?;
4208
4209 let status = resp.status();
4210 let content_type = resp
4211 .headers()
4212 .get("content-type")
4213 .and_then(|v| v.to_str().ok())
4214 .unwrap_or("application/octet-stream");
4215 let content_type = super::ContentType::from(content_type);
4216
4217 if !status.is_client_error() && !status.is_server_error() {
4218 let content = resp.text().await?;
4219 match content_type {
4220 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4221 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuPingResponse`"))),
4222 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::QemuPingResponse`")))),
4223 }
4224 } else {
4225 let content = resp.text().await?;
4226 let entity: Option<QemuPingError> = serde_json::from_str(&content).ok();
4227 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4228 }
4229}
4230
4231pub async fn qemu_read_alias(configuration: &configuration::Configuration, name: &str, node: &str, vmid: i32) -> Result<models::QemuReadAliasResponse, Error<QemuReadAliasError>> {
4233 let p_path_name = name;
4235 let p_path_node = node;
4236 let p_path_vmid = vmid;
4237
4238 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/aliases/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name), node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4239 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4240
4241 if let Some(ref user_agent) = configuration.user_agent {
4242 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4243 }
4244 if let Some(ref apikey) = configuration.api_key {
4245 let key = apikey.key.clone();
4246 let value = match apikey.prefix {
4247 Some(ref prefix) => format!("{} {}", prefix, key),
4248 None => key,
4249 };
4250 req_builder = req_builder.header("Authorization", value);
4251 };
4252 if let Some(ref apikey) = configuration.api_key {
4253 let key = apikey.key.clone();
4254 let value = match apikey.prefix {
4255 Some(ref prefix) => format!("{} {}", prefix, key),
4256 None => key,
4257 };
4258 req_builder = req_builder.header("CSRFPreventionToken", value);
4259 };
4260
4261 let req = req_builder.build()?;
4262 let resp = configuration.client.execute(req).await?;
4263
4264 let status = resp.status();
4265 let content_type = resp
4266 .headers()
4267 .get("content-type")
4268 .and_then(|v| v.to_str().ok())
4269 .unwrap_or("application/octet-stream");
4270 let content_type = super::ContentType::from(content_type);
4271
4272 if !status.is_client_error() && !status.is_server_error() {
4273 let content = resp.text().await?;
4274 match content_type {
4275 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4276 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuReadAliasResponse`"))),
4277 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::QemuReadAliasResponse`")))),
4278 }
4279 } else {
4280 let content = resp.text().await?;
4281 let entity: Option<QemuReadAliasError> = serde_json::from_str(&content).ok();
4282 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4283 }
4284}
4285
4286pub async fn qemu_read_ip(configuration: &configuration::Configuration, cidr: &str, name: &str, node: &str, vmid: i32) -> Result<models::QemuReadIpResponse, Error<QemuReadIpError>> {
4288 let p_path_cidr = cidr;
4290 let p_path_name = name;
4291 let p_path_node = node;
4292 let p_path_vmid = vmid;
4293
4294 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/ipset/{name}/{cidr}", configuration.base_path, cidr=crate::apis::urlencode(p_path_cidr), name=crate::apis::urlencode(p_path_name), node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4295 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4296
4297 if let Some(ref user_agent) = configuration.user_agent {
4298 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4299 }
4300 if let Some(ref apikey) = configuration.api_key {
4301 let key = apikey.key.clone();
4302 let value = match apikey.prefix {
4303 Some(ref prefix) => format!("{} {}", prefix, key),
4304 None => key,
4305 };
4306 req_builder = req_builder.header("Authorization", value);
4307 };
4308 if let Some(ref apikey) = configuration.api_key {
4309 let key = apikey.key.clone();
4310 let value = match apikey.prefix {
4311 Some(ref prefix) => format!("{} {}", prefix, key),
4312 None => key,
4313 };
4314 req_builder = req_builder.header("CSRFPreventionToken", value);
4315 };
4316
4317 let req = req_builder.build()?;
4318 let resp = configuration.client.execute(req).await?;
4319
4320 let status = resp.status();
4321 let content_type = resp
4322 .headers()
4323 .get("content-type")
4324 .and_then(|v| v.to_str().ok())
4325 .unwrap_or("application/octet-stream");
4326 let content_type = super::ContentType::from(content_type);
4327
4328 if !status.is_client_error() && !status.is_server_error() {
4329 let content = resp.text().await?;
4330 match content_type {
4331 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4332 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuReadIpResponse`"))),
4333 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::QemuReadIpResponse`")))),
4334 }
4335 } else {
4336 let content = resp.text().await?;
4337 let entity: Option<QemuReadIpError> = serde_json::from_str(&content).ok();
4338 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4339 }
4340}
4341
4342pub async fn qemu_refs(configuration: &configuration::Configuration, node: &str, vmid: i32, r#type: Option<models::PveTypeTypeEnum>) -> Result<models::QemuRefsResponse, Error<QemuRefsError>> {
4344 let p_path_node = node;
4346 let p_path_vmid = vmid;
4347 let p_query_type = r#type;
4348
4349 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/refs", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4350 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4351
4352 if let Some(ref param_value) = p_query_type {
4353 req_builder = req_builder.query(&[("type", ¶m_value.to_string())]);
4354 }
4355 if let Some(ref user_agent) = configuration.user_agent {
4356 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4357 }
4358 if let Some(ref apikey) = configuration.api_key {
4359 let key = apikey.key.clone();
4360 let value = match apikey.prefix {
4361 Some(ref prefix) => format!("{} {}", prefix, key),
4362 None => key,
4363 };
4364 req_builder = req_builder.header("Authorization", value);
4365 };
4366 if let Some(ref apikey) = configuration.api_key {
4367 let key = apikey.key.clone();
4368 let value = match apikey.prefix {
4369 Some(ref prefix) => format!("{} {}", prefix, key),
4370 None => key,
4371 };
4372 req_builder = req_builder.header("CSRFPreventionToken", value);
4373 };
4374
4375 let req = req_builder.build()?;
4376 let resp = configuration.client.execute(req).await?;
4377
4378 let status = resp.status();
4379 let content_type = resp
4380 .headers()
4381 .get("content-type")
4382 .and_then(|v| v.to_str().ok())
4383 .unwrap_or("application/octet-stream");
4384 let content_type = super::ContentType::from(content_type);
4385
4386 if !status.is_client_error() && !status.is_server_error() {
4387 let content = resp.text().await?;
4388 match content_type {
4389 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4390 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuRefsResponse`"))),
4391 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::QemuRefsResponse`")))),
4392 }
4393 } else {
4394 let content = resp.text().await?;
4395 let entity: Option<QemuRefsError> = serde_json::from_str(&content).ok();
4396 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4397 }
4398}
4399
4400pub async fn qemu_remote_migrate_vm(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_remote_migrate_vm_request: models::QemuRemoteMigrateVmRequest) -> Result<models::QemuRemoteMigrateVmResponse, Error<QemuRemoteMigrateVmError>> {
4402 let p_path_node = node;
4404 let p_path_vmid = vmid;
4405 let p_body_qemu_remote_migrate_vm_request = qemu_remote_migrate_vm_request;
4406
4407 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/remote_migrate", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4408 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4409
4410 if let Some(ref user_agent) = configuration.user_agent {
4411 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4412 }
4413 if let Some(ref apikey) = configuration.api_key {
4414 let key = apikey.key.clone();
4415 let value = match apikey.prefix {
4416 Some(ref prefix) => format!("{} {}", prefix, key),
4417 None => key,
4418 };
4419 req_builder = req_builder.header("Authorization", value);
4420 };
4421 if let Some(ref apikey) = configuration.api_key {
4422 let key = apikey.key.clone();
4423 let value = match apikey.prefix {
4424 Some(ref prefix) => format!("{} {}", prefix, key),
4425 None => key,
4426 };
4427 req_builder = req_builder.header("CSRFPreventionToken", value);
4428 };
4429 req_builder = req_builder.json(&p_body_qemu_remote_migrate_vm_request);
4430
4431 let req = req_builder.build()?;
4432 let resp = configuration.client.execute(req).await?;
4433
4434 let status = resp.status();
4435 let content_type = resp
4436 .headers()
4437 .get("content-type")
4438 .and_then(|v| v.to_str().ok())
4439 .unwrap_or("application/octet-stream");
4440 let content_type = super::ContentType::from(content_type);
4441
4442 if !status.is_client_error() && !status.is_server_error() {
4443 let content = resp.text().await?;
4444 match content_type {
4445 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4446 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuRemoteMigrateVmResponse`"))),
4447 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::QemuRemoteMigrateVmResponse`")))),
4448 }
4449 } else {
4450 let content = resp.text().await?;
4451 let entity: Option<QemuRemoteMigrateVmError> = serde_json::from_str(&content).ok();
4452 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4453 }
4454}
4455
4456pub async fn qemu_remove_alias(configuration: &configuration::Configuration, name: &str, node: &str, vmid: i32, digest: Option<&str>) -> Result<models::QemuRemoveAliasResponse, Error<QemuRemoveAliasError>> {
4458 let p_path_name = name;
4460 let p_path_node = node;
4461 let p_path_vmid = vmid;
4462 let p_query_digest = digest;
4463
4464 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/aliases/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name), node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4465 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4466
4467 if let Some(ref param_value) = p_query_digest {
4468 req_builder = req_builder.query(&[("digest", ¶m_value.to_string())]);
4469 }
4470 if let Some(ref user_agent) = configuration.user_agent {
4471 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4472 }
4473 if let Some(ref apikey) = configuration.api_key {
4474 let key = apikey.key.clone();
4475 let value = match apikey.prefix {
4476 Some(ref prefix) => format!("{} {}", prefix, key),
4477 None => key,
4478 };
4479 req_builder = req_builder.header("Authorization", value);
4480 };
4481 if let Some(ref apikey) = configuration.api_key {
4482 let key = apikey.key.clone();
4483 let value = match apikey.prefix {
4484 Some(ref prefix) => format!("{} {}", prefix, key),
4485 None => key,
4486 };
4487 req_builder = req_builder.header("CSRFPreventionToken", value);
4488 };
4489
4490 let req = req_builder.build()?;
4491 let resp = configuration.client.execute(req).await?;
4492
4493 let status = resp.status();
4494 let content_type = resp
4495 .headers()
4496 .get("content-type")
4497 .and_then(|v| v.to_str().ok())
4498 .unwrap_or("application/octet-stream");
4499 let content_type = super::ContentType::from(content_type);
4500
4501 if !status.is_client_error() && !status.is_server_error() {
4502 let content = resp.text().await?;
4503 match content_type {
4504 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4505 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuRemoveAliasResponse`"))),
4506 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::QemuRemoveAliasResponse`")))),
4507 }
4508 } else {
4509 let content = resp.text().await?;
4510 let entity: Option<QemuRemoveAliasError> = serde_json::from_str(&content).ok();
4511 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4512 }
4513}
4514
4515pub async fn qemu_remove_ip(configuration: &configuration::Configuration, cidr: &str, name: &str, node: &str, vmid: i32, digest: Option<&str>) -> Result<models::QemuRemoveIpResponse, Error<QemuRemoveIpError>> {
4517 let p_path_cidr = cidr;
4519 let p_path_name = name;
4520 let p_path_node = node;
4521 let p_path_vmid = vmid;
4522 let p_query_digest = digest;
4523
4524 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/ipset/{name}/{cidr}", configuration.base_path, cidr=crate::apis::urlencode(p_path_cidr), name=crate::apis::urlencode(p_path_name), node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4525 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4526
4527 if let Some(ref param_value) = p_query_digest {
4528 req_builder = req_builder.query(&[("digest", ¶m_value.to_string())]);
4529 }
4530 if let Some(ref user_agent) = configuration.user_agent {
4531 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4532 }
4533 if let Some(ref apikey) = configuration.api_key {
4534 let key = apikey.key.clone();
4535 let value = match apikey.prefix {
4536 Some(ref prefix) => format!("{} {}", prefix, key),
4537 None => key,
4538 };
4539 req_builder = req_builder.header("Authorization", value);
4540 };
4541 if let Some(ref apikey) = configuration.api_key {
4542 let key = apikey.key.clone();
4543 let value = match apikey.prefix {
4544 Some(ref prefix) => format!("{} {}", prefix, key),
4545 None => key,
4546 };
4547 req_builder = req_builder.header("CSRFPreventionToken", value);
4548 };
4549
4550 let req = req_builder.build()?;
4551 let resp = configuration.client.execute(req).await?;
4552
4553 let status = resp.status();
4554 let content_type = resp
4555 .headers()
4556 .get("content-type")
4557 .and_then(|v| v.to_str().ok())
4558 .unwrap_or("application/octet-stream");
4559 let content_type = super::ContentType::from(content_type);
4560
4561 if !status.is_client_error() && !status.is_server_error() {
4562 let content = resp.text().await?;
4563 match content_type {
4564 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4565 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuRemoveIpResponse`"))),
4566 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::QemuRemoveIpResponse`")))),
4567 }
4568 } else {
4569 let content = resp.text().await?;
4570 let entity: Option<QemuRemoveIpError> = serde_json::from_str(&content).ok();
4571 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4572 }
4573}
4574
4575pub async fn qemu_resize_vm(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_resize_vm_request: models::QemuResizeVmRequest) -> Result<models::QemuResizeVmResponse, Error<QemuResizeVmError>> {
4577 let p_path_node = node;
4579 let p_path_vmid = vmid;
4580 let p_body_qemu_resize_vm_request = qemu_resize_vm_request;
4581
4582 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/resize", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4583 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
4584
4585 if let Some(ref user_agent) = configuration.user_agent {
4586 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4587 }
4588 if let Some(ref apikey) = configuration.api_key {
4589 let key = apikey.key.clone();
4590 let value = match apikey.prefix {
4591 Some(ref prefix) => format!("{} {}", prefix, key),
4592 None => key,
4593 };
4594 req_builder = req_builder.header("Authorization", value);
4595 };
4596 if let Some(ref apikey) = configuration.api_key {
4597 let key = apikey.key.clone();
4598 let value = match apikey.prefix {
4599 Some(ref prefix) => format!("{} {}", prefix, key),
4600 None => key,
4601 };
4602 req_builder = req_builder.header("CSRFPreventionToken", value);
4603 };
4604 req_builder = req_builder.json(&p_body_qemu_resize_vm_request);
4605
4606 let req = req_builder.build()?;
4607 let resp = configuration.client.execute(req).await?;
4608
4609 let status = resp.status();
4610 let content_type = resp
4611 .headers()
4612 .get("content-type")
4613 .and_then(|v| v.to_str().ok())
4614 .unwrap_or("application/octet-stream");
4615 let content_type = super::ContentType::from(content_type);
4616
4617 if !status.is_client_error() && !status.is_server_error() {
4618 let content = resp.text().await?;
4619 match content_type {
4620 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4621 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuResizeVmResponse`"))),
4622 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::QemuResizeVmResponse`")))),
4623 }
4624 } else {
4625 let content = resp.text().await?;
4626 let entity: Option<QemuResizeVmError> = serde_json::from_str(&content).ok();
4627 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4628 }
4629}
4630
4631pub async fn qemu_rollback(configuration: &configuration::Configuration, node: &str, snapname: &str, vmid: i32, qemu_rollback_request: Option<models::QemuRollbackRequest>) -> Result<models::QemuRollbackResponse, Error<QemuRollbackError>> {
4633 let p_path_node = node;
4635 let p_path_snapname = snapname;
4636 let p_path_vmid = vmid;
4637 let p_body_qemu_rollback_request = qemu_rollback_request;
4638
4639 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/snapshot/{snapname}/rollback", configuration.base_path, node=crate::apis::urlencode(p_path_node), snapname=crate::apis::urlencode(p_path_snapname), vmid=p_path_vmid);
4640 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4641
4642 if let Some(ref user_agent) = configuration.user_agent {
4643 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4644 }
4645 if let Some(ref apikey) = configuration.api_key {
4646 let key = apikey.key.clone();
4647 let value = match apikey.prefix {
4648 Some(ref prefix) => format!("{} {}", prefix, key),
4649 None => key,
4650 };
4651 req_builder = req_builder.header("Authorization", value);
4652 };
4653 if let Some(ref apikey) = configuration.api_key {
4654 let key = apikey.key.clone();
4655 let value = match apikey.prefix {
4656 Some(ref prefix) => format!("{} {}", prefix, key),
4657 None => key,
4658 };
4659 req_builder = req_builder.header("CSRFPreventionToken", value);
4660 };
4661 req_builder = req_builder.json(&p_body_qemu_rollback_request);
4662
4663 let req = req_builder.build()?;
4664 let resp = configuration.client.execute(req).await?;
4665
4666 let status = resp.status();
4667 let content_type = resp
4668 .headers()
4669 .get("content-type")
4670 .and_then(|v| v.to_str().ok())
4671 .unwrap_or("application/octet-stream");
4672 let content_type = super::ContentType::from(content_type);
4673
4674 if !status.is_client_error() && !status.is_server_error() {
4675 let content = resp.text().await?;
4676 match content_type {
4677 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4678 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuRollbackResponse`"))),
4679 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::QemuRollbackResponse`")))),
4680 }
4681 } else {
4682 let content = resp.text().await?;
4683 let entity: Option<QemuRollbackError> = serde_json::from_str(&content).ok();
4684 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4685 }
4686}
4687
4688pub async fn qemu_rrd(configuration: &configuration::Configuration, ds: &str, node: &str, timeframe: models::PveTimeframeEnum, vmid: i32, cf: Option<models::PveCfEnum>) -> Result<models::QemuRrdResponse, Error<QemuRrdError>> {
4690 let p_query_ds = ds;
4692 let p_path_node = node;
4693 let p_query_timeframe = timeframe;
4694 let p_path_vmid = vmid;
4695 let p_query_cf = cf;
4696
4697 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/rrd", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4698 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4699
4700 if let Some(ref param_value) = p_query_cf {
4701 req_builder = req_builder.query(&[("cf", ¶m_value.to_string())]);
4702 }
4703 req_builder = req_builder.query(&[("ds", &p_query_ds.to_string())]);
4704 req_builder = req_builder.query(&[("timeframe", &p_query_timeframe.to_string())]);
4705 if let Some(ref user_agent) = configuration.user_agent {
4706 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4707 }
4708 if let Some(ref apikey) = configuration.api_key {
4709 let key = apikey.key.clone();
4710 let value = match apikey.prefix {
4711 Some(ref prefix) => format!("{} {}", prefix, key),
4712 None => key,
4713 };
4714 req_builder = req_builder.header("Authorization", value);
4715 };
4716 if let Some(ref apikey) = configuration.api_key {
4717 let key = apikey.key.clone();
4718 let value = match apikey.prefix {
4719 Some(ref prefix) => format!("{} {}", prefix, key),
4720 None => key,
4721 };
4722 req_builder = req_builder.header("CSRFPreventionToken", value);
4723 };
4724
4725 let req = req_builder.build()?;
4726 let resp = configuration.client.execute(req).await?;
4727
4728 let status = resp.status();
4729 let content_type = resp
4730 .headers()
4731 .get("content-type")
4732 .and_then(|v| v.to_str().ok())
4733 .unwrap_or("application/octet-stream");
4734 let content_type = super::ContentType::from(content_type);
4735
4736 if !status.is_client_error() && !status.is_server_error() {
4737 let content = resp.text().await?;
4738 match content_type {
4739 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4740 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuRrdResponse`"))),
4741 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::QemuRrdResponse`")))),
4742 }
4743 } else {
4744 let content = resp.text().await?;
4745 let entity: Option<QemuRrdError> = serde_json::from_str(&content).ok();
4746 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4747 }
4748}
4749
4750pub async fn qemu_rrddata(configuration: &configuration::Configuration, node: &str, timeframe: models::PveTimeframeEnum, vmid: i32, cf: Option<models::PveCfEnum>) -> Result<models::QemuRrddataResponse, Error<QemuRrddataError>> {
4752 let p_path_node = node;
4754 let p_query_timeframe = timeframe;
4755 let p_path_vmid = vmid;
4756 let p_query_cf = cf;
4757
4758 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/rrddata", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4759 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4760
4761 if let Some(ref param_value) = p_query_cf {
4762 req_builder = req_builder.query(&[("cf", ¶m_value.to_string())]);
4763 }
4764 req_builder = req_builder.query(&[("timeframe", &p_query_timeframe.to_string())]);
4765 if let Some(ref user_agent) = configuration.user_agent {
4766 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4767 }
4768 if let Some(ref apikey) = configuration.api_key {
4769 let key = apikey.key.clone();
4770 let value = match apikey.prefix {
4771 Some(ref prefix) => format!("{} {}", prefix, key),
4772 None => key,
4773 };
4774 req_builder = req_builder.header("Authorization", value);
4775 };
4776 if let Some(ref apikey) = configuration.api_key {
4777 let key = apikey.key.clone();
4778 let value = match apikey.prefix {
4779 Some(ref prefix) => format!("{} {}", prefix, key),
4780 None => key,
4781 };
4782 req_builder = req_builder.header("CSRFPreventionToken", value);
4783 };
4784
4785 let req = req_builder.build()?;
4786 let resp = configuration.client.execute(req).await?;
4787
4788 let status = resp.status();
4789 let content_type = resp
4790 .headers()
4791 .get("content-type")
4792 .and_then(|v| v.to_str().ok())
4793 .unwrap_or("application/octet-stream");
4794 let content_type = super::ContentType::from(content_type);
4795
4796 if !status.is_client_error() && !status.is_server_error() {
4797 let content = resp.text().await?;
4798 match content_type {
4799 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4800 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuRrddataResponse`"))),
4801 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::QemuRrddataResponse`")))),
4802 }
4803 } else {
4804 let content = resp.text().await?;
4805 let entity: Option<QemuRrddataError> = serde_json::from_str(&content).ok();
4806 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4807 }
4808}
4809
4810pub async fn qemu_set_options(configuration: &configuration::Configuration, node: &str, vmid: i32, lxc_set_options_request: Option<models::LxcSetOptionsRequest>) -> Result<models::QemuSetOptionsResponse, Error<QemuSetOptionsError>> {
4812 let p_path_node = node;
4814 let p_path_vmid = vmid;
4815 let p_body_lxc_set_options_request = lxc_set_options_request;
4816
4817 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/options", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4818 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
4819
4820 if let Some(ref user_agent) = configuration.user_agent {
4821 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4822 }
4823 if let Some(ref apikey) = configuration.api_key {
4824 let key = apikey.key.clone();
4825 let value = match apikey.prefix {
4826 Some(ref prefix) => format!("{} {}", prefix, key),
4827 None => key,
4828 };
4829 req_builder = req_builder.header("Authorization", value);
4830 };
4831 if let Some(ref apikey) = configuration.api_key {
4832 let key = apikey.key.clone();
4833 let value = match apikey.prefix {
4834 Some(ref prefix) => format!("{} {}", prefix, key),
4835 None => key,
4836 };
4837 req_builder = req_builder.header("CSRFPreventionToken", value);
4838 };
4839 req_builder = req_builder.json(&p_body_lxc_set_options_request);
4840
4841 let req = req_builder.build()?;
4842 let resp = configuration.client.execute(req).await?;
4843
4844 let status = resp.status();
4845 let content_type = resp
4846 .headers()
4847 .get("content-type")
4848 .and_then(|v| v.to_str().ok())
4849 .unwrap_or("application/octet-stream");
4850 let content_type = super::ContentType::from(content_type);
4851
4852 if !status.is_client_error() && !status.is_server_error() {
4853 let content = resp.text().await?;
4854 match content_type {
4855 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4856 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuSetOptionsResponse`"))),
4857 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::QemuSetOptionsResponse`")))),
4858 }
4859 } else {
4860 let content = resp.text().await?;
4861 let entity: Option<QemuSetOptionsError> = serde_json::from_str(&content).ok();
4862 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4863 }
4864}
4865
4866pub async fn qemu_set_user_password(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_set_user_password_request: models::QemuSetUserPasswordRequest) -> Result<models::QemuSetUserPasswordResponse, Error<QemuSetUserPasswordError>> {
4868 let p_path_node = node;
4870 let p_path_vmid = vmid;
4871 let p_body_qemu_set_user_password_request = qemu_set_user_password_request;
4872
4873 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/set-user-password", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4874 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4875
4876 if let Some(ref user_agent) = configuration.user_agent {
4877 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4878 }
4879 if let Some(ref apikey) = configuration.api_key {
4880 let key = apikey.key.clone();
4881 let value = match apikey.prefix {
4882 Some(ref prefix) => format!("{} {}", prefix, key),
4883 None => key,
4884 };
4885 req_builder = req_builder.header("Authorization", value);
4886 };
4887 if let Some(ref apikey) = configuration.api_key {
4888 let key = apikey.key.clone();
4889 let value = match apikey.prefix {
4890 Some(ref prefix) => format!("{} {}", prefix, key),
4891 None => key,
4892 };
4893 req_builder = req_builder.header("CSRFPreventionToken", value);
4894 };
4895 req_builder = req_builder.json(&p_body_qemu_set_user_password_request);
4896
4897 let req = req_builder.build()?;
4898 let resp = configuration.client.execute(req).await?;
4899
4900 let status = resp.status();
4901 let content_type = resp
4902 .headers()
4903 .get("content-type")
4904 .and_then(|v| v.to_str().ok())
4905 .unwrap_or("application/octet-stream");
4906 let content_type = super::ContentType::from(content_type);
4907
4908 if !status.is_client_error() && !status.is_server_error() {
4909 let content = resp.text().await?;
4910 match content_type {
4911 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4912 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuSetUserPasswordResponse`"))),
4913 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::QemuSetUserPasswordResponse`")))),
4914 }
4915 } else {
4916 let content = resp.text().await?;
4917 let entity: Option<QemuSetUserPasswordError> = serde_json::from_str(&content).ok();
4918 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4919 }
4920}
4921
4922pub async fn qemu_shutdown(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuShutdownResponse, Error<QemuShutdownError>> {
4924 let p_path_node = node;
4926 let p_path_vmid = vmid;
4927
4928 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/shutdown", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4929 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4930
4931 if let Some(ref user_agent) = configuration.user_agent {
4932 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4933 }
4934 if let Some(ref apikey) = configuration.api_key {
4935 let key = apikey.key.clone();
4936 let value = match apikey.prefix {
4937 Some(ref prefix) => format!("{} {}", prefix, key),
4938 None => key,
4939 };
4940 req_builder = req_builder.header("Authorization", value);
4941 };
4942 if let Some(ref apikey) = configuration.api_key {
4943 let key = apikey.key.clone();
4944 let value = match apikey.prefix {
4945 Some(ref prefix) => format!("{} {}", prefix, key),
4946 None => key,
4947 };
4948 req_builder = req_builder.header("CSRFPreventionToken", value);
4949 };
4950
4951 let req = req_builder.build()?;
4952 let resp = configuration.client.execute(req).await?;
4953
4954 let status = resp.status();
4955 let content_type = resp
4956 .headers()
4957 .get("content-type")
4958 .and_then(|v| v.to_str().ok())
4959 .unwrap_or("application/octet-stream");
4960 let content_type = super::ContentType::from(content_type);
4961
4962 if !status.is_client_error() && !status.is_server_error() {
4963 let content = resp.text().await?;
4964 match content_type {
4965 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4966 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuShutdownResponse`"))),
4967 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::QemuShutdownResponse`")))),
4968 }
4969 } else {
4970 let content = resp.text().await?;
4971 let entity: Option<QemuShutdownError> = serde_json::from_str(&content).ok();
4972 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4973 }
4974}
4975
4976pub async fn qemu_snapshot(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_snapshot_request: models::QemuSnapshotRequest) -> Result<models::QemuSnapshotResponse, Error<QemuSnapshotError>> {
4978 let p_path_node = node;
4980 let p_path_vmid = vmid;
4981 let p_body_qemu_snapshot_request = qemu_snapshot_request;
4982
4983 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/snapshot", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4984 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4985
4986 if let Some(ref user_agent) = configuration.user_agent {
4987 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4988 }
4989 if let Some(ref apikey) = configuration.api_key {
4990 let key = apikey.key.clone();
4991 let value = match apikey.prefix {
4992 Some(ref prefix) => format!("{} {}", prefix, key),
4993 None => key,
4994 };
4995 req_builder = req_builder.header("Authorization", value);
4996 };
4997 if let Some(ref apikey) = configuration.api_key {
4998 let key = apikey.key.clone();
4999 let value = match apikey.prefix {
5000 Some(ref prefix) => format!("{} {}", prefix, key),
5001 None => key,
5002 };
5003 req_builder = req_builder.header("CSRFPreventionToken", value);
5004 };
5005 req_builder = req_builder.json(&p_body_qemu_snapshot_request);
5006
5007 let req = req_builder.build()?;
5008 let resp = configuration.client.execute(req).await?;
5009
5010 let status = resp.status();
5011 let content_type = resp
5012 .headers()
5013 .get("content-type")
5014 .and_then(|v| v.to_str().ok())
5015 .unwrap_or("application/octet-stream");
5016 let content_type = super::ContentType::from(content_type);
5017
5018 if !status.is_client_error() && !status.is_server_error() {
5019 let content = resp.text().await?;
5020 match content_type {
5021 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5022 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuSnapshotResponse`"))),
5023 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::QemuSnapshotResponse`")))),
5024 }
5025 } else {
5026 let content = resp.text().await?;
5027 let entity: Option<QemuSnapshotError> = serde_json::from_str(&content).ok();
5028 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5029 }
5030}
5031
5032pub async fn qemu_snapshot_cmd_idx(configuration: &configuration::Configuration, node: &str, snapname: &str, vmid: i32) -> Result<models::QemuSnapshotCmdIdxResponse, Error<QemuSnapshotCmdIdxError>> {
5034 let p_path_node = node;
5036 let p_path_snapname = snapname;
5037 let p_path_vmid = vmid;
5038
5039 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/snapshot/{snapname}", configuration.base_path, node=crate::apis::urlencode(p_path_node), snapname=crate::apis::urlencode(p_path_snapname), vmid=p_path_vmid);
5040 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5041
5042 if let Some(ref user_agent) = configuration.user_agent {
5043 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5044 }
5045 if let Some(ref apikey) = configuration.api_key {
5046 let key = apikey.key.clone();
5047 let value = match apikey.prefix {
5048 Some(ref prefix) => format!("{} {}", prefix, key),
5049 None => key,
5050 };
5051 req_builder = req_builder.header("Authorization", value);
5052 };
5053 if let Some(ref apikey) = configuration.api_key {
5054 let key = apikey.key.clone();
5055 let value = match apikey.prefix {
5056 Some(ref prefix) => format!("{} {}", prefix, key),
5057 None => key,
5058 };
5059 req_builder = req_builder.header("CSRFPreventionToken", value);
5060 };
5061
5062 let req = req_builder.build()?;
5063 let resp = configuration.client.execute(req).await?;
5064
5065 let status = resp.status();
5066 let content_type = resp
5067 .headers()
5068 .get("content-type")
5069 .and_then(|v| v.to_str().ok())
5070 .unwrap_or("application/octet-stream");
5071 let content_type = super::ContentType::from(content_type);
5072
5073 if !status.is_client_error() && !status.is_server_error() {
5074 let content = resp.text().await?;
5075 match content_type {
5076 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5077 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuSnapshotCmdIdxResponse`"))),
5078 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::QemuSnapshotCmdIdxResponse`")))),
5079 }
5080 } else {
5081 let content = resp.text().await?;
5082 let entity: Option<QemuSnapshotCmdIdxError> = serde_json::from_str(&content).ok();
5083 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5084 }
5085}
5086
5087pub async fn qemu_snapshot_list(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuSnapshotListResponse, Error<QemuSnapshotListError>> {
5089 let p_path_node = node;
5091 let p_path_vmid = vmid;
5092
5093 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/snapshot", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
5094 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5095
5096 if let Some(ref user_agent) = configuration.user_agent {
5097 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5098 }
5099 if let Some(ref apikey) = configuration.api_key {
5100 let key = apikey.key.clone();
5101 let value = match apikey.prefix {
5102 Some(ref prefix) => format!("{} {}", prefix, key),
5103 None => key,
5104 };
5105 req_builder = req_builder.header("Authorization", value);
5106 };
5107 if let Some(ref apikey) = configuration.api_key {
5108 let key = apikey.key.clone();
5109 let value = match apikey.prefix {
5110 Some(ref prefix) => format!("{} {}", prefix, key),
5111 None => key,
5112 };
5113 req_builder = req_builder.header("CSRFPreventionToken", value);
5114 };
5115
5116 let req = req_builder.build()?;
5117 let resp = configuration.client.execute(req).await?;
5118
5119 let status = resp.status();
5120 let content_type = resp
5121 .headers()
5122 .get("content-type")
5123 .and_then(|v| v.to_str().ok())
5124 .unwrap_or("application/octet-stream");
5125 let content_type = super::ContentType::from(content_type);
5126
5127 if !status.is_client_error() && !status.is_server_error() {
5128 let content = resp.text().await?;
5129 match content_type {
5130 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5131 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuSnapshotListResponse`"))),
5132 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::QemuSnapshotListResponse`")))),
5133 }
5134 } else {
5135 let content = resp.text().await?;
5136 let entity: Option<QemuSnapshotListError> = serde_json::from_str(&content).ok();
5137 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5138 }
5139}
5140
5141pub async fn qemu_spiceproxy(configuration: &configuration::Configuration, node: &str, vmid: i32, lxc_spiceproxy_request: Option<models::LxcSpiceproxyRequest>) -> Result<models::QemuSpiceproxyResponse, Error<QemuSpiceproxyError>> {
5143 let p_path_node = node;
5145 let p_path_vmid = vmid;
5146 let p_body_lxc_spiceproxy_request = lxc_spiceproxy_request;
5147
5148 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/spiceproxy", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
5149 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
5150
5151 if let Some(ref user_agent) = configuration.user_agent {
5152 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5153 }
5154 if let Some(ref apikey) = configuration.api_key {
5155 let key = apikey.key.clone();
5156 let value = match apikey.prefix {
5157 Some(ref prefix) => format!("{} {}", prefix, key),
5158 None => key,
5159 };
5160 req_builder = req_builder.header("Authorization", value);
5161 };
5162 if let Some(ref apikey) = configuration.api_key {
5163 let key = apikey.key.clone();
5164 let value = match apikey.prefix {
5165 Some(ref prefix) => format!("{} {}", prefix, key),
5166 None => key,
5167 };
5168 req_builder = req_builder.header("CSRFPreventionToken", value);
5169 };
5170 req_builder = req_builder.json(&p_body_lxc_spiceproxy_request);
5171
5172 let req = req_builder.build()?;
5173 let resp = configuration.client.execute(req).await?;
5174
5175 let status = resp.status();
5176 let content_type = resp
5177 .headers()
5178 .get("content-type")
5179 .and_then(|v| v.to_str().ok())
5180 .unwrap_or("application/octet-stream");
5181 let content_type = super::ContentType::from(content_type);
5182
5183 if !status.is_client_error() && !status.is_server_error() {
5184 let content = resp.text().await?;
5185 match content_type {
5186 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5187 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuSpiceproxyResponse`"))),
5188 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::QemuSpiceproxyResponse`")))),
5189 }
5190 } else {
5191 let content = resp.text().await?;
5192 let entity: Option<QemuSpiceproxyError> = serde_json::from_str(&content).ok();
5193 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5194 }
5195}
5196
5197pub async fn qemu_suspend_disk(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuSuspendDiskResponse, Error<QemuSuspendDiskError>> {
5199 let p_path_node = node;
5201 let p_path_vmid = vmid;
5202
5203 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/suspend-disk", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
5204 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
5205
5206 if let Some(ref user_agent) = configuration.user_agent {
5207 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5208 }
5209 if let Some(ref apikey) = configuration.api_key {
5210 let key = apikey.key.clone();
5211 let value = match apikey.prefix {
5212 Some(ref prefix) => format!("{} {}", prefix, key),
5213 None => key,
5214 };
5215 req_builder = req_builder.header("Authorization", value);
5216 };
5217 if let Some(ref apikey) = configuration.api_key {
5218 let key = apikey.key.clone();
5219 let value = match apikey.prefix {
5220 Some(ref prefix) => format!("{} {}", prefix, key),
5221 None => key,
5222 };
5223 req_builder = req_builder.header("CSRFPreventionToken", value);
5224 };
5225
5226 let req = req_builder.build()?;
5227 let resp = configuration.client.execute(req).await?;
5228
5229 let status = resp.status();
5230 let content_type = resp
5231 .headers()
5232 .get("content-type")
5233 .and_then(|v| v.to_str().ok())
5234 .unwrap_or("application/octet-stream");
5235 let content_type = super::ContentType::from(content_type);
5236
5237 if !status.is_client_error() && !status.is_server_error() {
5238 let content = resp.text().await?;
5239 match content_type {
5240 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5241 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuSuspendDiskResponse`"))),
5242 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::QemuSuspendDiskResponse`")))),
5243 }
5244 } else {
5245 let content = resp.text().await?;
5246 let entity: Option<QemuSuspendDiskError> = serde_json::from_str(&content).ok();
5247 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5248 }
5249}
5250
5251pub async fn qemu_suspend_hybrid(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuSuspendHybridResponse, Error<QemuSuspendHybridError>> {
5253 let p_path_node = node;
5255 let p_path_vmid = vmid;
5256
5257 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/suspend-hybrid", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
5258 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
5259
5260 if let Some(ref user_agent) = configuration.user_agent {
5261 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5262 }
5263 if let Some(ref apikey) = configuration.api_key {
5264 let key = apikey.key.clone();
5265 let value = match apikey.prefix {
5266 Some(ref prefix) => format!("{} {}", prefix, key),
5267 None => key,
5268 };
5269 req_builder = req_builder.header("Authorization", value);
5270 };
5271 if let Some(ref apikey) = configuration.api_key {
5272 let key = apikey.key.clone();
5273 let value = match apikey.prefix {
5274 Some(ref prefix) => format!("{} {}", prefix, key),
5275 None => key,
5276 };
5277 req_builder = req_builder.header("CSRFPreventionToken", value);
5278 };
5279
5280 let req = req_builder.build()?;
5281 let resp = configuration.client.execute(req).await?;
5282
5283 let status = resp.status();
5284 let content_type = resp
5285 .headers()
5286 .get("content-type")
5287 .and_then(|v| v.to_str().ok())
5288 .unwrap_or("application/octet-stream");
5289 let content_type = super::ContentType::from(content_type);
5290
5291 if !status.is_client_error() && !status.is_server_error() {
5292 let content = resp.text().await?;
5293 match content_type {
5294 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5295 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuSuspendHybridResponse`"))),
5296 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::QemuSuspendHybridResponse`")))),
5297 }
5298 } else {
5299 let content = resp.text().await?;
5300 let entity: Option<QemuSuspendHybridError> = serde_json::from_str(&content).ok();
5301 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5302 }
5303}
5304
5305pub async fn qemu_suspend_ram(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuSuspendRamResponse, Error<QemuSuspendRamError>> {
5307 let p_path_node = node;
5309 let p_path_vmid = vmid;
5310
5311 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/agent/suspend-ram", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
5312 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
5313
5314 if let Some(ref user_agent) = configuration.user_agent {
5315 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5316 }
5317 if let Some(ref apikey) = configuration.api_key {
5318 let key = apikey.key.clone();
5319 let value = match apikey.prefix {
5320 Some(ref prefix) => format!("{} {}", prefix, key),
5321 None => key,
5322 };
5323 req_builder = req_builder.header("Authorization", value);
5324 };
5325 if let Some(ref apikey) = configuration.api_key {
5326 let key = apikey.key.clone();
5327 let value = match apikey.prefix {
5328 Some(ref prefix) => format!("{} {}", prefix, key),
5329 None => key,
5330 };
5331 req_builder = req_builder.header("CSRFPreventionToken", value);
5332 };
5333
5334 let req = req_builder.build()?;
5335 let resp = configuration.client.execute(req).await?;
5336
5337 let status = resp.status();
5338 let content_type = resp
5339 .headers()
5340 .get("content-type")
5341 .and_then(|v| v.to_str().ok())
5342 .unwrap_or("application/octet-stream");
5343 let content_type = super::ContentType::from(content_type);
5344
5345 if !status.is_client_error() && !status.is_server_error() {
5346 let content = resp.text().await?;
5347 match content_type {
5348 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5349 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuSuspendRamResponse`"))),
5350 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::QemuSuspendRamResponse`")))),
5351 }
5352 } else {
5353 let content = resp.text().await?;
5354 let entity: Option<QemuSuspendRamError> = serde_json::from_str(&content).ok();
5355 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5356 }
5357}
5358
5359pub async fn qemu_template(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_template_request: Option<models::QemuTemplateRequest>) -> Result<models::QemuTemplateResponse, Error<QemuTemplateError>> {
5361 let p_path_node = node;
5363 let p_path_vmid = vmid;
5364 let p_body_qemu_template_request = qemu_template_request;
5365
5366 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/template", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
5367 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
5368
5369 if let Some(ref user_agent) = configuration.user_agent {
5370 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5371 }
5372 if let Some(ref apikey) = configuration.api_key {
5373 let key = apikey.key.clone();
5374 let value = match apikey.prefix {
5375 Some(ref prefix) => format!("{} {}", prefix, key),
5376 None => key,
5377 };
5378 req_builder = req_builder.header("Authorization", value);
5379 };
5380 if let Some(ref apikey) = configuration.api_key {
5381 let key = apikey.key.clone();
5382 let value = match apikey.prefix {
5383 Some(ref prefix) => format!("{} {}", prefix, key),
5384 None => key,
5385 };
5386 req_builder = req_builder.header("CSRFPreventionToken", value);
5387 };
5388 req_builder = req_builder.json(&p_body_qemu_template_request);
5389
5390 let req = req_builder.build()?;
5391 let resp = configuration.client.execute(req).await?;
5392
5393 let status = resp.status();
5394 let content_type = resp
5395 .headers()
5396 .get("content-type")
5397 .and_then(|v| v.to_str().ok())
5398 .unwrap_or("application/octet-stream");
5399 let content_type = super::ContentType::from(content_type);
5400
5401 if !status.is_client_error() && !status.is_server_error() {
5402 let content = resp.text().await?;
5403 match content_type {
5404 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5405 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuTemplateResponse`"))),
5406 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::QemuTemplateResponse`")))),
5407 }
5408 } else {
5409 let content = resp.text().await?;
5410 let entity: Option<QemuTemplateError> = serde_json::from_str(&content).ok();
5411 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5412 }
5413}
5414
5415pub async fn qemu_termproxy(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_termproxy_request: Option<models::QemuTermproxyRequest>) -> Result<models::QemuTermproxyResponse, Error<QemuTermproxyError>> {
5417 let p_path_node = node;
5419 let p_path_vmid = vmid;
5420 let p_body_qemu_termproxy_request = qemu_termproxy_request;
5421
5422 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/termproxy", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
5423 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
5424
5425 if let Some(ref user_agent) = configuration.user_agent {
5426 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5427 }
5428 if let Some(ref apikey) = configuration.api_key {
5429 let key = apikey.key.clone();
5430 let value = match apikey.prefix {
5431 Some(ref prefix) => format!("{} {}", prefix, key),
5432 None => key,
5433 };
5434 req_builder = req_builder.header("Authorization", value);
5435 };
5436 if let Some(ref apikey) = configuration.api_key {
5437 let key = apikey.key.clone();
5438 let value = match apikey.prefix {
5439 Some(ref prefix) => format!("{} {}", prefix, key),
5440 None => key,
5441 };
5442 req_builder = req_builder.header("CSRFPreventionToken", value);
5443 };
5444 req_builder = req_builder.json(&p_body_qemu_termproxy_request);
5445
5446 let req = req_builder.build()?;
5447 let resp = configuration.client.execute(req).await?;
5448
5449 let status = resp.status();
5450 let content_type = resp
5451 .headers()
5452 .get("content-type")
5453 .and_then(|v| v.to_str().ok())
5454 .unwrap_or("application/octet-stream");
5455 let content_type = super::ContentType::from(content_type);
5456
5457 if !status.is_client_error() && !status.is_server_error() {
5458 let content = resp.text().await?;
5459 match content_type {
5460 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5461 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuTermproxyResponse`"))),
5462 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::QemuTermproxyResponse`")))),
5463 }
5464 } else {
5465 let content = resp.text().await?;
5466 let entity: Option<QemuTermproxyError> = serde_json::from_str(&content).ok();
5467 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5468 }
5469}
5470
5471pub async fn qemu_unlink(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_unlink_request: models::QemuUnlinkRequest) -> Result<models::QemuUnlinkResponse, Error<QemuUnlinkError>> {
5473 let p_path_node = node;
5475 let p_path_vmid = vmid;
5476 let p_body_qemu_unlink_request = qemu_unlink_request;
5477
5478 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/unlink", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
5479 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
5480
5481 if let Some(ref user_agent) = configuration.user_agent {
5482 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5483 }
5484 if let Some(ref apikey) = configuration.api_key {
5485 let key = apikey.key.clone();
5486 let value = match apikey.prefix {
5487 Some(ref prefix) => format!("{} {}", prefix, key),
5488 None => key,
5489 };
5490 req_builder = req_builder.header("Authorization", value);
5491 };
5492 if let Some(ref apikey) = configuration.api_key {
5493 let key = apikey.key.clone();
5494 let value = match apikey.prefix {
5495 Some(ref prefix) => format!("{} {}", prefix, key),
5496 None => key,
5497 };
5498 req_builder = req_builder.header("CSRFPreventionToken", value);
5499 };
5500 req_builder = req_builder.json(&p_body_qemu_unlink_request);
5501
5502 let req = req_builder.build()?;
5503 let resp = configuration.client.execute(req).await?;
5504
5505 let status = resp.status();
5506 let content_type = resp
5507 .headers()
5508 .get("content-type")
5509 .and_then(|v| v.to_str().ok())
5510 .unwrap_or("application/octet-stream");
5511 let content_type = super::ContentType::from(content_type);
5512
5513 if !status.is_client_error() && !status.is_server_error() {
5514 let content = resp.text().await?;
5515 match content_type {
5516 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5517 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuUnlinkResponse`"))),
5518 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::QemuUnlinkResponse`")))),
5519 }
5520 } else {
5521 let content = resp.text().await?;
5522 let entity: Option<QemuUnlinkError> = serde_json::from_str(&content).ok();
5523 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5524 }
5525}
5526
5527pub async fn qemu_update_alias(configuration: &configuration::Configuration, name: &str, node: &str, vmid: i32, cluster_firewall_update_alias_request: models::ClusterFirewallUpdateAliasRequest) -> Result<models::QemuUpdateAliasResponse, Error<QemuUpdateAliasError>> {
5529 let p_path_name = name;
5531 let p_path_node = node;
5532 let p_path_vmid = vmid;
5533 let p_body_cluster_firewall_update_alias_request = cluster_firewall_update_alias_request;
5534
5535 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/aliases/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name), node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
5536 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
5537
5538 if let Some(ref user_agent) = configuration.user_agent {
5539 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5540 }
5541 if let Some(ref apikey) = configuration.api_key {
5542 let key = apikey.key.clone();
5543 let value = match apikey.prefix {
5544 Some(ref prefix) => format!("{} {}", prefix, key),
5545 None => key,
5546 };
5547 req_builder = req_builder.header("Authorization", value);
5548 };
5549 if let Some(ref apikey) = configuration.api_key {
5550 let key = apikey.key.clone();
5551 let value = match apikey.prefix {
5552 Some(ref prefix) => format!("{} {}", prefix, key),
5553 None => key,
5554 };
5555 req_builder = req_builder.header("CSRFPreventionToken", value);
5556 };
5557 req_builder = req_builder.json(&p_body_cluster_firewall_update_alias_request);
5558
5559 let req = req_builder.build()?;
5560 let resp = configuration.client.execute(req).await?;
5561
5562 let status = resp.status();
5563 let content_type = resp
5564 .headers()
5565 .get("content-type")
5566 .and_then(|v| v.to_str().ok())
5567 .unwrap_or("application/octet-stream");
5568 let content_type = super::ContentType::from(content_type);
5569
5570 if !status.is_client_error() && !status.is_server_error() {
5571 let content = resp.text().await?;
5572 match content_type {
5573 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5574 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuUpdateAliasResponse`"))),
5575 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::QemuUpdateAliasResponse`")))),
5576 }
5577 } else {
5578 let content = resp.text().await?;
5579 let entity: Option<QemuUpdateAliasError> = serde_json::from_str(&content).ok();
5580 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5581 }
5582}
5583
5584pub async fn qemu_update_ip(configuration: &configuration::Configuration, cidr: &str, name: &str, node: &str, vmid: i32, cluster_firewall_update_ip_request: Option<models::ClusterFirewallUpdateIpRequest>) -> Result<models::QemuUpdateIpResponse, Error<QemuUpdateIpError>> {
5586 let p_path_cidr = cidr;
5588 let p_path_name = name;
5589 let p_path_node = node;
5590 let p_path_vmid = vmid;
5591 let p_body_cluster_firewall_update_ip_request = cluster_firewall_update_ip_request;
5592
5593 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/ipset/{name}/{cidr}", configuration.base_path, cidr=crate::apis::urlencode(p_path_cidr), name=crate::apis::urlencode(p_path_name), node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
5594 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
5595
5596 if let Some(ref user_agent) = configuration.user_agent {
5597 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5598 }
5599 if let Some(ref apikey) = configuration.api_key {
5600 let key = apikey.key.clone();
5601 let value = match apikey.prefix {
5602 Some(ref prefix) => format!("{} {}", prefix, key),
5603 None => key,
5604 };
5605 req_builder = req_builder.header("Authorization", value);
5606 };
5607 if let Some(ref apikey) = configuration.api_key {
5608 let key = apikey.key.clone();
5609 let value = match apikey.prefix {
5610 Some(ref prefix) => format!("{} {}", prefix, key),
5611 None => key,
5612 };
5613 req_builder = req_builder.header("CSRFPreventionToken", value);
5614 };
5615 req_builder = req_builder.json(&p_body_cluster_firewall_update_ip_request);
5616
5617 let req = req_builder.build()?;
5618 let resp = configuration.client.execute(req).await?;
5619
5620 let status = resp.status();
5621 let content_type = resp
5622 .headers()
5623 .get("content-type")
5624 .and_then(|v| v.to_str().ok())
5625 .unwrap_or("application/octet-stream");
5626 let content_type = super::ContentType::from(content_type);
5627
5628 if !status.is_client_error() && !status.is_server_error() {
5629 let content = resp.text().await?;
5630 match content_type {
5631 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5632 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuUpdateIpResponse`"))),
5633 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::QemuUpdateIpResponse`")))),
5634 }
5635 } else {
5636 let content = resp.text().await?;
5637 let entity: Option<QemuUpdateIpError> = serde_json::from_str(&content).ok();
5638 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5639 }
5640}
5641
5642pub async fn qemu_update_rule(configuration: &configuration::Configuration, node: &str, pos: i64, vmid: i32, cluster_firewall_update_rule_request: Option<models::ClusterFirewallUpdateRuleRequest>) -> Result<models::QemuUpdateRuleResponse, Error<QemuUpdateRuleError>> {
5644 let p_path_node = node;
5646 let p_path_pos = pos;
5647 let p_path_vmid = vmid;
5648 let p_body_cluster_firewall_update_rule_request = cluster_firewall_update_rule_request;
5649
5650 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/firewall/rules/{pos}", configuration.base_path, node=crate::apis::urlencode(p_path_node), pos=p_path_pos, vmid=p_path_vmid);
5651 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
5652
5653 if let Some(ref user_agent) = configuration.user_agent {
5654 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5655 }
5656 if let Some(ref apikey) = configuration.api_key {
5657 let key = apikey.key.clone();
5658 let value = match apikey.prefix {
5659 Some(ref prefix) => format!("{} {}", prefix, key),
5660 None => key,
5661 };
5662 req_builder = req_builder.header("Authorization", value);
5663 };
5664 if let Some(ref apikey) = configuration.api_key {
5665 let key = apikey.key.clone();
5666 let value = match apikey.prefix {
5667 Some(ref prefix) => format!("{} {}", prefix, key),
5668 None => key,
5669 };
5670 req_builder = req_builder.header("CSRFPreventionToken", value);
5671 };
5672 req_builder = req_builder.json(&p_body_cluster_firewall_update_rule_request);
5673
5674 let req = req_builder.build()?;
5675 let resp = configuration.client.execute(req).await?;
5676
5677 let status = resp.status();
5678 let content_type = resp
5679 .headers()
5680 .get("content-type")
5681 .and_then(|v| v.to_str().ok())
5682 .unwrap_or("application/octet-stream");
5683 let content_type = super::ContentType::from(content_type);
5684
5685 if !status.is_client_error() && !status.is_server_error() {
5686 let content = resp.text().await?;
5687 match content_type {
5688 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5689 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuUpdateRuleResponse`"))),
5690 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::QemuUpdateRuleResponse`")))),
5691 }
5692 } else {
5693 let content = resp.text().await?;
5694 let entity: Option<QemuUpdateRuleError> = serde_json::from_str(&content).ok();
5695 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5696 }
5697}
5698
5699pub async fn qemu_update_snapshot_config(configuration: &configuration::Configuration, node: &str, snapname: &str, vmid: i32, lxc_update_snapshot_config_request: Option<models::LxcUpdateSnapshotConfigRequest>) -> Result<models::QemuUpdateSnapshotConfigResponse, Error<QemuUpdateSnapshotConfigError>> {
5701 let p_path_node = node;
5703 let p_path_snapname = snapname;
5704 let p_path_vmid = vmid;
5705 let p_body_lxc_update_snapshot_config_request = lxc_update_snapshot_config_request;
5706
5707 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/snapshot/{snapname}/config", configuration.base_path, node=crate::apis::urlencode(p_path_node), snapname=crate::apis::urlencode(p_path_snapname), vmid=p_path_vmid);
5708 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
5709
5710 if let Some(ref user_agent) = configuration.user_agent {
5711 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5712 }
5713 if let Some(ref apikey) = configuration.api_key {
5714 let key = apikey.key.clone();
5715 let value = match apikey.prefix {
5716 Some(ref prefix) => format!("{} {}", prefix, key),
5717 None => key,
5718 };
5719 req_builder = req_builder.header("Authorization", value);
5720 };
5721 if let Some(ref apikey) = configuration.api_key {
5722 let key = apikey.key.clone();
5723 let value = match apikey.prefix {
5724 Some(ref prefix) => format!("{} {}", prefix, key),
5725 None => key,
5726 };
5727 req_builder = req_builder.header("CSRFPreventionToken", value);
5728 };
5729 req_builder = req_builder.json(&p_body_lxc_update_snapshot_config_request);
5730
5731 let req = req_builder.build()?;
5732 let resp = configuration.client.execute(req).await?;
5733
5734 let status = resp.status();
5735 let content_type = resp
5736 .headers()
5737 .get("content-type")
5738 .and_then(|v| v.to_str().ok())
5739 .unwrap_or("application/octet-stream");
5740 let content_type = super::ContentType::from(content_type);
5741
5742 if !status.is_client_error() && !status.is_server_error() {
5743 let content = resp.text().await?;
5744 match content_type {
5745 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5746 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuUpdateSnapshotConfigResponse`"))),
5747 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::QemuUpdateSnapshotConfigResponse`")))),
5748 }
5749 } else {
5750 let content = resp.text().await?;
5751 let entity: Option<QemuUpdateSnapshotConfigError> = serde_json::from_str(&content).ok();
5752 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5753 }
5754}
5755
5756pub async fn qemu_update_vm(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_update_vm_request: Option<models::QemuUpdateVmRequest>) -> Result<models::QemuUpdateVmResponse, Error<QemuUpdateVmError>> {
5758 let p_path_node = node;
5760 let p_path_vmid = vmid;
5761 let p_body_qemu_update_vm_request = qemu_update_vm_request;
5762
5763 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/config", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
5764 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
5765
5766 if let Some(ref user_agent) = configuration.user_agent {
5767 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5768 }
5769 if let Some(ref apikey) = configuration.api_key {
5770 let key = apikey.key.clone();
5771 let value = match apikey.prefix {
5772 Some(ref prefix) => format!("{} {}", prefix, key),
5773 None => key,
5774 };
5775 req_builder = req_builder.header("Authorization", value);
5776 };
5777 if let Some(ref apikey) = configuration.api_key {
5778 let key = apikey.key.clone();
5779 let value = match apikey.prefix {
5780 Some(ref prefix) => format!("{} {}", prefix, key),
5781 None => key,
5782 };
5783 req_builder = req_builder.header("CSRFPreventionToken", value);
5784 };
5785 req_builder = req_builder.json(&p_body_qemu_update_vm_request);
5786
5787 let req = req_builder.build()?;
5788 let resp = configuration.client.execute(req).await?;
5789
5790 let status = resp.status();
5791 let content_type = resp
5792 .headers()
5793 .get("content-type")
5794 .and_then(|v| v.to_str().ok())
5795 .unwrap_or("application/octet-stream");
5796 let content_type = super::ContentType::from(content_type);
5797
5798 if !status.is_client_error() && !status.is_server_error() {
5799 let content = resp.text().await?;
5800 match content_type {
5801 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5802 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuUpdateVmResponse`"))),
5803 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::QemuUpdateVmResponse`")))),
5804 }
5805 } else {
5806 let content = resp.text().await?;
5807 let entity: Option<QemuUpdateVmError> = serde_json::from_str(&content).ok();
5808 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5809 }
5810}
5811
5812pub async fn qemu_update_vm_async_op(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_update_vm_async_op_request: Option<models::QemuUpdateVmAsyncOpRequest>) -> Result<models::QemuUpdateVmAsyncOpResponse, Error<QemuUpdateVmAsyncOpError>> {
5814 let p_path_node = node;
5816 let p_path_vmid = vmid;
5817 let p_body_qemu_update_vm_async_op_request = qemu_update_vm_async_op_request;
5818
5819 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/config", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
5820 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
5821
5822 if let Some(ref user_agent) = configuration.user_agent {
5823 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5824 }
5825 if let Some(ref apikey) = configuration.api_key {
5826 let key = apikey.key.clone();
5827 let value = match apikey.prefix {
5828 Some(ref prefix) => format!("{} {}", prefix, key),
5829 None => key,
5830 };
5831 req_builder = req_builder.header("Authorization", value);
5832 };
5833 if let Some(ref apikey) = configuration.api_key {
5834 let key = apikey.key.clone();
5835 let value = match apikey.prefix {
5836 Some(ref prefix) => format!("{} {}", prefix, key),
5837 None => key,
5838 };
5839 req_builder = req_builder.header("CSRFPreventionToken", value);
5840 };
5841 req_builder = req_builder.json(&p_body_qemu_update_vm_async_op_request);
5842
5843 let req = req_builder.build()?;
5844 let resp = configuration.client.execute(req).await?;
5845
5846 let status = resp.status();
5847 let content_type = resp
5848 .headers()
5849 .get("content-type")
5850 .and_then(|v| v.to_str().ok())
5851 .unwrap_or("application/octet-stream");
5852 let content_type = super::ContentType::from(content_type);
5853
5854 if !status.is_client_error() && !status.is_server_error() {
5855 let content = resp.text().await?;
5856 match content_type {
5857 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5858 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuUpdateVmAsyncOpResponse`"))),
5859 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::QemuUpdateVmAsyncOpResponse`")))),
5860 }
5861 } else {
5862 let content = resp.text().await?;
5863 let entity: Option<QemuUpdateVmAsyncOpError> = serde_json::from_str(&content).ok();
5864 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5865 }
5866}
5867
5868pub async fn qemu_vm_config(configuration: &configuration::Configuration, node: &str, vmid: i32, current: Option<&str>, snapshot: Option<&str>) -> Result<models::QemuVmConfigResponse, Error<QemuVmConfigError>> {
5870 let p_path_node = node;
5872 let p_path_vmid = vmid;
5873 let p_query_current = current;
5874 let p_query_snapshot = snapshot;
5875
5876 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/config", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
5877 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5878
5879 if let Some(ref param_value) = p_query_current {
5880 req_builder = req_builder.query(&[("current", ¶m_value.to_string())]);
5881 }
5882 if let Some(ref param_value) = p_query_snapshot {
5883 req_builder = req_builder.query(&[("snapshot", ¶m_value.to_string())]);
5884 }
5885 if let Some(ref user_agent) = configuration.user_agent {
5886 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5887 }
5888 if let Some(ref apikey) = configuration.api_key {
5889 let key = apikey.key.clone();
5890 let value = match apikey.prefix {
5891 Some(ref prefix) => format!("{} {}", prefix, key),
5892 None => key,
5893 };
5894 req_builder = req_builder.header("Authorization", value);
5895 };
5896 if let Some(ref apikey) = configuration.api_key {
5897 let key = apikey.key.clone();
5898 let value = match apikey.prefix {
5899 Some(ref prefix) => format!("{} {}", prefix, key),
5900 None => key,
5901 };
5902 req_builder = req_builder.header("CSRFPreventionToken", value);
5903 };
5904
5905 let req = req_builder.build()?;
5906 let resp = configuration.client.execute(req).await?;
5907
5908 let status = resp.status();
5909 let content_type = resp
5910 .headers()
5911 .get("content-type")
5912 .and_then(|v| v.to_str().ok())
5913 .unwrap_or("application/octet-stream");
5914 let content_type = super::ContentType::from(content_type);
5915
5916 if !status.is_client_error() && !status.is_server_error() {
5917 let content = resp.text().await?;
5918 match content_type {
5919 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5920 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuVmConfigResponse`"))),
5921 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::QemuVmConfigResponse`")))),
5922 }
5923 } else {
5924 let content = resp.text().await?;
5925 let entity: Option<QemuVmConfigError> = serde_json::from_str(&content).ok();
5926 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5927 }
5928}
5929
5930pub async fn qemu_vm_feature(configuration: &configuration::Configuration, feature: models::PveFeatureEnum, node: &str, vmid: i32, snapname: Option<&str>) -> Result<models::QemuVmFeatureResponse, Error<QemuVmFeatureError>> {
5932 let p_query_feature = feature;
5934 let p_path_node = node;
5935 let p_path_vmid = vmid;
5936 let p_query_snapname = snapname;
5937
5938 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/feature", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
5939 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5940
5941 req_builder = req_builder.query(&[("feature", &p_query_feature.to_string())]);
5942 if let Some(ref param_value) = p_query_snapname {
5943 req_builder = req_builder.query(&[("snapname", ¶m_value.to_string())]);
5944 }
5945 if let Some(ref user_agent) = configuration.user_agent {
5946 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5947 }
5948 if let Some(ref apikey) = configuration.api_key {
5949 let key = apikey.key.clone();
5950 let value = match apikey.prefix {
5951 Some(ref prefix) => format!("{} {}", prefix, key),
5952 None => key,
5953 };
5954 req_builder = req_builder.header("Authorization", value);
5955 };
5956 if let Some(ref apikey) = configuration.api_key {
5957 let key = apikey.key.clone();
5958 let value = match apikey.prefix {
5959 Some(ref prefix) => format!("{} {}", prefix, key),
5960 None => key,
5961 };
5962 req_builder = req_builder.header("CSRFPreventionToken", value);
5963 };
5964
5965 let req = req_builder.build()?;
5966 let resp = configuration.client.execute(req).await?;
5967
5968 let status = resp.status();
5969 let content_type = resp
5970 .headers()
5971 .get("content-type")
5972 .and_then(|v| v.to_str().ok())
5973 .unwrap_or("application/octet-stream");
5974 let content_type = super::ContentType::from(content_type);
5975
5976 if !status.is_client_error() && !status.is_server_error() {
5977 let content = resp.text().await?;
5978 match content_type {
5979 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5980 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuVmFeatureResponse`"))),
5981 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::QemuVmFeatureResponse`")))),
5982 }
5983 } else {
5984 let content = resp.text().await?;
5985 let entity: Option<QemuVmFeatureError> = serde_json::from_str(&content).ok();
5986 Err(Error::ResponseError(ResponseContent { status, content, entity }))
5987 }
5988}
5989
5990pub async fn qemu_vm_pending(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuVmPendingResponse, Error<QemuVmPendingError>> {
5992 let p_path_node = node;
5994 let p_path_vmid = vmid;
5995
5996 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/pending", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
5997 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5998
5999 if let Some(ref user_agent) = configuration.user_agent {
6000 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6001 }
6002 if let Some(ref apikey) = configuration.api_key {
6003 let key = apikey.key.clone();
6004 let value = match apikey.prefix {
6005 Some(ref prefix) => format!("{} {}", prefix, key),
6006 None => key,
6007 };
6008 req_builder = req_builder.header("Authorization", value);
6009 };
6010 if let Some(ref apikey) = configuration.api_key {
6011 let key = apikey.key.clone();
6012 let value = match apikey.prefix {
6013 Some(ref prefix) => format!("{} {}", prefix, key),
6014 None => key,
6015 };
6016 req_builder = req_builder.header("CSRFPreventionToken", value);
6017 };
6018
6019 let req = req_builder.build()?;
6020 let resp = configuration.client.execute(req).await?;
6021
6022 let status = resp.status();
6023 let content_type = resp
6024 .headers()
6025 .get("content-type")
6026 .and_then(|v| v.to_str().ok())
6027 .unwrap_or("application/octet-stream");
6028 let content_type = super::ContentType::from(content_type);
6029
6030 if !status.is_client_error() && !status.is_server_error() {
6031 let content = resp.text().await?;
6032 match content_type {
6033 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6034 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuVmPendingResponse`"))),
6035 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::QemuVmPendingResponse`")))),
6036 }
6037 } else {
6038 let content = resp.text().await?;
6039 let entity: Option<QemuVmPendingError> = serde_json::from_str(&content).ok();
6040 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6041 }
6042}
6043
6044pub async fn qemu_vm_reboot(configuration: &configuration::Configuration, node: &str, vmid: i32, lxc_vm_reboot_request: Option<models::LxcVmRebootRequest>) -> Result<models::QemuVmRebootResponse, Error<QemuVmRebootError>> {
6046 let p_path_node = node;
6048 let p_path_vmid = vmid;
6049 let p_body_lxc_vm_reboot_request = lxc_vm_reboot_request;
6050
6051 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/status/reboot", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
6052 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6053
6054 if let Some(ref user_agent) = configuration.user_agent {
6055 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6056 }
6057 if let Some(ref apikey) = configuration.api_key {
6058 let key = apikey.key.clone();
6059 let value = match apikey.prefix {
6060 Some(ref prefix) => format!("{} {}", prefix, key),
6061 None => key,
6062 };
6063 req_builder = req_builder.header("Authorization", value);
6064 };
6065 if let Some(ref apikey) = configuration.api_key {
6066 let key = apikey.key.clone();
6067 let value = match apikey.prefix {
6068 Some(ref prefix) => format!("{} {}", prefix, key),
6069 None => key,
6070 };
6071 req_builder = req_builder.header("CSRFPreventionToken", value);
6072 };
6073 req_builder = req_builder.json(&p_body_lxc_vm_reboot_request);
6074
6075 let req = req_builder.build()?;
6076 let resp = configuration.client.execute(req).await?;
6077
6078 let status = resp.status();
6079 let content_type = resp
6080 .headers()
6081 .get("content-type")
6082 .and_then(|v| v.to_str().ok())
6083 .unwrap_or("application/octet-stream");
6084 let content_type = super::ContentType::from(content_type);
6085
6086 if !status.is_client_error() && !status.is_server_error() {
6087 let content = resp.text().await?;
6088 match content_type {
6089 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6090 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuVmRebootResponse`"))),
6091 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::QemuVmRebootResponse`")))),
6092 }
6093 } else {
6094 let content = resp.text().await?;
6095 let entity: Option<QemuVmRebootError> = serde_json::from_str(&content).ok();
6096 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6097 }
6098}
6099
6100pub async fn qemu_vm_reset(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_vm_reset_request: Option<models::QemuVmResetRequest>) -> Result<models::QemuVmResetResponse, Error<QemuVmResetError>> {
6102 let p_path_node = node;
6104 let p_path_vmid = vmid;
6105 let p_body_qemu_vm_reset_request = qemu_vm_reset_request;
6106
6107 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/status/reset", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
6108 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6109
6110 if let Some(ref user_agent) = configuration.user_agent {
6111 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6112 }
6113 if let Some(ref apikey) = configuration.api_key {
6114 let key = apikey.key.clone();
6115 let value = match apikey.prefix {
6116 Some(ref prefix) => format!("{} {}", prefix, key),
6117 None => key,
6118 };
6119 req_builder = req_builder.header("Authorization", value);
6120 };
6121 if let Some(ref apikey) = configuration.api_key {
6122 let key = apikey.key.clone();
6123 let value = match apikey.prefix {
6124 Some(ref prefix) => format!("{} {}", prefix, key),
6125 None => key,
6126 };
6127 req_builder = req_builder.header("CSRFPreventionToken", value);
6128 };
6129 req_builder = req_builder.json(&p_body_qemu_vm_reset_request);
6130
6131 let req = req_builder.build()?;
6132 let resp = configuration.client.execute(req).await?;
6133
6134 let status = resp.status();
6135 let content_type = resp
6136 .headers()
6137 .get("content-type")
6138 .and_then(|v| v.to_str().ok())
6139 .unwrap_or("application/octet-stream");
6140 let content_type = super::ContentType::from(content_type);
6141
6142 if !status.is_client_error() && !status.is_server_error() {
6143 let content = resp.text().await?;
6144 match content_type {
6145 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6146 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuVmResetResponse`"))),
6147 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::QemuVmResetResponse`")))),
6148 }
6149 } else {
6150 let content = resp.text().await?;
6151 let entity: Option<QemuVmResetError> = serde_json::from_str(&content).ok();
6152 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6153 }
6154}
6155
6156pub async fn qemu_vm_resume(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_vm_resume_request: Option<models::QemuVmResumeRequest>) -> Result<models::QemuVmResumeResponse, Error<QemuVmResumeError>> {
6158 let p_path_node = node;
6160 let p_path_vmid = vmid;
6161 let p_body_qemu_vm_resume_request = qemu_vm_resume_request;
6162
6163 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/status/resume", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
6164 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6165
6166 if let Some(ref user_agent) = configuration.user_agent {
6167 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6168 }
6169 if let Some(ref apikey) = configuration.api_key {
6170 let key = apikey.key.clone();
6171 let value = match apikey.prefix {
6172 Some(ref prefix) => format!("{} {}", prefix, key),
6173 None => key,
6174 };
6175 req_builder = req_builder.header("Authorization", value);
6176 };
6177 if let Some(ref apikey) = configuration.api_key {
6178 let key = apikey.key.clone();
6179 let value = match apikey.prefix {
6180 Some(ref prefix) => format!("{} {}", prefix, key),
6181 None => key,
6182 };
6183 req_builder = req_builder.header("CSRFPreventionToken", value);
6184 };
6185 req_builder = req_builder.json(&p_body_qemu_vm_resume_request);
6186
6187 let req = req_builder.build()?;
6188 let resp = configuration.client.execute(req).await?;
6189
6190 let status = resp.status();
6191 let content_type = resp
6192 .headers()
6193 .get("content-type")
6194 .and_then(|v| v.to_str().ok())
6195 .unwrap_or("application/octet-stream");
6196 let content_type = super::ContentType::from(content_type);
6197
6198 if !status.is_client_error() && !status.is_server_error() {
6199 let content = resp.text().await?;
6200 match content_type {
6201 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6202 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuVmResumeResponse`"))),
6203 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::QemuVmResumeResponse`")))),
6204 }
6205 } else {
6206 let content = resp.text().await?;
6207 let entity: Option<QemuVmResumeError> = serde_json::from_str(&content).ok();
6208 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6209 }
6210}
6211
6212pub async fn qemu_vm_sendkey(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_vm_sendkey_request: models::QemuVmSendkeyRequest) -> Result<models::QemuVmSendkeyResponse, Error<QemuVmSendkeyError>> {
6214 let p_path_node = node;
6216 let p_path_vmid = vmid;
6217 let p_body_qemu_vm_sendkey_request = qemu_vm_sendkey_request;
6218
6219 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/sendkey", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
6220 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
6221
6222 if let Some(ref user_agent) = configuration.user_agent {
6223 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6224 }
6225 if let Some(ref apikey) = configuration.api_key {
6226 let key = apikey.key.clone();
6227 let value = match apikey.prefix {
6228 Some(ref prefix) => format!("{} {}", prefix, key),
6229 None => key,
6230 };
6231 req_builder = req_builder.header("Authorization", value);
6232 };
6233 if let Some(ref apikey) = configuration.api_key {
6234 let key = apikey.key.clone();
6235 let value = match apikey.prefix {
6236 Some(ref prefix) => format!("{} {}", prefix, key),
6237 None => key,
6238 };
6239 req_builder = req_builder.header("CSRFPreventionToken", value);
6240 };
6241 req_builder = req_builder.json(&p_body_qemu_vm_sendkey_request);
6242
6243 let req = req_builder.build()?;
6244 let resp = configuration.client.execute(req).await?;
6245
6246 let status = resp.status();
6247 let content_type = resp
6248 .headers()
6249 .get("content-type")
6250 .and_then(|v| v.to_str().ok())
6251 .unwrap_or("application/octet-stream");
6252 let content_type = super::ContentType::from(content_type);
6253
6254 if !status.is_client_error() && !status.is_server_error() {
6255 let content = resp.text().await?;
6256 match content_type {
6257 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6258 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuVmSendkeyResponse`"))),
6259 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::QemuVmSendkeyResponse`")))),
6260 }
6261 } else {
6262 let content = resp.text().await?;
6263 let entity: Option<QemuVmSendkeyError> = serde_json::from_str(&content).ok();
6264 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6265 }
6266}
6267
6268pub async fn qemu_vm_shutdown(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_vm_shutdown_request: Option<models::QemuVmShutdownRequest>) -> Result<models::QemuVmShutdownResponse, Error<QemuVmShutdownError>> {
6270 let p_path_node = node;
6272 let p_path_vmid = vmid;
6273 let p_body_qemu_vm_shutdown_request = qemu_vm_shutdown_request;
6274
6275 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/status/shutdown", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
6276 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6277
6278 if let Some(ref user_agent) = configuration.user_agent {
6279 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6280 }
6281 if let Some(ref apikey) = configuration.api_key {
6282 let key = apikey.key.clone();
6283 let value = match apikey.prefix {
6284 Some(ref prefix) => format!("{} {}", prefix, key),
6285 None => key,
6286 };
6287 req_builder = req_builder.header("Authorization", value);
6288 };
6289 if let Some(ref apikey) = configuration.api_key {
6290 let key = apikey.key.clone();
6291 let value = match apikey.prefix {
6292 Some(ref prefix) => format!("{} {}", prefix, key),
6293 None => key,
6294 };
6295 req_builder = req_builder.header("CSRFPreventionToken", value);
6296 };
6297 req_builder = req_builder.json(&p_body_qemu_vm_shutdown_request);
6298
6299 let req = req_builder.build()?;
6300 let resp = configuration.client.execute(req).await?;
6301
6302 let status = resp.status();
6303 let content_type = resp
6304 .headers()
6305 .get("content-type")
6306 .and_then(|v| v.to_str().ok())
6307 .unwrap_or("application/octet-stream");
6308 let content_type = super::ContentType::from(content_type);
6309
6310 if !status.is_client_error() && !status.is_server_error() {
6311 let content = resp.text().await?;
6312 match content_type {
6313 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6314 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuVmShutdownResponse`"))),
6315 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::QemuVmShutdownResponse`")))),
6316 }
6317 } else {
6318 let content = resp.text().await?;
6319 let entity: Option<QemuVmShutdownError> = serde_json::from_str(&content).ok();
6320 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6321 }
6322}
6323
6324pub async fn qemu_vm_start(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_vm_start_request: Option<models::QemuVmStartRequest>) -> Result<models::QemuVmStartResponse, Error<QemuVmStartError>> {
6326 let p_path_node = node;
6328 let p_path_vmid = vmid;
6329 let p_body_qemu_vm_start_request = qemu_vm_start_request;
6330
6331 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/status/start", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
6332 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6333
6334 if let Some(ref user_agent) = configuration.user_agent {
6335 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6336 }
6337 if let Some(ref apikey) = configuration.api_key {
6338 let key = apikey.key.clone();
6339 let value = match apikey.prefix {
6340 Some(ref prefix) => format!("{} {}", prefix, key),
6341 None => key,
6342 };
6343 req_builder = req_builder.header("Authorization", value);
6344 };
6345 if let Some(ref apikey) = configuration.api_key {
6346 let key = apikey.key.clone();
6347 let value = match apikey.prefix {
6348 Some(ref prefix) => format!("{} {}", prefix, key),
6349 None => key,
6350 };
6351 req_builder = req_builder.header("CSRFPreventionToken", value);
6352 };
6353 req_builder = req_builder.json(&p_body_qemu_vm_start_request);
6354
6355 let req = req_builder.build()?;
6356 let resp = configuration.client.execute(req).await?;
6357
6358 let status = resp.status();
6359 let content_type = resp
6360 .headers()
6361 .get("content-type")
6362 .and_then(|v| v.to_str().ok())
6363 .unwrap_or("application/octet-stream");
6364 let content_type = super::ContentType::from(content_type);
6365
6366 if !status.is_client_error() && !status.is_server_error() {
6367 let content = resp.text().await?;
6368 match content_type {
6369 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6370 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuVmStartResponse`"))),
6371 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::QemuVmStartResponse`")))),
6372 }
6373 } else {
6374 let content = resp.text().await?;
6375 let entity: Option<QemuVmStartError> = serde_json::from_str(&content).ok();
6376 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6377 }
6378}
6379
6380pub async fn qemu_vm_status(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuVmStatusResponse, Error<QemuVmStatusError>> {
6382 let p_path_node = node;
6384 let p_path_vmid = vmid;
6385
6386 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/status/current", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
6387 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6388
6389 if let Some(ref user_agent) = configuration.user_agent {
6390 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6391 }
6392 if let Some(ref apikey) = configuration.api_key {
6393 let key = apikey.key.clone();
6394 let value = match apikey.prefix {
6395 Some(ref prefix) => format!("{} {}", prefix, key),
6396 None => key,
6397 };
6398 req_builder = req_builder.header("Authorization", value);
6399 };
6400 if let Some(ref apikey) = configuration.api_key {
6401 let key = apikey.key.clone();
6402 let value = match apikey.prefix {
6403 Some(ref prefix) => format!("{} {}", prefix, key),
6404 None => key,
6405 };
6406 req_builder = req_builder.header("CSRFPreventionToken", value);
6407 };
6408
6409 let req = req_builder.build()?;
6410 let resp = configuration.client.execute(req).await?;
6411
6412 let status = resp.status();
6413 let content_type = resp
6414 .headers()
6415 .get("content-type")
6416 .and_then(|v| v.to_str().ok())
6417 .unwrap_or("application/octet-stream");
6418 let content_type = super::ContentType::from(content_type);
6419
6420 if !status.is_client_error() && !status.is_server_error() {
6421 let content = resp.text().await?;
6422 match content_type {
6423 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6424 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuVmStatusResponse`"))),
6425 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::QemuVmStatusResponse`")))),
6426 }
6427 } else {
6428 let content = resp.text().await?;
6429 let entity: Option<QemuVmStatusError> = serde_json::from_str(&content).ok();
6430 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6431 }
6432}
6433
6434pub async fn qemu_vm_stop(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_vm_stop_request: Option<models::QemuVmStopRequest>) -> Result<models::QemuVmStopResponse, Error<QemuVmStopError>> {
6436 let p_path_node = node;
6438 let p_path_vmid = vmid;
6439 let p_body_qemu_vm_stop_request = qemu_vm_stop_request;
6440
6441 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/status/stop", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
6442 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6443
6444 if let Some(ref user_agent) = configuration.user_agent {
6445 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6446 }
6447 if let Some(ref apikey) = configuration.api_key {
6448 let key = apikey.key.clone();
6449 let value = match apikey.prefix {
6450 Some(ref prefix) => format!("{} {}", prefix, key),
6451 None => key,
6452 };
6453 req_builder = req_builder.header("Authorization", value);
6454 };
6455 if let Some(ref apikey) = configuration.api_key {
6456 let key = apikey.key.clone();
6457 let value = match apikey.prefix {
6458 Some(ref prefix) => format!("{} {}", prefix, key),
6459 None => key,
6460 };
6461 req_builder = req_builder.header("CSRFPreventionToken", value);
6462 };
6463 req_builder = req_builder.json(&p_body_qemu_vm_stop_request);
6464
6465 let req = req_builder.build()?;
6466 let resp = configuration.client.execute(req).await?;
6467
6468 let status = resp.status();
6469 let content_type = resp
6470 .headers()
6471 .get("content-type")
6472 .and_then(|v| v.to_str().ok())
6473 .unwrap_or("application/octet-stream");
6474 let content_type = super::ContentType::from(content_type);
6475
6476 if !status.is_client_error() && !status.is_server_error() {
6477 let content = resp.text().await?;
6478 match content_type {
6479 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6480 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuVmStopResponse`"))),
6481 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::QemuVmStopResponse`")))),
6482 }
6483 } else {
6484 let content = resp.text().await?;
6485 let entity: Option<QemuVmStopError> = serde_json::from_str(&content).ok();
6486 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6487 }
6488}
6489
6490pub async fn qemu_vm_suspend(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_vm_suspend_request: Option<models::QemuVmSuspendRequest>) -> Result<models::QemuVmSuspendResponse, Error<QemuVmSuspendError>> {
6492 let p_path_node = node;
6494 let p_path_vmid = vmid;
6495 let p_body_qemu_vm_suspend_request = qemu_vm_suspend_request;
6496
6497 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/status/suspend", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
6498 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6499
6500 if let Some(ref user_agent) = configuration.user_agent {
6501 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6502 }
6503 if let Some(ref apikey) = configuration.api_key {
6504 let key = apikey.key.clone();
6505 let value = match apikey.prefix {
6506 Some(ref prefix) => format!("{} {}", prefix, key),
6507 None => key,
6508 };
6509 req_builder = req_builder.header("Authorization", value);
6510 };
6511 if let Some(ref apikey) = configuration.api_key {
6512 let key = apikey.key.clone();
6513 let value = match apikey.prefix {
6514 Some(ref prefix) => format!("{} {}", prefix, key),
6515 None => key,
6516 };
6517 req_builder = req_builder.header("CSRFPreventionToken", value);
6518 };
6519 req_builder = req_builder.json(&p_body_qemu_vm_suspend_request);
6520
6521 let req = req_builder.build()?;
6522 let resp = configuration.client.execute(req).await?;
6523
6524 let status = resp.status();
6525 let content_type = resp
6526 .headers()
6527 .get("content-type")
6528 .and_then(|v| v.to_str().ok())
6529 .unwrap_or("application/octet-stream");
6530 let content_type = super::ContentType::from(content_type);
6531
6532 if !status.is_client_error() && !status.is_server_error() {
6533 let content = resp.text().await?;
6534 match content_type {
6535 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6536 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuVmSuspendResponse`"))),
6537 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::QemuVmSuspendResponse`")))),
6538 }
6539 } else {
6540 let content = resp.text().await?;
6541 let entity: Option<QemuVmSuspendError> = serde_json::from_str(&content).ok();
6542 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6543 }
6544}
6545
6546pub async fn qemu_vmcmdidx(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuVmcmdidxResponse, Error<QemuVmcmdidxError>> {
6548 let p_path_node = node;
6550 let p_path_vmid = vmid;
6551
6552 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/status", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
6553 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6554
6555 if let Some(ref user_agent) = configuration.user_agent {
6556 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6557 }
6558 if let Some(ref apikey) = configuration.api_key {
6559 let key = apikey.key.clone();
6560 let value = match apikey.prefix {
6561 Some(ref prefix) => format!("{} {}", prefix, key),
6562 None => key,
6563 };
6564 req_builder = req_builder.header("Authorization", value);
6565 };
6566 if let Some(ref apikey) = configuration.api_key {
6567 let key = apikey.key.clone();
6568 let value = match apikey.prefix {
6569 Some(ref prefix) => format!("{} {}", prefix, key),
6570 None => key,
6571 };
6572 req_builder = req_builder.header("CSRFPreventionToken", value);
6573 };
6574
6575 let req = req_builder.build()?;
6576 let resp = configuration.client.execute(req).await?;
6577
6578 let status = resp.status();
6579 let content_type = resp
6580 .headers()
6581 .get("content-type")
6582 .and_then(|v| v.to_str().ok())
6583 .unwrap_or("application/octet-stream");
6584 let content_type = super::ContentType::from(content_type);
6585
6586 if !status.is_client_error() && !status.is_server_error() {
6587 let content = resp.text().await?;
6588 match content_type {
6589 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6590 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuVmcmdidxResponse`"))),
6591 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::QemuVmcmdidxResponse`")))),
6592 }
6593 } else {
6594 let content = resp.text().await?;
6595 let entity: Option<QemuVmcmdidxError> = serde_json::from_str(&content).ok();
6596 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6597 }
6598}
6599
6600pub async fn qemu_vmdiridx(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::QemuVmdiridxResponse, Error<QemuVmdiridxError>> {
6602 let p_path_node = node;
6604 let p_path_vmid = vmid;
6605
6606 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
6607 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6608
6609 if let Some(ref user_agent) = configuration.user_agent {
6610 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6611 }
6612 if let Some(ref apikey) = configuration.api_key {
6613 let key = apikey.key.clone();
6614 let value = match apikey.prefix {
6615 Some(ref prefix) => format!("{} {}", prefix, key),
6616 None => key,
6617 };
6618 req_builder = req_builder.header("Authorization", value);
6619 };
6620 if let Some(ref apikey) = configuration.api_key {
6621 let key = apikey.key.clone();
6622 let value = match apikey.prefix {
6623 Some(ref prefix) => format!("{} {}", prefix, key),
6624 None => key,
6625 };
6626 req_builder = req_builder.header("CSRFPreventionToken", value);
6627 };
6628
6629 let req = req_builder.build()?;
6630 let resp = configuration.client.execute(req).await?;
6631
6632 let status = resp.status();
6633 let content_type = resp
6634 .headers()
6635 .get("content-type")
6636 .and_then(|v| v.to_str().ok())
6637 .unwrap_or("application/octet-stream");
6638 let content_type = super::ContentType::from(content_type);
6639
6640 if !status.is_client_error() && !status.is_server_error() {
6641 let content = resp.text().await?;
6642 match content_type {
6643 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6644 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuVmdiridxResponse`"))),
6645 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::QemuVmdiridxResponse`")))),
6646 }
6647 } else {
6648 let content = resp.text().await?;
6649 let entity: Option<QemuVmdiridxError> = serde_json::from_str(&content).ok();
6650 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6651 }
6652}
6653
6654pub async fn qemu_vmlist(configuration: &configuration::Configuration, node: &str, full: Option<&str>) -> Result<models::QemuVmlistResponse, Error<QemuVmlistError>> {
6656 let p_path_node = node;
6658 let p_query_full = full;
6659
6660 let uri_str = format!("{}/nodes/{node}/qemu", configuration.base_path, node=crate::apis::urlencode(p_path_node));
6661 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6662
6663 if let Some(ref param_value) = p_query_full {
6664 req_builder = req_builder.query(&[("full", ¶m_value.to_string())]);
6665 }
6666 if let Some(ref user_agent) = configuration.user_agent {
6667 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6668 }
6669 if let Some(ref apikey) = configuration.api_key {
6670 let key = apikey.key.clone();
6671 let value = match apikey.prefix {
6672 Some(ref prefix) => format!("{} {}", prefix, key),
6673 None => key,
6674 };
6675 req_builder = req_builder.header("Authorization", value);
6676 };
6677 if let Some(ref apikey) = configuration.api_key {
6678 let key = apikey.key.clone();
6679 let value = match apikey.prefix {
6680 Some(ref prefix) => format!("{} {}", prefix, key),
6681 None => key,
6682 };
6683 req_builder = req_builder.header("CSRFPreventionToken", value);
6684 };
6685
6686 let req = req_builder.build()?;
6687 let resp = configuration.client.execute(req).await?;
6688
6689 let status = resp.status();
6690 let content_type = resp
6691 .headers()
6692 .get("content-type")
6693 .and_then(|v| v.to_str().ok())
6694 .unwrap_or("application/octet-stream");
6695 let content_type = super::ContentType::from(content_type);
6696
6697 if !status.is_client_error() && !status.is_server_error() {
6698 let content = resp.text().await?;
6699 match content_type {
6700 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6701 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuVmlistResponse`"))),
6702 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::QemuVmlistResponse`")))),
6703 }
6704 } else {
6705 let content = resp.text().await?;
6706 let entity: Option<QemuVmlistError> = serde_json::from_str(&content).ok();
6707 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6708 }
6709}
6710
6711pub async fn qemu_vncproxy(configuration: &configuration::Configuration, node: &str, vmid: i32, qemu_vncproxy_request: Option<models::QemuVncproxyRequest>) -> Result<models::QemuVncproxyResponse, Error<QemuVncproxyError>> {
6713 let p_path_node = node;
6715 let p_path_vmid = vmid;
6716 let p_body_qemu_vncproxy_request = qemu_vncproxy_request;
6717
6718 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/vncproxy", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
6719 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
6720
6721 if let Some(ref user_agent) = configuration.user_agent {
6722 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6723 }
6724 if let Some(ref apikey) = configuration.api_key {
6725 let key = apikey.key.clone();
6726 let value = match apikey.prefix {
6727 Some(ref prefix) => format!("{} {}", prefix, key),
6728 None => key,
6729 };
6730 req_builder = req_builder.header("Authorization", value);
6731 };
6732 if let Some(ref apikey) = configuration.api_key {
6733 let key = apikey.key.clone();
6734 let value = match apikey.prefix {
6735 Some(ref prefix) => format!("{} {}", prefix, key),
6736 None => key,
6737 };
6738 req_builder = req_builder.header("CSRFPreventionToken", value);
6739 };
6740 req_builder = req_builder.json(&p_body_qemu_vncproxy_request);
6741
6742 let req = req_builder.build()?;
6743 let resp = configuration.client.execute(req).await?;
6744
6745 let status = resp.status();
6746 let content_type = resp
6747 .headers()
6748 .get("content-type")
6749 .and_then(|v| v.to_str().ok())
6750 .unwrap_or("application/octet-stream");
6751 let content_type = super::ContentType::from(content_type);
6752
6753 if !status.is_client_error() && !status.is_server_error() {
6754 let content = resp.text().await?;
6755 match content_type {
6756 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6757 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuVncproxyResponse`"))),
6758 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::QemuVncproxyResponse`")))),
6759 }
6760 } else {
6761 let content = resp.text().await?;
6762 let entity: Option<QemuVncproxyError> = serde_json::from_str(&content).ok();
6763 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6764 }
6765}
6766
6767pub async fn qemu_vncwebsocket(configuration: &configuration::Configuration, node: &str, port: i32, vmid: i32, vncticket: &str) -> Result<models::QemuVncwebsocketResponse, Error<QemuVncwebsocketError>> {
6769 let p_path_node = node;
6771 let p_query_port = port;
6772 let p_path_vmid = vmid;
6773 let p_query_vncticket = vncticket;
6774
6775 let uri_str = format!("{}/nodes/{node}/qemu/{vmid}/vncwebsocket", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
6776 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
6777
6778 req_builder = req_builder.query(&[("port", &p_query_port.to_string())]);
6779 req_builder = req_builder.query(&[("vncticket", &p_query_vncticket.to_string())]);
6780 if let Some(ref user_agent) = configuration.user_agent {
6781 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
6782 }
6783 if let Some(ref apikey) = configuration.api_key {
6784 let key = apikey.key.clone();
6785 let value = match apikey.prefix {
6786 Some(ref prefix) => format!("{} {}", prefix, key),
6787 None => key,
6788 };
6789 req_builder = req_builder.header("Authorization", value);
6790 };
6791 if let Some(ref apikey) = configuration.api_key {
6792 let key = apikey.key.clone();
6793 let value = match apikey.prefix {
6794 Some(ref prefix) => format!("{} {}", prefix, key),
6795 None => key,
6796 };
6797 req_builder = req_builder.header("CSRFPreventionToken", value);
6798 };
6799
6800 let req = req_builder.build()?;
6801 let resp = configuration.client.execute(req).await?;
6802
6803 let status = resp.status();
6804 let content_type = resp
6805 .headers()
6806 .get("content-type")
6807 .and_then(|v| v.to_str().ok())
6808 .unwrap_or("application/octet-stream");
6809 let content_type = super::ContentType::from(content_type);
6810
6811 if !status.is_client_error() && !status.is_server_error() {
6812 let content = resp.text().await?;
6813 match content_type {
6814 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
6815 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::QemuVncwebsocketResponse`"))),
6816 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::QemuVncwebsocketResponse`")))),
6817 }
6818 } else {
6819 let content = resp.text().await?;
6820 let entity: Option<QemuVncwebsocketError> = serde_json::from_str(&content).ok();
6821 Err(Error::ResponseError(ResponseContent { status, content, entity }))
6822 }
6823}
6824