clientapi-pve 2026.5.24

Generated from apidoc.js. NOT an official Proxmox specification. See https://pve.proxmox.com/pve-docs/api-viewer/ for the upstream documentation.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
/*
 * Proxmox Virtual Environment API
 *
 * Generated from apidoc.js. NOT an official Proxmox specification. See https://pve.proxmox.com/pve-docs/api-viewer/ for the upstream documentation.
 *
 * The version of the OpenAPI document: 9.x
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq)]
pub struct LxcCreateVmRequest {


    /// OS architecture type.
    pub arch: Option<models::PveLxcArchEnum>,

    /// Override I/O bandwidth limit (in KiB/s).
    pub bwlimit: Option<f64>,

    /// Console mode. By default, the console command tries to open a connection to one of the available tty devices. By setting cmode to 'console' it tries to attach to /dev/console instead. If you set cmode to 'shell', it simply invokes a shell inside the container (no login).
    pub cmode: Option<models::PveCmodeEnum>,

    /// Attach a console device (/dev/console) to the container.
    pub console: Option<models::PveBoolean>,

    /// The number of cores assigned to the container. A container can use all available cores by default.
    pub cores: Option<i32>,

    /// Limit of CPU usage.  NOTE: If the computer has 2 CPUs, it has a total of '2' CPU time. Value '0' indicates no CPU limit.
    pub cpulimit: Option<f64>,

    /// CPU weight for a container. Argument is used in the kernel fair scheduler. The larger the number is, the more CPU time this container gets. Number is relative to the weights of all the other running guests.
    pub cpuunits: Option<i32>,

    /// Try to be more verbose. For now this only enables debug log-level on start.
    pub debug: Option<models::PveBoolean>,

    /// Description for the Container. Shown in the web-interface CT's summary. This is saved as comment inside the configuration file.
    pub description: Option<String>,

    /// Command to run as init, optionally with arguments; may start with an absolute path, relative path, or a binary in $PATH.
    pub entrypoint: Option<String>,

    /// The container runtime environment as NUL-separated list. Replaces any lxc.environment.runtime entries in the config.
    pub env: Option<String>,

    /// Allow containers access to advanced features.
    pub features: Option<Box<models::PveFeaturesField>>,

    /// Allow to overwrite existing container.
    pub force: Option<models::PveBoolean>,

    /// Add the CT as a HA resource after it was created.
    pub ha_managed: Option<models::PveBoolean>,

    /// Script that will be executed during various steps in the containers lifetime.
    pub hookscript: Option<String>,

    /// Set a host name for the container.
    pub hostname: Option<String>,

    /// Ignore errors when extracting the template.
    pub ignore_unpack_errors: Option<models::PveBoolean>,

    /// Lock/unlock the container.
    pub lock: Option<models::PveLockEnum>,

    /// Amount of RAM for the container in MB.
    pub memory: Option<i64>,

    /// Sets DNS server IP address for a container. Create will automatically use the setting from the host if you neither set searchdomain nor nameserver.
    pub nameserver: Option<String>,

    /// Specifies whether a container will be started during system bootup.
    pub onboot: Option<models::PveBoolean>,

    /// The OS template or backup file.
    pub ostemplate: String,

    /// OS type. This is used to setup configuration inside the container, and corresponds to lxc setup scripts in /usr/share/lxc/config/<ostype>.common.conf. Value 'unmanaged' can be used to skip and OS specific setup.
    pub ostype: Option<models::PveOstypeEnum>,

    /// Sets root password inside container.
    pub password: Option<String>,

    /// Add the VM to the specified pool.
    pub pool: Option<String>,

    /// Sets the protection flag of the container. This will prevent the CT or CT's disk remove/update operation.
    pub protection: Option<models::PveBoolean>,

    /// Mark this as restore task.
    pub restore: Option<models::PveBoolean>,

    /// Use volume as container root.
    pub rootfs: Option<Box<models::PveRootfsField>>,

    /// Sets DNS search domains for a container. Create will automatically use the setting from the host if you neither set searchdomain nor nameserver.
    pub searchdomain: Option<String>,

    /// Setup public SSH keys (one key per line, OpenSSH format).
    pub ssh_public_keys: Option<String>,

    /// Start the CT after its creation finished successfully.
    pub start: Option<models::PveBoolean>,

    /// Startup and shutdown behavior. Order is a non-negative number defining the general startup order. Shutdown in done with reverse ordering. Additionally you can set the 'up' or 'down' delay in seconds, which specifies a delay to wait before the next VM is started or stopped.
    pub startup: Option<String>,

    /// Default Storage.
    pub storage: Option<String>,

    /// Amount of SWAP for the container in MB.
    pub swap: Option<i64>,

    /// Tags of the Container. This is only meta information.
    pub tags: Option<String>,

    /// Enable/disable Template.
    pub template: Option<models::PveBoolean>,

    /// Time zone to use in the container. If option isn't set, then nothing will be done. Can be set to 'host' to match the host time zone, or an arbitrary time zone option from /usr/share/zoneinfo/zone.tab
    pub timezone: Option<String>,

    /// Specify the number of tty available to the container
    pub tty: Option<i32>,

    /// Assign a unique random ethernet address.
    pub unique: Option<models::PveBoolean>,

    /// Makes the container run as unprivileged user. For creation, the default is 1. For restore, the default is the value from the backup. (Should not be modified manually.)
    pub unprivileged: Option<models::PveBoolean>,

    /// The (unique) ID of the VM.
    pub vmid: i32,

    /// Devs family. Wire form: `dev0..dev8`. Serialised by the manual impls below.
    pub devs: Option<std::collections::HashMap<u32, models::PveDevField>>,
    /// Mps family. Wire form: `mp0..mp255`. Serialised by the manual impls below.
    pub mps: Option<std::collections::HashMap<u32, models::PveMpField>>,
    /// Nets family. Wire form: `net0..net31`. Serialised by the manual impls below.
    pub nets: Option<std::collections::HashMap<u32, models::PveNetField>>,
    /// Unuseds family. Wire form: `unused0..unused255`. Serialised by the manual impls below.
    pub unuseds: Option<std::collections::HashMap<u32, models::PveUnusedField>>,
}

impl LxcCreateVmRequest {
    pub fn new(ostemplate: String, vmid: i32) -> LxcCreateVmRequest {
        LxcCreateVmRequest {
            
            arch: None,
            
            bwlimit: None,
            
            cmode: None,
            
            console: None,
            
            cores: None,
            
            cpulimit: None,
            
            cpuunits: None,
            
            debug: None,
            
            description: None,
            
            entrypoint: None,
            
            env: None,
            
            features: None,
            
            force: None,
            
            ha_managed: None,
            
            hookscript: None,
            
            hostname: None,
            
            ignore_unpack_errors: None,
            
            lock: None,
            
            memory: None,
            
            nameserver: None,
            
            onboot: None,
            
            ostemplate,
            
            ostype: None,
            
            password: None,
            
            pool: None,
            
            protection: None,
            
            restore: None,
            
            rootfs: None,
            
            searchdomain: None,
            
            ssh_public_keys: None,
            
            start: None,
            
            startup: None,
            
            storage: None,
            
            swap: None,
            
            tags: None,
            
            template: None,
            
            timezone: None,
            
            tty: None,
            
            unique: None,
            
            unprivileged: None,
            
            vmid,
            
            devs: None,
            mps: None,
            nets: None,
            unuseds: None,
        }
    }
}


// Flattens indexed-family maps to/from `<base><idx>` wire keys.
impl serde::Serialize for LxcCreateVmRequest {
    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        use serde::ser::Error;
        let mut map = serde_json::Map::new();
        
        {
            let _v = serde_json::to_value(&self.arch).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("arch".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.bwlimit).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("bwlimit".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.cmode).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("cmode".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.console).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("console".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.cores).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("cores".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.cpulimit).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("cpulimit".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.cpuunits).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("cpuunits".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.debug).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("debug".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.description).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("description".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.entrypoint).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("entrypoint".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.env).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("env".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.features).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("features".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.force).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("force".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.ha_managed).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("ha-managed".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.hookscript).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("hookscript".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.hostname).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("hostname".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.ignore_unpack_errors).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("ignore-unpack-errors".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.lock).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("lock".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.memory).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("memory".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.nameserver).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("nameserver".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.onboot).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("onboot".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.ostemplate).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("ostemplate".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.ostype).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("ostype".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.password).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("password".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.pool).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("pool".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.protection).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("protection".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.restore).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("restore".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.rootfs).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("rootfs".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.searchdomain).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("searchdomain".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.ssh_public_keys).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("ssh-public-keys".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.start).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("start".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.startup).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("startup".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.storage).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("storage".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.swap).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("swap".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.tags).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("tags".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.template).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("template".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.timezone).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("timezone".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.tty).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("tty".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.unique).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("unique".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.unprivileged).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("unprivileged".to_string(), _v);
            }
        }
        
        {
            let _v = serde_json::to_value(&self.vmid).map_err(Error::custom)?;
            if !_v.is_null() {
                map.insert("vmid".to_string(), _v);
            }
        }
        
        if let Some(ref _m) = self.devs {
            for (_idx, _val) in _m.iter() {
                map.insert(format!("dev{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
            }
        }
        if let Some(ref _m) = self.mps {
            for (_idx, _val) in _m.iter() {
                map.insert(format!("mp{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
            }
        }
        if let Some(ref _m) = self.nets {
            for (_idx, _val) in _m.iter() {
                map.insert(format!("net{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
            }
        }
        if let Some(ref _m) = self.unuseds {
            for (_idx, _val) in _m.iter() {
                map.insert(format!("unused{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
            }
        }
        serde_json::Value::Object(map).serialize(serializer)
    }
}

impl<'de> serde::Deserialize<'de> for LxcCreateVmRequest {
    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        use serde::de::Error;
        let mut raw: serde_json::Map<String, serde_json::Value> =
            serde::Deserialize::deserialize(deserializer)?;
        let mut __devs: std::collections::HashMap<u32, models::PveDevField> = std::collections::HashMap::new();
        {
            let _prefix = "dev";
            let _keys: Vec<String> = raw.keys()
                .filter(|k| {
                    if let Some(_suffix) = k.strip_prefix(_prefix) {
                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
                    } else {
                        false
                    }
                })
                .cloned()
                .collect();
            for _key in _keys {
                let _suffix = _key.strip_prefix(_prefix).unwrap();
                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
                let _value = raw.remove(&_key).unwrap();
                let _item: models::PveDevField = serde_json::from_value(_value).map_err(Error::custom)?;
                __devs.insert(_idx, _item);
            }
        }
        let mut __mps: std::collections::HashMap<u32, models::PveMpField> = std::collections::HashMap::new();
        {
            let _prefix = "mp";
            let _keys: Vec<String> = raw.keys()
                .filter(|k| {
                    if let Some(_suffix) = k.strip_prefix(_prefix) {
                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
                    } else {
                        false
                    }
                })
                .cloned()
                .collect();
            for _key in _keys {
                let _suffix = _key.strip_prefix(_prefix).unwrap();
                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
                let _value = raw.remove(&_key).unwrap();
                let _item: models::PveMpField = serde_json::from_value(_value).map_err(Error::custom)?;
                __mps.insert(_idx, _item);
            }
        }
        let mut __nets: std::collections::HashMap<u32, models::PveNetField> = std::collections::HashMap::new();
        {
            let _prefix = "net";
            let _keys: Vec<String> = raw.keys()
                .filter(|k| {
                    if let Some(_suffix) = k.strip_prefix(_prefix) {
                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
                    } else {
                        false
                    }
                })
                .cloned()
                .collect();
            for _key in _keys {
                let _suffix = _key.strip_prefix(_prefix).unwrap();
                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
                let _value = raw.remove(&_key).unwrap();
                let _item: models::PveNetField = serde_json::from_value(_value).map_err(Error::custom)?;
                __nets.insert(_idx, _item);
            }
        }
        let mut __unuseds: std::collections::HashMap<u32, models::PveUnusedField> = std::collections::HashMap::new();
        {
            let _prefix = "unused";
            let _keys: Vec<String> = raw.keys()
                .filter(|k| {
                    if let Some(_suffix) = k.strip_prefix(_prefix) {
                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
                    } else {
                        false
                    }
                })
                .cloned()
                .collect();
            for _key in _keys {
                let _suffix = _key.strip_prefix(_prefix).unwrap();
                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
                let _value = raw.remove(&_key).unwrap();
                let _item: models::PveUnusedField = serde_json::from_value(_value).map_err(Error::custom)?;
                __unuseds.insert(_idx, _item);
            }
        }
        Ok(LxcCreateVmRequest {
            
            arch: serde_json::from_value(raw.remove("arch").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            bwlimit: serde_json::from_value(raw.remove("bwlimit").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            cmode: serde_json::from_value(raw.remove("cmode").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            console: serde_json::from_value(raw.remove("console").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            cores: serde_json::from_value(raw.remove("cores").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            cpulimit: serde_json::from_value(raw.remove("cpulimit").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            cpuunits: serde_json::from_value(raw.remove("cpuunits").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            debug: serde_json::from_value(raw.remove("debug").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            description: serde_json::from_value(raw.remove("description").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            entrypoint: serde_json::from_value(raw.remove("entrypoint").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            env: serde_json::from_value(raw.remove("env").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            features: serde_json::from_value(raw.remove("features").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            force: serde_json::from_value(raw.remove("force").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            ha_managed: serde_json::from_value(raw.remove("ha-managed").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            hookscript: serde_json::from_value(raw.remove("hookscript").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            hostname: serde_json::from_value(raw.remove("hostname").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            ignore_unpack_errors: serde_json::from_value(raw.remove("ignore-unpack-errors").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            lock: serde_json::from_value(raw.remove("lock").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            memory: serde_json::from_value(raw.remove("memory").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            nameserver: serde_json::from_value(raw.remove("nameserver").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            onboot: serde_json::from_value(raw.remove("onboot").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            ostemplate: serde_json::from_value(raw.remove("ostemplate").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            ostype: serde_json::from_value(raw.remove("ostype").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            password: serde_json::from_value(raw.remove("password").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            pool: serde_json::from_value(raw.remove("pool").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            protection: serde_json::from_value(raw.remove("protection").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            restore: serde_json::from_value(raw.remove("restore").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            rootfs: serde_json::from_value(raw.remove("rootfs").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            searchdomain: serde_json::from_value(raw.remove("searchdomain").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            ssh_public_keys: serde_json::from_value(raw.remove("ssh-public-keys").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            start: serde_json::from_value(raw.remove("start").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            startup: serde_json::from_value(raw.remove("startup").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            storage: serde_json::from_value(raw.remove("storage").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            swap: serde_json::from_value(raw.remove("swap").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            tags: serde_json::from_value(raw.remove("tags").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            template: serde_json::from_value(raw.remove("template").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            timezone: serde_json::from_value(raw.remove("timezone").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            tty: serde_json::from_value(raw.remove("tty").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            unique: serde_json::from_value(raw.remove("unique").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            unprivileged: serde_json::from_value(raw.remove("unprivileged").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            vmid: serde_json::from_value(raw.remove("vmid").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
            
            devs: if __devs.is_empty() { None } else { Some(__devs) },
            mps: if __mps.is_empty() { None } else { Some(__mps) },
            nets: if __nets.is_empty() { None } else { Some(__nets) },
            unuseds: if __unuseds.is_empty() { None } else { Some(__unuseds) },
        })
    }
}