kcr_jetstream_nats_io 3.20260118.103134

Kubernetes Custom Resource Bindings
Documentation
// WARNING: generated by kopium - manual changes will be overwritten
// kopium command: kopium --docs --derive=Default --derive=PartialEq --smart-derive-elision --filename crd-catalog/nats-io/nack/jetstream.nats.io/v1beta2/accounts.yaml
// kopium version: 0.22.5

#[allow(unused_imports)]
mod prelude {
    pub use kube::CustomResource;
    pub use serde::{Serialize, Deserialize};
    pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition;
}
use self::prelude::*;

#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[kube(group = "jetstream.nats.io", version = "v1beta2", kind = "Account", plural = "accounts")]
#[kube(namespaced)]
#[kube(status = "AccountStatus")]
#[kube(schema = "disabled")]
#[kube(derive="Default")]
#[kube(derive="PartialEq")]
pub struct AccountSpec {
    /// The creds to be used to connect to the NATS Service.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub creds: Option<AccountCreds>,
    /// A unique name for the Account.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// A list of servers to connect.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub servers: Option<Vec<String>>,
    /// The TLS certs to be used to connect to the NATS Service.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub tls: Option<AccountTls>,
    /// When true, the KV Store will initiate TLS before server INFO.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "tlsFirst")]
    pub tls_first: Option<bool>,
    /// The token to be used to connect to the NATS Service.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub token: Option<AccountToken>,
    /// The user and password to be used to connect to the NATS Service.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub user: Option<AccountUser>,
}

/// The creds to be used to connect to the NATS Service.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct AccountCreds {
    /// Credentials file, generated with github.com/nats-io/nsc tool.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub file: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub secret: Option<AccountCredsSecret>,
}

#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct AccountCredsSecret {
    /// Name of the secret with the creds.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
}

/// The TLS certs to be used to connect to the NATS Service.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct AccountTls {
    /// Filename of the Root CA of the TLS cert.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub ca: Option<String>,
    /// Filename of the TLS cert.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub cert: Option<String>,
    /// Filename of the TLS cert key.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub key: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub secret: Option<AccountTlsSecret>,
}

#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct AccountTlsSecret {
    /// Name of the TLS secret with the certs.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
}

/// The token to be used to connect to the NATS Service.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct AccountToken {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub secret: Option<AccountTokenSecret>,
    /// Key in the secret that contains the token.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub token: Option<String>,
}

#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct AccountTokenSecret {
    /// Name of the secret with the token.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
}

/// The user and password to be used to connect to the NATS Service.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct AccountUser {
    /// Key in the secret that contains the password.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub password: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub secret: Option<AccountUserSecret>,
    /// Key in the secret that contains the user.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub user: Option<String>,
}

#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct AccountUserSecret {
    /// Name of the secret with the user and password.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
}

#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct AccountStatus {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub conditions: Option<Vec<Condition>>,
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "observedGeneration")]
    pub observed_generation: Option<i64>,
}