//! Auto-generated models for flux-operator-resourcesetinputproviders
//! Generated from: flux-operator-resourcesetinputproviders.crds.yaml
//! DO NOT EDIT - This file is auto-generated by kopium
#![allow(clippy::all)]

// WARNING: generated by kopium - manual changes will be overwritten
// kopium command: kopium --filename /tmp/tmp.rRXNwKC7OV/doc1.yaml --derive Default --derive PartialEq --docs --smart-derive-elision
// kopium version: 0.23.0

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

use self::prelude::*;

/// ResourceSetInputProviderSpec defines the desired state of ResourceSetInputProvider
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, PartialEq)]
#[kube(
    group = "fluxcd.controlplane.io",
    version = "v1",
    kind = "ResourceSetInputProvider",
    plural = "resourcesetinputproviders"
)]
#[kube(namespaced)]
#[kube(status = "ResourceSetInputProviderStatus")]
#[kube(schema = "disabled")]
#[kube(derive = "PartialEq")]
pub struct ResourceSetInputProviderSpec {
    /// CertSecretRef specifies the Kubernetes Secret containing either or both of
    ///
    /// - a PEM-encoded CA certificate (`ca.crt`)
    /// - a PEM-encoded client certificate (`tls.crt`) and private key (`tls.key`)
    ///
    /// When connecting to a Git, OCI, or ExternalService provider that uses self-signed certificates,
    /// the CA certificate must be set in the Secret under the 'ca.crt' key to establish the trust relationship.
    /// When connecting to a provider that supports client certificates (mTLS), the client certificate
    /// and private key must be set in the Secret under the 'tls.crt' and 'tls.key' keys, respectively.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "certSecretRef"
    )]
    pub cert_secret_ref: Option<ResourceSetInputProviderCertSecretRef>,
    /// DefaultValues contains the default values for the inputs.
    /// These values are used to populate the inputs when the provider
    /// response does not contain them.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "defaultValues"
    )]
    pub default_values: Option<BTreeMap<String, serde_json::Value>>,
    /// Filter defines the filter to apply to the input provider response.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub filter: Option<ResourceSetInputProviderFilter>,
    /// Insecure allows connecting to an ExternalService or OCIArtifactTag provider
    /// over plain HTTP without TLS. When not set, the URL must use HTTPS.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub insecure: Option<bool>,
    /// Schedule defines the schedules for the input provider to run.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub schedule: Option<Vec<ResourceSetInputProviderSchedule>>,
    /// SecretRef specifies the Kubernetes Secret containing the credentials
    /// to access the input provider.
    /// When connecting to a Git provider, the secret must contain the keys
    /// 'username' and 'password', and the password should be a personal access token
    /// that grants read-only access to the repository.
    /// When connecting to an OCI provider, the secret must contain a Kubernetes
    /// Image Pull Secret, as if created by `kubectl create secret docker-registry`.
    /// When connecting to an ExternalService provider, the secret must contain either
    /// a 'token' key for bearer token authentication, or 'username' and 'password'
    /// keys for basic authentication.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "secretRef")]
    pub secret_ref: Option<ResourceSetInputProviderSecretRef>,
    /// ServiceAccountName specifies the name of the Kubernetes ServiceAccount
    /// used for authentication with AWS, Azure or GCP services through
    /// workload identity federation features. If not specified, the
    /// authentication for these cloud providers will use the ServiceAccount
    /// of the operator (or any other environment authentication configuration).
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "serviceAccountName"
    )]
    pub service_account_name: Option<String>,
    /// Skip defines whether we need to skip input provider response updates.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub skip: Option<ResourceSetInputProviderSkip>,
    /// Type specifies the type of the input provider.
    #[serde(rename = "type")]
    pub r#type: ResourceSetInputProviderType,
    /// URL specifies the HTTP/S or OCI address of the input provider API.
    /// When connecting to a Git provider, the URL should point to the repository address.
    /// When connecting to an OCI provider, the URL should point to the OCI repository address.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub url: Option<String>,
}

/// CertSecretRef specifies the Kubernetes Secret containing either or both of
///
/// - a PEM-encoded CA certificate (`ca.crt`)
/// - a PEM-encoded client certificate (`tls.crt`) and private key (`tls.key`)
///
/// When connecting to a Git, OCI, or ExternalService provider that uses self-signed certificates,
/// the CA certificate must be set in the Secret under the 'ca.crt' key to establish the trust relationship.
/// When connecting to a provider that supports client certificates (mTLS), the client certificate
/// and private key must be set in the Secret under the 'tls.crt' and 'tls.key' keys, respectively.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct ResourceSetInputProviderCertSecretRef {
    /// Name of the referent.
    pub name: String,
}

/// Filter defines the filter to apply to the input provider response.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct ResourceSetInputProviderFilter {
    /// ExcludeBranch specifies the regular expression to filter the branches
    /// that the input provider should exclude.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "excludeBranch"
    )]
    pub exclude_branch: Option<String>,
    /// ExcludeEnvironment specifies the regular expression to filter the environments
    /// that the input provider should exclude.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "excludeEnvironment"
    )]
    pub exclude_environment: Option<String>,
    /// ExcludeTag specifies the regular expression to filter the tags
    /// that the input provider should exclude.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "excludeTag"
    )]
    pub exclude_tag: Option<String>,
    /// IncludeBranch specifies the regular expression to filter the branches
    /// that the input provider should include.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "includeBranch"
    )]
    pub include_branch: Option<String>,
    /// IncludeEnvironment specifies the regular expression to filter the environments
    /// that the input provider should include.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "includeEnvironment"
    )]
    pub include_environment: Option<String>,
    /// IncludeTag specifies the regular expression to filter the tags
    /// that the input provider should include.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "includeTag"
    )]
    pub include_tag: Option<String>,
    /// Labels specifies the list of labels to filter the input provider response.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub labels: Option<Vec<String>>,
    /// Limit specifies the maximum number of input sets to return.
    /// When not set, the default limit is 100.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub limit: Option<i64>,
    /// Semver specifies a semantic version range to filter and sort the tags.
    /// If this field is not specified, the tags will be sorted in reverse
    /// alphabetical order.
    /// Supported only for tags at the moment.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub semver: Option<String>,
}

/// Schedule defines a schedule for something to run.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct ResourceSetInputProviderSchedule {
    /// Cron specifies the cron expression for the schedule.
    pub cron: String,
    /// TimeZone specifies the time zone for the cron schedule. Defaults to UTC.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "timeZone")]
    pub time_zone: Option<String>,
    /// Window defines the time window during which the execution is allowed.
    /// Defaults to 0s, meaning no window is applied.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub window: Option<String>,
}

/// SecretRef specifies the Kubernetes Secret containing the credentials
/// to access the input provider.
/// When connecting to a Git provider, the secret must contain the keys
/// 'username' and 'password', and the password should be a personal access token
/// that grants read-only access to the repository.
/// When connecting to an OCI provider, the secret must contain a Kubernetes
/// Image Pull Secret, as if created by `kubectl create secret docker-registry`.
/// When connecting to an ExternalService provider, the secret must contain either
/// a 'token' key for bearer token authentication, or 'username' and 'password'
/// keys for basic authentication.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct ResourceSetInputProviderSecretRef {
    /// Name of the referent.
    pub name: String,
}

/// Skip defines whether we need to skip input provider response updates.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct ResourceSetInputProviderSkip {
    /// Labels specifies list of labels to skip input provider response when any of the label conditions matched.
    /// When prefixed with !, input provider response will be skipped if it does not have this label.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub labels: Option<Vec<String>>,
}

/// ResourceSetInputProviderSpec defines the desired state of ResourceSetInputProvider
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum ResourceSetInputProviderType {
    Static,
    GitHubBranch,
    GitHubTag,
    GitHubPullRequest,
    GitLabBranch,
    GitLabTag,
    GitLabMergeRequest,
    GitLabEnvironment,
    AzureDevOpsBranch,
    AzureDevOpsTag,
    AzureDevOpsPullRequest,
    GiteaBranch,
    GiteaTag,
    GiteaPullRequest,
    #[serde(rename = "OCIArtifactTag")]
    OciArtifactTag,
    #[serde(rename = "ACRArtifactTag")]
    AcrArtifactTag,
    #[serde(rename = "ECRArtifactTag")]
    EcrArtifactTag,
    #[serde(rename = "GARArtifactTag")]
    GarArtifactTag,
    ExternalService,
}

/// ResourceSetInputProviderStatus defines the observed state of ResourceSetInputProvider.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct ResourceSetInputProviderStatus {
    /// Conditions contains the readiness conditions of the object.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub conditions: Option<Vec<Condition>>,
    /// ExportedInputs contains the list of inputs exported by the provider.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "exportedInputs"
    )]
    pub exported_inputs: Option<Vec<BTreeMap<String, serde_json::Value>>>,
    /// LastExportedRevision is the digest of the
    /// inputs that were last reconcile.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "lastExportedRevision"
    )]
    pub last_exported_revision: Option<String>,
    /// LastHandledForceAt holds the value of the most recent
    /// force request value, so a change of the annotation value
    /// can be detected.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "lastHandledForceAt"
    )]
    pub last_handled_force_at: Option<String>,
    /// LastHandledReconcileAt holds the value of the most recent
    /// reconcile request value, so a change of the annotation value
    /// can be detected.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "lastHandledReconcileAt"
    )]
    pub last_handled_reconcile_at: Option<String>,
    /// NextSchedule is the next schedule when the input provider will run.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "nextSchedule"
    )]
    pub next_schedule: Option<ResourceSetInputProviderStatusNextSchedule>,
}

/// NextSchedule is the next schedule when the input provider will run.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct ResourceSetInputProviderStatusNextSchedule {
    /// Cron specifies the cron expression for the schedule.
    pub cron: String,
    /// TimeZone specifies the time zone for the cron schedule. Defaults to UTC.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "timeZone")]
    pub time_zone: Option<String>,
    /// When is the next time the schedule will run.
    pub when: String,
    /// Window defines the time window during which the execution is allowed.
    /// Defaults to 0s, meaning no window is applied.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub window: Option<String>,
}
