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

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

/// SidecarTask represents a subset of Task fields that can be set to override
/// the fields of the Task generated for the sidecar
///
/// This struct was generated based on the Go types of the official Nomad API.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Builder)]
pub struct SidecarTask {
    #[serde(rename = "kill_signal", skip_serializing_if = "Option::is_none")]
    pub kill_signal: Option<String>,

    #[serde(
        rename = "VolumeMounts",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub volume_mounts: Vec<super::VolumeMount>,

    #[serde(rename = "Driver")]
    pub driver: String,

    #[serde(rename = "User")]
    pub user: String,

    #[serde(rename = "Config")]
    pub config: std::collections::HashMap<String, serde_json::Value>,

    #[serde(rename = "Env")]
    pub env: std::collections::HashMap<String, String>,

    #[serde(rename = "Resources", skip_serializing_if = "Option::is_none")]
    pub resources: Option<super::Resources>,

    #[serde(rename = "Meta")]
    pub meta: std::collections::HashMap<String, String>,

    #[serde(rename = "Name")]
    pub name: String,

    #[serde(
        rename = "kill_timeout",
        skip_serializing_if = "Option::is_none",
        serialize_with = "crate::serialize_duration_option",
        deserialize_with = "crate::deserialize_duration_option",
        default
    )]
    pub kill_timeout: Option<chrono::TimeDelta>,

    #[serde(rename = "logs", skip_serializing_if = "Option::is_none")]
    pub log_config: Option<super::LogConfig>,

    #[serde(
        rename = "shutdown_delay",
        skip_serializing_if = "Option::is_none",
        serialize_with = "crate::serialize_duration_option",
        deserialize_with = "crate::deserialize_duration_option",
        default
    )]
    pub shutdown_delay: Option<chrono::TimeDelta>,
}
