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

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

/// RequestedDevice is used to request a device for a 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 RequestedDevice {
    /// Name is the request name. The possible values are as follows:
    /// * <type>: A single value only specifies the type of request.
    /// * <vendor>/<type>: A single slash delimiter assumes the vendor and type of device is specified.
    /// * <vendor>/<type>/<name>: Two slash delimiters assume vendor, type and specific model are specified.
    ///
    /// Examples are as follows:
    /// * "gpu"
    /// * "nvidia/gpu"
    /// * "nvidia/gpu/GTX2080Ti"
    #[serde(rename = "Name")]
    pub name: String,

    /// Count is the number of requested devices
    #[serde(rename = "Count", skip_serializing_if = "Option::is_none")]
    pub count: Option<u64>,

    /// Constraints are a set of constraints to apply when selecting the device
    /// to use.
    #[serde(
        rename = "Constraints",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub constraints: Vec<super::Constraint>,

    /// Affinities are a set of affinites to apply when selecting the device
    /// to use.
    #[serde(
        rename = "Affinities",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub affinities: Vec<super::Affinity>,
}
