Skip to main content

clientapi_pve/apis/
lxc_api.rs

1/*
2 * Proxmox Virtual Environment API
3 *
4 * Generated from apidoc.js. NOT an official Proxmox specification. See https://pve.proxmox.com/pve-docs/api-viewer/ for the upstream documentation.
5 *
6 * The version of the OpenAPI document: 9.x
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18/// struct for typed errors of method [`lxc_clone_vm`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum LxcCloneVmError {
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/// struct for typed errors of method [`lxc_create_alias`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum LxcCreateAliasError {
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/// struct for typed errors of method [`lxc_create_ip`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum LxcCreateIpError {
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/// struct for typed errors of method [`lxc_create_ipset`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum LxcCreateIpsetError {
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/// struct for typed errors of method [`lxc_create_rule`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum LxcCreateRuleError {
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/// struct for typed errors of method [`lxc_create_vm`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum LxcCreateVmError {
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/// struct for typed errors of method [`lxc_delete_ipset`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum LxcDeleteIpsetError {
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/// struct for typed errors of method [`lxc_delete_rule`]
117#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum LxcDeleteRuleError {
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/// struct for typed errors of method [`lxc_delsnapshot`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum LxcDelsnapshotError {
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/// struct for typed errors of method [`lxc_destroy_vm`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum LxcDestroyVmError {
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/// struct for typed errors of method [`lxc_get_aliases`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum LxcGetAliasesError {
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/// struct for typed errors of method [`lxc_get_firewall`]
173#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum LxcGetFirewallError {
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/// struct for typed errors of method [`lxc_get_ipset`]
187#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum LxcGetIpsetError {
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/// struct for typed errors of method [`lxc_get_options`]
201#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum LxcGetOptionsError {
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/// struct for typed errors of method [`lxc_get_rule`]
215#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum LxcGetRuleError {
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/// struct for typed errors of method [`lxc_get_rules`]
229#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum LxcGetRulesError {
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/// struct for typed errors of method [`lxc_get_snapshot`]
243#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum LxcGetSnapshotError {
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/// struct for typed errors of method [`lxc_get_snapshot_config`]
257#[derive(Debug, Clone, Serialize, Deserialize)]
258#[serde(untagged)]
259pub enum LxcGetSnapshotConfigError {
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/// struct for typed errors of method [`lxc_ip`]
271#[derive(Debug, Clone, Serialize, Deserialize)]
272#[serde(untagged)]
273pub enum LxcIpError {
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/// struct for typed errors of method [`lxc_ipset_index`]
285#[derive(Debug, Clone, Serialize, Deserialize)]
286#[serde(untagged)]
287pub enum LxcIpsetIndexError {
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/// struct for typed errors of method [`lxc_log`]
299#[derive(Debug, Clone, Serialize, Deserialize)]
300#[serde(untagged)]
301pub enum LxcLogError {
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/// struct for typed errors of method [`lxc_migrate_vm`]
313#[derive(Debug, Clone, Serialize, Deserialize)]
314#[serde(untagged)]
315pub enum LxcMigrateVmError {
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/// struct for typed errors of method [`lxc_migrate_vm_precondition`]
327#[derive(Debug, Clone, Serialize, Deserialize)]
328#[serde(untagged)]
329pub enum LxcMigrateVmPreconditionError {
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/// struct for typed errors of method [`lxc_move_volume`]
341#[derive(Debug, Clone, Serialize, Deserialize)]
342#[serde(untagged)]
343pub enum LxcMoveVolumeError {
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/// struct for typed errors of method [`lxc_mtunnel`]
355#[derive(Debug, Clone, Serialize, Deserialize)]
356#[serde(untagged)]
357pub enum LxcMtunnelError {
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/// struct for typed errors of method [`lxc_mtunnelwebsocket`]
369#[derive(Debug, Clone, Serialize, Deserialize)]
370#[serde(untagged)]
371pub enum LxcMtunnelwebsocketError {
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/// struct for typed errors of method [`lxc_read_alias`]
383#[derive(Debug, Clone, Serialize, Deserialize)]
384#[serde(untagged)]
385pub enum LxcReadAliasError {
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/// struct for typed errors of method [`lxc_read_ip`]
397#[derive(Debug, Clone, Serialize, Deserialize)]
398#[serde(untagged)]
399pub enum LxcReadIpError {
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/// struct for typed errors of method [`lxc_refs`]
411#[derive(Debug, Clone, Serialize, Deserialize)]
412#[serde(untagged)]
413pub enum LxcRefsError {
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/// struct for typed errors of method [`lxc_remote_migrate_vm`]
425#[derive(Debug, Clone, Serialize, Deserialize)]
426#[serde(untagged)]
427pub enum LxcRemoteMigrateVmError {
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/// struct for typed errors of method [`lxc_remove_alias`]
439#[derive(Debug, Clone, Serialize, Deserialize)]
440#[serde(untagged)]
441pub enum LxcRemoveAliasError {
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/// struct for typed errors of method [`lxc_remove_ip`]
453#[derive(Debug, Clone, Serialize, Deserialize)]
454#[serde(untagged)]
455pub enum LxcRemoveIpError {
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/// struct for typed errors of method [`lxc_resize_vm`]
467#[derive(Debug, Clone, Serialize, Deserialize)]
468#[serde(untagged)]
469pub enum LxcResizeVmError {
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/// struct for typed errors of method [`lxc_rollback`]
481#[derive(Debug, Clone, Serialize, Deserialize)]
482#[serde(untagged)]
483pub enum LxcRollbackError {
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/// struct for typed errors of method [`lxc_rrd`]
495#[derive(Debug, Clone, Serialize, Deserialize)]
496#[serde(untagged)]
497pub enum LxcRrdError {
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/// struct for typed errors of method [`lxc_rrddata`]
509#[derive(Debug, Clone, Serialize, Deserialize)]
510#[serde(untagged)]
511pub enum LxcRrddataError {
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/// struct for typed errors of method [`lxc_set_options`]
523#[derive(Debug, Clone, Serialize, Deserialize)]
524#[serde(untagged)]
525pub enum LxcSetOptionsError {
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/// struct for typed errors of method [`lxc_snapshot`]
537#[derive(Debug, Clone, Serialize, Deserialize)]
538#[serde(untagged)]
539pub enum LxcSnapshotError {
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/// struct for typed errors of method [`lxc_snapshot_cmd_idx`]
551#[derive(Debug, Clone, Serialize, Deserialize)]
552#[serde(untagged)]
553pub enum LxcSnapshotCmdIdxError {
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/// struct for typed errors of method [`lxc_spiceproxy`]
565#[derive(Debug, Clone, Serialize, Deserialize)]
566#[serde(untagged)]
567pub enum LxcSpiceproxyError {
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/// struct for typed errors of method [`lxc_template`]
579#[derive(Debug, Clone, Serialize, Deserialize)]
580#[serde(untagged)]
581pub enum LxcTemplateError {
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/// struct for typed errors of method [`lxc_termproxy`]
593#[derive(Debug, Clone, Serialize, Deserialize)]
594#[serde(untagged)]
595pub enum LxcTermproxyError {
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/// struct for typed errors of method [`lxc_update_alias`]
607#[derive(Debug, Clone, Serialize, Deserialize)]
608#[serde(untagged)]
609pub enum LxcUpdateAliasError {
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/// struct for typed errors of method [`lxc_update_ip`]
621#[derive(Debug, Clone, Serialize, Deserialize)]
622#[serde(untagged)]
623pub enum LxcUpdateIpError {
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/// struct for typed errors of method [`lxc_update_rule`]
635#[derive(Debug, Clone, Serialize, Deserialize)]
636#[serde(untagged)]
637pub enum LxcUpdateRuleError {
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/// struct for typed errors of method [`lxc_update_snapshot_config`]
649#[derive(Debug, Clone, Serialize, Deserialize)]
650#[serde(untagged)]
651pub enum LxcUpdateSnapshotConfigError {
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/// struct for typed errors of method [`lxc_update_vm`]
663#[derive(Debug, Clone, Serialize, Deserialize)]
664#[serde(untagged)]
665pub enum LxcUpdateVmError {
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/// struct for typed errors of method [`lxc_vm_config`]
677#[derive(Debug, Clone, Serialize, Deserialize)]
678#[serde(untagged)]
679pub enum LxcVmConfigError {
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/// struct for typed errors of method [`lxc_vm_feature`]
691#[derive(Debug, Clone, Serialize, Deserialize)]
692#[serde(untagged)]
693pub enum LxcVmFeatureError {
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/// struct for typed errors of method [`lxc_vm_pending`]
705#[derive(Debug, Clone, Serialize, Deserialize)]
706#[serde(untagged)]
707pub enum LxcVmPendingError {
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/// struct for typed errors of method [`lxc_vm_reboot`]
719#[derive(Debug, Clone, Serialize, Deserialize)]
720#[serde(untagged)]
721pub enum LxcVmRebootError {
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/// struct for typed errors of method [`lxc_vm_resume`]
733#[derive(Debug, Clone, Serialize, Deserialize)]
734#[serde(untagged)]
735pub enum LxcVmResumeError {
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/// struct for typed errors of method [`lxc_vm_shutdown`]
747#[derive(Debug, Clone, Serialize, Deserialize)]
748#[serde(untagged)]
749pub enum LxcVmShutdownError {
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/// struct for typed errors of method [`lxc_vm_start`]
761#[derive(Debug, Clone, Serialize, Deserialize)]
762#[serde(untagged)]
763pub enum LxcVmStartError {
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/// struct for typed errors of method [`lxc_vm_status`]
775#[derive(Debug, Clone, Serialize, Deserialize)]
776#[serde(untagged)]
777pub enum LxcVmStatusError {
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/// struct for typed errors of method [`lxc_vm_stop`]
789#[derive(Debug, Clone, Serialize, Deserialize)]
790#[serde(untagged)]
791pub enum LxcVmStopError {
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/// struct for typed errors of method [`lxc_vm_suspend`]
803#[derive(Debug, Clone, Serialize, Deserialize)]
804#[serde(untagged)]
805pub enum LxcVmSuspendError {
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/// struct for typed errors of method [`lxc_vmcmdidx`]
817#[derive(Debug, Clone, Serialize, Deserialize)]
818#[serde(untagged)]
819pub enum LxcVmcmdidxError {
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/// struct for typed errors of method [`lxc_vmdiridx`]
831#[derive(Debug, Clone, Serialize, Deserialize)]
832#[serde(untagged)]
833pub enum LxcVmdiridxError {
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/// struct for typed errors of method [`lxc_vmlist`]
845#[derive(Debug, Clone, Serialize, Deserialize)]
846#[serde(untagged)]
847pub enum LxcVmlistError {
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/// struct for typed errors of method [`lxc_vncproxy`]
859#[derive(Debug, Clone, Serialize, Deserialize)]
860#[serde(untagged)]
861pub enum LxcVncproxyError {
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/// struct for typed errors of method [`lxc_vncwebsocket`]
873#[derive(Debug, Clone, Serialize, Deserialize)]
874#[serde(untagged)]
875pub enum LxcVncwebsocketError {
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
887/// Create a container clone/copy  Permissions: You need 'VM.Clone' permissions on /vms/{vmid}, and 'VM.Allocate' permissions on /vms/{newid} (or on the VM pool /pool/{pool}). You also need 'Datastore.AllocateSpace' on any used storage, and 'SDN.Use' on any bridge.
888pub async fn lxc_clone_vm(configuration: &configuration::Configuration, node: &str, vmid: i32, lxc_clone_vm_request: models::LxcCloneVmRequest) -> Result<models::LxcCloneVmResponse, Error<LxcCloneVmError>> {
889    // add a prefix to parameters to efficiently prevent name collisions
890    let p_path_node = node;
891    let p_path_vmid = vmid;
892    let p_body_lxc_clone_vm_request = lxc_clone_vm_request;
893
894    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/clone", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
895    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
896
897    if let Some(ref user_agent) = configuration.user_agent {
898        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
899    }
900    if let Some(ref apikey) = configuration.api_key {
901        let key = apikey.key.clone();
902        let value = match apikey.prefix {
903            Some(ref prefix) => format!("{} {}", prefix, key),
904            None => key,
905        };
906        req_builder = req_builder.header("Authorization", value);
907    };
908    if let Some(ref apikey) = configuration.api_key {
909        let key = apikey.key.clone();
910        let value = match apikey.prefix {
911            Some(ref prefix) => format!("{} {}", prefix, key),
912            None => key,
913        };
914        req_builder = req_builder.header("CSRFPreventionToken", value);
915    };
916    req_builder = req_builder.json(&p_body_lxc_clone_vm_request);
917
918    let req = req_builder.build()?;
919    let resp = configuration.client.execute(req).await?;
920
921    let status = resp.status();
922    let content_type = resp
923        .headers()
924        .get("content-type")
925        .and_then(|v| v.to_str().ok())
926        .unwrap_or("application/octet-stream");
927    let content_type = super::ContentType::from(content_type);
928
929    if !status.is_client_error() && !status.is_server_error() {
930        let content = resp.text().await?;
931        match content_type {
932            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
933            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcCloneVmResponse`"))),
934            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::LxcCloneVmResponse`")))),
935        }
936    } else {
937        let content = resp.text().await?;
938        let entity: Option<LxcCloneVmError> = serde_json::from_str(&content).ok();
939        Err(Error::ResponseError(ResponseContent { status, content, entity }))
940    }
941}
942
943/// Create IP or Network Alias.
944pub async fn lxc_create_alias(configuration: &configuration::Configuration, node: &str, vmid: i32, cluster_firewall_create_alias_request: models::ClusterFirewallCreateAliasRequest) -> Result<models::LxcCreateAliasResponse, Error<LxcCreateAliasError>> {
945    // add a prefix to parameters to efficiently prevent name collisions
946    let p_path_node = node;
947    let p_path_vmid = vmid;
948    let p_body_cluster_firewall_create_alias_request = cluster_firewall_create_alias_request;
949
950    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/firewall/aliases", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
951    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
952
953    if let Some(ref user_agent) = configuration.user_agent {
954        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
955    }
956    if let Some(ref apikey) = configuration.api_key {
957        let key = apikey.key.clone();
958        let value = match apikey.prefix {
959            Some(ref prefix) => format!("{} {}", prefix, key),
960            None => key,
961        };
962        req_builder = req_builder.header("Authorization", value);
963    };
964    if let Some(ref apikey) = configuration.api_key {
965        let key = apikey.key.clone();
966        let value = match apikey.prefix {
967            Some(ref prefix) => format!("{} {}", prefix, key),
968            None => key,
969        };
970        req_builder = req_builder.header("CSRFPreventionToken", value);
971    };
972    req_builder = req_builder.json(&p_body_cluster_firewall_create_alias_request);
973
974    let req = req_builder.build()?;
975    let resp = configuration.client.execute(req).await?;
976
977    let status = resp.status();
978    let content_type = resp
979        .headers()
980        .get("content-type")
981        .and_then(|v| v.to_str().ok())
982        .unwrap_or("application/octet-stream");
983    let content_type = super::ContentType::from(content_type);
984
985    if !status.is_client_error() && !status.is_server_error() {
986        let content = resp.text().await?;
987        match content_type {
988            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
989            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcCreateAliasResponse`"))),
990            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::LxcCreateAliasResponse`")))),
991        }
992    } else {
993        let content = resp.text().await?;
994        let entity: Option<LxcCreateAliasError> = serde_json::from_str(&content).ok();
995        Err(Error::ResponseError(ResponseContent { status, content, entity }))
996    }
997}
998
999/// Add IP or Network to IPSet.
1000pub async fn lxc_create_ip(configuration: &configuration::Configuration, name: &str, node: &str, vmid: i32, cluster_firewall_create_ip_request: models::ClusterFirewallCreateIpRequest) -> Result<models::LxcCreateIpResponse, Error<LxcCreateIpError>> {
1001    // add a prefix to parameters to efficiently prevent name collisions
1002    let p_path_name = name;
1003    let p_path_node = node;
1004    let p_path_vmid = vmid;
1005    let p_body_cluster_firewall_create_ip_request = cluster_firewall_create_ip_request;
1006
1007    let uri_str = format!("{}/nodes/{node}/lxc/{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);
1008    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1009
1010    if let Some(ref user_agent) = configuration.user_agent {
1011        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1012    }
1013    if let Some(ref apikey) = configuration.api_key {
1014        let key = apikey.key.clone();
1015        let value = match apikey.prefix {
1016            Some(ref prefix) => format!("{} {}", prefix, key),
1017            None => key,
1018        };
1019        req_builder = req_builder.header("Authorization", value);
1020    };
1021    if let Some(ref apikey) = configuration.api_key {
1022        let key = apikey.key.clone();
1023        let value = match apikey.prefix {
1024            Some(ref prefix) => format!("{} {}", prefix, key),
1025            None => key,
1026        };
1027        req_builder = req_builder.header("CSRFPreventionToken", value);
1028    };
1029    req_builder = req_builder.json(&p_body_cluster_firewall_create_ip_request);
1030
1031    let req = req_builder.build()?;
1032    let resp = configuration.client.execute(req).await?;
1033
1034    let status = resp.status();
1035    let content_type = resp
1036        .headers()
1037        .get("content-type")
1038        .and_then(|v| v.to_str().ok())
1039        .unwrap_or("application/octet-stream");
1040    let content_type = super::ContentType::from(content_type);
1041
1042    if !status.is_client_error() && !status.is_server_error() {
1043        let content = resp.text().await?;
1044        match content_type {
1045            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1046            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcCreateIpResponse`"))),
1047            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::LxcCreateIpResponse`")))),
1048        }
1049    } else {
1050        let content = resp.text().await?;
1051        let entity: Option<LxcCreateIpError> = serde_json::from_str(&content).ok();
1052        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1053    }
1054}
1055
1056/// Create new IPSet
1057pub async fn lxc_create_ipset(configuration: &configuration::Configuration, node: &str, vmid: i32, cluster_firewall_create_ipset_request: models::ClusterFirewallCreateIpsetRequest) -> Result<models::LxcCreateIpsetResponse, Error<LxcCreateIpsetError>> {
1058    // add a prefix to parameters to efficiently prevent name collisions
1059    let p_path_node = node;
1060    let p_path_vmid = vmid;
1061    let p_body_cluster_firewall_create_ipset_request = cluster_firewall_create_ipset_request;
1062
1063    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/firewall/ipset", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1064    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1065
1066    if let Some(ref user_agent) = configuration.user_agent {
1067        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1068    }
1069    if let Some(ref apikey) = configuration.api_key {
1070        let key = apikey.key.clone();
1071        let value = match apikey.prefix {
1072            Some(ref prefix) => format!("{} {}", prefix, key),
1073            None => key,
1074        };
1075        req_builder = req_builder.header("Authorization", value);
1076    };
1077    if let Some(ref apikey) = configuration.api_key {
1078        let key = apikey.key.clone();
1079        let value = match apikey.prefix {
1080            Some(ref prefix) => format!("{} {}", prefix, key),
1081            None => key,
1082        };
1083        req_builder = req_builder.header("CSRFPreventionToken", value);
1084    };
1085    req_builder = req_builder.json(&p_body_cluster_firewall_create_ipset_request);
1086
1087    let req = req_builder.build()?;
1088    let resp = configuration.client.execute(req).await?;
1089
1090    let status = resp.status();
1091    let content_type = resp
1092        .headers()
1093        .get("content-type")
1094        .and_then(|v| v.to_str().ok())
1095        .unwrap_or("application/octet-stream");
1096    let content_type = super::ContentType::from(content_type);
1097
1098    if !status.is_client_error() && !status.is_server_error() {
1099        let content = resp.text().await?;
1100        match content_type {
1101            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1102            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcCreateIpsetResponse`"))),
1103            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::LxcCreateIpsetResponse`")))),
1104        }
1105    } else {
1106        let content = resp.text().await?;
1107        let entity: Option<LxcCreateIpsetError> = serde_json::from_str(&content).ok();
1108        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1109    }
1110}
1111
1112/// Create new rule.
1113pub async fn lxc_create_rule(configuration: &configuration::Configuration, node: &str, vmid: i32, cluster_firewall_create_rule_request: models::ClusterFirewallCreateRuleRequest) -> Result<models::LxcCreateRuleResponse, Error<LxcCreateRuleError>> {
1114    // add a prefix to parameters to efficiently prevent name collisions
1115    let p_path_node = node;
1116    let p_path_vmid = vmid;
1117    let p_body_cluster_firewall_create_rule_request = cluster_firewall_create_rule_request;
1118
1119    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/firewall/rules", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1120    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1121
1122    if let Some(ref user_agent) = configuration.user_agent {
1123        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1124    }
1125    if let Some(ref apikey) = configuration.api_key {
1126        let key = apikey.key.clone();
1127        let value = match apikey.prefix {
1128            Some(ref prefix) => format!("{} {}", prefix, key),
1129            None => key,
1130        };
1131        req_builder = req_builder.header("Authorization", value);
1132    };
1133    if let Some(ref apikey) = configuration.api_key {
1134        let key = apikey.key.clone();
1135        let value = match apikey.prefix {
1136            Some(ref prefix) => format!("{} {}", prefix, key),
1137            None => key,
1138        };
1139        req_builder = req_builder.header("CSRFPreventionToken", value);
1140    };
1141    req_builder = req_builder.json(&p_body_cluster_firewall_create_rule_request);
1142
1143    let req = req_builder.build()?;
1144    let resp = configuration.client.execute(req).await?;
1145
1146    let status = resp.status();
1147    let content_type = resp
1148        .headers()
1149        .get("content-type")
1150        .and_then(|v| v.to_str().ok())
1151        .unwrap_or("application/octet-stream");
1152    let content_type = super::ContentType::from(content_type);
1153
1154    if !status.is_client_error() && !status.is_server_error() {
1155        let content = resp.text().await?;
1156        match content_type {
1157            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1158            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcCreateRuleResponse`"))),
1159            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::LxcCreateRuleResponse`")))),
1160        }
1161    } else {
1162        let content = resp.text().await?;
1163        let entity: Option<LxcCreateRuleError> = serde_json::from_str(&content).ok();
1164        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1165    }
1166}
1167
1168/// Create or restore a container.  Permissions: You need 'VM.Allocate' permission on /vms/{vmid} or on the VM pool /pool/{pool}. For restore, it is enough if the user has 'VM.Backup' permission and the VM already exists. You also need 'Datastore.AllocateSpace' permissions on the storage. For privileged containers, 'Sys.Modify' permissions on '/' are required.
1169pub async fn lxc_create_vm(configuration: &configuration::Configuration, node: &str, lxc_create_vm_request: models::LxcCreateVmRequest) -> Result<models::LxcCreateVmResponse, Error<LxcCreateVmError>> {
1170    // add a prefix to parameters to efficiently prevent name collisions
1171    let p_path_node = node;
1172    let p_body_lxc_create_vm_request = lxc_create_vm_request;
1173
1174    let uri_str = format!("{}/nodes/{node}/lxc", configuration.base_path, node=crate::apis::urlencode(p_path_node));
1175    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1176
1177    if let Some(ref user_agent) = configuration.user_agent {
1178        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1179    }
1180    if let Some(ref apikey) = configuration.api_key {
1181        let key = apikey.key.clone();
1182        let value = match apikey.prefix {
1183            Some(ref prefix) => format!("{} {}", prefix, key),
1184            None => key,
1185        };
1186        req_builder = req_builder.header("Authorization", value);
1187    };
1188    if let Some(ref apikey) = configuration.api_key {
1189        let key = apikey.key.clone();
1190        let value = match apikey.prefix {
1191            Some(ref prefix) => format!("{} {}", prefix, key),
1192            None => key,
1193        };
1194        req_builder = req_builder.header("CSRFPreventionToken", value);
1195    };
1196    req_builder = req_builder.json(&p_body_lxc_create_vm_request);
1197
1198    let req = req_builder.build()?;
1199    let resp = configuration.client.execute(req).await?;
1200
1201    let status = resp.status();
1202    let content_type = resp
1203        .headers()
1204        .get("content-type")
1205        .and_then(|v| v.to_str().ok())
1206        .unwrap_or("application/octet-stream");
1207    let content_type = super::ContentType::from(content_type);
1208
1209    if !status.is_client_error() && !status.is_server_error() {
1210        let content = resp.text().await?;
1211        match content_type {
1212            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1213            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcCreateVmResponse`"))),
1214            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::LxcCreateVmResponse`")))),
1215        }
1216    } else {
1217        let content = resp.text().await?;
1218        let entity: Option<LxcCreateVmError> = serde_json::from_str(&content).ok();
1219        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1220    }
1221}
1222
1223/// Delete IPSet
1224pub async fn lxc_delete_ipset(configuration: &configuration::Configuration, name: &str, node: &str, vmid: i32, force: Option<&str>) -> Result<models::LxcDeleteIpsetResponse, Error<LxcDeleteIpsetError>> {
1225    // add a prefix to parameters to efficiently prevent name collisions
1226    let p_path_name = name;
1227    let p_path_node = node;
1228    let p_path_vmid = vmid;
1229    let p_query_force = force;
1230
1231    let uri_str = format!("{}/nodes/{node}/lxc/{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);
1232    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1233
1234    if let Some(ref param_value) = p_query_force {
1235        req_builder = req_builder.query(&[("force", &param_value.to_string())]);
1236    }
1237    if let Some(ref user_agent) = configuration.user_agent {
1238        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1239    }
1240    if let Some(ref apikey) = configuration.api_key {
1241        let key = apikey.key.clone();
1242        let value = match apikey.prefix {
1243            Some(ref prefix) => format!("{} {}", prefix, key),
1244            None => key,
1245        };
1246        req_builder = req_builder.header("Authorization", value);
1247    };
1248    if let Some(ref apikey) = configuration.api_key {
1249        let key = apikey.key.clone();
1250        let value = match apikey.prefix {
1251            Some(ref prefix) => format!("{} {}", prefix, key),
1252            None => key,
1253        };
1254        req_builder = req_builder.header("CSRFPreventionToken", value);
1255    };
1256
1257    let req = req_builder.build()?;
1258    let resp = configuration.client.execute(req).await?;
1259
1260    let status = resp.status();
1261    let content_type = resp
1262        .headers()
1263        .get("content-type")
1264        .and_then(|v| v.to_str().ok())
1265        .unwrap_or("application/octet-stream");
1266    let content_type = super::ContentType::from(content_type);
1267
1268    if !status.is_client_error() && !status.is_server_error() {
1269        let content = resp.text().await?;
1270        match content_type {
1271            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1272            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcDeleteIpsetResponse`"))),
1273            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::LxcDeleteIpsetResponse`")))),
1274        }
1275    } else {
1276        let content = resp.text().await?;
1277        let entity: Option<LxcDeleteIpsetError> = serde_json::from_str(&content).ok();
1278        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1279    }
1280}
1281
1282/// Delete rule.
1283pub async fn lxc_delete_rule(configuration: &configuration::Configuration, node: &str, pos: i64, vmid: i32, digest: Option<&str>) -> Result<models::LxcDeleteRuleResponse, Error<LxcDeleteRuleError>> {
1284    // add a prefix to parameters to efficiently prevent name collisions
1285    let p_path_node = node;
1286    let p_path_pos = pos;
1287    let p_path_vmid = vmid;
1288    let p_query_digest = digest;
1289
1290    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/firewall/rules/{pos}", configuration.base_path, node=crate::apis::urlencode(p_path_node), pos=p_path_pos, vmid=p_path_vmid);
1291    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1292
1293    if let Some(ref param_value) = p_query_digest {
1294        req_builder = req_builder.query(&[("digest", &param_value.to_string())]);
1295    }
1296    if let Some(ref user_agent) = configuration.user_agent {
1297        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1298    }
1299    if let Some(ref apikey) = configuration.api_key {
1300        let key = apikey.key.clone();
1301        let value = match apikey.prefix {
1302            Some(ref prefix) => format!("{} {}", prefix, key),
1303            None => key,
1304        };
1305        req_builder = req_builder.header("Authorization", value);
1306    };
1307    if let Some(ref apikey) = configuration.api_key {
1308        let key = apikey.key.clone();
1309        let value = match apikey.prefix {
1310            Some(ref prefix) => format!("{} {}", prefix, key),
1311            None => key,
1312        };
1313        req_builder = req_builder.header("CSRFPreventionToken", value);
1314    };
1315
1316    let req = req_builder.build()?;
1317    let resp = configuration.client.execute(req).await?;
1318
1319    let status = resp.status();
1320    let content_type = resp
1321        .headers()
1322        .get("content-type")
1323        .and_then(|v| v.to_str().ok())
1324        .unwrap_or("application/octet-stream");
1325    let content_type = super::ContentType::from(content_type);
1326
1327    if !status.is_client_error() && !status.is_server_error() {
1328        let content = resp.text().await?;
1329        match content_type {
1330            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1331            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcDeleteRuleResponse`"))),
1332            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::LxcDeleteRuleResponse`")))),
1333        }
1334    } else {
1335        let content = resp.text().await?;
1336        let entity: Option<LxcDeleteRuleError> = serde_json::from_str(&content).ok();
1337        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1338    }
1339}
1340
1341/// Delete a LXC snapshot.
1342pub async fn lxc_delsnapshot(configuration: &configuration::Configuration, node: &str, snapname: &str, vmid: i32, force: Option<&str>) -> Result<models::LxcDelsnapshotResponse, Error<LxcDelsnapshotError>> {
1343    // add a prefix to parameters to efficiently prevent name collisions
1344    let p_path_node = node;
1345    let p_path_snapname = snapname;
1346    let p_path_vmid = vmid;
1347    let p_query_force = force;
1348
1349    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/snapshot/{snapname}", configuration.base_path, node=crate::apis::urlencode(p_path_node), snapname=crate::apis::urlencode(p_path_snapname), vmid=p_path_vmid);
1350    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1351
1352    if let Some(ref param_value) = p_query_force {
1353        req_builder = req_builder.query(&[("force", &param_value.to_string())]);
1354    }
1355    if let Some(ref user_agent) = configuration.user_agent {
1356        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1357    }
1358    if let Some(ref apikey) = configuration.api_key {
1359        let key = apikey.key.clone();
1360        let value = match apikey.prefix {
1361            Some(ref prefix) => format!("{} {}", prefix, key),
1362            None => key,
1363        };
1364        req_builder = req_builder.header("Authorization", value);
1365    };
1366    if let Some(ref apikey) = configuration.api_key {
1367        let key = apikey.key.clone();
1368        let value = match apikey.prefix {
1369            Some(ref prefix) => format!("{} {}", prefix, key),
1370            None => key,
1371        };
1372        req_builder = req_builder.header("CSRFPreventionToken", value);
1373    };
1374
1375    let req = req_builder.build()?;
1376    let resp = configuration.client.execute(req).await?;
1377
1378    let status = resp.status();
1379    let content_type = resp
1380        .headers()
1381        .get("content-type")
1382        .and_then(|v| v.to_str().ok())
1383        .unwrap_or("application/octet-stream");
1384    let content_type = super::ContentType::from(content_type);
1385
1386    if !status.is_client_error() && !status.is_server_error() {
1387        let content = resp.text().await?;
1388        match content_type {
1389            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1390            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcDelsnapshotResponse`"))),
1391            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::LxcDelsnapshotResponse`")))),
1392        }
1393    } else {
1394        let content = resp.text().await?;
1395        let entity: Option<LxcDelsnapshotError> = serde_json::from_str(&content).ok();
1396        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1397    }
1398}
1399
1400/// Destroy the container (also delete all uses files).
1401pub async fn lxc_destroy_vm(configuration: &configuration::Configuration, node: &str, vmid: i32, destroy_unreferenced_disks: Option<&str>, force: Option<&str>, purge: Option<&str>) -> Result<models::LxcDestroyVmResponse, Error<LxcDestroyVmError>> {
1402    // add a prefix to parameters to efficiently prevent name collisions
1403    let p_path_node = node;
1404    let p_path_vmid = vmid;
1405    let p_query_destroy_unreferenced_disks = destroy_unreferenced_disks;
1406    let p_query_force = force;
1407    let p_query_purge = purge;
1408
1409    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1410    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1411
1412    if let Some(ref param_value) = p_query_destroy_unreferenced_disks {
1413        req_builder = req_builder.query(&[("destroy-unreferenced-disks", &param_value.to_string())]);
1414    }
1415    if let Some(ref param_value) = p_query_force {
1416        req_builder = req_builder.query(&[("force", &param_value.to_string())]);
1417    }
1418    if let Some(ref param_value) = p_query_purge {
1419        req_builder = req_builder.query(&[("purge", &param_value.to_string())]);
1420    }
1421    if let Some(ref user_agent) = configuration.user_agent {
1422        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1423    }
1424    if let Some(ref apikey) = configuration.api_key {
1425        let key = apikey.key.clone();
1426        let value = match apikey.prefix {
1427            Some(ref prefix) => format!("{} {}", prefix, key),
1428            None => key,
1429        };
1430        req_builder = req_builder.header("Authorization", value);
1431    };
1432    if let Some(ref apikey) = configuration.api_key {
1433        let key = apikey.key.clone();
1434        let value = match apikey.prefix {
1435            Some(ref prefix) => format!("{} {}", prefix, key),
1436            None => key,
1437        };
1438        req_builder = req_builder.header("CSRFPreventionToken", value);
1439    };
1440
1441    let req = req_builder.build()?;
1442    let resp = configuration.client.execute(req).await?;
1443
1444    let status = resp.status();
1445    let content_type = resp
1446        .headers()
1447        .get("content-type")
1448        .and_then(|v| v.to_str().ok())
1449        .unwrap_or("application/octet-stream");
1450    let content_type = super::ContentType::from(content_type);
1451
1452    if !status.is_client_error() && !status.is_server_error() {
1453        let content = resp.text().await?;
1454        match content_type {
1455            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1456            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcDestroyVmResponse`"))),
1457            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::LxcDestroyVmResponse`")))),
1458        }
1459    } else {
1460        let content = resp.text().await?;
1461        let entity: Option<LxcDestroyVmError> = serde_json::from_str(&content).ok();
1462        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1463    }
1464}
1465
1466/// List aliases
1467pub async fn lxc_get_aliases(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::LxcGetAliasesResponse, Error<LxcGetAliasesError>> {
1468    // add a prefix to parameters to efficiently prevent name collisions
1469    let p_path_node = node;
1470    let p_path_vmid = vmid;
1471
1472    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/firewall/aliases", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1473    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1474
1475    if let Some(ref user_agent) = configuration.user_agent {
1476        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1477    }
1478    if let Some(ref apikey) = configuration.api_key {
1479        let key = apikey.key.clone();
1480        let value = match apikey.prefix {
1481            Some(ref prefix) => format!("{} {}", prefix, key),
1482            None => key,
1483        };
1484        req_builder = req_builder.header("Authorization", value);
1485    };
1486    if let Some(ref apikey) = configuration.api_key {
1487        let key = apikey.key.clone();
1488        let value = match apikey.prefix {
1489            Some(ref prefix) => format!("{} {}", prefix, key),
1490            None => key,
1491        };
1492        req_builder = req_builder.header("CSRFPreventionToken", value);
1493    };
1494
1495    let req = req_builder.build()?;
1496    let resp = configuration.client.execute(req).await?;
1497
1498    let status = resp.status();
1499    let content_type = resp
1500        .headers()
1501        .get("content-type")
1502        .and_then(|v| v.to_str().ok())
1503        .unwrap_or("application/octet-stream");
1504    let content_type = super::ContentType::from(content_type);
1505
1506    if !status.is_client_error() && !status.is_server_error() {
1507        let content = resp.text().await?;
1508        match content_type {
1509            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1510            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcGetAliasesResponse`"))),
1511            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::LxcGetAliasesResponse`")))),
1512        }
1513    } else {
1514        let content = resp.text().await?;
1515        let entity: Option<LxcGetAliasesError> = serde_json::from_str(&content).ok();
1516        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1517    }
1518}
1519
1520/// Directory index.
1521pub async fn lxc_get_firewall(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::LxcGetFirewallResponse, Error<LxcGetFirewallError>> {
1522    // add a prefix to parameters to efficiently prevent name collisions
1523    let p_path_node = node;
1524    let p_path_vmid = vmid;
1525
1526    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/firewall", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1527    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1528
1529    if let Some(ref user_agent) = configuration.user_agent {
1530        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1531    }
1532    if let Some(ref apikey) = configuration.api_key {
1533        let key = apikey.key.clone();
1534        let value = match apikey.prefix {
1535            Some(ref prefix) => format!("{} {}", prefix, key),
1536            None => key,
1537        };
1538        req_builder = req_builder.header("Authorization", value);
1539    };
1540    if let Some(ref apikey) = configuration.api_key {
1541        let key = apikey.key.clone();
1542        let value = match apikey.prefix {
1543            Some(ref prefix) => format!("{} {}", prefix, key),
1544            None => key,
1545        };
1546        req_builder = req_builder.header("CSRFPreventionToken", value);
1547    };
1548
1549    let req = req_builder.build()?;
1550    let resp = configuration.client.execute(req).await?;
1551
1552    let status = resp.status();
1553    let content_type = resp
1554        .headers()
1555        .get("content-type")
1556        .and_then(|v| v.to_str().ok())
1557        .unwrap_or("application/octet-stream");
1558    let content_type = super::ContentType::from(content_type);
1559
1560    if !status.is_client_error() && !status.is_server_error() {
1561        let content = resp.text().await?;
1562        match content_type {
1563            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1564            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcGetFirewallResponse`"))),
1565            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::LxcGetFirewallResponse`")))),
1566        }
1567    } else {
1568        let content = resp.text().await?;
1569        let entity: Option<LxcGetFirewallError> = serde_json::from_str(&content).ok();
1570        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1571    }
1572}
1573
1574/// List IPSet content
1575pub async fn lxc_get_ipset(configuration: &configuration::Configuration, name: &str, node: &str, vmid: i32) -> Result<models::LxcGetIpsetResponse, Error<LxcGetIpsetError>> {
1576    // add a prefix to parameters to efficiently prevent name collisions
1577    let p_path_name = name;
1578    let p_path_node = node;
1579    let p_path_vmid = vmid;
1580
1581    let uri_str = format!("{}/nodes/{node}/lxc/{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);
1582    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1583
1584    if let Some(ref user_agent) = configuration.user_agent {
1585        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1586    }
1587    if let Some(ref apikey) = configuration.api_key {
1588        let key = apikey.key.clone();
1589        let value = match apikey.prefix {
1590            Some(ref prefix) => format!("{} {}", prefix, key),
1591            None => key,
1592        };
1593        req_builder = req_builder.header("Authorization", value);
1594    };
1595    if let Some(ref apikey) = configuration.api_key {
1596        let key = apikey.key.clone();
1597        let value = match apikey.prefix {
1598            Some(ref prefix) => format!("{} {}", prefix, key),
1599            None => key,
1600        };
1601        req_builder = req_builder.header("CSRFPreventionToken", value);
1602    };
1603
1604    let req = req_builder.build()?;
1605    let resp = configuration.client.execute(req).await?;
1606
1607    let status = resp.status();
1608    let content_type = resp
1609        .headers()
1610        .get("content-type")
1611        .and_then(|v| v.to_str().ok())
1612        .unwrap_or("application/octet-stream");
1613    let content_type = super::ContentType::from(content_type);
1614
1615    if !status.is_client_error() && !status.is_server_error() {
1616        let content = resp.text().await?;
1617        match content_type {
1618            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1619            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcGetIpsetResponse`"))),
1620            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::LxcGetIpsetResponse`")))),
1621        }
1622    } else {
1623        let content = resp.text().await?;
1624        let entity: Option<LxcGetIpsetError> = serde_json::from_str(&content).ok();
1625        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1626    }
1627}
1628
1629/// Get VM firewall options.
1630pub async fn lxc_get_options(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::LxcGetOptionsResponse, Error<LxcGetOptionsError>> {
1631    // add a prefix to parameters to efficiently prevent name collisions
1632    let p_path_node = node;
1633    let p_path_vmid = vmid;
1634
1635    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/firewall/options", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1636    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1637
1638    if let Some(ref user_agent) = configuration.user_agent {
1639        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1640    }
1641    if let Some(ref apikey) = configuration.api_key {
1642        let key = apikey.key.clone();
1643        let value = match apikey.prefix {
1644            Some(ref prefix) => format!("{} {}", prefix, key),
1645            None => key,
1646        };
1647        req_builder = req_builder.header("Authorization", value);
1648    };
1649    if let Some(ref apikey) = configuration.api_key {
1650        let key = apikey.key.clone();
1651        let value = match apikey.prefix {
1652            Some(ref prefix) => format!("{} {}", prefix, key),
1653            None => key,
1654        };
1655        req_builder = req_builder.header("CSRFPreventionToken", value);
1656    };
1657
1658    let req = req_builder.build()?;
1659    let resp = configuration.client.execute(req).await?;
1660
1661    let status = resp.status();
1662    let content_type = resp
1663        .headers()
1664        .get("content-type")
1665        .and_then(|v| v.to_str().ok())
1666        .unwrap_or("application/octet-stream");
1667    let content_type = super::ContentType::from(content_type);
1668
1669    if !status.is_client_error() && !status.is_server_error() {
1670        let content = resp.text().await?;
1671        match content_type {
1672            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1673            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcGetOptionsResponse`"))),
1674            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::LxcGetOptionsResponse`")))),
1675        }
1676    } else {
1677        let content = resp.text().await?;
1678        let entity: Option<LxcGetOptionsError> = serde_json::from_str(&content).ok();
1679        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1680    }
1681}
1682
1683/// Get single rule data.
1684pub async fn lxc_get_rule(configuration: &configuration::Configuration, node: &str, pos: i64, vmid: i32) -> Result<models::LxcGetRuleResponse, Error<LxcGetRuleError>> {
1685    // add a prefix to parameters to efficiently prevent name collisions
1686    let p_path_node = node;
1687    let p_path_pos = pos;
1688    let p_path_vmid = vmid;
1689
1690    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/firewall/rules/{pos}", configuration.base_path, node=crate::apis::urlencode(p_path_node), pos=p_path_pos, vmid=p_path_vmid);
1691    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1692
1693    if let Some(ref user_agent) = configuration.user_agent {
1694        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1695    }
1696    if let Some(ref apikey) = configuration.api_key {
1697        let key = apikey.key.clone();
1698        let value = match apikey.prefix {
1699            Some(ref prefix) => format!("{} {}", prefix, key),
1700            None => key,
1701        };
1702        req_builder = req_builder.header("Authorization", value);
1703    };
1704    if let Some(ref apikey) = configuration.api_key {
1705        let key = apikey.key.clone();
1706        let value = match apikey.prefix {
1707            Some(ref prefix) => format!("{} {}", prefix, key),
1708            None => key,
1709        };
1710        req_builder = req_builder.header("CSRFPreventionToken", value);
1711    };
1712
1713    let req = req_builder.build()?;
1714    let resp = configuration.client.execute(req).await?;
1715
1716    let status = resp.status();
1717    let content_type = resp
1718        .headers()
1719        .get("content-type")
1720        .and_then(|v| v.to_str().ok())
1721        .unwrap_or("application/octet-stream");
1722    let content_type = super::ContentType::from(content_type);
1723
1724    if !status.is_client_error() && !status.is_server_error() {
1725        let content = resp.text().await?;
1726        match content_type {
1727            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1728            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcGetRuleResponse`"))),
1729            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::LxcGetRuleResponse`")))),
1730        }
1731    } else {
1732        let content = resp.text().await?;
1733        let entity: Option<LxcGetRuleError> = serde_json::from_str(&content).ok();
1734        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1735    }
1736}
1737
1738/// List rules.
1739pub async fn lxc_get_rules(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::LxcGetRulesResponse, Error<LxcGetRulesError>> {
1740    // add a prefix to parameters to efficiently prevent name collisions
1741    let p_path_node = node;
1742    let p_path_vmid = vmid;
1743
1744    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/firewall/rules", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1745    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1746
1747    if let Some(ref user_agent) = configuration.user_agent {
1748        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1749    }
1750    if let Some(ref apikey) = configuration.api_key {
1751        let key = apikey.key.clone();
1752        let value = match apikey.prefix {
1753            Some(ref prefix) => format!("{} {}", prefix, key),
1754            None => key,
1755        };
1756        req_builder = req_builder.header("Authorization", value);
1757    };
1758    if let Some(ref apikey) = configuration.api_key {
1759        let key = apikey.key.clone();
1760        let value = match apikey.prefix {
1761            Some(ref prefix) => format!("{} {}", prefix, key),
1762            None => key,
1763        };
1764        req_builder = req_builder.header("CSRFPreventionToken", value);
1765    };
1766
1767    let req = req_builder.build()?;
1768    let resp = configuration.client.execute(req).await?;
1769
1770    let status = resp.status();
1771    let content_type = resp
1772        .headers()
1773        .get("content-type")
1774        .and_then(|v| v.to_str().ok())
1775        .unwrap_or("application/octet-stream");
1776    let content_type = super::ContentType::from(content_type);
1777
1778    if !status.is_client_error() && !status.is_server_error() {
1779        let content = resp.text().await?;
1780        match content_type {
1781            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1782            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcGetRulesResponse`"))),
1783            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::LxcGetRulesResponse`")))),
1784        }
1785    } else {
1786        let content = resp.text().await?;
1787        let entity: Option<LxcGetRulesError> = serde_json::from_str(&content).ok();
1788        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1789    }
1790}
1791
1792/// List all snapshots.
1793pub async fn lxc_get_snapshot(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::LxcGetSnapshotResponse, Error<LxcGetSnapshotError>> {
1794    // add a prefix to parameters to efficiently prevent name collisions
1795    let p_path_node = node;
1796    let p_path_vmid = vmid;
1797
1798    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/snapshot", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1799    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1800
1801    if let Some(ref user_agent) = configuration.user_agent {
1802        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1803    }
1804    if let Some(ref apikey) = configuration.api_key {
1805        let key = apikey.key.clone();
1806        let value = match apikey.prefix {
1807            Some(ref prefix) => format!("{} {}", prefix, key),
1808            None => key,
1809        };
1810        req_builder = req_builder.header("Authorization", value);
1811    };
1812    if let Some(ref apikey) = configuration.api_key {
1813        let key = apikey.key.clone();
1814        let value = match apikey.prefix {
1815            Some(ref prefix) => format!("{} {}", prefix, key),
1816            None => key,
1817        };
1818        req_builder = req_builder.header("CSRFPreventionToken", value);
1819    };
1820
1821    let req = req_builder.build()?;
1822    let resp = configuration.client.execute(req).await?;
1823
1824    let status = resp.status();
1825    let content_type = resp
1826        .headers()
1827        .get("content-type")
1828        .and_then(|v| v.to_str().ok())
1829        .unwrap_or("application/octet-stream");
1830    let content_type = super::ContentType::from(content_type);
1831
1832    if !status.is_client_error() && !status.is_server_error() {
1833        let content = resp.text().await?;
1834        match content_type {
1835            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1836            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcGetSnapshotResponse`"))),
1837            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::LxcGetSnapshotResponse`")))),
1838        }
1839    } else {
1840        let content = resp.text().await?;
1841        let entity: Option<LxcGetSnapshotError> = serde_json::from_str(&content).ok();
1842        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1843    }
1844}
1845
1846/// Get snapshot configuration
1847pub async fn lxc_get_snapshot_config(configuration: &configuration::Configuration, node: &str, snapname: &str, vmid: i32) -> Result<models::LxcGetSnapshotConfigResponse, Error<LxcGetSnapshotConfigError>> {
1848    // add a prefix to parameters to efficiently prevent name collisions
1849    let p_path_node = node;
1850    let p_path_snapname = snapname;
1851    let p_path_vmid = vmid;
1852
1853    let uri_str = format!("{}/nodes/{node}/lxc/{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);
1854    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1855
1856    if let Some(ref user_agent) = configuration.user_agent {
1857        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1858    }
1859    if let Some(ref apikey) = configuration.api_key {
1860        let key = apikey.key.clone();
1861        let value = match apikey.prefix {
1862            Some(ref prefix) => format!("{} {}", prefix, key),
1863            None => key,
1864        };
1865        req_builder = req_builder.header("Authorization", value);
1866    };
1867    if let Some(ref apikey) = configuration.api_key {
1868        let key = apikey.key.clone();
1869        let value = match apikey.prefix {
1870            Some(ref prefix) => format!("{} {}", prefix, key),
1871            None => key,
1872        };
1873        req_builder = req_builder.header("CSRFPreventionToken", value);
1874    };
1875
1876    let req = req_builder.build()?;
1877    let resp = configuration.client.execute(req).await?;
1878
1879    let status = resp.status();
1880    let content_type = resp
1881        .headers()
1882        .get("content-type")
1883        .and_then(|v| v.to_str().ok())
1884        .unwrap_or("application/octet-stream");
1885    let content_type = super::ContentType::from(content_type);
1886
1887    if !status.is_client_error() && !status.is_server_error() {
1888        let content = resp.text().await?;
1889        match content_type {
1890            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1891            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcGetSnapshotConfigResponse`"))),
1892            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::LxcGetSnapshotConfigResponse`")))),
1893        }
1894    } else {
1895        let content = resp.text().await?;
1896        let entity: Option<LxcGetSnapshotConfigError> = serde_json::from_str(&content).ok();
1897        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1898    }
1899}
1900
1901/// Get IP addresses of the specified container interface.
1902pub async fn lxc_ip(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::LxcIpResponse, Error<LxcIpError>> {
1903    // add a prefix to parameters to efficiently prevent name collisions
1904    let p_path_node = node;
1905    let p_path_vmid = vmid;
1906
1907    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/interfaces", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1908    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1909
1910    if let Some(ref user_agent) = configuration.user_agent {
1911        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1912    }
1913    if let Some(ref apikey) = configuration.api_key {
1914        let key = apikey.key.clone();
1915        let value = match apikey.prefix {
1916            Some(ref prefix) => format!("{} {}", prefix, key),
1917            None => key,
1918        };
1919        req_builder = req_builder.header("Authorization", value);
1920    };
1921    if let Some(ref apikey) = configuration.api_key {
1922        let key = apikey.key.clone();
1923        let value = match apikey.prefix {
1924            Some(ref prefix) => format!("{} {}", prefix, key),
1925            None => key,
1926        };
1927        req_builder = req_builder.header("CSRFPreventionToken", value);
1928    };
1929
1930    let req = req_builder.build()?;
1931    let resp = configuration.client.execute(req).await?;
1932
1933    let status = resp.status();
1934    let content_type = resp
1935        .headers()
1936        .get("content-type")
1937        .and_then(|v| v.to_str().ok())
1938        .unwrap_or("application/octet-stream");
1939    let content_type = super::ContentType::from(content_type);
1940
1941    if !status.is_client_error() && !status.is_server_error() {
1942        let content = resp.text().await?;
1943        match content_type {
1944            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1945            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcIpResponse`"))),
1946            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::LxcIpResponse`")))),
1947        }
1948    } else {
1949        let content = resp.text().await?;
1950        let entity: Option<LxcIpError> = serde_json::from_str(&content).ok();
1951        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1952    }
1953}
1954
1955/// List IPSets
1956pub async fn lxc_ipset_index(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::LxcIpsetIndexResponse, Error<LxcIpsetIndexError>> {
1957    // add a prefix to parameters to efficiently prevent name collisions
1958    let p_path_node = node;
1959    let p_path_vmid = vmid;
1960
1961    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/firewall/ipset", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
1962    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1963
1964    if let Some(ref user_agent) = configuration.user_agent {
1965        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1966    }
1967    if let Some(ref apikey) = configuration.api_key {
1968        let key = apikey.key.clone();
1969        let value = match apikey.prefix {
1970            Some(ref prefix) => format!("{} {}", prefix, key),
1971            None => key,
1972        };
1973        req_builder = req_builder.header("Authorization", value);
1974    };
1975    if let Some(ref apikey) = configuration.api_key {
1976        let key = apikey.key.clone();
1977        let value = match apikey.prefix {
1978            Some(ref prefix) => format!("{} {}", prefix, key),
1979            None => key,
1980        };
1981        req_builder = req_builder.header("CSRFPreventionToken", value);
1982    };
1983
1984    let req = req_builder.build()?;
1985    let resp = configuration.client.execute(req).await?;
1986
1987    let status = resp.status();
1988    let content_type = resp
1989        .headers()
1990        .get("content-type")
1991        .and_then(|v| v.to_str().ok())
1992        .unwrap_or("application/octet-stream");
1993    let content_type = super::ContentType::from(content_type);
1994
1995    if !status.is_client_error() && !status.is_server_error() {
1996        let content = resp.text().await?;
1997        match content_type {
1998            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1999            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcIpsetIndexResponse`"))),
2000            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::LxcIpsetIndexResponse`")))),
2001        }
2002    } else {
2003        let content = resp.text().await?;
2004        let entity: Option<LxcIpsetIndexError> = serde_json::from_str(&content).ok();
2005        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2006    }
2007}
2008
2009/// Read firewall log
2010pub async fn lxc_log(configuration: &configuration::Configuration, node: &str, vmid: i32, limit: Option<i64>, since: Option<i64>, start: Option<i64>, until: Option<i64>) -> Result<models::LxcLogResponse, Error<LxcLogError>> {
2011    // add a prefix to parameters to efficiently prevent name collisions
2012    let p_path_node = node;
2013    let p_path_vmid = vmid;
2014    let p_query_limit = limit;
2015    let p_query_since = since;
2016    let p_query_start = start;
2017    let p_query_until = until;
2018
2019    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/firewall/log", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2020    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2021
2022    if let Some(ref param_value) = p_query_limit {
2023        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
2024    }
2025    if let Some(ref param_value) = p_query_since {
2026        req_builder = req_builder.query(&[("since", &param_value.to_string())]);
2027    }
2028    if let Some(ref param_value) = p_query_start {
2029        req_builder = req_builder.query(&[("start", &param_value.to_string())]);
2030    }
2031    if let Some(ref param_value) = p_query_until {
2032        req_builder = req_builder.query(&[("until", &param_value.to_string())]);
2033    }
2034    if let Some(ref user_agent) = configuration.user_agent {
2035        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2036    }
2037    if let Some(ref apikey) = configuration.api_key {
2038        let key = apikey.key.clone();
2039        let value = match apikey.prefix {
2040            Some(ref prefix) => format!("{} {}", prefix, key),
2041            None => key,
2042        };
2043        req_builder = req_builder.header("Authorization", value);
2044    };
2045    if let Some(ref apikey) = configuration.api_key {
2046        let key = apikey.key.clone();
2047        let value = match apikey.prefix {
2048            Some(ref prefix) => format!("{} {}", prefix, key),
2049            None => key,
2050        };
2051        req_builder = req_builder.header("CSRFPreventionToken", value);
2052    };
2053
2054    let req = req_builder.build()?;
2055    let resp = configuration.client.execute(req).await?;
2056
2057    let status = resp.status();
2058    let content_type = resp
2059        .headers()
2060        .get("content-type")
2061        .and_then(|v| v.to_str().ok())
2062        .unwrap_or("application/octet-stream");
2063    let content_type = super::ContentType::from(content_type);
2064
2065    if !status.is_client_error() && !status.is_server_error() {
2066        let content = resp.text().await?;
2067        match content_type {
2068            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2069            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcLogResponse`"))),
2070            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::LxcLogResponse`")))),
2071        }
2072    } else {
2073        let content = resp.text().await?;
2074        let entity: Option<LxcLogError> = serde_json::from_str(&content).ok();
2075        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2076    }
2077}
2078
2079/// Migrate the container to another node. Creates a new migration task.
2080pub async fn lxc_migrate_vm(configuration: &configuration::Configuration, node: &str, vmid: i32, lxc_migrate_vm_request: models::LxcMigrateVmRequest) -> Result<models::LxcMigrateVmResponse, Error<LxcMigrateVmError>> {
2081    // add a prefix to parameters to efficiently prevent name collisions
2082    let p_path_node = node;
2083    let p_path_vmid = vmid;
2084    let p_body_lxc_migrate_vm_request = lxc_migrate_vm_request;
2085
2086    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/migrate", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2087    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2088
2089    if let Some(ref user_agent) = configuration.user_agent {
2090        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2091    }
2092    if let Some(ref apikey) = configuration.api_key {
2093        let key = apikey.key.clone();
2094        let value = match apikey.prefix {
2095            Some(ref prefix) => format!("{} {}", prefix, key),
2096            None => key,
2097        };
2098        req_builder = req_builder.header("Authorization", value);
2099    };
2100    if let Some(ref apikey) = configuration.api_key {
2101        let key = apikey.key.clone();
2102        let value = match apikey.prefix {
2103            Some(ref prefix) => format!("{} {}", prefix, key),
2104            None => key,
2105        };
2106        req_builder = req_builder.header("CSRFPreventionToken", value);
2107    };
2108    req_builder = req_builder.json(&p_body_lxc_migrate_vm_request);
2109
2110    let req = req_builder.build()?;
2111    let resp = configuration.client.execute(req).await?;
2112
2113    let status = resp.status();
2114    let content_type = resp
2115        .headers()
2116        .get("content-type")
2117        .and_then(|v| v.to_str().ok())
2118        .unwrap_or("application/octet-stream");
2119    let content_type = super::ContentType::from(content_type);
2120
2121    if !status.is_client_error() && !status.is_server_error() {
2122        let content = resp.text().await?;
2123        match content_type {
2124            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2125            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcMigrateVmResponse`"))),
2126            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::LxcMigrateVmResponse`")))),
2127        }
2128    } else {
2129        let content = resp.text().await?;
2130        let entity: Option<LxcMigrateVmError> = serde_json::from_str(&content).ok();
2131        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2132    }
2133}
2134
2135/// Get preconditions for migration.
2136pub async fn lxc_migrate_vm_precondition(configuration: &configuration::Configuration, node: &str, vmid: i32, target: Option<&str>) -> Result<models::LxcMigrateVmPreconditionResponse, Error<LxcMigrateVmPreconditionError>> {
2137    // add a prefix to parameters to efficiently prevent name collisions
2138    let p_path_node = node;
2139    let p_path_vmid = vmid;
2140    let p_query_target = target;
2141
2142    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/migrate", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2143    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2144
2145    if let Some(ref param_value) = p_query_target {
2146        req_builder = req_builder.query(&[("target", &param_value.to_string())]);
2147    }
2148    if let Some(ref user_agent) = configuration.user_agent {
2149        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2150    }
2151    if let Some(ref apikey) = configuration.api_key {
2152        let key = apikey.key.clone();
2153        let value = match apikey.prefix {
2154            Some(ref prefix) => format!("{} {}", prefix, key),
2155            None => key,
2156        };
2157        req_builder = req_builder.header("Authorization", value);
2158    };
2159    if let Some(ref apikey) = configuration.api_key {
2160        let key = apikey.key.clone();
2161        let value = match apikey.prefix {
2162            Some(ref prefix) => format!("{} {}", prefix, key),
2163            None => key,
2164        };
2165        req_builder = req_builder.header("CSRFPreventionToken", value);
2166    };
2167
2168    let req = req_builder.build()?;
2169    let resp = configuration.client.execute(req).await?;
2170
2171    let status = resp.status();
2172    let content_type = resp
2173        .headers()
2174        .get("content-type")
2175        .and_then(|v| v.to_str().ok())
2176        .unwrap_or("application/octet-stream");
2177    let content_type = super::ContentType::from(content_type);
2178
2179    if !status.is_client_error() && !status.is_server_error() {
2180        let content = resp.text().await?;
2181        match content_type {
2182            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2183            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcMigrateVmPreconditionResponse`"))),
2184            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::LxcMigrateVmPreconditionResponse`")))),
2185        }
2186    } else {
2187        let content = resp.text().await?;
2188        let entity: Option<LxcMigrateVmPreconditionError> = serde_json::from_str(&content).ok();
2189        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2190    }
2191}
2192
2193/// Move a rootfs-/mp-volume to a different storage or to a different container.  Permissions: You need 'VM.Config.Disk' permissions on /vms/{vmid}, and 'Datastore.AllocateSpace' permissions on the storage. To move a volume to another container, you need the permissions on the target container as well.
2194pub async fn lxc_move_volume(configuration: &configuration::Configuration, node: &str, vmid: i32, lxc_move_volume_request: models::LxcMoveVolumeRequest) -> Result<models::LxcMoveVolumeResponse, Error<LxcMoveVolumeError>> {
2195    // add a prefix to parameters to efficiently prevent name collisions
2196    let p_path_node = node;
2197    let p_path_vmid = vmid;
2198    let p_body_lxc_move_volume_request = lxc_move_volume_request;
2199
2200    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/move_volume", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2201    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2202
2203    if let Some(ref user_agent) = configuration.user_agent {
2204        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2205    }
2206    if let Some(ref apikey) = configuration.api_key {
2207        let key = apikey.key.clone();
2208        let value = match apikey.prefix {
2209            Some(ref prefix) => format!("{} {}", prefix, key),
2210            None => key,
2211        };
2212        req_builder = req_builder.header("Authorization", value);
2213    };
2214    if let Some(ref apikey) = configuration.api_key {
2215        let key = apikey.key.clone();
2216        let value = match apikey.prefix {
2217            Some(ref prefix) => format!("{} {}", prefix, key),
2218            None => key,
2219        };
2220        req_builder = req_builder.header("CSRFPreventionToken", value);
2221    };
2222    req_builder = req_builder.json(&p_body_lxc_move_volume_request);
2223
2224    let req = req_builder.build()?;
2225    let resp = configuration.client.execute(req).await?;
2226
2227    let status = resp.status();
2228    let content_type = resp
2229        .headers()
2230        .get("content-type")
2231        .and_then(|v| v.to_str().ok())
2232        .unwrap_or("application/octet-stream");
2233    let content_type = super::ContentType::from(content_type);
2234
2235    if !status.is_client_error() && !status.is_server_error() {
2236        let content = resp.text().await?;
2237        match content_type {
2238            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2239            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcMoveVolumeResponse`"))),
2240            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::LxcMoveVolumeResponse`")))),
2241        }
2242    } else {
2243        let content = resp.text().await?;
2244        let entity: Option<LxcMoveVolumeError> = serde_json::from_str(&content).ok();
2245        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2246    }
2247}
2248
2249/// Migration tunnel endpoint - only for internal use by CT migration.  Permissions: You need 'VM.Allocate' permissions on '/vms/{vmid}' and Sys.Incoming on '/'. Further permission checks happen during the actual migration.
2250pub async fn lxc_mtunnel(configuration: &configuration::Configuration, node: &str, vmid: i32, lxc_mtunnel_request: Option<models::LxcMtunnelRequest>) -> Result<models::LxcMtunnelResponse, Error<LxcMtunnelError>> {
2251    // add a prefix to parameters to efficiently prevent name collisions
2252    let p_path_node = node;
2253    let p_path_vmid = vmid;
2254    let p_body_lxc_mtunnel_request = lxc_mtunnel_request;
2255
2256    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/mtunnel", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2257    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2258
2259    if let Some(ref user_agent) = configuration.user_agent {
2260        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2261    }
2262    if let Some(ref apikey) = configuration.api_key {
2263        let key = apikey.key.clone();
2264        let value = match apikey.prefix {
2265            Some(ref prefix) => format!("{} {}", prefix, key),
2266            None => key,
2267        };
2268        req_builder = req_builder.header("Authorization", value);
2269    };
2270    if let Some(ref apikey) = configuration.api_key {
2271        let key = apikey.key.clone();
2272        let value = match apikey.prefix {
2273            Some(ref prefix) => format!("{} {}", prefix, key),
2274            None => key,
2275        };
2276        req_builder = req_builder.header("CSRFPreventionToken", value);
2277    };
2278    req_builder = req_builder.json(&p_body_lxc_mtunnel_request);
2279
2280    let req = req_builder.build()?;
2281    let resp = configuration.client.execute(req).await?;
2282
2283    let status = resp.status();
2284    let content_type = resp
2285        .headers()
2286        .get("content-type")
2287        .and_then(|v| v.to_str().ok())
2288        .unwrap_or("application/octet-stream");
2289    let content_type = super::ContentType::from(content_type);
2290
2291    if !status.is_client_error() && !status.is_server_error() {
2292        let content = resp.text().await?;
2293        match content_type {
2294            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2295            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcMtunnelResponse`"))),
2296            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::LxcMtunnelResponse`")))),
2297        }
2298    } else {
2299        let content = resp.text().await?;
2300        let entity: Option<LxcMtunnelError> = serde_json::from_str(&content).ok();
2301        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2302    }
2303}
2304
2305/// Migration tunnel endpoint for websocket upgrade - only for internal use by VM migration.  Permissions: You need to pass a ticket valid for the selected socket. Tickets can be created via the mtunnel API call, which will check permissions accordingly.
2306pub async fn lxc_mtunnelwebsocket(configuration: &configuration::Configuration, node: &str, socket: &str, ticket: &str, vmid: i32) -> Result<models::LxcMtunnelwebsocketResponse, Error<LxcMtunnelwebsocketError>> {
2307    // add a prefix to parameters to efficiently prevent name collisions
2308    let p_path_node = node;
2309    let p_query_socket = socket;
2310    let p_query_ticket = ticket;
2311    let p_path_vmid = vmid;
2312
2313    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/mtunnelwebsocket", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2314    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2315
2316    req_builder = req_builder.query(&[("socket", &p_query_socket.to_string())]);
2317    req_builder = req_builder.query(&[("ticket", &p_query_ticket.to_string())]);
2318    if let Some(ref user_agent) = configuration.user_agent {
2319        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2320    }
2321    if let Some(ref apikey) = configuration.api_key {
2322        let key = apikey.key.clone();
2323        let value = match apikey.prefix {
2324            Some(ref prefix) => format!("{} {}", prefix, key),
2325            None => key,
2326        };
2327        req_builder = req_builder.header("Authorization", value);
2328    };
2329    if let Some(ref apikey) = configuration.api_key {
2330        let key = apikey.key.clone();
2331        let value = match apikey.prefix {
2332            Some(ref prefix) => format!("{} {}", prefix, key),
2333            None => key,
2334        };
2335        req_builder = req_builder.header("CSRFPreventionToken", value);
2336    };
2337
2338    let req = req_builder.build()?;
2339    let resp = configuration.client.execute(req).await?;
2340
2341    let status = resp.status();
2342    let content_type = resp
2343        .headers()
2344        .get("content-type")
2345        .and_then(|v| v.to_str().ok())
2346        .unwrap_or("application/octet-stream");
2347    let content_type = super::ContentType::from(content_type);
2348
2349    if !status.is_client_error() && !status.is_server_error() {
2350        let content = resp.text().await?;
2351        match content_type {
2352            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2353            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcMtunnelwebsocketResponse`"))),
2354            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::LxcMtunnelwebsocketResponse`")))),
2355        }
2356    } else {
2357        let content = resp.text().await?;
2358        let entity: Option<LxcMtunnelwebsocketError> = serde_json::from_str(&content).ok();
2359        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2360    }
2361}
2362
2363/// Read alias.
2364pub async fn lxc_read_alias(configuration: &configuration::Configuration, name: &str, node: &str, vmid: i32) -> Result<models::LxcReadAliasResponse, Error<LxcReadAliasError>> {
2365    // add a prefix to parameters to efficiently prevent name collisions
2366    let p_path_name = name;
2367    let p_path_node = node;
2368    let p_path_vmid = vmid;
2369
2370    let uri_str = format!("{}/nodes/{node}/lxc/{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);
2371    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2372
2373    if let Some(ref user_agent) = configuration.user_agent {
2374        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2375    }
2376    if let Some(ref apikey) = configuration.api_key {
2377        let key = apikey.key.clone();
2378        let value = match apikey.prefix {
2379            Some(ref prefix) => format!("{} {}", prefix, key),
2380            None => key,
2381        };
2382        req_builder = req_builder.header("Authorization", value);
2383    };
2384    if let Some(ref apikey) = configuration.api_key {
2385        let key = apikey.key.clone();
2386        let value = match apikey.prefix {
2387            Some(ref prefix) => format!("{} {}", prefix, key),
2388            None => key,
2389        };
2390        req_builder = req_builder.header("CSRFPreventionToken", value);
2391    };
2392
2393    let req = req_builder.build()?;
2394    let resp = configuration.client.execute(req).await?;
2395
2396    let status = resp.status();
2397    let content_type = resp
2398        .headers()
2399        .get("content-type")
2400        .and_then(|v| v.to_str().ok())
2401        .unwrap_or("application/octet-stream");
2402    let content_type = super::ContentType::from(content_type);
2403
2404    if !status.is_client_error() && !status.is_server_error() {
2405        let content = resp.text().await?;
2406        match content_type {
2407            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2408            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcReadAliasResponse`"))),
2409            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::LxcReadAliasResponse`")))),
2410        }
2411    } else {
2412        let content = resp.text().await?;
2413        let entity: Option<LxcReadAliasError> = serde_json::from_str(&content).ok();
2414        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2415    }
2416}
2417
2418/// Read IP or Network settings from IPSet.
2419pub async fn lxc_read_ip(configuration: &configuration::Configuration, cidr: &str, name: &str, node: &str, vmid: i32) -> Result<models::LxcReadIpResponse, Error<LxcReadIpError>> {
2420    // add a prefix to parameters to efficiently prevent name collisions
2421    let p_path_cidr = cidr;
2422    let p_path_name = name;
2423    let p_path_node = node;
2424    let p_path_vmid = vmid;
2425
2426    let uri_str = format!("{}/nodes/{node}/lxc/{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);
2427    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2428
2429    if let Some(ref user_agent) = configuration.user_agent {
2430        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2431    }
2432    if let Some(ref apikey) = configuration.api_key {
2433        let key = apikey.key.clone();
2434        let value = match apikey.prefix {
2435            Some(ref prefix) => format!("{} {}", prefix, key),
2436            None => key,
2437        };
2438        req_builder = req_builder.header("Authorization", value);
2439    };
2440    if let Some(ref apikey) = configuration.api_key {
2441        let key = apikey.key.clone();
2442        let value = match apikey.prefix {
2443            Some(ref prefix) => format!("{} {}", prefix, key),
2444            None => key,
2445        };
2446        req_builder = req_builder.header("CSRFPreventionToken", value);
2447    };
2448
2449    let req = req_builder.build()?;
2450    let resp = configuration.client.execute(req).await?;
2451
2452    let status = resp.status();
2453    let content_type = resp
2454        .headers()
2455        .get("content-type")
2456        .and_then(|v| v.to_str().ok())
2457        .unwrap_or("application/octet-stream");
2458    let content_type = super::ContentType::from(content_type);
2459
2460    if !status.is_client_error() && !status.is_server_error() {
2461        let content = resp.text().await?;
2462        match content_type {
2463            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2464            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcReadIpResponse`"))),
2465            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::LxcReadIpResponse`")))),
2466        }
2467    } else {
2468        let content = resp.text().await?;
2469        let entity: Option<LxcReadIpError> = serde_json::from_str(&content).ok();
2470        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2471    }
2472}
2473
2474/// Lists possible IPSet/Alias reference which are allowed in source/dest properties.
2475pub async fn lxc_refs(configuration: &configuration::Configuration, node: &str, vmid: i32, r#type: Option<models::PveTypeTypeEnum>) -> Result<models::LxcRefsResponse, Error<LxcRefsError>> {
2476    // add a prefix to parameters to efficiently prevent name collisions
2477    let p_path_node = node;
2478    let p_path_vmid = vmid;
2479    let p_query_type = r#type;
2480
2481    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/firewall/refs", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2482    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2483
2484    if let Some(ref param_value) = p_query_type {
2485        req_builder = req_builder.query(&[("type", &param_value.to_string())]);
2486    }
2487    if let Some(ref user_agent) = configuration.user_agent {
2488        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2489    }
2490    if let Some(ref apikey) = configuration.api_key {
2491        let key = apikey.key.clone();
2492        let value = match apikey.prefix {
2493            Some(ref prefix) => format!("{} {}", prefix, key),
2494            None => key,
2495        };
2496        req_builder = req_builder.header("Authorization", value);
2497    };
2498    if let Some(ref apikey) = configuration.api_key {
2499        let key = apikey.key.clone();
2500        let value = match apikey.prefix {
2501            Some(ref prefix) => format!("{} {}", prefix, key),
2502            None => key,
2503        };
2504        req_builder = req_builder.header("CSRFPreventionToken", value);
2505    };
2506
2507    let req = req_builder.build()?;
2508    let resp = configuration.client.execute(req).await?;
2509
2510    let status = resp.status();
2511    let content_type = resp
2512        .headers()
2513        .get("content-type")
2514        .and_then(|v| v.to_str().ok())
2515        .unwrap_or("application/octet-stream");
2516    let content_type = super::ContentType::from(content_type);
2517
2518    if !status.is_client_error() && !status.is_server_error() {
2519        let content = resp.text().await?;
2520        match content_type {
2521            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2522            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcRefsResponse`"))),
2523            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::LxcRefsResponse`")))),
2524        }
2525    } else {
2526        let content = resp.text().await?;
2527        let entity: Option<LxcRefsError> = serde_json::from_str(&content).ok();
2528        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2529    }
2530}
2531
2532/// Migrate the container to another cluster. Creates a new migration task. EXPERIMENTAL feature!
2533pub async fn lxc_remote_migrate_vm(configuration: &configuration::Configuration, node: &str, vmid: i32, lxc_remote_migrate_vm_request: models::LxcRemoteMigrateVmRequest) -> Result<models::LxcRemoteMigrateVmResponse, Error<LxcRemoteMigrateVmError>> {
2534    // add a prefix to parameters to efficiently prevent name collisions
2535    let p_path_node = node;
2536    let p_path_vmid = vmid;
2537    let p_body_lxc_remote_migrate_vm_request = lxc_remote_migrate_vm_request;
2538
2539    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/remote_migrate", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2540    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2541
2542    if let Some(ref user_agent) = configuration.user_agent {
2543        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2544    }
2545    if let Some(ref apikey) = configuration.api_key {
2546        let key = apikey.key.clone();
2547        let value = match apikey.prefix {
2548            Some(ref prefix) => format!("{} {}", prefix, key),
2549            None => key,
2550        };
2551        req_builder = req_builder.header("Authorization", value);
2552    };
2553    if let Some(ref apikey) = configuration.api_key {
2554        let key = apikey.key.clone();
2555        let value = match apikey.prefix {
2556            Some(ref prefix) => format!("{} {}", prefix, key),
2557            None => key,
2558        };
2559        req_builder = req_builder.header("CSRFPreventionToken", value);
2560    };
2561    req_builder = req_builder.json(&p_body_lxc_remote_migrate_vm_request);
2562
2563    let req = req_builder.build()?;
2564    let resp = configuration.client.execute(req).await?;
2565
2566    let status = resp.status();
2567    let content_type = resp
2568        .headers()
2569        .get("content-type")
2570        .and_then(|v| v.to_str().ok())
2571        .unwrap_or("application/octet-stream");
2572    let content_type = super::ContentType::from(content_type);
2573
2574    if !status.is_client_error() && !status.is_server_error() {
2575        let content = resp.text().await?;
2576        match content_type {
2577            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2578            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcRemoteMigrateVmResponse`"))),
2579            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::LxcRemoteMigrateVmResponse`")))),
2580        }
2581    } else {
2582        let content = resp.text().await?;
2583        let entity: Option<LxcRemoteMigrateVmError> = serde_json::from_str(&content).ok();
2584        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2585    }
2586}
2587
2588/// Remove IP or Network alias.
2589pub async fn lxc_remove_alias(configuration: &configuration::Configuration, name: &str, node: &str, vmid: i32, digest: Option<&str>) -> Result<models::LxcRemoveAliasResponse, Error<LxcRemoveAliasError>> {
2590    // add a prefix to parameters to efficiently prevent name collisions
2591    let p_path_name = name;
2592    let p_path_node = node;
2593    let p_path_vmid = vmid;
2594    let p_query_digest = digest;
2595
2596    let uri_str = format!("{}/nodes/{node}/lxc/{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);
2597    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2598
2599    if let Some(ref param_value) = p_query_digest {
2600        req_builder = req_builder.query(&[("digest", &param_value.to_string())]);
2601    }
2602    if let Some(ref user_agent) = configuration.user_agent {
2603        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2604    }
2605    if let Some(ref apikey) = configuration.api_key {
2606        let key = apikey.key.clone();
2607        let value = match apikey.prefix {
2608            Some(ref prefix) => format!("{} {}", prefix, key),
2609            None => key,
2610        };
2611        req_builder = req_builder.header("Authorization", value);
2612    };
2613    if let Some(ref apikey) = configuration.api_key {
2614        let key = apikey.key.clone();
2615        let value = match apikey.prefix {
2616            Some(ref prefix) => format!("{} {}", prefix, key),
2617            None => key,
2618        };
2619        req_builder = req_builder.header("CSRFPreventionToken", value);
2620    };
2621
2622    let req = req_builder.build()?;
2623    let resp = configuration.client.execute(req).await?;
2624
2625    let status = resp.status();
2626    let content_type = resp
2627        .headers()
2628        .get("content-type")
2629        .and_then(|v| v.to_str().ok())
2630        .unwrap_or("application/octet-stream");
2631    let content_type = super::ContentType::from(content_type);
2632
2633    if !status.is_client_error() && !status.is_server_error() {
2634        let content = resp.text().await?;
2635        match content_type {
2636            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2637            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcRemoveAliasResponse`"))),
2638            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::LxcRemoveAliasResponse`")))),
2639        }
2640    } else {
2641        let content = resp.text().await?;
2642        let entity: Option<LxcRemoveAliasError> = serde_json::from_str(&content).ok();
2643        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2644    }
2645}
2646
2647/// Remove IP or Network from IPSet.
2648pub async fn lxc_remove_ip(configuration: &configuration::Configuration, cidr: &str, name: &str, node: &str, vmid: i32, digest: Option<&str>) -> Result<models::LxcRemoveIpResponse, Error<LxcRemoveIpError>> {
2649    // add a prefix to parameters to efficiently prevent name collisions
2650    let p_path_cidr = cidr;
2651    let p_path_name = name;
2652    let p_path_node = node;
2653    let p_path_vmid = vmid;
2654    let p_query_digest = digest;
2655
2656    let uri_str = format!("{}/nodes/{node}/lxc/{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);
2657    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2658
2659    if let Some(ref param_value) = p_query_digest {
2660        req_builder = req_builder.query(&[("digest", &param_value.to_string())]);
2661    }
2662    if let Some(ref user_agent) = configuration.user_agent {
2663        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2664    }
2665    if let Some(ref apikey) = configuration.api_key {
2666        let key = apikey.key.clone();
2667        let value = match apikey.prefix {
2668            Some(ref prefix) => format!("{} {}", prefix, key),
2669            None => key,
2670        };
2671        req_builder = req_builder.header("Authorization", value);
2672    };
2673    if let Some(ref apikey) = configuration.api_key {
2674        let key = apikey.key.clone();
2675        let value = match apikey.prefix {
2676            Some(ref prefix) => format!("{} {}", prefix, key),
2677            None => key,
2678        };
2679        req_builder = req_builder.header("CSRFPreventionToken", value);
2680    };
2681
2682    let req = req_builder.build()?;
2683    let resp = configuration.client.execute(req).await?;
2684
2685    let status = resp.status();
2686    let content_type = resp
2687        .headers()
2688        .get("content-type")
2689        .and_then(|v| v.to_str().ok())
2690        .unwrap_or("application/octet-stream");
2691    let content_type = super::ContentType::from(content_type);
2692
2693    if !status.is_client_error() && !status.is_server_error() {
2694        let content = resp.text().await?;
2695        match content_type {
2696            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2697            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcRemoveIpResponse`"))),
2698            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::LxcRemoveIpResponse`")))),
2699        }
2700    } else {
2701        let content = resp.text().await?;
2702        let entity: Option<LxcRemoveIpError> = serde_json::from_str(&content).ok();
2703        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2704    }
2705}
2706
2707/// Resize a container mount point.
2708pub async fn lxc_resize_vm(configuration: &configuration::Configuration, node: &str, vmid: i32, lxc_resize_vm_request: models::LxcResizeVmRequest) -> Result<models::LxcResizeVmResponse, Error<LxcResizeVmError>> {
2709    // add a prefix to parameters to efficiently prevent name collisions
2710    let p_path_node = node;
2711    let p_path_vmid = vmid;
2712    let p_body_lxc_resize_vm_request = lxc_resize_vm_request;
2713
2714    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/resize", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2715    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2716
2717    if let Some(ref user_agent) = configuration.user_agent {
2718        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2719    }
2720    if let Some(ref apikey) = configuration.api_key {
2721        let key = apikey.key.clone();
2722        let value = match apikey.prefix {
2723            Some(ref prefix) => format!("{} {}", prefix, key),
2724            None => key,
2725        };
2726        req_builder = req_builder.header("Authorization", value);
2727    };
2728    if let Some(ref apikey) = configuration.api_key {
2729        let key = apikey.key.clone();
2730        let value = match apikey.prefix {
2731            Some(ref prefix) => format!("{} {}", prefix, key),
2732            None => key,
2733        };
2734        req_builder = req_builder.header("CSRFPreventionToken", value);
2735    };
2736    req_builder = req_builder.json(&p_body_lxc_resize_vm_request);
2737
2738    let req = req_builder.build()?;
2739    let resp = configuration.client.execute(req).await?;
2740
2741    let status = resp.status();
2742    let content_type = resp
2743        .headers()
2744        .get("content-type")
2745        .and_then(|v| v.to_str().ok())
2746        .unwrap_or("application/octet-stream");
2747    let content_type = super::ContentType::from(content_type);
2748
2749    if !status.is_client_error() && !status.is_server_error() {
2750        let content = resp.text().await?;
2751        match content_type {
2752            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2753            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcResizeVmResponse`"))),
2754            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::LxcResizeVmResponse`")))),
2755        }
2756    } else {
2757        let content = resp.text().await?;
2758        let entity: Option<LxcResizeVmError> = serde_json::from_str(&content).ok();
2759        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2760    }
2761}
2762
2763/// Rollback LXC state to specified snapshot.
2764pub async fn lxc_rollback(configuration: &configuration::Configuration, node: &str, snapname: &str, vmid: i32, lxc_rollback_request: Option<models::LxcRollbackRequest>) -> Result<models::LxcRollbackResponse, Error<LxcRollbackError>> {
2765    // add a prefix to parameters to efficiently prevent name collisions
2766    let p_path_node = node;
2767    let p_path_snapname = snapname;
2768    let p_path_vmid = vmid;
2769    let p_body_lxc_rollback_request = lxc_rollback_request;
2770
2771    let uri_str = format!("{}/nodes/{node}/lxc/{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);
2772    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2773
2774    if let Some(ref user_agent) = configuration.user_agent {
2775        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2776    }
2777    if let Some(ref apikey) = configuration.api_key {
2778        let key = apikey.key.clone();
2779        let value = match apikey.prefix {
2780            Some(ref prefix) => format!("{} {}", prefix, key),
2781            None => key,
2782        };
2783        req_builder = req_builder.header("Authorization", value);
2784    };
2785    if let Some(ref apikey) = configuration.api_key {
2786        let key = apikey.key.clone();
2787        let value = match apikey.prefix {
2788            Some(ref prefix) => format!("{} {}", prefix, key),
2789            None => key,
2790        };
2791        req_builder = req_builder.header("CSRFPreventionToken", value);
2792    };
2793    req_builder = req_builder.json(&p_body_lxc_rollback_request);
2794
2795    let req = req_builder.build()?;
2796    let resp = configuration.client.execute(req).await?;
2797
2798    let status = resp.status();
2799    let content_type = resp
2800        .headers()
2801        .get("content-type")
2802        .and_then(|v| v.to_str().ok())
2803        .unwrap_or("application/octet-stream");
2804    let content_type = super::ContentType::from(content_type);
2805
2806    if !status.is_client_error() && !status.is_server_error() {
2807        let content = resp.text().await?;
2808        match content_type {
2809            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2810            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcRollbackResponse`"))),
2811            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::LxcRollbackResponse`")))),
2812        }
2813    } else {
2814        let content = resp.text().await?;
2815        let entity: Option<LxcRollbackError> = serde_json::from_str(&content).ok();
2816        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2817    }
2818}
2819
2820/// Read VM RRD statistics (returns PNG)
2821pub async fn lxc_rrd(configuration: &configuration::Configuration, ds: &str, node: &str, timeframe: models::PveTimeframeEnum, vmid: i32, cf: Option<models::PveCfEnum>) -> Result<models::LxcRrdResponse, Error<LxcRrdError>> {
2822    // add a prefix to parameters to efficiently prevent name collisions
2823    let p_query_ds = ds;
2824    let p_path_node = node;
2825    let p_query_timeframe = timeframe;
2826    let p_path_vmid = vmid;
2827    let p_query_cf = cf;
2828
2829    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/rrd", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2830    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2831
2832    if let Some(ref param_value) = p_query_cf {
2833        req_builder = req_builder.query(&[("cf", &param_value.to_string())]);
2834    }
2835    req_builder = req_builder.query(&[("ds", &p_query_ds.to_string())]);
2836    req_builder = req_builder.query(&[("timeframe", &p_query_timeframe.to_string())]);
2837    if let Some(ref user_agent) = configuration.user_agent {
2838        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2839    }
2840    if let Some(ref apikey) = configuration.api_key {
2841        let key = apikey.key.clone();
2842        let value = match apikey.prefix {
2843            Some(ref prefix) => format!("{} {}", prefix, key),
2844            None => key,
2845        };
2846        req_builder = req_builder.header("Authorization", value);
2847    };
2848    if let Some(ref apikey) = configuration.api_key {
2849        let key = apikey.key.clone();
2850        let value = match apikey.prefix {
2851            Some(ref prefix) => format!("{} {}", prefix, key),
2852            None => key,
2853        };
2854        req_builder = req_builder.header("CSRFPreventionToken", value);
2855    };
2856
2857    let req = req_builder.build()?;
2858    let resp = configuration.client.execute(req).await?;
2859
2860    let status = resp.status();
2861    let content_type = resp
2862        .headers()
2863        .get("content-type")
2864        .and_then(|v| v.to_str().ok())
2865        .unwrap_or("application/octet-stream");
2866    let content_type = super::ContentType::from(content_type);
2867
2868    if !status.is_client_error() && !status.is_server_error() {
2869        let content = resp.text().await?;
2870        match content_type {
2871            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2872            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcRrdResponse`"))),
2873            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::LxcRrdResponse`")))),
2874        }
2875    } else {
2876        let content = resp.text().await?;
2877        let entity: Option<LxcRrdError> = serde_json::from_str(&content).ok();
2878        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2879    }
2880}
2881
2882/// Read VM RRD statistics
2883pub async fn lxc_rrddata(configuration: &configuration::Configuration, node: &str, timeframe: models::PveTimeframeEnum, vmid: i32, cf: Option<models::PveCfEnum>) -> Result<models::LxcRrddataResponse, Error<LxcRrddataError>> {
2884    // add a prefix to parameters to efficiently prevent name collisions
2885    let p_path_node = node;
2886    let p_query_timeframe = timeframe;
2887    let p_path_vmid = vmid;
2888    let p_query_cf = cf;
2889
2890    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/rrddata", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2891    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2892
2893    if let Some(ref param_value) = p_query_cf {
2894        req_builder = req_builder.query(&[("cf", &param_value.to_string())]);
2895    }
2896    req_builder = req_builder.query(&[("timeframe", &p_query_timeframe.to_string())]);
2897    if let Some(ref user_agent) = configuration.user_agent {
2898        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2899    }
2900    if let Some(ref apikey) = configuration.api_key {
2901        let key = apikey.key.clone();
2902        let value = match apikey.prefix {
2903            Some(ref prefix) => format!("{} {}", prefix, key),
2904            None => key,
2905        };
2906        req_builder = req_builder.header("Authorization", value);
2907    };
2908    if let Some(ref apikey) = configuration.api_key {
2909        let key = apikey.key.clone();
2910        let value = match apikey.prefix {
2911            Some(ref prefix) => format!("{} {}", prefix, key),
2912            None => key,
2913        };
2914        req_builder = req_builder.header("CSRFPreventionToken", value);
2915    };
2916
2917    let req = req_builder.build()?;
2918    let resp = configuration.client.execute(req).await?;
2919
2920    let status = resp.status();
2921    let content_type = resp
2922        .headers()
2923        .get("content-type")
2924        .and_then(|v| v.to_str().ok())
2925        .unwrap_or("application/octet-stream");
2926    let content_type = super::ContentType::from(content_type);
2927
2928    if !status.is_client_error() && !status.is_server_error() {
2929        let content = resp.text().await?;
2930        match content_type {
2931            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2932            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcRrddataResponse`"))),
2933            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::LxcRrddataResponse`")))),
2934        }
2935    } else {
2936        let content = resp.text().await?;
2937        let entity: Option<LxcRrddataError> = serde_json::from_str(&content).ok();
2938        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2939    }
2940}
2941
2942/// Set Firewall options.
2943pub async fn lxc_set_options(configuration: &configuration::Configuration, node: &str, vmid: i32, lxc_set_options_request: Option<models::LxcSetOptionsRequest>) -> Result<models::LxcSetOptionsResponse, Error<LxcSetOptionsError>> {
2944    // add a prefix to parameters to efficiently prevent name collisions
2945    let p_path_node = node;
2946    let p_path_vmid = vmid;
2947    let p_body_lxc_set_options_request = lxc_set_options_request;
2948
2949    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/firewall/options", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
2950    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2951
2952    if let Some(ref user_agent) = configuration.user_agent {
2953        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2954    }
2955    if let Some(ref apikey) = configuration.api_key {
2956        let key = apikey.key.clone();
2957        let value = match apikey.prefix {
2958            Some(ref prefix) => format!("{} {}", prefix, key),
2959            None => key,
2960        };
2961        req_builder = req_builder.header("Authorization", value);
2962    };
2963    if let Some(ref apikey) = configuration.api_key {
2964        let key = apikey.key.clone();
2965        let value = match apikey.prefix {
2966            Some(ref prefix) => format!("{} {}", prefix, key),
2967            None => key,
2968        };
2969        req_builder = req_builder.header("CSRFPreventionToken", value);
2970    };
2971    req_builder = req_builder.json(&p_body_lxc_set_options_request);
2972
2973    let req = req_builder.build()?;
2974    let resp = configuration.client.execute(req).await?;
2975
2976    let status = resp.status();
2977    let content_type = resp
2978        .headers()
2979        .get("content-type")
2980        .and_then(|v| v.to_str().ok())
2981        .unwrap_or("application/octet-stream");
2982    let content_type = super::ContentType::from(content_type);
2983
2984    if !status.is_client_error() && !status.is_server_error() {
2985        let content = resp.text().await?;
2986        match content_type {
2987            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2988            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcSetOptionsResponse`"))),
2989            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::LxcSetOptionsResponse`")))),
2990        }
2991    } else {
2992        let content = resp.text().await?;
2993        let entity: Option<LxcSetOptionsError> = serde_json::from_str(&content).ok();
2994        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2995    }
2996}
2997
2998/// Snapshot a container.
2999pub async fn lxc_snapshot(configuration: &configuration::Configuration, node: &str, vmid: i32, lxc_snapshot_request: models::LxcSnapshotRequest) -> Result<models::LxcSnapshotResponse, Error<LxcSnapshotError>> {
3000    // add a prefix to parameters to efficiently prevent name collisions
3001    let p_path_node = node;
3002    let p_path_vmid = vmid;
3003    let p_body_lxc_snapshot_request = lxc_snapshot_request;
3004
3005    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/snapshot", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3006    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3007
3008    if let Some(ref user_agent) = configuration.user_agent {
3009        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3010    }
3011    if let Some(ref apikey) = configuration.api_key {
3012        let key = apikey.key.clone();
3013        let value = match apikey.prefix {
3014            Some(ref prefix) => format!("{} {}", prefix, key),
3015            None => key,
3016        };
3017        req_builder = req_builder.header("Authorization", value);
3018    };
3019    if let Some(ref apikey) = configuration.api_key {
3020        let key = apikey.key.clone();
3021        let value = match apikey.prefix {
3022            Some(ref prefix) => format!("{} {}", prefix, key),
3023            None => key,
3024        };
3025        req_builder = req_builder.header("CSRFPreventionToken", value);
3026    };
3027    req_builder = req_builder.json(&p_body_lxc_snapshot_request);
3028
3029    let req = req_builder.build()?;
3030    let resp = configuration.client.execute(req).await?;
3031
3032    let status = resp.status();
3033    let content_type = resp
3034        .headers()
3035        .get("content-type")
3036        .and_then(|v| v.to_str().ok())
3037        .unwrap_or("application/octet-stream");
3038    let content_type = super::ContentType::from(content_type);
3039
3040    if !status.is_client_error() && !status.is_server_error() {
3041        let content = resp.text().await?;
3042        match content_type {
3043            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3044            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcSnapshotResponse`"))),
3045            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::LxcSnapshotResponse`")))),
3046        }
3047    } else {
3048        let content = resp.text().await?;
3049        let entity: Option<LxcSnapshotError> = serde_json::from_str(&content).ok();
3050        Err(Error::ResponseError(ResponseContent { status, content, entity }))
3051    }
3052}
3053
3054/// 
3055pub async fn lxc_snapshot_cmd_idx(configuration: &configuration::Configuration, node: &str, snapname: &str, vmid: i32) -> Result<models::LxcSnapshotCmdIdxResponse, Error<LxcSnapshotCmdIdxError>> {
3056    // add a prefix to parameters to efficiently prevent name collisions
3057    let p_path_node = node;
3058    let p_path_snapname = snapname;
3059    let p_path_vmid = vmid;
3060
3061    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/snapshot/{snapname}", configuration.base_path, node=crate::apis::urlencode(p_path_node), snapname=crate::apis::urlencode(p_path_snapname), vmid=p_path_vmid);
3062    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3063
3064    if let Some(ref user_agent) = configuration.user_agent {
3065        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3066    }
3067    if let Some(ref apikey) = configuration.api_key {
3068        let key = apikey.key.clone();
3069        let value = match apikey.prefix {
3070            Some(ref prefix) => format!("{} {}", prefix, key),
3071            None => key,
3072        };
3073        req_builder = req_builder.header("Authorization", value);
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("CSRFPreventionToken", value);
3082    };
3083
3084    let req = req_builder.build()?;
3085    let resp = configuration.client.execute(req).await?;
3086
3087    let status = resp.status();
3088    let content_type = resp
3089        .headers()
3090        .get("content-type")
3091        .and_then(|v| v.to_str().ok())
3092        .unwrap_or("application/octet-stream");
3093    let content_type = super::ContentType::from(content_type);
3094
3095    if !status.is_client_error() && !status.is_server_error() {
3096        let content = resp.text().await?;
3097        match content_type {
3098            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3099            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcSnapshotCmdIdxResponse`"))),
3100            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::LxcSnapshotCmdIdxResponse`")))),
3101        }
3102    } else {
3103        let content = resp.text().await?;
3104        let entity: Option<LxcSnapshotCmdIdxError> = serde_json::from_str(&content).ok();
3105        Err(Error::ResponseError(ResponseContent { status, content, entity }))
3106    }
3107}
3108
3109/// Returns a SPICE configuration to connect to the CT.
3110pub async fn lxc_spiceproxy(configuration: &configuration::Configuration, node: &str, vmid: i32, lxc_spiceproxy_request: Option<models::LxcSpiceproxyRequest>) -> Result<models::LxcSpiceproxyResponse, Error<LxcSpiceproxyError>> {
3111    // add a prefix to parameters to efficiently prevent name collisions
3112    let p_path_node = node;
3113    let p_path_vmid = vmid;
3114    let p_body_lxc_spiceproxy_request = lxc_spiceproxy_request;
3115
3116    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/spiceproxy", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3117    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3118
3119    if let Some(ref user_agent) = configuration.user_agent {
3120        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3121    }
3122    if let Some(ref apikey) = configuration.api_key {
3123        let key = apikey.key.clone();
3124        let value = match apikey.prefix {
3125            Some(ref prefix) => format!("{} {}", prefix, key),
3126            None => key,
3127        };
3128        req_builder = req_builder.header("Authorization", value);
3129    };
3130    if let Some(ref apikey) = configuration.api_key {
3131        let key = apikey.key.clone();
3132        let value = match apikey.prefix {
3133            Some(ref prefix) => format!("{} {}", prefix, key),
3134            None => key,
3135        };
3136        req_builder = req_builder.header("CSRFPreventionToken", value);
3137    };
3138    req_builder = req_builder.json(&p_body_lxc_spiceproxy_request);
3139
3140    let req = req_builder.build()?;
3141    let resp = configuration.client.execute(req).await?;
3142
3143    let status = resp.status();
3144    let content_type = resp
3145        .headers()
3146        .get("content-type")
3147        .and_then(|v| v.to_str().ok())
3148        .unwrap_or("application/octet-stream");
3149    let content_type = super::ContentType::from(content_type);
3150
3151    if !status.is_client_error() && !status.is_server_error() {
3152        let content = resp.text().await?;
3153        match content_type {
3154            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3155            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcSpiceproxyResponse`"))),
3156            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::LxcSpiceproxyResponse`")))),
3157        }
3158    } else {
3159        let content = resp.text().await?;
3160        let entity: Option<LxcSpiceproxyError> = serde_json::from_str(&content).ok();
3161        Err(Error::ResponseError(ResponseContent { status, content, entity }))
3162    }
3163}
3164
3165/// Create a Template.  Permissions: You need 'VM.Allocate' permissions on /vms/{vmid}
3166pub async fn lxc_template(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::LxcTemplateResponse, Error<LxcTemplateError>> {
3167    // add a prefix to parameters to efficiently prevent name collisions
3168    let p_path_node = node;
3169    let p_path_vmid = vmid;
3170
3171    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/template", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3172    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3173
3174    if let Some(ref user_agent) = configuration.user_agent {
3175        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3176    }
3177    if let Some(ref apikey) = configuration.api_key {
3178        let key = apikey.key.clone();
3179        let value = match apikey.prefix {
3180            Some(ref prefix) => format!("{} {}", prefix, key),
3181            None => key,
3182        };
3183        req_builder = req_builder.header("Authorization", value);
3184    };
3185    if let Some(ref apikey) = configuration.api_key {
3186        let key = apikey.key.clone();
3187        let value = match apikey.prefix {
3188            Some(ref prefix) => format!("{} {}", prefix, key),
3189            None => key,
3190        };
3191        req_builder = req_builder.header("CSRFPreventionToken", value);
3192    };
3193
3194    let req = req_builder.build()?;
3195    let resp = configuration.client.execute(req).await?;
3196
3197    let status = resp.status();
3198    let content_type = resp
3199        .headers()
3200        .get("content-type")
3201        .and_then(|v| v.to_str().ok())
3202        .unwrap_or("application/octet-stream");
3203    let content_type = super::ContentType::from(content_type);
3204
3205    if !status.is_client_error() && !status.is_server_error() {
3206        let content = resp.text().await?;
3207        match content_type {
3208            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3209            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcTemplateResponse`"))),
3210            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::LxcTemplateResponse`")))),
3211        }
3212    } else {
3213        let content = resp.text().await?;
3214        let entity: Option<LxcTemplateError> = serde_json::from_str(&content).ok();
3215        Err(Error::ResponseError(ResponseContent { status, content, entity }))
3216    }
3217}
3218
3219/// Creates a TCP proxy connection.
3220pub async fn lxc_termproxy(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::LxcTermproxyResponse, Error<LxcTermproxyError>> {
3221    // add a prefix to parameters to efficiently prevent name collisions
3222    let p_path_node = node;
3223    let p_path_vmid = vmid;
3224
3225    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/termproxy", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3226    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3227
3228    if let Some(ref user_agent) = configuration.user_agent {
3229        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3230    }
3231    if let Some(ref apikey) = configuration.api_key {
3232        let key = apikey.key.clone();
3233        let value = match apikey.prefix {
3234            Some(ref prefix) => format!("{} {}", prefix, key),
3235            None => key,
3236        };
3237        req_builder = req_builder.header("Authorization", value);
3238    };
3239    if let Some(ref apikey) = configuration.api_key {
3240        let key = apikey.key.clone();
3241        let value = match apikey.prefix {
3242            Some(ref prefix) => format!("{} {}", prefix, key),
3243            None => key,
3244        };
3245        req_builder = req_builder.header("CSRFPreventionToken", value);
3246    };
3247
3248    let req = req_builder.build()?;
3249    let resp = configuration.client.execute(req).await?;
3250
3251    let status = resp.status();
3252    let content_type = resp
3253        .headers()
3254        .get("content-type")
3255        .and_then(|v| v.to_str().ok())
3256        .unwrap_or("application/octet-stream");
3257    let content_type = super::ContentType::from(content_type);
3258
3259    if !status.is_client_error() && !status.is_server_error() {
3260        let content = resp.text().await?;
3261        match content_type {
3262            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3263            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcTermproxyResponse`"))),
3264            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::LxcTermproxyResponse`")))),
3265        }
3266    } else {
3267        let content = resp.text().await?;
3268        let entity: Option<LxcTermproxyError> = serde_json::from_str(&content).ok();
3269        Err(Error::ResponseError(ResponseContent { status, content, entity }))
3270    }
3271}
3272
3273/// Update IP or Network alias.
3274pub async fn lxc_update_alias(configuration: &configuration::Configuration, name: &str, node: &str, vmid: i32, cluster_firewall_update_alias_request: models::ClusterFirewallUpdateAliasRequest) -> Result<models::LxcUpdateAliasResponse, Error<LxcUpdateAliasError>> {
3275    // add a prefix to parameters to efficiently prevent name collisions
3276    let p_path_name = name;
3277    let p_path_node = node;
3278    let p_path_vmid = vmid;
3279    let p_body_cluster_firewall_update_alias_request = cluster_firewall_update_alias_request;
3280
3281    let uri_str = format!("{}/nodes/{node}/lxc/{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);
3282    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3283
3284    if let Some(ref user_agent) = configuration.user_agent {
3285        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3286    }
3287    if let Some(ref apikey) = configuration.api_key {
3288        let key = apikey.key.clone();
3289        let value = match apikey.prefix {
3290            Some(ref prefix) => format!("{} {}", prefix, key),
3291            None => key,
3292        };
3293        req_builder = req_builder.header("Authorization", value);
3294    };
3295    if let Some(ref apikey) = configuration.api_key {
3296        let key = apikey.key.clone();
3297        let value = match apikey.prefix {
3298            Some(ref prefix) => format!("{} {}", prefix, key),
3299            None => key,
3300        };
3301        req_builder = req_builder.header("CSRFPreventionToken", value);
3302    };
3303    req_builder = req_builder.json(&p_body_cluster_firewall_update_alias_request);
3304
3305    let req = req_builder.build()?;
3306    let resp = configuration.client.execute(req).await?;
3307
3308    let status = resp.status();
3309    let content_type = resp
3310        .headers()
3311        .get("content-type")
3312        .and_then(|v| v.to_str().ok())
3313        .unwrap_or("application/octet-stream");
3314    let content_type = super::ContentType::from(content_type);
3315
3316    if !status.is_client_error() && !status.is_server_error() {
3317        let content = resp.text().await?;
3318        match content_type {
3319            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3320            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcUpdateAliasResponse`"))),
3321            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::LxcUpdateAliasResponse`")))),
3322        }
3323    } else {
3324        let content = resp.text().await?;
3325        let entity: Option<LxcUpdateAliasError> = serde_json::from_str(&content).ok();
3326        Err(Error::ResponseError(ResponseContent { status, content, entity }))
3327    }
3328}
3329
3330/// Update IP or Network settings
3331pub async fn lxc_update_ip(configuration: &configuration::Configuration, cidr: &str, name: &str, node: &str, vmid: i32, cluster_firewall_update_ip_request: Option<models::ClusterFirewallUpdateIpRequest>) -> Result<models::LxcUpdateIpResponse, Error<LxcUpdateIpError>> {
3332    // add a prefix to parameters to efficiently prevent name collisions
3333    let p_path_cidr = cidr;
3334    let p_path_name = name;
3335    let p_path_node = node;
3336    let p_path_vmid = vmid;
3337    let p_body_cluster_firewall_update_ip_request = cluster_firewall_update_ip_request;
3338
3339    let uri_str = format!("{}/nodes/{node}/lxc/{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);
3340    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3341
3342    if let Some(ref user_agent) = configuration.user_agent {
3343        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3344    }
3345    if let Some(ref apikey) = configuration.api_key {
3346        let key = apikey.key.clone();
3347        let value = match apikey.prefix {
3348            Some(ref prefix) => format!("{} {}", prefix, key),
3349            None => key,
3350        };
3351        req_builder = req_builder.header("Authorization", value);
3352    };
3353    if let Some(ref apikey) = configuration.api_key {
3354        let key = apikey.key.clone();
3355        let value = match apikey.prefix {
3356            Some(ref prefix) => format!("{} {}", prefix, key),
3357            None => key,
3358        };
3359        req_builder = req_builder.header("CSRFPreventionToken", value);
3360    };
3361    req_builder = req_builder.json(&p_body_cluster_firewall_update_ip_request);
3362
3363    let req = req_builder.build()?;
3364    let resp = configuration.client.execute(req).await?;
3365
3366    let status = resp.status();
3367    let content_type = resp
3368        .headers()
3369        .get("content-type")
3370        .and_then(|v| v.to_str().ok())
3371        .unwrap_or("application/octet-stream");
3372    let content_type = super::ContentType::from(content_type);
3373
3374    if !status.is_client_error() && !status.is_server_error() {
3375        let content = resp.text().await?;
3376        match content_type {
3377            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3378            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcUpdateIpResponse`"))),
3379            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::LxcUpdateIpResponse`")))),
3380        }
3381    } else {
3382        let content = resp.text().await?;
3383        let entity: Option<LxcUpdateIpError> = serde_json::from_str(&content).ok();
3384        Err(Error::ResponseError(ResponseContent { status, content, entity }))
3385    }
3386}
3387
3388/// Modify rule data.
3389pub async fn lxc_update_rule(configuration: &configuration::Configuration, node: &str, pos: i64, vmid: i32, cluster_firewall_update_rule_request: Option<models::ClusterFirewallUpdateRuleRequest>) -> Result<models::LxcUpdateRuleResponse, Error<LxcUpdateRuleError>> {
3390    // add a prefix to parameters to efficiently prevent name collisions
3391    let p_path_node = node;
3392    let p_path_pos = pos;
3393    let p_path_vmid = vmid;
3394    let p_body_cluster_firewall_update_rule_request = cluster_firewall_update_rule_request;
3395
3396    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/firewall/rules/{pos}", configuration.base_path, node=crate::apis::urlencode(p_path_node), pos=p_path_pos, vmid=p_path_vmid);
3397    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3398
3399    if let Some(ref user_agent) = configuration.user_agent {
3400        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3401    }
3402    if let Some(ref apikey) = configuration.api_key {
3403        let key = apikey.key.clone();
3404        let value = match apikey.prefix {
3405            Some(ref prefix) => format!("{} {}", prefix, key),
3406            None => key,
3407        };
3408        req_builder = req_builder.header("Authorization", value);
3409    };
3410    if let Some(ref apikey) = configuration.api_key {
3411        let key = apikey.key.clone();
3412        let value = match apikey.prefix {
3413            Some(ref prefix) => format!("{} {}", prefix, key),
3414            None => key,
3415        };
3416        req_builder = req_builder.header("CSRFPreventionToken", value);
3417    };
3418    req_builder = req_builder.json(&p_body_cluster_firewall_update_rule_request);
3419
3420    let req = req_builder.build()?;
3421    let resp = configuration.client.execute(req).await?;
3422
3423    let status = resp.status();
3424    let content_type = resp
3425        .headers()
3426        .get("content-type")
3427        .and_then(|v| v.to_str().ok())
3428        .unwrap_or("application/octet-stream");
3429    let content_type = super::ContentType::from(content_type);
3430
3431    if !status.is_client_error() && !status.is_server_error() {
3432        let content = resp.text().await?;
3433        match content_type {
3434            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3435            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcUpdateRuleResponse`"))),
3436            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::LxcUpdateRuleResponse`")))),
3437        }
3438    } else {
3439        let content = resp.text().await?;
3440        let entity: Option<LxcUpdateRuleError> = serde_json::from_str(&content).ok();
3441        Err(Error::ResponseError(ResponseContent { status, content, entity }))
3442    }
3443}
3444
3445/// Update snapshot metadata.
3446pub async fn lxc_update_snapshot_config(configuration: &configuration::Configuration, node: &str, snapname: &str, vmid: i32, lxc_update_snapshot_config_request: Option<models::LxcUpdateSnapshotConfigRequest>) -> Result<models::LxcUpdateSnapshotConfigResponse, Error<LxcUpdateSnapshotConfigError>> {
3447    // add a prefix to parameters to efficiently prevent name collisions
3448    let p_path_node = node;
3449    let p_path_snapname = snapname;
3450    let p_path_vmid = vmid;
3451    let p_body_lxc_update_snapshot_config_request = lxc_update_snapshot_config_request;
3452
3453    let uri_str = format!("{}/nodes/{node}/lxc/{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);
3454    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3455
3456    if let Some(ref user_agent) = configuration.user_agent {
3457        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3458    }
3459    if let Some(ref apikey) = configuration.api_key {
3460        let key = apikey.key.clone();
3461        let value = match apikey.prefix {
3462            Some(ref prefix) => format!("{} {}", prefix, key),
3463            None => key,
3464        };
3465        req_builder = req_builder.header("Authorization", value);
3466    };
3467    if let Some(ref apikey) = configuration.api_key {
3468        let key = apikey.key.clone();
3469        let value = match apikey.prefix {
3470            Some(ref prefix) => format!("{} {}", prefix, key),
3471            None => key,
3472        };
3473        req_builder = req_builder.header("CSRFPreventionToken", value);
3474    };
3475    req_builder = req_builder.json(&p_body_lxc_update_snapshot_config_request);
3476
3477    let req = req_builder.build()?;
3478    let resp = configuration.client.execute(req).await?;
3479
3480    let status = resp.status();
3481    let content_type = resp
3482        .headers()
3483        .get("content-type")
3484        .and_then(|v| v.to_str().ok())
3485        .unwrap_or("application/octet-stream");
3486    let content_type = super::ContentType::from(content_type);
3487
3488    if !status.is_client_error() && !status.is_server_error() {
3489        let content = resp.text().await?;
3490        match content_type {
3491            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3492            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcUpdateSnapshotConfigResponse`"))),
3493            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::LxcUpdateSnapshotConfigResponse`")))),
3494        }
3495    } else {
3496        let content = resp.text().await?;
3497        let entity: Option<LxcUpdateSnapshotConfigError> = serde_json::from_str(&content).ok();
3498        Err(Error::ResponseError(ResponseContent { status, content, entity }))
3499    }
3500}
3501
3502/// Set container options.  Permissions: non-volume mount points in rootfs and mp[n] are restricted to root@pam
3503pub async fn lxc_update_vm(configuration: &configuration::Configuration, node: &str, vmid: i32, lxc_update_vm_request: Option<models::LxcUpdateVmRequest>) -> Result<models::LxcUpdateVmResponse, Error<LxcUpdateVmError>> {
3504    // add a prefix to parameters to efficiently prevent name collisions
3505    let p_path_node = node;
3506    let p_path_vmid = vmid;
3507    let p_body_lxc_update_vm_request = lxc_update_vm_request;
3508
3509    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/config", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3510    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3511
3512    if let Some(ref user_agent) = configuration.user_agent {
3513        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3514    }
3515    if let Some(ref apikey) = configuration.api_key {
3516        let key = apikey.key.clone();
3517        let value = match apikey.prefix {
3518            Some(ref prefix) => format!("{} {}", prefix, key),
3519            None => key,
3520        };
3521        req_builder = req_builder.header("Authorization", value);
3522    };
3523    if let Some(ref apikey) = configuration.api_key {
3524        let key = apikey.key.clone();
3525        let value = match apikey.prefix {
3526            Some(ref prefix) => format!("{} {}", prefix, key),
3527            None => key,
3528        };
3529        req_builder = req_builder.header("CSRFPreventionToken", value);
3530    };
3531    req_builder = req_builder.json(&p_body_lxc_update_vm_request);
3532
3533    let req = req_builder.build()?;
3534    let resp = configuration.client.execute(req).await?;
3535
3536    let status = resp.status();
3537    let content_type = resp
3538        .headers()
3539        .get("content-type")
3540        .and_then(|v| v.to_str().ok())
3541        .unwrap_or("application/octet-stream");
3542    let content_type = super::ContentType::from(content_type);
3543
3544    if !status.is_client_error() && !status.is_server_error() {
3545        let content = resp.text().await?;
3546        match content_type {
3547            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3548            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcUpdateVmResponse`"))),
3549            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::LxcUpdateVmResponse`")))),
3550        }
3551    } else {
3552        let content = resp.text().await?;
3553        let entity: Option<LxcUpdateVmError> = serde_json::from_str(&content).ok();
3554        Err(Error::ResponseError(ResponseContent { status, content, entity }))
3555    }
3556}
3557
3558/// Get container configuration.
3559pub async fn lxc_vm_config(configuration: &configuration::Configuration, node: &str, vmid: i32, current: Option<&str>, snapshot: Option<&str>) -> Result<models::LxcVmConfigResponse, Error<LxcVmConfigError>> {
3560    // add a prefix to parameters to efficiently prevent name collisions
3561    let p_path_node = node;
3562    let p_path_vmid = vmid;
3563    let p_query_current = current;
3564    let p_query_snapshot = snapshot;
3565
3566    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/config", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3567    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3568
3569    if let Some(ref param_value) = p_query_current {
3570        req_builder = req_builder.query(&[("current", &param_value.to_string())]);
3571    }
3572    if let Some(ref param_value) = p_query_snapshot {
3573        req_builder = req_builder.query(&[("snapshot", &param_value.to_string())]);
3574    }
3575    if let Some(ref user_agent) = configuration.user_agent {
3576        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3577    }
3578    if let Some(ref apikey) = configuration.api_key {
3579        let key = apikey.key.clone();
3580        let value = match apikey.prefix {
3581            Some(ref prefix) => format!("{} {}", prefix, key),
3582            None => key,
3583        };
3584        req_builder = req_builder.header("Authorization", value);
3585    };
3586    if let Some(ref apikey) = configuration.api_key {
3587        let key = apikey.key.clone();
3588        let value = match apikey.prefix {
3589            Some(ref prefix) => format!("{} {}", prefix, key),
3590            None => key,
3591        };
3592        req_builder = req_builder.header("CSRFPreventionToken", value);
3593    };
3594
3595    let req = req_builder.build()?;
3596    let resp = configuration.client.execute(req).await?;
3597
3598    let status = resp.status();
3599    let content_type = resp
3600        .headers()
3601        .get("content-type")
3602        .and_then(|v| v.to_str().ok())
3603        .unwrap_or("application/octet-stream");
3604    let content_type = super::ContentType::from(content_type);
3605
3606    if !status.is_client_error() && !status.is_server_error() {
3607        let content = resp.text().await?;
3608        match content_type {
3609            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3610            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcVmConfigResponse`"))),
3611            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::LxcVmConfigResponse`")))),
3612        }
3613    } else {
3614        let content = resp.text().await?;
3615        let entity: Option<LxcVmConfigError> = serde_json::from_str(&content).ok();
3616        Err(Error::ResponseError(ResponseContent { status, content, entity }))
3617    }
3618}
3619
3620/// Check if feature for virtual machine is available.
3621pub async fn lxc_vm_feature(configuration: &configuration::Configuration, feature: models::PveFeatureEnum, node: &str, vmid: i32, snapname: Option<&str>) -> Result<models::LxcVmFeatureResponse, Error<LxcVmFeatureError>> {
3622    // add a prefix to parameters to efficiently prevent name collisions
3623    let p_query_feature = feature;
3624    let p_path_node = node;
3625    let p_path_vmid = vmid;
3626    let p_query_snapname = snapname;
3627
3628    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/feature", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3629    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3630
3631    req_builder = req_builder.query(&[("feature", &p_query_feature.to_string())]);
3632    if let Some(ref param_value) = p_query_snapname {
3633        req_builder = req_builder.query(&[("snapname", &param_value.to_string())]);
3634    }
3635    if let Some(ref user_agent) = configuration.user_agent {
3636        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3637    }
3638    if let Some(ref apikey) = configuration.api_key {
3639        let key = apikey.key.clone();
3640        let value = match apikey.prefix {
3641            Some(ref prefix) => format!("{} {}", prefix, key),
3642            None => key,
3643        };
3644        req_builder = req_builder.header("Authorization", value);
3645    };
3646    if let Some(ref apikey) = configuration.api_key {
3647        let key = apikey.key.clone();
3648        let value = match apikey.prefix {
3649            Some(ref prefix) => format!("{} {}", prefix, key),
3650            None => key,
3651        };
3652        req_builder = req_builder.header("CSRFPreventionToken", value);
3653    };
3654
3655    let req = req_builder.build()?;
3656    let resp = configuration.client.execute(req).await?;
3657
3658    let status = resp.status();
3659    let content_type = resp
3660        .headers()
3661        .get("content-type")
3662        .and_then(|v| v.to_str().ok())
3663        .unwrap_or("application/octet-stream");
3664    let content_type = super::ContentType::from(content_type);
3665
3666    if !status.is_client_error() && !status.is_server_error() {
3667        let content = resp.text().await?;
3668        match content_type {
3669            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3670            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcVmFeatureResponse`"))),
3671            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::LxcVmFeatureResponse`")))),
3672        }
3673    } else {
3674        let content = resp.text().await?;
3675        let entity: Option<LxcVmFeatureError> = serde_json::from_str(&content).ok();
3676        Err(Error::ResponseError(ResponseContent { status, content, entity }))
3677    }
3678}
3679
3680/// Get container configuration, including pending changes.
3681pub async fn lxc_vm_pending(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::LxcVmPendingResponse, Error<LxcVmPendingError>> {
3682    // add a prefix to parameters to efficiently prevent name collisions
3683    let p_path_node = node;
3684    let p_path_vmid = vmid;
3685
3686    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/pending", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3687    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3688
3689    if let Some(ref user_agent) = configuration.user_agent {
3690        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3691    }
3692    if let Some(ref apikey) = configuration.api_key {
3693        let key = apikey.key.clone();
3694        let value = match apikey.prefix {
3695            Some(ref prefix) => format!("{} {}", prefix, key),
3696            None => key,
3697        };
3698        req_builder = req_builder.header("Authorization", value);
3699    };
3700    if let Some(ref apikey) = configuration.api_key {
3701        let key = apikey.key.clone();
3702        let value = match apikey.prefix {
3703            Some(ref prefix) => format!("{} {}", prefix, key),
3704            None => key,
3705        };
3706        req_builder = req_builder.header("CSRFPreventionToken", value);
3707    };
3708
3709    let req = req_builder.build()?;
3710    let resp = configuration.client.execute(req).await?;
3711
3712    let status = resp.status();
3713    let content_type = resp
3714        .headers()
3715        .get("content-type")
3716        .and_then(|v| v.to_str().ok())
3717        .unwrap_or("application/octet-stream");
3718    let content_type = super::ContentType::from(content_type);
3719
3720    if !status.is_client_error() && !status.is_server_error() {
3721        let content = resp.text().await?;
3722        match content_type {
3723            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3724            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcVmPendingResponse`"))),
3725            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::LxcVmPendingResponse`")))),
3726        }
3727    } else {
3728        let content = resp.text().await?;
3729        let entity: Option<LxcVmPendingError> = serde_json::from_str(&content).ok();
3730        Err(Error::ResponseError(ResponseContent { status, content, entity }))
3731    }
3732}
3733
3734/// Reboot the container by shutting it down, and starting it again. Applies pending changes.
3735pub async fn lxc_vm_reboot(configuration: &configuration::Configuration, node: &str, vmid: i32, lxc_vm_reboot_request: Option<models::LxcVmRebootRequest>) -> Result<models::LxcVmRebootResponse, Error<LxcVmRebootError>> {
3736    // add a prefix to parameters to efficiently prevent name collisions
3737    let p_path_node = node;
3738    let p_path_vmid = vmid;
3739    let p_body_lxc_vm_reboot_request = lxc_vm_reboot_request;
3740
3741    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/status/reboot", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3742    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3743
3744    if let Some(ref user_agent) = configuration.user_agent {
3745        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3746    }
3747    if let Some(ref apikey) = configuration.api_key {
3748        let key = apikey.key.clone();
3749        let value = match apikey.prefix {
3750            Some(ref prefix) => format!("{} {}", prefix, key),
3751            None => key,
3752        };
3753        req_builder = req_builder.header("Authorization", value);
3754    };
3755    if let Some(ref apikey) = configuration.api_key {
3756        let key = apikey.key.clone();
3757        let value = match apikey.prefix {
3758            Some(ref prefix) => format!("{} {}", prefix, key),
3759            None => key,
3760        };
3761        req_builder = req_builder.header("CSRFPreventionToken", value);
3762    };
3763    req_builder = req_builder.json(&p_body_lxc_vm_reboot_request);
3764
3765    let req = req_builder.build()?;
3766    let resp = configuration.client.execute(req).await?;
3767
3768    let status = resp.status();
3769    let content_type = resp
3770        .headers()
3771        .get("content-type")
3772        .and_then(|v| v.to_str().ok())
3773        .unwrap_or("application/octet-stream");
3774    let content_type = super::ContentType::from(content_type);
3775
3776    if !status.is_client_error() && !status.is_server_error() {
3777        let content = resp.text().await?;
3778        match content_type {
3779            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3780            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcVmRebootResponse`"))),
3781            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::LxcVmRebootResponse`")))),
3782        }
3783    } else {
3784        let content = resp.text().await?;
3785        let entity: Option<LxcVmRebootError> = serde_json::from_str(&content).ok();
3786        Err(Error::ResponseError(ResponseContent { status, content, entity }))
3787    }
3788}
3789
3790/// Resume the container.
3791pub async fn lxc_vm_resume(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::LxcVmResumeResponse, Error<LxcVmResumeError>> {
3792    // add a prefix to parameters to efficiently prevent name collisions
3793    let p_path_node = node;
3794    let p_path_vmid = vmid;
3795
3796    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/status/resume", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3797    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3798
3799    if let Some(ref user_agent) = configuration.user_agent {
3800        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3801    }
3802    if let Some(ref apikey) = configuration.api_key {
3803        let key = apikey.key.clone();
3804        let value = match apikey.prefix {
3805            Some(ref prefix) => format!("{} {}", prefix, key),
3806            None => key,
3807        };
3808        req_builder = req_builder.header("Authorization", value);
3809    };
3810    if let Some(ref apikey) = configuration.api_key {
3811        let key = apikey.key.clone();
3812        let value = match apikey.prefix {
3813            Some(ref prefix) => format!("{} {}", prefix, key),
3814            None => key,
3815        };
3816        req_builder = req_builder.header("CSRFPreventionToken", value);
3817    };
3818
3819    let req = req_builder.build()?;
3820    let resp = configuration.client.execute(req).await?;
3821
3822    let status = resp.status();
3823    let content_type = resp
3824        .headers()
3825        .get("content-type")
3826        .and_then(|v| v.to_str().ok())
3827        .unwrap_or("application/octet-stream");
3828    let content_type = super::ContentType::from(content_type);
3829
3830    if !status.is_client_error() && !status.is_server_error() {
3831        let content = resp.text().await?;
3832        match content_type {
3833            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3834            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcVmResumeResponse`"))),
3835            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::LxcVmResumeResponse`")))),
3836        }
3837    } else {
3838        let content = resp.text().await?;
3839        let entity: Option<LxcVmResumeError> = serde_json::from_str(&content).ok();
3840        Err(Error::ResponseError(ResponseContent { status, content, entity }))
3841    }
3842}
3843
3844/// Shutdown the container. This will trigger a clean shutdown of the container, see lxc-stop(1) for details.
3845pub async fn lxc_vm_shutdown(configuration: &configuration::Configuration, node: &str, vmid: i32, lxc_vm_shutdown_request: Option<models::LxcVmShutdownRequest>) -> Result<models::LxcVmShutdownResponse, Error<LxcVmShutdownError>> {
3846    // add a prefix to parameters to efficiently prevent name collisions
3847    let p_path_node = node;
3848    let p_path_vmid = vmid;
3849    let p_body_lxc_vm_shutdown_request = lxc_vm_shutdown_request;
3850
3851    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/status/shutdown", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3852    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3853
3854    if let Some(ref user_agent) = configuration.user_agent {
3855        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3856    }
3857    if let Some(ref apikey) = configuration.api_key {
3858        let key = apikey.key.clone();
3859        let value = match apikey.prefix {
3860            Some(ref prefix) => format!("{} {}", prefix, key),
3861            None => key,
3862        };
3863        req_builder = req_builder.header("Authorization", value);
3864    };
3865    if let Some(ref apikey) = configuration.api_key {
3866        let key = apikey.key.clone();
3867        let value = match apikey.prefix {
3868            Some(ref prefix) => format!("{} {}", prefix, key),
3869            None => key,
3870        };
3871        req_builder = req_builder.header("CSRFPreventionToken", value);
3872    };
3873    req_builder = req_builder.json(&p_body_lxc_vm_shutdown_request);
3874
3875    let req = req_builder.build()?;
3876    let resp = configuration.client.execute(req).await?;
3877
3878    let status = resp.status();
3879    let content_type = resp
3880        .headers()
3881        .get("content-type")
3882        .and_then(|v| v.to_str().ok())
3883        .unwrap_or("application/octet-stream");
3884    let content_type = super::ContentType::from(content_type);
3885
3886    if !status.is_client_error() && !status.is_server_error() {
3887        let content = resp.text().await?;
3888        match content_type {
3889            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3890            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcVmShutdownResponse`"))),
3891            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::LxcVmShutdownResponse`")))),
3892        }
3893    } else {
3894        let content = resp.text().await?;
3895        let entity: Option<LxcVmShutdownError> = serde_json::from_str(&content).ok();
3896        Err(Error::ResponseError(ResponseContent { status, content, entity }))
3897    }
3898}
3899
3900/// Start the container.
3901pub async fn lxc_vm_start(configuration: &configuration::Configuration, node: &str, vmid: i32, lxc_vm_start_request: Option<models::LxcVmStartRequest>) -> Result<models::LxcVmStartResponse, Error<LxcVmStartError>> {
3902    // add a prefix to parameters to efficiently prevent name collisions
3903    let p_path_node = node;
3904    let p_path_vmid = vmid;
3905    let p_body_lxc_vm_start_request = lxc_vm_start_request;
3906
3907    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/status/start", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3908    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3909
3910    if let Some(ref user_agent) = configuration.user_agent {
3911        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3912    }
3913    if let Some(ref apikey) = configuration.api_key {
3914        let key = apikey.key.clone();
3915        let value = match apikey.prefix {
3916            Some(ref prefix) => format!("{} {}", prefix, key),
3917            None => key,
3918        };
3919        req_builder = req_builder.header("Authorization", value);
3920    };
3921    if let Some(ref apikey) = configuration.api_key {
3922        let key = apikey.key.clone();
3923        let value = match apikey.prefix {
3924            Some(ref prefix) => format!("{} {}", prefix, key),
3925            None => key,
3926        };
3927        req_builder = req_builder.header("CSRFPreventionToken", value);
3928    };
3929    req_builder = req_builder.json(&p_body_lxc_vm_start_request);
3930
3931    let req = req_builder.build()?;
3932    let resp = configuration.client.execute(req).await?;
3933
3934    let status = resp.status();
3935    let content_type = resp
3936        .headers()
3937        .get("content-type")
3938        .and_then(|v| v.to_str().ok())
3939        .unwrap_or("application/octet-stream");
3940    let content_type = super::ContentType::from(content_type);
3941
3942    if !status.is_client_error() && !status.is_server_error() {
3943        let content = resp.text().await?;
3944        match content_type {
3945            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3946            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcVmStartResponse`"))),
3947            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::LxcVmStartResponse`")))),
3948        }
3949    } else {
3950        let content = resp.text().await?;
3951        let entity: Option<LxcVmStartError> = serde_json::from_str(&content).ok();
3952        Err(Error::ResponseError(ResponseContent { status, content, entity }))
3953    }
3954}
3955
3956/// Get virtual machine status.
3957pub async fn lxc_vm_status(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::LxcVmStatusResponse, Error<LxcVmStatusError>> {
3958    // add a prefix to parameters to efficiently prevent name collisions
3959    let p_path_node = node;
3960    let p_path_vmid = vmid;
3961
3962    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/status/current", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
3963    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3964
3965    if let Some(ref user_agent) = configuration.user_agent {
3966        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3967    }
3968    if let Some(ref apikey) = configuration.api_key {
3969        let key = apikey.key.clone();
3970        let value = match apikey.prefix {
3971            Some(ref prefix) => format!("{} {}", prefix, key),
3972            None => key,
3973        };
3974        req_builder = req_builder.header("Authorization", value);
3975    };
3976    if let Some(ref apikey) = configuration.api_key {
3977        let key = apikey.key.clone();
3978        let value = match apikey.prefix {
3979            Some(ref prefix) => format!("{} {}", prefix, key),
3980            None => key,
3981        };
3982        req_builder = req_builder.header("CSRFPreventionToken", value);
3983    };
3984
3985    let req = req_builder.build()?;
3986    let resp = configuration.client.execute(req).await?;
3987
3988    let status = resp.status();
3989    let content_type = resp
3990        .headers()
3991        .get("content-type")
3992        .and_then(|v| v.to_str().ok())
3993        .unwrap_or("application/octet-stream");
3994    let content_type = super::ContentType::from(content_type);
3995
3996    if !status.is_client_error() && !status.is_server_error() {
3997        let content = resp.text().await?;
3998        match content_type {
3999            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4000            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcVmStatusResponse`"))),
4001            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::LxcVmStatusResponse`")))),
4002        }
4003    } else {
4004        let content = resp.text().await?;
4005        let entity: Option<LxcVmStatusError> = serde_json::from_str(&content).ok();
4006        Err(Error::ResponseError(ResponseContent { status, content, entity }))
4007    }
4008}
4009
4010/// Stop the container. This will abruptly stop all processes running in the container.
4011pub async fn lxc_vm_stop(configuration: &configuration::Configuration, node: &str, vmid: i32, lxc_vm_stop_request: Option<models::LxcVmStopRequest>) -> Result<models::LxcVmStopResponse, Error<LxcVmStopError>> {
4012    // add a prefix to parameters to efficiently prevent name collisions
4013    let p_path_node = node;
4014    let p_path_vmid = vmid;
4015    let p_body_lxc_vm_stop_request = lxc_vm_stop_request;
4016
4017    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/status/stop", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4018    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4019
4020    if let Some(ref user_agent) = configuration.user_agent {
4021        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4022    }
4023    if let Some(ref apikey) = configuration.api_key {
4024        let key = apikey.key.clone();
4025        let value = match apikey.prefix {
4026            Some(ref prefix) => format!("{} {}", prefix, key),
4027            None => key,
4028        };
4029        req_builder = req_builder.header("Authorization", value);
4030    };
4031    if let Some(ref apikey) = configuration.api_key {
4032        let key = apikey.key.clone();
4033        let value = match apikey.prefix {
4034            Some(ref prefix) => format!("{} {}", prefix, key),
4035            None => key,
4036        };
4037        req_builder = req_builder.header("CSRFPreventionToken", value);
4038    };
4039    req_builder = req_builder.json(&p_body_lxc_vm_stop_request);
4040
4041    let req = req_builder.build()?;
4042    let resp = configuration.client.execute(req).await?;
4043
4044    let status = resp.status();
4045    let content_type = resp
4046        .headers()
4047        .get("content-type")
4048        .and_then(|v| v.to_str().ok())
4049        .unwrap_or("application/octet-stream");
4050    let content_type = super::ContentType::from(content_type);
4051
4052    if !status.is_client_error() && !status.is_server_error() {
4053        let content = resp.text().await?;
4054        match content_type {
4055            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4056            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcVmStopResponse`"))),
4057            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::LxcVmStopResponse`")))),
4058        }
4059    } else {
4060        let content = resp.text().await?;
4061        let entity: Option<LxcVmStopError> = serde_json::from_str(&content).ok();
4062        Err(Error::ResponseError(ResponseContent { status, content, entity }))
4063    }
4064}
4065
4066/// Suspend the container. This is experimental.
4067pub async fn lxc_vm_suspend(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::LxcVmSuspendResponse, Error<LxcVmSuspendError>> {
4068    // add a prefix to parameters to efficiently prevent name collisions
4069    let p_path_node = node;
4070    let p_path_vmid = vmid;
4071
4072    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/status/suspend", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4073    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4074
4075    if let Some(ref user_agent) = configuration.user_agent {
4076        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4077    }
4078    if let Some(ref apikey) = configuration.api_key {
4079        let key = apikey.key.clone();
4080        let value = match apikey.prefix {
4081            Some(ref prefix) => format!("{} {}", prefix, key),
4082            None => key,
4083        };
4084        req_builder = req_builder.header("Authorization", value);
4085    };
4086    if let Some(ref apikey) = configuration.api_key {
4087        let key = apikey.key.clone();
4088        let value = match apikey.prefix {
4089            Some(ref prefix) => format!("{} {}", prefix, key),
4090            None => key,
4091        };
4092        req_builder = req_builder.header("CSRFPreventionToken", value);
4093    };
4094
4095    let req = req_builder.build()?;
4096    let resp = configuration.client.execute(req).await?;
4097
4098    let status = resp.status();
4099    let content_type = resp
4100        .headers()
4101        .get("content-type")
4102        .and_then(|v| v.to_str().ok())
4103        .unwrap_or("application/octet-stream");
4104    let content_type = super::ContentType::from(content_type);
4105
4106    if !status.is_client_error() && !status.is_server_error() {
4107        let content = resp.text().await?;
4108        match content_type {
4109            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4110            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcVmSuspendResponse`"))),
4111            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::LxcVmSuspendResponse`")))),
4112        }
4113    } else {
4114        let content = resp.text().await?;
4115        let entity: Option<LxcVmSuspendError> = serde_json::from_str(&content).ok();
4116        Err(Error::ResponseError(ResponseContent { status, content, entity }))
4117    }
4118}
4119
4120/// Directory index
4121pub async fn lxc_vmcmdidx(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::LxcVmcmdidxResponse, Error<LxcVmcmdidxError>> {
4122    // add a prefix to parameters to efficiently prevent name collisions
4123    let p_path_node = node;
4124    let p_path_vmid = vmid;
4125
4126    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/status", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4127    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4128
4129    if let Some(ref user_agent) = configuration.user_agent {
4130        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4131    }
4132    if let Some(ref apikey) = configuration.api_key {
4133        let key = apikey.key.clone();
4134        let value = match apikey.prefix {
4135            Some(ref prefix) => format!("{} {}", prefix, key),
4136            None => key,
4137        };
4138        req_builder = req_builder.header("Authorization", value);
4139    };
4140    if let Some(ref apikey) = configuration.api_key {
4141        let key = apikey.key.clone();
4142        let value = match apikey.prefix {
4143            Some(ref prefix) => format!("{} {}", prefix, key),
4144            None => key,
4145        };
4146        req_builder = req_builder.header("CSRFPreventionToken", value);
4147    };
4148
4149    let req = req_builder.build()?;
4150    let resp = configuration.client.execute(req).await?;
4151
4152    let status = resp.status();
4153    let content_type = resp
4154        .headers()
4155        .get("content-type")
4156        .and_then(|v| v.to_str().ok())
4157        .unwrap_or("application/octet-stream");
4158    let content_type = super::ContentType::from(content_type);
4159
4160    if !status.is_client_error() && !status.is_server_error() {
4161        let content = resp.text().await?;
4162        match content_type {
4163            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4164            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcVmcmdidxResponse`"))),
4165            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::LxcVmcmdidxResponse`")))),
4166        }
4167    } else {
4168        let content = resp.text().await?;
4169        let entity: Option<LxcVmcmdidxError> = serde_json::from_str(&content).ok();
4170        Err(Error::ResponseError(ResponseContent { status, content, entity }))
4171    }
4172}
4173
4174/// Directory index
4175pub async fn lxc_vmdiridx(configuration: &configuration::Configuration, node: &str, vmid: i32) -> Result<models::LxcVmdiridxResponse, Error<LxcVmdiridxError>> {
4176    // add a prefix to parameters to efficiently prevent name collisions
4177    let p_path_node = node;
4178    let p_path_vmid = vmid;
4179
4180    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4181    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4182
4183    if let Some(ref user_agent) = configuration.user_agent {
4184        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4185    }
4186    if let Some(ref apikey) = configuration.api_key {
4187        let key = apikey.key.clone();
4188        let value = match apikey.prefix {
4189            Some(ref prefix) => format!("{} {}", prefix, key),
4190            None => key,
4191        };
4192        req_builder = req_builder.header("Authorization", value);
4193    };
4194    if let Some(ref apikey) = configuration.api_key {
4195        let key = apikey.key.clone();
4196        let value = match apikey.prefix {
4197            Some(ref prefix) => format!("{} {}", prefix, key),
4198            None => key,
4199        };
4200        req_builder = req_builder.header("CSRFPreventionToken", value);
4201    };
4202
4203    let req = req_builder.build()?;
4204    let resp = configuration.client.execute(req).await?;
4205
4206    let status = resp.status();
4207    let content_type = resp
4208        .headers()
4209        .get("content-type")
4210        .and_then(|v| v.to_str().ok())
4211        .unwrap_or("application/octet-stream");
4212    let content_type = super::ContentType::from(content_type);
4213
4214    if !status.is_client_error() && !status.is_server_error() {
4215        let content = resp.text().await?;
4216        match content_type {
4217            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4218            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcVmdiridxResponse`"))),
4219            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::LxcVmdiridxResponse`")))),
4220        }
4221    } else {
4222        let content = resp.text().await?;
4223        let entity: Option<LxcVmdiridxError> = serde_json::from_str(&content).ok();
4224        Err(Error::ResponseError(ResponseContent { status, content, entity }))
4225    }
4226}
4227
4228/// LXC container index (per node).  Permissions: Only list CTs where you have VM.Audit permission on /vms/<vmid>.
4229pub async fn lxc_vmlist(configuration: &configuration::Configuration, node: &str) -> Result<models::LxcVmlistResponse, Error<LxcVmlistError>> {
4230    // add a prefix to parameters to efficiently prevent name collisions
4231    let p_path_node = node;
4232
4233    let uri_str = format!("{}/nodes/{node}/lxc", configuration.base_path, node=crate::apis::urlencode(p_path_node));
4234    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4235
4236    if let Some(ref user_agent) = configuration.user_agent {
4237        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4238    }
4239    if let Some(ref apikey) = configuration.api_key {
4240        let key = apikey.key.clone();
4241        let value = match apikey.prefix {
4242            Some(ref prefix) => format!("{} {}", prefix, key),
4243            None => key,
4244        };
4245        req_builder = req_builder.header("Authorization", value);
4246    };
4247    if let Some(ref apikey) = configuration.api_key {
4248        let key = apikey.key.clone();
4249        let value = match apikey.prefix {
4250            Some(ref prefix) => format!("{} {}", prefix, key),
4251            None => key,
4252        };
4253        req_builder = req_builder.header("CSRFPreventionToken", value);
4254    };
4255
4256    let req = req_builder.build()?;
4257    let resp = configuration.client.execute(req).await?;
4258
4259    let status = resp.status();
4260    let content_type = resp
4261        .headers()
4262        .get("content-type")
4263        .and_then(|v| v.to_str().ok())
4264        .unwrap_or("application/octet-stream");
4265    let content_type = super::ContentType::from(content_type);
4266
4267    if !status.is_client_error() && !status.is_server_error() {
4268        let content = resp.text().await?;
4269        match content_type {
4270            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4271            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcVmlistResponse`"))),
4272            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::LxcVmlistResponse`")))),
4273        }
4274    } else {
4275        let content = resp.text().await?;
4276        let entity: Option<LxcVmlistError> = serde_json::from_str(&content).ok();
4277        Err(Error::ResponseError(ResponseContent { status, content, entity }))
4278    }
4279}
4280
4281/// Creates a TCP VNC proxy connections.
4282pub async fn lxc_vncproxy(configuration: &configuration::Configuration, node: &str, vmid: i32, lxc_vncproxy_request: Option<models::LxcVncproxyRequest>) -> Result<models::LxcVncproxyResponse, Error<LxcVncproxyError>> {
4283    // add a prefix to parameters to efficiently prevent name collisions
4284    let p_path_node = node;
4285    let p_path_vmid = vmid;
4286    let p_body_lxc_vncproxy_request = lxc_vncproxy_request;
4287
4288    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/vncproxy", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4289    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4290
4291    if let Some(ref user_agent) = configuration.user_agent {
4292        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4293    }
4294    if let Some(ref apikey) = configuration.api_key {
4295        let key = apikey.key.clone();
4296        let value = match apikey.prefix {
4297            Some(ref prefix) => format!("{} {}", prefix, key),
4298            None => key,
4299        };
4300        req_builder = req_builder.header("Authorization", value);
4301    };
4302    if let Some(ref apikey) = configuration.api_key {
4303        let key = apikey.key.clone();
4304        let value = match apikey.prefix {
4305            Some(ref prefix) => format!("{} {}", prefix, key),
4306            None => key,
4307        };
4308        req_builder = req_builder.header("CSRFPreventionToken", value);
4309    };
4310    req_builder = req_builder.json(&p_body_lxc_vncproxy_request);
4311
4312    let req = req_builder.build()?;
4313    let resp = configuration.client.execute(req).await?;
4314
4315    let status = resp.status();
4316    let content_type = resp
4317        .headers()
4318        .get("content-type")
4319        .and_then(|v| v.to_str().ok())
4320        .unwrap_or("application/octet-stream");
4321    let content_type = super::ContentType::from(content_type);
4322
4323    if !status.is_client_error() && !status.is_server_error() {
4324        let content = resp.text().await?;
4325        match content_type {
4326            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4327            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcVncproxyResponse`"))),
4328            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::LxcVncproxyResponse`")))),
4329        }
4330    } else {
4331        let content = resp.text().await?;
4332        let entity: Option<LxcVncproxyError> = serde_json::from_str(&content).ok();
4333        Err(Error::ResponseError(ResponseContent { status, content, entity }))
4334    }
4335}
4336
4337/// Opens a websocket for VNC traffic.  Permissions: You also need to pass a valid ticket (vncticket).  Wire-level note: this endpoint answers HTTP 101 Upgrade, not a JSON body. The 200 schema below is the apidoc-declared shape for tooling, but real clients perform a WebSocket upgrade and exchange framed messages on the resulting socket. See the `x-pve-websocket` extension for the framing and the list of sibling endpoints that issue tickets.
4338pub async fn lxc_vncwebsocket(configuration: &configuration::Configuration, node: &str, port: i32, vmid: i32, vncticket: &str) -> Result<models::LxcVncwebsocketResponse, Error<LxcVncwebsocketError>> {
4339    // add a prefix to parameters to efficiently prevent name collisions
4340    let p_path_node = node;
4341    let p_query_port = port;
4342    let p_path_vmid = vmid;
4343    let p_query_vncticket = vncticket;
4344
4345    let uri_str = format!("{}/nodes/{node}/lxc/{vmid}/vncwebsocket", configuration.base_path, node=crate::apis::urlencode(p_path_node), vmid=p_path_vmid);
4346    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4347
4348    req_builder = req_builder.query(&[("port", &p_query_port.to_string())]);
4349    req_builder = req_builder.query(&[("vncticket", &p_query_vncticket.to_string())]);
4350    if let Some(ref user_agent) = configuration.user_agent {
4351        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4352    }
4353    if let Some(ref apikey) = configuration.api_key {
4354        let key = apikey.key.clone();
4355        let value = match apikey.prefix {
4356            Some(ref prefix) => format!("{} {}", prefix, key),
4357            None => key,
4358        };
4359        req_builder = req_builder.header("Authorization", value);
4360    };
4361    if let Some(ref apikey) = configuration.api_key {
4362        let key = apikey.key.clone();
4363        let value = match apikey.prefix {
4364            Some(ref prefix) => format!("{} {}", prefix, key),
4365            None => key,
4366        };
4367        req_builder = req_builder.header("CSRFPreventionToken", value);
4368    };
4369
4370    let req = req_builder.build()?;
4371    let resp = configuration.client.execute(req).await?;
4372
4373    let status = resp.status();
4374    let content_type = resp
4375        .headers()
4376        .get("content-type")
4377        .and_then(|v| v.to_str().ok())
4378        .unwrap_or("application/octet-stream");
4379    let content_type = super::ContentType::from(content_type);
4380
4381    if !status.is_client_error() && !status.is_server_error() {
4382        let content = resp.text().await?;
4383        match content_type {
4384            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4385            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LxcVncwebsocketResponse`"))),
4386            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::LxcVncwebsocketResponse`")))),
4387        }
4388    } else {
4389        let content = resp.text().await?;
4390        let entity: Option<LxcVncwebsocketError> = serde_json::from_str(&content).ok();
4391        Err(Error::ResponseError(ResponseContent { status, content, entity }))
4392    }
4393}
4394