/*
 * 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};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct NetConfig {
    #[serde(rename = "tap", skip_serializing_if = "Option::is_none")]
    pub tap: Option<String>,
    /// IPv4 or IPv6 address
    #[serde(rename = "ip", skip_serializing_if = "Option::is_none")]
    pub ip: Option<String>,
    /// Must be a valid IPv4 netmask if ip is an IPv4 address or a valid IPv6 netmask if ip is an IPv6 address.
    #[serde(rename = "mask", skip_serializing_if = "Option::is_none")]
    pub mask: Option<String>,
    #[serde(rename = "mac", skip_serializing_if = "Option::is_none")]
    pub mac: Option<String>,
    #[serde(rename = "host_mac", skip_serializing_if = "Option::is_none")]
    pub host_mac: Option<String>,
    #[serde(rename = "mtu", skip_serializing_if = "Option::is_none")]
    pub mtu: Option<i32>,
    #[serde(rename = "iommu", skip_serializing_if = "Option::is_none")]
    pub iommu: Option<bool>,
    #[serde(rename = "num_queues", skip_serializing_if = "Option::is_none")]
    pub num_queues: Option<i32>,
    #[serde(rename = "queue_size", skip_serializing_if = "Option::is_none")]
    pub queue_size: Option<i32>,
    #[serde(rename = "vhost_user", skip_serializing_if = "Option::is_none")]
    pub vhost_user: Option<bool>,
    #[serde(rename = "vhost_socket", skip_serializing_if = "Option::is_none")]
    pub vhost_socket: Option<String>,
    #[serde(rename = "vhost_mode", skip_serializing_if = "Option::is_none")]
    pub vhost_mode: Option<String>,
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    #[serde(rename = "pci_segment", skip_serializing_if = "Option::is_none")]
    pub pci_segment: Option<i16>,
    #[serde(rename = "pci_device_id", skip_serializing_if = "Option::is_none")]
    pub pci_device_id: Option<u8>,
    #[serde(
        rename = "rate_limiter_config",
        skip_serializing_if = "Option::is_none"
    )]
    pub rate_limiter_config: Option<models::RateLimiterConfig>,
    #[serde(rename = "offload_tso", skip_serializing_if = "Option::is_none")]
    pub offload_tso: Option<bool>,
    #[serde(rename = "offload_ufo", skip_serializing_if = "Option::is_none")]
    pub offload_ufo: Option<bool>,
    #[serde(rename = "offload_csum", skip_serializing_if = "Option::is_none")]
    pub offload_csum: Option<bool>,
}

impl NetConfig {
    pub fn new() -> NetConfig {
        NetConfig {
            tap: None,
            ip: None,
            mask: None,
            mac: None,
            host_mac: None,
            mtu: None,
            iommu: None,
            num_queues: None,
            queue_size: None,
            vhost_user: None,
            vhost_socket: None,
            vhost_mode: None,
            id: None,
            pci_segment: None,
            pci_device_id: None,
            rate_limiter_config: None,
            offload_tso: None,
            offload_ufo: None,
            offload_csum: None,
        }
    }
}
