Skip to main content

clientapi_pve/models/
lxc_create_vm_request.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
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq)]
15pub struct LxcCreateVmRequest {
16
17
18    /// OS architecture type.
19    pub arch: Option<models::PveLxcArchEnum>,
20
21    /// Override I/O bandwidth limit (in KiB/s).
22    pub bwlimit: Option<f64>,
23
24    /// 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).
25    pub cmode: Option<models::PveCmodeEnum>,
26
27    /// Attach a console device (/dev/console) to the container.
28    pub console: Option<models::PveBoolean>,
29
30    /// The number of cores assigned to the container. A container can use all available cores by default.
31    pub cores: Option<i32>,
32
33    /// 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.
34    pub cpulimit: Option<f64>,
35
36    /// 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.
37    pub cpuunits: Option<i32>,
38
39    /// Try to be more verbose. For now this only enables debug log-level on start.
40    pub debug: Option<models::PveBoolean>,
41
42    /// Description for the Container. Shown in the web-interface CT's summary. This is saved as comment inside the configuration file.
43    pub description: Option<String>,
44
45    /// Command to run as init, optionally with arguments; may start with an absolute path, relative path, or a binary in $PATH.
46    pub entrypoint: Option<String>,
47
48    /// The container runtime environment as NUL-separated list. Replaces any lxc.environment.runtime entries in the config.
49    pub env: Option<String>,
50
51    /// Allow containers access to advanced features.
52    pub features: Option<Box<models::PveFeaturesField>>,
53
54    /// Allow to overwrite existing container.
55    pub force: Option<models::PveBoolean>,
56
57    /// Add the CT as a HA resource after it was created.
58    pub ha_managed: Option<models::PveBoolean>,
59
60    /// Script that will be executed during various steps in the containers lifetime.
61    pub hookscript: Option<String>,
62
63    /// Set a host name for the container.
64    pub hostname: Option<String>,
65
66    /// Ignore errors when extracting the template.
67    pub ignore_unpack_errors: Option<models::PveBoolean>,
68
69    /// Lock/unlock the container.
70    pub lock: Option<models::PveLockEnum>,
71
72    /// Amount of RAM for the container in MB.
73    pub memory: Option<i64>,
74
75    /// Sets DNS server IP address for a container. Create will automatically use the setting from the host if you neither set searchdomain nor nameserver.
76    pub nameserver: Option<String>,
77
78    /// Specifies whether a container will be started during system bootup.
79    pub onboot: Option<models::PveBoolean>,
80
81    /// The OS template or backup file.
82    pub ostemplate: String,
83
84    /// 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.
85    pub ostype: Option<models::PveOstypeEnum>,
86
87    /// Sets root password inside container.
88    pub password: Option<String>,
89
90    /// Add the VM to the specified pool.
91    pub pool: Option<String>,
92
93    /// Sets the protection flag of the container. This will prevent the CT or CT's disk remove/update operation.
94    pub protection: Option<models::PveBoolean>,
95
96    /// Mark this as restore task.
97    pub restore: Option<models::PveBoolean>,
98
99    /// Use volume as container root.
100    pub rootfs: Option<Box<models::PveRootfsField>>,
101
102    /// Sets DNS search domains for a container. Create will automatically use the setting from the host if you neither set searchdomain nor nameserver.
103    pub searchdomain: Option<String>,
104
105    /// Setup public SSH keys (one key per line, OpenSSH format).
106    pub ssh_public_keys: Option<String>,
107
108    /// Start the CT after its creation finished successfully.
109    pub start: Option<models::PveBoolean>,
110
111    /// 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.
112    pub startup: Option<String>,
113
114    /// Default Storage.
115    pub storage: Option<String>,
116
117    /// Amount of SWAP for the container in MB.
118    pub swap: Option<i64>,
119
120    /// Tags of the Container. This is only meta information.
121    pub tags: Option<String>,
122
123    /// Enable/disable Template.
124    pub template: Option<models::PveBoolean>,
125
126    /// 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
127    pub timezone: Option<String>,
128
129    /// Specify the number of tty available to the container
130    pub tty: Option<i32>,
131
132    /// Assign a unique random ethernet address.
133    pub unique: Option<models::PveBoolean>,
134
135    /// 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.)
136    pub unprivileged: Option<models::PveBoolean>,
137
138    /// The (unique) ID of the VM.
139    pub vmid: i32,
140
141    /// Devs family. Wire form: `dev0..dev8`. Serialised by the manual impls below.
142    pub devs: Option<std::collections::HashMap<u32, models::PveDevField>>,
143    /// Mps family. Wire form: `mp0..mp255`. Serialised by the manual impls below.
144    pub mps: Option<std::collections::HashMap<u32, models::PveMpField>>,
145    /// Nets family. Wire form: `net0..net31`. Serialised by the manual impls below.
146    pub nets: Option<std::collections::HashMap<u32, models::PveNetField>>,
147    /// Unuseds family. Wire form: `unused0..unused255`. Serialised by the manual impls below.
148    pub unuseds: Option<std::collections::HashMap<u32, models::PveUnusedField>>,
149}
150
151impl LxcCreateVmRequest {
152    pub fn new(ostemplate: String, vmid: i32) -> LxcCreateVmRequest {
153        LxcCreateVmRequest {
154            
155            arch: None,
156            
157            bwlimit: None,
158            
159            cmode: None,
160            
161            console: None,
162            
163            cores: None,
164            
165            cpulimit: None,
166            
167            cpuunits: None,
168            
169            debug: None,
170            
171            description: None,
172            
173            entrypoint: None,
174            
175            env: None,
176            
177            features: None,
178            
179            force: None,
180            
181            ha_managed: None,
182            
183            hookscript: None,
184            
185            hostname: None,
186            
187            ignore_unpack_errors: None,
188            
189            lock: None,
190            
191            memory: None,
192            
193            nameserver: None,
194            
195            onboot: None,
196            
197            ostemplate,
198            
199            ostype: None,
200            
201            password: None,
202            
203            pool: None,
204            
205            protection: None,
206            
207            restore: None,
208            
209            rootfs: None,
210            
211            searchdomain: None,
212            
213            ssh_public_keys: None,
214            
215            start: None,
216            
217            startup: None,
218            
219            storage: None,
220            
221            swap: None,
222            
223            tags: None,
224            
225            template: None,
226            
227            timezone: None,
228            
229            tty: None,
230            
231            unique: None,
232            
233            unprivileged: None,
234            
235            vmid,
236            
237            devs: None,
238            mps: None,
239            nets: None,
240            unuseds: None,
241        }
242    }
243}
244
245
246// Flattens indexed-family maps to/from `<base><idx>` wire keys.
247impl serde::Serialize for LxcCreateVmRequest {
248    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
249        use serde::ser::Error;
250        let mut map = serde_json::Map::new();
251        
252        {
253            let _v = serde_json::to_value(&self.arch).map_err(Error::custom)?;
254            if !_v.is_null() {
255                map.insert("arch".to_string(), _v);
256            }
257        }
258        
259        {
260            let _v = serde_json::to_value(&self.bwlimit).map_err(Error::custom)?;
261            if !_v.is_null() {
262                map.insert("bwlimit".to_string(), _v);
263            }
264        }
265        
266        {
267            let _v = serde_json::to_value(&self.cmode).map_err(Error::custom)?;
268            if !_v.is_null() {
269                map.insert("cmode".to_string(), _v);
270            }
271        }
272        
273        {
274            let _v = serde_json::to_value(&self.console).map_err(Error::custom)?;
275            if !_v.is_null() {
276                map.insert("console".to_string(), _v);
277            }
278        }
279        
280        {
281            let _v = serde_json::to_value(&self.cores).map_err(Error::custom)?;
282            if !_v.is_null() {
283                map.insert("cores".to_string(), _v);
284            }
285        }
286        
287        {
288            let _v = serde_json::to_value(&self.cpulimit).map_err(Error::custom)?;
289            if !_v.is_null() {
290                map.insert("cpulimit".to_string(), _v);
291            }
292        }
293        
294        {
295            let _v = serde_json::to_value(&self.cpuunits).map_err(Error::custom)?;
296            if !_v.is_null() {
297                map.insert("cpuunits".to_string(), _v);
298            }
299        }
300        
301        {
302            let _v = serde_json::to_value(&self.debug).map_err(Error::custom)?;
303            if !_v.is_null() {
304                map.insert("debug".to_string(), _v);
305            }
306        }
307        
308        {
309            let _v = serde_json::to_value(&self.description).map_err(Error::custom)?;
310            if !_v.is_null() {
311                map.insert("description".to_string(), _v);
312            }
313        }
314        
315        {
316            let _v = serde_json::to_value(&self.entrypoint).map_err(Error::custom)?;
317            if !_v.is_null() {
318                map.insert("entrypoint".to_string(), _v);
319            }
320        }
321        
322        {
323            let _v = serde_json::to_value(&self.env).map_err(Error::custom)?;
324            if !_v.is_null() {
325                map.insert("env".to_string(), _v);
326            }
327        }
328        
329        {
330            let _v = serde_json::to_value(&self.features).map_err(Error::custom)?;
331            if !_v.is_null() {
332                map.insert("features".to_string(), _v);
333            }
334        }
335        
336        {
337            let _v = serde_json::to_value(&self.force).map_err(Error::custom)?;
338            if !_v.is_null() {
339                map.insert("force".to_string(), _v);
340            }
341        }
342        
343        {
344            let _v = serde_json::to_value(&self.ha_managed).map_err(Error::custom)?;
345            if !_v.is_null() {
346                map.insert("ha-managed".to_string(), _v);
347            }
348        }
349        
350        {
351            let _v = serde_json::to_value(&self.hookscript).map_err(Error::custom)?;
352            if !_v.is_null() {
353                map.insert("hookscript".to_string(), _v);
354            }
355        }
356        
357        {
358            let _v = serde_json::to_value(&self.hostname).map_err(Error::custom)?;
359            if !_v.is_null() {
360                map.insert("hostname".to_string(), _v);
361            }
362        }
363        
364        {
365            let _v = serde_json::to_value(&self.ignore_unpack_errors).map_err(Error::custom)?;
366            if !_v.is_null() {
367                map.insert("ignore-unpack-errors".to_string(), _v);
368            }
369        }
370        
371        {
372            let _v = serde_json::to_value(&self.lock).map_err(Error::custom)?;
373            if !_v.is_null() {
374                map.insert("lock".to_string(), _v);
375            }
376        }
377        
378        {
379            let _v = serde_json::to_value(&self.memory).map_err(Error::custom)?;
380            if !_v.is_null() {
381                map.insert("memory".to_string(), _v);
382            }
383        }
384        
385        {
386            let _v = serde_json::to_value(&self.nameserver).map_err(Error::custom)?;
387            if !_v.is_null() {
388                map.insert("nameserver".to_string(), _v);
389            }
390        }
391        
392        {
393            let _v = serde_json::to_value(&self.onboot).map_err(Error::custom)?;
394            if !_v.is_null() {
395                map.insert("onboot".to_string(), _v);
396            }
397        }
398        
399        {
400            let _v = serde_json::to_value(&self.ostemplate).map_err(Error::custom)?;
401            if !_v.is_null() {
402                map.insert("ostemplate".to_string(), _v);
403            }
404        }
405        
406        {
407            let _v = serde_json::to_value(&self.ostype).map_err(Error::custom)?;
408            if !_v.is_null() {
409                map.insert("ostype".to_string(), _v);
410            }
411        }
412        
413        {
414            let _v = serde_json::to_value(&self.password).map_err(Error::custom)?;
415            if !_v.is_null() {
416                map.insert("password".to_string(), _v);
417            }
418        }
419        
420        {
421            let _v = serde_json::to_value(&self.pool).map_err(Error::custom)?;
422            if !_v.is_null() {
423                map.insert("pool".to_string(), _v);
424            }
425        }
426        
427        {
428            let _v = serde_json::to_value(&self.protection).map_err(Error::custom)?;
429            if !_v.is_null() {
430                map.insert("protection".to_string(), _v);
431            }
432        }
433        
434        {
435            let _v = serde_json::to_value(&self.restore).map_err(Error::custom)?;
436            if !_v.is_null() {
437                map.insert("restore".to_string(), _v);
438            }
439        }
440        
441        {
442            let _v = serde_json::to_value(&self.rootfs).map_err(Error::custom)?;
443            if !_v.is_null() {
444                map.insert("rootfs".to_string(), _v);
445            }
446        }
447        
448        {
449            let _v = serde_json::to_value(&self.searchdomain).map_err(Error::custom)?;
450            if !_v.is_null() {
451                map.insert("searchdomain".to_string(), _v);
452            }
453        }
454        
455        {
456            let _v = serde_json::to_value(&self.ssh_public_keys).map_err(Error::custom)?;
457            if !_v.is_null() {
458                map.insert("ssh-public-keys".to_string(), _v);
459            }
460        }
461        
462        {
463            let _v = serde_json::to_value(&self.start).map_err(Error::custom)?;
464            if !_v.is_null() {
465                map.insert("start".to_string(), _v);
466            }
467        }
468        
469        {
470            let _v = serde_json::to_value(&self.startup).map_err(Error::custom)?;
471            if !_v.is_null() {
472                map.insert("startup".to_string(), _v);
473            }
474        }
475        
476        {
477            let _v = serde_json::to_value(&self.storage).map_err(Error::custom)?;
478            if !_v.is_null() {
479                map.insert("storage".to_string(), _v);
480            }
481        }
482        
483        {
484            let _v = serde_json::to_value(&self.swap).map_err(Error::custom)?;
485            if !_v.is_null() {
486                map.insert("swap".to_string(), _v);
487            }
488        }
489        
490        {
491            let _v = serde_json::to_value(&self.tags).map_err(Error::custom)?;
492            if !_v.is_null() {
493                map.insert("tags".to_string(), _v);
494            }
495        }
496        
497        {
498            let _v = serde_json::to_value(&self.template).map_err(Error::custom)?;
499            if !_v.is_null() {
500                map.insert("template".to_string(), _v);
501            }
502        }
503        
504        {
505            let _v = serde_json::to_value(&self.timezone).map_err(Error::custom)?;
506            if !_v.is_null() {
507                map.insert("timezone".to_string(), _v);
508            }
509        }
510        
511        {
512            let _v = serde_json::to_value(&self.tty).map_err(Error::custom)?;
513            if !_v.is_null() {
514                map.insert("tty".to_string(), _v);
515            }
516        }
517        
518        {
519            let _v = serde_json::to_value(&self.unique).map_err(Error::custom)?;
520            if !_v.is_null() {
521                map.insert("unique".to_string(), _v);
522            }
523        }
524        
525        {
526            let _v = serde_json::to_value(&self.unprivileged).map_err(Error::custom)?;
527            if !_v.is_null() {
528                map.insert("unprivileged".to_string(), _v);
529            }
530        }
531        
532        {
533            let _v = serde_json::to_value(&self.vmid).map_err(Error::custom)?;
534            if !_v.is_null() {
535                map.insert("vmid".to_string(), _v);
536            }
537        }
538        
539        if let Some(ref _m) = self.devs {
540            for (_idx, _val) in _m.iter() {
541                map.insert(format!("dev{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
542            }
543        }
544        if let Some(ref _m) = self.mps {
545            for (_idx, _val) in _m.iter() {
546                map.insert(format!("mp{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
547            }
548        }
549        if let Some(ref _m) = self.nets {
550            for (_idx, _val) in _m.iter() {
551                map.insert(format!("net{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
552            }
553        }
554        if let Some(ref _m) = self.unuseds {
555            for (_idx, _val) in _m.iter() {
556                map.insert(format!("unused{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
557            }
558        }
559        serde_json::Value::Object(map).serialize(serializer)
560    }
561}
562
563impl<'de> serde::Deserialize<'de> for LxcCreateVmRequest {
564    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
565        use serde::de::Error;
566        let mut raw: serde_json::Map<String, serde_json::Value> =
567            serde::Deserialize::deserialize(deserializer)?;
568        let mut __devs: std::collections::HashMap<u32, models::PveDevField> = std::collections::HashMap::new();
569        {
570            let _prefix = "dev";
571            let _keys: Vec<String> = raw.keys()
572                .filter(|k| {
573                    if let Some(_suffix) = k.strip_prefix(_prefix) {
574                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
575                    } else {
576                        false
577                    }
578                })
579                .cloned()
580                .collect();
581            for _key in _keys {
582                let _suffix = _key.strip_prefix(_prefix).unwrap();
583                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
584                let _value = raw.remove(&_key).unwrap();
585                let _item: models::PveDevField = serde_json::from_value(_value).map_err(Error::custom)?;
586                __devs.insert(_idx, _item);
587            }
588        }
589        let mut __mps: std::collections::HashMap<u32, models::PveMpField> = std::collections::HashMap::new();
590        {
591            let _prefix = "mp";
592            let _keys: Vec<String> = raw.keys()
593                .filter(|k| {
594                    if let Some(_suffix) = k.strip_prefix(_prefix) {
595                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
596                    } else {
597                        false
598                    }
599                })
600                .cloned()
601                .collect();
602            for _key in _keys {
603                let _suffix = _key.strip_prefix(_prefix).unwrap();
604                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
605                let _value = raw.remove(&_key).unwrap();
606                let _item: models::PveMpField = serde_json::from_value(_value).map_err(Error::custom)?;
607                __mps.insert(_idx, _item);
608            }
609        }
610        let mut __nets: std::collections::HashMap<u32, models::PveNetField> = std::collections::HashMap::new();
611        {
612            let _prefix = "net";
613            let _keys: Vec<String> = raw.keys()
614                .filter(|k| {
615                    if let Some(_suffix) = k.strip_prefix(_prefix) {
616                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
617                    } else {
618                        false
619                    }
620                })
621                .cloned()
622                .collect();
623            for _key in _keys {
624                let _suffix = _key.strip_prefix(_prefix).unwrap();
625                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
626                let _value = raw.remove(&_key).unwrap();
627                let _item: models::PveNetField = serde_json::from_value(_value).map_err(Error::custom)?;
628                __nets.insert(_idx, _item);
629            }
630        }
631        let mut __unuseds: std::collections::HashMap<u32, models::PveUnusedField> = std::collections::HashMap::new();
632        {
633            let _prefix = "unused";
634            let _keys: Vec<String> = raw.keys()
635                .filter(|k| {
636                    if let Some(_suffix) = k.strip_prefix(_prefix) {
637                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
638                    } else {
639                        false
640                    }
641                })
642                .cloned()
643                .collect();
644            for _key in _keys {
645                let _suffix = _key.strip_prefix(_prefix).unwrap();
646                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
647                let _value = raw.remove(&_key).unwrap();
648                let _item: models::PveUnusedField = serde_json::from_value(_value).map_err(Error::custom)?;
649                __unuseds.insert(_idx, _item);
650            }
651        }
652        Ok(LxcCreateVmRequest {
653            
654            arch: serde_json::from_value(raw.remove("arch").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
655            
656            bwlimit: serde_json::from_value(raw.remove("bwlimit").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
657            
658            cmode: serde_json::from_value(raw.remove("cmode").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
659            
660            console: serde_json::from_value(raw.remove("console").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
661            
662            cores: serde_json::from_value(raw.remove("cores").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
663            
664            cpulimit: serde_json::from_value(raw.remove("cpulimit").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
665            
666            cpuunits: serde_json::from_value(raw.remove("cpuunits").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
667            
668            debug: serde_json::from_value(raw.remove("debug").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
669            
670            description: serde_json::from_value(raw.remove("description").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
671            
672            entrypoint: serde_json::from_value(raw.remove("entrypoint").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
673            
674            env: serde_json::from_value(raw.remove("env").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
675            
676            features: serde_json::from_value(raw.remove("features").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
677            
678            force: serde_json::from_value(raw.remove("force").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
679            
680            ha_managed: serde_json::from_value(raw.remove("ha-managed").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
681            
682            hookscript: serde_json::from_value(raw.remove("hookscript").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
683            
684            hostname: serde_json::from_value(raw.remove("hostname").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
685            
686            ignore_unpack_errors: serde_json::from_value(raw.remove("ignore-unpack-errors").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
687            
688            lock: serde_json::from_value(raw.remove("lock").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
689            
690            memory: serde_json::from_value(raw.remove("memory").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
691            
692            nameserver: serde_json::from_value(raw.remove("nameserver").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
693            
694            onboot: serde_json::from_value(raw.remove("onboot").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
695            
696            ostemplate: serde_json::from_value(raw.remove("ostemplate").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
697            
698            ostype: serde_json::from_value(raw.remove("ostype").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
699            
700            password: serde_json::from_value(raw.remove("password").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
701            
702            pool: serde_json::from_value(raw.remove("pool").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
703            
704            protection: serde_json::from_value(raw.remove("protection").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
705            
706            restore: serde_json::from_value(raw.remove("restore").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
707            
708            rootfs: serde_json::from_value(raw.remove("rootfs").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
709            
710            searchdomain: serde_json::from_value(raw.remove("searchdomain").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
711            
712            ssh_public_keys: serde_json::from_value(raw.remove("ssh-public-keys").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
713            
714            start: serde_json::from_value(raw.remove("start").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
715            
716            startup: serde_json::from_value(raw.remove("startup").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
717            
718            storage: serde_json::from_value(raw.remove("storage").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
719            
720            swap: serde_json::from_value(raw.remove("swap").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
721            
722            tags: serde_json::from_value(raw.remove("tags").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
723            
724            template: serde_json::from_value(raw.remove("template").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
725            
726            timezone: serde_json::from_value(raw.remove("timezone").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
727            
728            tty: serde_json::from_value(raw.remove("tty").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
729            
730            unique: serde_json::from_value(raw.remove("unique").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
731            
732            unprivileged: serde_json::from_value(raw.remove("unprivileged").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
733            
734            vmid: serde_json::from_value(raw.remove("vmid").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
735            
736            devs: if __devs.is_empty() { None } else { Some(__devs) },
737            mps: if __mps.is_empty() { None } else { Some(__mps) },
738            nets: if __nets.is_empty() { None } else { Some(__nets) },
739            unuseds: if __unuseds.is_empty() { None } else { Some(__unuseds) },
740        })
741    }
742}
743
744