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

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

/// WorkloadIdentity is the jobspec block which determines if and how a workload
/// identity is exposed to tasks.
///
/// This struct was generated based on the Go types of the official Nomad API.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Builder)]
pub struct WorkloadIdentity {
    #[serde(rename = "change_mode", skip_serializing_if = "Option::is_none")]
    pub change_mode: Option<String>,

    #[serde(rename = "change_signal", skip_serializing_if = "Option::is_none")]
    pub change_signal: Option<String>,

    #[serde(rename = "Env")]
    pub env: bool,

    #[serde(rename = "File")]
    pub file: bool,

    #[serde(rename = "Filepath")]
    pub filepath: String,

    #[serde(rename = "ServiceName")]
    pub service_name: String,

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

    #[serde(rename = "aud", skip_serializing_if = "Option::is_none")]
    pub audience: Option<Vec<String>>,

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