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

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

/// ACLBindingRule contains a direct relation to an ACLAuthMethod and represents
/// a rule to apply when logging in via the named AuthMethod. This allows the
/// transformation of OIDC provider claims, to Nomad based ACL concepts such as
/// ACL Roles and Policies.
///
/// This struct was generated based on the Go types of the official Nomad API.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Builder)]
pub struct AclBindingRule {
    #[serde(rename = "CreateTime")]
    pub create_time: chrono::DateTime<chrono::Utc>,

    #[serde(rename = "ModifyTime")]
    pub modify_time: chrono::DateTime<chrono::Utc>,

    #[serde(rename = "ModifyIndex")]
    pub modify_index: u64,

    /// BindType adjusts how this binding rule is applied at login time. The
    /// valid values are ACLBindingRuleBindTypeRole,
    /// ACLBindingRuleBindTypePolicy, and ACLBindingRuleBindTypeManagement.
    #[serde(rename = "BindType")]
    pub bind_type: String,

    /// BindName is the target of the binding. Can be lightly templated using
    /// HIL ${foo} syntax from available field names. How it is used depends
    /// upon the BindType.
    #[serde(rename = "BindName")]
    pub bind_name: String,

    /// AuthMethod is the name of the auth method for which this rule applies
    /// to. This is required and the method must exist within state before the
    /// cluster administrator can create the rule.
    #[serde(rename = "AuthMethod")]
    pub auth_method: String,

    /// Selector is an expression that matches against verified identity
    /// attributes returned from the auth method during login. This is optional
    /// and when not set, provides a catch-all rule.
    #[serde(rename = "Selector")]
    pub selector: String,

    #[serde(rename = "CreateIndex")]
    pub create_index: u64,

    /// ID is an internally generated UUID for this rule and is controlled by
    /// Nomad.
    #[serde(rename = "ID")]
    pub id: String,

    /// Description is a human-readable, operator set description that can
    /// provide additional context about the binding rule. This is an
    /// operational field.
    #[serde(rename = "Description")]
    pub description: String,
}
