/*
* 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 QemuCreateVmRequest {
/// Enable/disable ACPI.
pub acpi: Option<models::PveBoolean>,
/// List of host cores used to execute guest processes, for example: 0,5,8-11
pub affinity: Option<String>,
/// Enable/disable communication with the QEMU Guest Agent and its properties.
pub agent: Option<Box<models::PveAgentField>>,
/// Allow memory pages of this guest to be merged via KSM (Kernel Samepage Merging).
pub allow_ksm: Option<models::PveBoolean>,
/// Secure Encrypted Virtualization (SEV) features by AMD CPUs
pub amd_sev: Option<String>,
/// Virtual processor architecture. Defaults to the host architecture.
pub arch: Option<models::PveArchEnum>,
/// The backup archive. Either the file system path to a .tar or .vma file (use '-' to pipe data from stdin) or a proxmox storage backup volume identifier.
pub archive: Option<String>,
/// Arbitrary arguments passed to kvm, for example: args: -no-reboot -smbios 'type=0,vendor=FOO' NOTE: this option is for experts only.
pub args: Option<String>,
/// Configure a audio device, useful in combination with QXL/Spice.
pub audio0: Option<Box<models::PveAudioField>>,
/// Automatic restart after crash (currently ignored).
pub autostart: Option<models::PveBoolean>,
/// Amount of target RAM for the VM in MiB. The balloon driver is enabled by default, unless it is explicitly disabled by setting the value to zero.
pub balloon: Option<i64>,
/// Select BIOS implementation.
pub bios: Option<models::PveBiosEnum>,
/// Specify guest boot order. Use the 'order=' sub-property as usage with no key or 'legacy=' is deprecated.
pub boot: Option<String>,
/// Enable booting from specified disk. Deprecated: Use 'boot: order=foo;bar' instead.
pub bootdisk: Option<String>,
/// Override I/O bandwidth limit (in KiB/s).
pub bwlimit: Option<i64>,
/// This is an alias for option -ide2
pub cdrom: Option<String>,
/// cloud-init: Specify custom files to replace the automatically generated ones at start.
pub cicustom: Option<String>,
/// cloud-init: Password to assign the user. Using this is generally not recommended. Use ssh keys instead. Also note that older cloud-init versions do not support hashed passwords.
pub cipassword: Option<String>,
/// Specifies the cloud-init configuration format. The default depends on the configured operating system type (`ostype`. We use the `nocloud` format for Linux, and `configdrive2` for windows.
pub citype: Option<models::PveCitypeEnum>,
/// cloud-init: do an automatic package upgrade after the first boot.
pub ciupgrade: Option<models::PveBoolean>,
/// cloud-init: User name to change ssh keys and password for instead of the image's configured default user.
pub ciuser: Option<String>,
/// The number of cores per socket.
pub cores: Option<i64>,
/// Emulated CPU type.
pub cpu: Option<String>,
/// Limit of CPU usage. NOTE: If the computer has 2 CPUs, it has total of '2' CPU time. Value '0' indicates no CPU limit.
pub cpulimit: Option<f64>,
/// CPU weight for a VM. Argument is used in the kernel fair scheduler. The larger the number is, the more CPU time this VM gets. Number is relative to weights of all the other running VMs.
pub cpuunits: Option<i32>,
/// Description for the VM. Shown in the web-interface VM's summary. This is saved as comment inside the configuration file.
pub description: Option<String>,
/// Configure a disk for storing EFI vars. Use the special syntax STORAGE_ID:SIZE_IN_GiB to allocate a new volume. Note that SIZE_IN_GiB is ignored here and that the default EFI vars are copied to the volume instead. Use STORAGE_ID:0 and the 'import-from' parameter to import from an existing volume.
pub efidisk0: Option<Box<models::PveEfidiskField>>,
/// Allow to overwrite existing VM.
pub force: Option<models::PveBoolean>,
/// Freeze CPU at startup (use 'c' monitor command to start execution).
pub freeze: Option<models::PveBoolean>,
/// Add the VM as a HA resource after it was created.
pub ha_managed: Option<models::PveBoolean>,
/// Script that will be executed during various steps in the vms lifetime.
pub hookscript: Option<String>,
/// Selectively enable hotplug features. This is a comma separated list of hotplug features: 'network', 'disk', 'cpu', 'memory', 'usb' and 'cloudinit'. Use '0' to disable hotplug completely. Using '1' as value is an alias for the default `network,disk,usb`. USB hotplugging is possible for guests with machine version >= 7.1 and ostype l26 or windows > 7.
pub hotplug: Option<String>,
/// Enables hugepages memory. Sets the size of hugepages in MiB. If the value is set to 'any' then 1 GiB hugepages will be used if possible, otherwise the size will fall back to 2 MiB.
pub hugepages: Option<models::PveHugepagesEnum>,
/// A file-based storage with 'images' content-type enabled, which is used as an intermediary extraction storage during import. Defaults to the source storage.
pub import_working_storage: Option<String>,
/// Trusted Domain Extension (TDX) features by Intel CPUs
pub intel_tdx: Option<String>,
/// Inter-VM shared memory. Useful for direct communication between VMs, or to the host.
pub ivshmem: Option<Box<models::PveIvshmemField>>,
/// Use together with hugepages. If enabled, hugepages will not not be deleted after VM shutdown and can be used for subsequent starts.
pub keephugepages: Option<models::PveBoolean>,
/// Keyboard layout for VNC server. This option is generally not required and is often better handled from within the guest OS.
pub keyboard: Option<models::PveKeyboardEnum>,
/// Enable/disable KVM hardware virtualization.
pub kvm: Option<models::PveBoolean>,
/// Start the VM immediately while importing or restoring in the background.
pub live_restore: Option<models::PveBoolean>,
/// Set the real time clock (RTC) to local time. This is enabled by default if the `ostype` indicates a Microsoft Windows OS.
pub localtime: Option<models::PveBoolean>,
/// Lock/unlock the VM.
pub lock: Option<models::PveQemuLockEnum>,
/// Specify the QEMU machine.
pub machine: Option<Box<models::PveMachineField>>,
/// Memory properties.
pub memory: Option<Box<models::PveMemoryField>>,
/// Set maximum tolerated downtime (in seconds) for migrations. Should the migration not be able to converge in the very end, because too much newly dirtied RAM needs to be transferred, the limit will be increased automatically step-by-step until migration can converge. Will be capped to 2000 seconds (maximum in QEMU).
pub migrate_downtime: Option<f64>,
/// Set maximum speed (in MB/s) for migrations. Value 0 is no limit.
pub migrate_speed: Option<i64>,
/// Set a name for the VM. Only used on the configuration web interface.
pub name: Option<String>,
/// cloud-init: Sets DNS server IP address for a container. Create will automatically use the setting from the host if neither searchdomain nor nameserver are set.
pub nameserver: Option<String>,
/// Enable/disable NUMA.
pub numa: Option<models::PveBoolean>,
/// Specifies whether a VM will be started during system bootup.
pub onboot: Option<models::PveBoolean>,
/// Specify guest operating system. This is used to enable special optimization/features for specific operating systems: [horizontal] other;; unspecified OS wxp;; Microsoft Windows XP w2k;; Microsoft Windows 2000 w2k3;; Microsoft Windows 2003 w2k8;; Microsoft Windows 2008 wvista;; Microsoft Windows Vista win7;; Microsoft Windows 7 win8;; Microsoft Windows 8/2012/2012r2 win10;; Microsoft Windows 10/2016/2019 win11;; Microsoft Windows 11/2022/2025 l24;; Linux 2.4 Kernel l26;; Linux 2.6 - 7.X Kernel solaris;; Solaris/OpenSolaris/OpenIndiania kernel
pub ostype: Option<models::PveQemuOstypeEnum>,
/// Add the VM to the specified pool.
pub pool: Option<String>,
/// Sets the protection flag of the VM. This will disable the remove VM and remove disk operations.
pub protection: Option<models::PveBoolean>,
/// Allow reboot. If set to '0' the VM exit on reboot.
pub reboot: Option<models::PveBoolean>,
/// Configure a VirtIO-based Random Number Generator.
pub rng0: Option<String>,
/// SCSI controller model
pub scsihw: Option<models::PveScsihwEnum>,
/// cloud-init: Sets DNS search domains for a container. Create will automatically use the setting from the host if neither searchdomain nor nameserver are set.
pub searchdomain: Option<String>,
/// Amount of memory shares for auto-ballooning. The larger the number is, the more memory this VM gets. Number is relative to weights of all other running VMs. Using zero disables auto-ballooning. Auto-ballooning is done by pvestatd.
pub shares: Option<i32>,
/// Specify SMBIOS type 1 fields.
pub smbios1: Option<String>,
/// The number of CPUs. Please use option -sockets instead.
pub smp: Option<i64>,
/// The number of CPU sockets.
pub sockets: Option<i64>,
/// Configure additional enhancements for SPICE.
pub spice_enhancements: Option<Box<models::PveSpiceEnhancementsField>>,
/// cloud-init: Setup public SSH keys (one key per line, OpenSSH format).
pub sshkeys: Option<String>,
/// Start VM after it was created successfully.
pub start: Option<models::PveBoolean>,
/// Set the initial date of the real time clock. Valid format for date are:'now' or '2006-06-17T16:01:21' or '2006-06-17'.
pub startdate: Option<String>,
/// 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>,
/// Enable/disable the USB tablet device. This device is usually needed to allow absolute mouse positioning with VNC. Else the mouse runs out of sync with normal VNC clients. If you're running lots of console-only guests on one host, you may consider disabling this to save some context switches. This is turned off by default if you use spice (`qm set <vmid> --vga qxl`).
pub tablet: Option<models::PveBoolean>,
/// Tags of the VM. This is only meta information.
pub tags: Option<String>,
/// Enable/disable time drift fix.
pub tdf: Option<models::PveBoolean>,
/// Enable/disable Template.
pub template: Option<models::PveBoolean>,
/// Configure a Disk for storing TPM state. The format is fixed to 'raw'. Use the special syntax STORAGE_ID:SIZE_IN_GiB to allocate a new volume. Note that SIZE_IN_GiB is ignored here and 4 MiB will be used instead. Use STORAGE_ID:0 and the 'import-from' parameter to import from an existing volume.
pub tpmstate0: Option<Box<models::PveTpmstateField>>,
/// Assign a unique random ethernet address.
pub unique: Option<models::PveBoolean>,
/// Number of hotplugged vcpus.
pub vcpus: Option<i64>,
/// Configure the VGA Hardware. If you want to use high resolution modes (>= 1280x1024x16) you may need to increase the vga memory option. Since QEMU 2.9 the default VGA display type is 'std' for all OS types besides some Windows versions (XP and older) which use 'cirrus'. The 'qxl' option enables the SPICE display server. For win* OS you can select how many independent displays you want, Linux guests can add displays them self. You can also run without any graphic card, using a serial device as terminal.
pub vga: Option<Box<models::PveVgaField>>,
/// The VM generation ID (vmgenid) device exposes a 128-bit integer value identifier to the guest OS. This allows to notify the guest operating system when the virtual machine is executed with a different configuration (e.g. snapshot execution or creation from a template). The guest operating system notices the change, and is then able to react as appropriate by marking its copies of distributed databases as dirty, re-initializing its random number generator, etc. Note that auto-creation only works when done through API/CLI create or update methods, but not when manually editing the config file.
pub vmgenid: Option<String>,
/// The (unique) ID of the VM.
pub vmid: i32,
/// Default storage for VM state volumes/files.
pub vmstatestorage: Option<String>,
/// Create a virtual hardware watchdog device. Once enabled (by a guest action), the watchdog must be periodically polled by an agent inside the guest or else the watchdog will reset the guest (or execute the respective action specified)
pub watchdog: Option<String>,
/// Hostpcis family. Wire form: `hostpci0..hostpci15`. Serialised by the manual impls below.
pub hostpcis: Option<std::collections::HashMap<u32, String>>,
/// Ides family. Wire form: `ide0..ide3`. Serialised by the manual impls below.
pub ides: Option<std::collections::HashMap<u32, models::PveIdeField>>,
/// Ipconfigs family. Wire form: `ipconfig0..ipconfig31`. Serialised by the manual impls below.
pub ipconfigs: Option<std::collections::HashMap<u32, String>>,
/// Nets family. Wire form: `net0..net31`. Serialised by the manual impls below.
pub nets: Option<std::collections::HashMap<u32, models::PveQemuNetField>>,
/// Numas family. Wire form: `numa0..numa7`. Serialised by the manual impls below.
pub numas: Option<std::collections::HashMap<u32, models::PveNumaField>>,
/// Parallels family. Wire form: `parallel0..parallel2`. Serialised by the manual impls below.
pub parallels: Option<std::collections::HashMap<u32, String>>,
/// Satas family. Wire form: `sata0..sata5`. Serialised by the manual impls below.
pub satas: Option<std::collections::HashMap<u32, models::PveSataField>>,
/// Scsis family. Wire form: `scsi0..scsi30`. Serialised by the manual impls below.
pub scsis: Option<std::collections::HashMap<u32, models::PveScsiField>>,
/// Serials family. Wire form: `serial0..serial3`. Serialised by the manual impls below.
pub serials: Option<std::collections::HashMap<u32, String>>,
/// Unuseds family. Wire form: `unused0..unused255`. Serialised by the manual impls below.
pub unuseds: Option<std::collections::HashMap<u32, models::PveQemuUnusedField>>,
/// Usbs family. Wire form: `usb0..usb4`. Serialised by the manual impls below.
pub usbs: Option<std::collections::HashMap<u32, models::PveUsbField>>,
/// Virtiofs family. Wire form: `virtiofs0..virtiofs8`. Serialised by the manual impls below.
pub virtiofs: Option<std::collections::HashMap<u32, models::PveVirtiofsField>>,
/// Virtios family. Wire form: `virtio0..virtio15`. Serialised by the manual impls below.
pub virtios: Option<std::collections::HashMap<u32, models::PveVirtioField>>,
}
impl QemuCreateVmRequest {
pub fn new(vmid: i32) -> QemuCreateVmRequest {
QemuCreateVmRequest {
acpi: None,
affinity: None,
agent: None,
allow_ksm: None,
amd_sev: None,
arch: None,
archive: None,
args: None,
audio0: None,
autostart: None,
balloon: None,
bios: None,
boot: None,
bootdisk: None,
bwlimit: None,
cdrom: None,
cicustom: None,
cipassword: None,
citype: None,
ciupgrade: None,
ciuser: None,
cores: None,
cpu: None,
cpulimit: None,
cpuunits: None,
description: None,
efidisk0: None,
force: None,
freeze: None,
ha_managed: None,
hookscript: None,
hotplug: None,
hugepages: None,
import_working_storage: None,
intel_tdx: None,
ivshmem: None,
keephugepages: None,
keyboard: None,
kvm: None,
live_restore: None,
localtime: None,
lock: None,
machine: None,
memory: None,
migrate_downtime: None,
migrate_speed: None,
name: None,
nameserver: None,
numa: None,
onboot: None,
ostype: None,
pool: None,
protection: None,
reboot: None,
rng0: None,
scsihw: None,
searchdomain: None,
shares: None,
smbios1: None,
smp: None,
sockets: None,
spice_enhancements: None,
sshkeys: None,
start: None,
startdate: None,
startup: None,
storage: None,
tablet: None,
tags: None,
tdf: None,
template: None,
tpmstate0: None,
unique: None,
vcpus: None,
vga: None,
vmgenid: None,
vmid,
vmstatestorage: None,
watchdog: None,
hostpcis: None,
ides: None,
ipconfigs: None,
nets: None,
numas: None,
parallels: None,
satas: None,
scsis: None,
serials: None,
unuseds: None,
usbs: None,
virtiofs: None,
virtios: None,
}
}
}
// Flattens indexed-family maps to/from `<base><idx>` wire keys.
impl serde::Serialize for QemuCreateVmRequest {
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.acpi).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("acpi".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.affinity).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("affinity".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.agent).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("agent".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.allow_ksm).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("allow-ksm".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.amd_sev).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("amd-sev".to_string(), _v);
}
}
{
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.archive).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("archive".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.args).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("args".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.audio0).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("audio0".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.autostart).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("autostart".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.balloon).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("balloon".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.bios).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("bios".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.boot).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("boot".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.bootdisk).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("bootdisk".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.cdrom).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("cdrom".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.cicustom).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("cicustom".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.cipassword).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("cipassword".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.citype).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("citype".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.ciupgrade).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("ciupgrade".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.ciuser).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("ciuser".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.cpu).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("cpu".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.description).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("description".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.efidisk0).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("efidisk0".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.freeze).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("freeze".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.hotplug).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("hotplug".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.hugepages).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("hugepages".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.import_working_storage).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("import-working-storage".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.intel_tdx).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("intel-tdx".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.ivshmem).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("ivshmem".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.keephugepages).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("keephugepages".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.keyboard).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("keyboard".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.kvm).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("kvm".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.live_restore).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("live-restore".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.localtime).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("localtime".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.machine).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("machine".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.migrate_downtime).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("migrate_downtime".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.migrate_speed).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("migrate_speed".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.name).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("name".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.numa).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("numa".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.ostype).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("ostype".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.reboot).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("reboot".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.rng0).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("rng0".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.scsihw).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("scsihw".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.shares).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("shares".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.smbios1).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("smbios1".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.smp).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("smp".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.sockets).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("sockets".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.spice_enhancements).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("spice_enhancements".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.sshkeys).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("sshkeys".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.startdate).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("startdate".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.tablet).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("tablet".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.tdf).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("tdf".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.tpmstate0).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("tpmstate0".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.vcpus).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("vcpus".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.vga).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("vga".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.vmgenid).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("vmgenid".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);
}
}
{
let _v = serde_json::to_value(&self.vmstatestorage).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("vmstatestorage".to_string(), _v);
}
}
{
let _v = serde_json::to_value(&self.watchdog).map_err(Error::custom)?;
if !_v.is_null() {
map.insert("watchdog".to_string(), _v);
}
}
if let Some(ref _m) = self.hostpcis {
for (_idx, _val) in _m.iter() {
map.insert(format!("hostpci{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
}
}
if let Some(ref _m) = self.ides {
for (_idx, _val) in _m.iter() {
map.insert(format!("ide{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
}
}
if let Some(ref _m) = self.ipconfigs {
for (_idx, _val) in _m.iter() {
map.insert(format!("ipconfig{}", _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.numas {
for (_idx, _val) in _m.iter() {
map.insert(format!("numa{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
}
}
if let Some(ref _m) = self.parallels {
for (_idx, _val) in _m.iter() {
map.insert(format!("parallel{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
}
}
if let Some(ref _m) = self.satas {
for (_idx, _val) in _m.iter() {
map.insert(format!("sata{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
}
}
if let Some(ref _m) = self.scsis {
for (_idx, _val) in _m.iter() {
map.insert(format!("scsi{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
}
}
if let Some(ref _m) = self.serials {
for (_idx, _val) in _m.iter() {
map.insert(format!("serial{}", _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)?);
}
}
if let Some(ref _m) = self.usbs {
for (_idx, _val) in _m.iter() {
map.insert(format!("usb{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
}
}
if let Some(ref _m) = self.virtiofs {
for (_idx, _val) in _m.iter() {
map.insert(format!("virtiofs{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
}
}
if let Some(ref _m) = self.virtios {
for (_idx, _val) in _m.iter() {
map.insert(format!("virtio{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
}
}
serde_json::Value::Object(map).serialize(serializer)
}
}
impl<'de> serde::Deserialize<'de> for QemuCreateVmRequest {
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 __hostpcis: std::collections::HashMap<u32, String> = std::collections::HashMap::new();
{
let _prefix = "hostpci";
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: String = serde_json::from_value(_value).map_err(Error::custom)?;
__hostpcis.insert(_idx, _item);
}
}
let mut __ides: std::collections::HashMap<u32, models::PveIdeField> = std::collections::HashMap::new();
{
let _prefix = "ide";
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::PveIdeField = serde_json::from_value(_value).map_err(Error::custom)?;
__ides.insert(_idx, _item);
}
}
let mut __ipconfigs: std::collections::HashMap<u32, String> = std::collections::HashMap::new();
{
let _prefix = "ipconfig";
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: String = serde_json::from_value(_value).map_err(Error::custom)?;
__ipconfigs.insert(_idx, _item);
}
}
let mut __nets: std::collections::HashMap<u32, models::PveQemuNetField> = 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::PveQemuNetField = serde_json::from_value(_value).map_err(Error::custom)?;
__nets.insert(_idx, _item);
}
}
let mut __numas: std::collections::HashMap<u32, models::PveNumaField> = std::collections::HashMap::new();
{
let _prefix = "numa";
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::PveNumaField = serde_json::from_value(_value).map_err(Error::custom)?;
__numas.insert(_idx, _item);
}
}
let mut __parallels: std::collections::HashMap<u32, String> = std::collections::HashMap::new();
{
let _prefix = "parallel";
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: String = serde_json::from_value(_value).map_err(Error::custom)?;
__parallels.insert(_idx, _item);
}
}
let mut __satas: std::collections::HashMap<u32, models::PveSataField> = std::collections::HashMap::new();
{
let _prefix = "sata";
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::PveSataField = serde_json::from_value(_value).map_err(Error::custom)?;
__satas.insert(_idx, _item);
}
}
let mut __scsis: std::collections::HashMap<u32, models::PveScsiField> = std::collections::HashMap::new();
{
let _prefix = "scsi";
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::PveScsiField = serde_json::from_value(_value).map_err(Error::custom)?;
__scsis.insert(_idx, _item);
}
}
let mut __serials: std::collections::HashMap<u32, String> = std::collections::HashMap::new();
{
let _prefix = "serial";
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: String = serde_json::from_value(_value).map_err(Error::custom)?;
__serials.insert(_idx, _item);
}
}
let mut __unuseds: std::collections::HashMap<u32, models::PveQemuUnusedField> = 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::PveQemuUnusedField = serde_json::from_value(_value).map_err(Error::custom)?;
__unuseds.insert(_idx, _item);
}
}
let mut __usbs: std::collections::HashMap<u32, models::PveUsbField> = std::collections::HashMap::new();
{
let _prefix = "usb";
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::PveUsbField = serde_json::from_value(_value).map_err(Error::custom)?;
__usbs.insert(_idx, _item);
}
}
let mut __virtiofs: std::collections::HashMap<u32, models::PveVirtiofsField> = std::collections::HashMap::new();
{
let _prefix = "virtiofs";
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::PveVirtiofsField = serde_json::from_value(_value).map_err(Error::custom)?;
__virtiofs.insert(_idx, _item);
}
}
let mut __virtios: std::collections::HashMap<u32, models::PveVirtioField> = std::collections::HashMap::new();
{
let _prefix = "virtio";
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::PveVirtioField = serde_json::from_value(_value).map_err(Error::custom)?;
__virtios.insert(_idx, _item);
}
}
Ok(QemuCreateVmRequest {
acpi: serde_json::from_value(raw.remove("acpi").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
affinity: serde_json::from_value(raw.remove("affinity").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
agent: serde_json::from_value(raw.remove("agent").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
allow_ksm: serde_json::from_value(raw.remove("allow-ksm").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
amd_sev: serde_json::from_value(raw.remove("amd-sev").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
arch: serde_json::from_value(raw.remove("arch").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
archive: serde_json::from_value(raw.remove("archive").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
args: serde_json::from_value(raw.remove("args").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
audio0: serde_json::from_value(raw.remove("audio0").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
autostart: serde_json::from_value(raw.remove("autostart").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
balloon: serde_json::from_value(raw.remove("balloon").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
bios: serde_json::from_value(raw.remove("bios").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
boot: serde_json::from_value(raw.remove("boot").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
bootdisk: serde_json::from_value(raw.remove("bootdisk").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)?,
cdrom: serde_json::from_value(raw.remove("cdrom").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
cicustom: serde_json::from_value(raw.remove("cicustom").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
cipassword: serde_json::from_value(raw.remove("cipassword").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
citype: serde_json::from_value(raw.remove("citype").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
ciupgrade: serde_json::from_value(raw.remove("ciupgrade").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
ciuser: serde_json::from_value(raw.remove("ciuser").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)?,
cpu: serde_json::from_value(raw.remove("cpu").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)?,
description: serde_json::from_value(raw.remove("description").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
efidisk0: serde_json::from_value(raw.remove("efidisk0").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)?,
freeze: serde_json::from_value(raw.remove("freeze").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)?,
hotplug: serde_json::from_value(raw.remove("hotplug").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
hugepages: serde_json::from_value(raw.remove("hugepages").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
import_working_storage: serde_json::from_value(raw.remove("import-working-storage").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
intel_tdx: serde_json::from_value(raw.remove("intel-tdx").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
ivshmem: serde_json::from_value(raw.remove("ivshmem").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
keephugepages: serde_json::from_value(raw.remove("keephugepages").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
keyboard: serde_json::from_value(raw.remove("keyboard").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
kvm: serde_json::from_value(raw.remove("kvm").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
live_restore: serde_json::from_value(raw.remove("live-restore").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
localtime: serde_json::from_value(raw.remove("localtime").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)?,
machine: serde_json::from_value(raw.remove("machine").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)?,
migrate_downtime: serde_json::from_value(raw.remove("migrate_downtime").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
migrate_speed: serde_json::from_value(raw.remove("migrate_speed").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
name: serde_json::from_value(raw.remove("name").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)?,
numa: serde_json::from_value(raw.remove("numa").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)?,
ostype: serde_json::from_value(raw.remove("ostype").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)?,
reboot: serde_json::from_value(raw.remove("reboot").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
rng0: serde_json::from_value(raw.remove("rng0").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
scsihw: serde_json::from_value(raw.remove("scsihw").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)?,
shares: serde_json::from_value(raw.remove("shares").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
smbios1: serde_json::from_value(raw.remove("smbios1").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
smp: serde_json::from_value(raw.remove("smp").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
sockets: serde_json::from_value(raw.remove("sockets").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
spice_enhancements: serde_json::from_value(raw.remove("spice_enhancements").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
sshkeys: serde_json::from_value(raw.remove("sshkeys").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)?,
startdate: serde_json::from_value(raw.remove("startdate").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)?,
tablet: serde_json::from_value(raw.remove("tablet").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)?,
tdf: serde_json::from_value(raw.remove("tdf").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)?,
tpmstate0: serde_json::from_value(raw.remove("tpmstate0").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)?,
vcpus: serde_json::from_value(raw.remove("vcpus").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
vga: serde_json::from_value(raw.remove("vga").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
vmgenid: serde_json::from_value(raw.remove("vmgenid").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)?,
vmstatestorage: serde_json::from_value(raw.remove("vmstatestorage").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
watchdog: serde_json::from_value(raw.remove("watchdog").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
hostpcis: if __hostpcis.is_empty() { None } else { Some(__hostpcis) },
ides: if __ides.is_empty() { None } else { Some(__ides) },
ipconfigs: if __ipconfigs.is_empty() { None } else { Some(__ipconfigs) },
nets: if __nets.is_empty() { None } else { Some(__nets) },
numas: if __numas.is_empty() { None } else { Some(__numas) },
parallels: if __parallels.is_empty() { None } else { Some(__parallels) },
satas: if __satas.is_empty() { None } else { Some(__satas) },
scsis: if __scsis.is_empty() { None } else { Some(__scsis) },
serials: if __serials.is_empty() { None } else { Some(__serials) },
unuseds: if __unuseds.is_empty() { None } else { Some(__unuseds) },
usbs: if __usbs.is_empty() { None } else { Some(__usbs) },
virtiofs: if __virtiofs.is_empty() { None } else { Some(__virtiofs) },
virtios: if __virtios.is_empty() { None } else { Some(__virtios) },
})
}
}