/*
 * Cloud Hypervisor API
 *
 * Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
 *
 * The version of the OpenAPI document: 0.3.0
 *
 * Generated by: https://openapi-generator.tech
 */

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

/// VmConfig : Virtual machine configuration
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct VmConfig {
    #[serde(rename = "cpus", skip_serializing_if = "Option::is_none")]
    pub cpus: Option<models::CpusConfig>,
    #[serde(rename = "memory", skip_serializing_if = "Option::is_none")]
    pub memory: Option<models::MemoryConfig>,
    #[serde(rename = "payload")]
    pub payload: models::PayloadConfig,
    #[serde(rename = "rate_limit_groups", skip_serializing_if = "Option::is_none")]
    pub rate_limit_groups: Option<Vec<models::RateLimitGroupConfig>>,
    #[serde(rename = "disks", skip_serializing_if = "Option::is_none")]
    pub disks: Option<Vec<models::DiskConfig>>,
    #[serde(rename = "net", skip_serializing_if = "Option::is_none")]
    pub net: Option<Vec<models::NetConfig>>,
    #[serde(rename = "rng", skip_serializing_if = "Option::is_none")]
    pub rng: Option<models::RngConfig>,
    #[serde(rename = "balloon", skip_serializing_if = "Option::is_none")]
    pub balloon: Option<models::BalloonConfig>,
    #[serde(rename = "fs", skip_serializing_if = "Option::is_none")]
    pub fs: Option<Vec<models::FsConfig>>,
    #[serde(rename = "generic-vhost-user", skip_serializing_if = "Option::is_none")]
    pub generic_vhost_user: Option<Vec<models::GenericVhostUserConfig>>,
    #[serde(rename = "pmem", skip_serializing_if = "Option::is_none")]
    pub pmem: Option<Vec<models::PmemConfig>>,
    #[serde(rename = "serial", skip_serializing_if = "Option::is_none")]
    pub serial: Option<models::ConsoleConfig>,
    #[serde(rename = "console", skip_serializing_if = "Option::is_none")]
    pub console: Option<models::ConsoleConfig>,
    #[serde(rename = "debug_console", skip_serializing_if = "Option::is_none")]
    pub debug_console: Option<models::DebugConsoleConfig>,
    #[serde(rename = "devices", skip_serializing_if = "Option::is_none")]
    pub devices: Option<Vec<models::DeviceConfig>>,
    #[serde(rename = "user_devices", skip_serializing_if = "Option::is_none")]
    pub user_devices: Option<Vec<models::UserDeviceConfig>>,
    #[serde(rename = "vdpa", skip_serializing_if = "Option::is_none")]
    pub vdpa: Option<Vec<models::VdpaConfig>>,
    #[serde(rename = "vsock", skip_serializing_if = "Option::is_none")]
    pub vsock: Option<models::VsockConfig>,
    #[serde(rename = "numa", skip_serializing_if = "Option::is_none")]
    pub numa: Option<Vec<models::NumaConfig>>,
    #[serde(rename = "iommu", skip_serializing_if = "Option::is_none")]
    pub iommu: Option<bool>,
    #[serde(rename = "watchdog", skip_serializing_if = "Option::is_none")]
    pub watchdog: Option<bool>,
    #[serde(rename = "pvpanic", skip_serializing_if = "Option::is_none")]
    pub pvpanic: Option<bool>,
    #[serde(rename = "pci_segments", skip_serializing_if = "Option::is_none")]
    pub pci_segments: Option<Vec<models::PciSegmentConfig>>,
    #[serde(rename = "platform", skip_serializing_if = "Option::is_none")]
    pub platform: Option<models::PlatformConfig>,
    #[serde(rename = "tpm", skip_serializing_if = "Option::is_none")]
    pub tpm: Option<models::TpmConfig>,
    #[serde(rename = "landlock_enable", skip_serializing_if = "Option::is_none")]
    pub landlock_enable: Option<bool>,
    #[serde(rename = "landlock_rules", skip_serializing_if = "Option::is_none")]
    pub landlock_rules: Option<Vec<models::LandlockConfig>>,
}

impl VmConfig {
    /// Virtual machine configuration
    pub fn new(payload: models::PayloadConfig) -> VmConfig {
        VmConfig {
            cpus: None,
            memory: None,
            payload,
            rate_limit_groups: None,
            disks: None,
            net: None,
            rng: None,
            balloon: None,
            fs: None,
            generic_vhost_user: None,
            pmem: None,
            serial: None,
            console: None,
            debug_console: None,
            devices: None,
            user_devices: None,
            vdpa: None,
            vsock: None,
            numa: None,
            iommu: None,
            watchdog: None,
            pvpanic: None,
            pci_segments: None,
            platform: None,
            tpm: None,
            landlock_enable: None,
            landlock_rules: None,
        }
    }
}
