/*
 * This is an auto-generated file.
 * Any manual changes may be overwritten without notice!
 */

use derive_builder::Builder;
use serde::{Deserialize, Serialize};

/// NetworkResource is used to describe required network
/// resources of a given task.
///
/// This struct was generated based on the Go types of the official Nomad API.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Builder)]
pub struct NetworkResource {
    #[serde(rename = "Hostname")]
    pub hostname: String,

    #[serde(rename = "IP")]
    pub ip: String,

    #[serde(rename = "DNS", skip_serializing_if = "Option::is_none")]
    pub dns: Option<super::DNSConfig>,

    #[serde(
        rename = "DynamicPorts",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub dynamic_ports: Vec<super::Port>,

    #[serde(
        rename = "ReservedPorts",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub reserved_ports: Vec<super::Port>,

    /// COMPAT(0.13)
    /// XXX Deprecated. Please do not use. The field will be removed in Nomad
    /// 0.13 and is only being kept to allow any references to be removed before
    /// then.
    #[serde(rename = "MBits", skip_serializing_if = "Option::is_none")]
    pub m_bits: Option<i64>,

    #[serde(rename = "CNI", skip_serializing_if = "Option::is_none")]
    pub cni: Option<super::CNIConfig>,

    #[serde(rename = "Mode")]
    pub mode: String,

    #[serde(rename = "Device")]
    pub device: String,

    #[serde(rename = "CIDR")]
    pub cidr: String,
}
