kcr_couchbase_com 3.20260601.153757

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/couchbase-partners/helm-charts/couchbase.com/v2/couchbasebackuprestores.yaml
// kopium version: 0.23.0

#[allow(unused_imports)]
mod prelude {
    pub use kube::CustomResource;
    pub use serde::{Serialize, Deserialize};
    pub use std::collections::BTreeMap;
}

use self::prelude::*;

/// CouchbaseBackupRestoreSpec allows the specification of data restoration to be
/// configured.  This includes the backup and repository to restore data from, and
/// the time range of data to be restored.
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[kube(group = "couchbase.com", version = "v2", kind = "CouchbaseBackupRestore", plural = "couchbasebackuprestores")]
#[kube(namespaced)]
#[kube(status = "CouchbaseBackupRestoreStatus")]
#[kube(schema = "disabled")]
#[kube(derive="Default")]
#[kube(derive="PartialEq")]
pub struct CouchbaseBackupRestoreSpec {
    /// Number of times the restore job should try to execute.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "backoffLimit")]
    pub backoff_limit: Option<i32>,
    /// The backup resource name associated with this restore, or the backup PVC
    /// name to restore from.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub backup: Option<String>,
    /// DEPRECATED - by spec.data.
    /// Specific buckets can be explicitly included or excluded in the restore,
    /// as well as bucket mappings.  This field is now ignored.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub buckets: Option<BTreeMap<String, serde_json::Value>>,
    /// Data allows control over what key-value/document data is included in the
    /// restore.  By default, all data is included.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub data: Option<CouchbaseBackupRestoreData>,
    /// End denotes the last backup to restore from.  Omitting this field will only
    /// restore the backup referenced by start.  This may be specified as
    /// an integer index (starting from 1), a string specifying a short date
    /// DD-MM-YYYY, the backup name, or one of either `start` or `oldest` keywords.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end: Option<CouchbaseBackupRestoreEnd>,
    /// Forces data in the Couchbase cluster to be overwritten even if the data in the cluster is newer.
    /// By default, the system does not force updates,
    /// and all updates use Couchbase's conflict resolution mechanism to ensure
    /// that if newer data exists on the cluster,
    /// older restored data does not overwrite it.
    /// However, if `couchbasebackuprestores.spec.forceUpdates` is true,
    /// then the backup record will _always_ overwrite the cluster record,
    /// regardless of Couchbase's conflict resolution.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "forceUpdates")]
    pub force_updates: Option<bool>,
    /// Number of hours to hold restore script logs for, everything older will be deleted.
    /// More info:
    /// <https://golang.org/pkg/time/#ParseDuration>
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "logRetention")]
    pub log_retention: Option<String>,
    /// The remote destination for backup.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "objectStore")]
    pub object_store: Option<CouchbaseBackupRestoreObjectStore>,
    /// Overwrites the already existing users in the cluster when  user restoration is enabled (spec.services.users).
    /// The default behavior of backup/restore of users is to skip already existing users.
    /// This is only available for Couchbase Server 7.6 and later.
    /// This field defaults to `false`.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "overwriteUsers")]
    pub overwrite_users: Option<bool>,
    /// Repo is the backup folder to restore from.  If no repository is specified,
    /// the backup container will choose the latest.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub repo: Option<String>,
    /// DEPRECATED - by spec.objectStore.uri
    /// Name of S3 bucket to restore from. If non-empty this overrides local backup.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub s3bucket: Option<String>,
    /// This list accepts a certain set of parameters that will disable that data and prevent it being restored.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub services: Option<CouchbaseBackupRestoreServices>,
    /// StagingVolume contains configuration related to the
    /// ephemeral volume used as staging when restoring from a cloud backup.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "stagingVolume")]
    pub staging_volume: Option<CouchbaseBackupRestoreStagingVolume>,
    /// Start denotes the first backup to restore from.  This may be specified as
    /// an integer index (starting from 1), a string specifying a short date
    /// DD-MM-YYYY, the backup name, or one of either `start` or `oldest` keywords.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub start: Option<CouchbaseBackupRestoreStart>,
    /// How many threads to use during the restore.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub threads: Option<i64>,
    /// Number of seconds to elapse before a completed job is deleted.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "ttlSecondsAfterFinished")]
    pub ttl_seconds_after_finished: Option<i32>,
}

/// Data allows control over what key-value/document data is included in the
/// restore.  By default, all data is included.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct CouchbaseBackupRestoreData {
    /// Exclude defines the buckets, scopes or collections that are excluded from the backup.
    /// When this field is set, it implies that by default everything will be backed up,
    /// and data items can be explicitly excluded.  You may define an exclusion as a bucket
    /// -- `my-bucket`, a scope -- `my-bucket.my-scope`, or a collection -- `my-bucket.my-scope.my-collection`.
    /// Buckets may contain periods, and therefore must be escaped -- `my\.bucket.my-scope`, as
    /// period is the separator used to delimit scopes and collections.  Excluded data cannot overlap
    /// e.g. specifying `my-bucket` and `my-bucket.my-scope` is illegal.  This field cannot
    /// be used at the same time as included items.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub exclude: Option<Vec<String>>,
    /// FilterKeys only restores documents whose names match the provided regular expression.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "filterKeys")]
    pub filter_keys: Option<String>,
    /// FilterValues only restores documents whose values match the provided regular expression.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "filterValues")]
    pub filter_values: Option<String>,
    /// Include defines the buckets, scopes or collections that are included in the restore.
    /// When this field is set, it implies that by default nothing will be restored,
    /// and data items must be explicitly included.  You may define an inclusion as a bucket
    /// -- `my-bucket`, a scope -- `my-bucket.my-scope`, or a collection -- `my-bucket.my-scope.my-collection`.
    /// Buckets may contain periods, and therefore must be escaped -- `my\.bucket.my-scope`, as
    /// period is the separator used to delimit scopes and collections.  Included data cannot overlap
    /// e.g. specifying `my-bucket` and `my-bucket.my-scope` is illegal.  This field cannot
    /// be used at the same time as excluded items.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub include: Option<Vec<String>>,
    /// Map allows data items in the restore to be remapped to a different named container.
    /// Buckets can be remapped to other buckets e.g. "source=target", scopes and collections
    /// can be remapped to other scopes and collections within the same bucket only e.g.
    /// "bucket.scope=bucket.other" or "bucket.scope.collection=bucket.scope.other".  Map
    /// sources may only be specified once, and may not overlap.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub map: Option<Vec<CouchbaseBackupRestoreDataMap>>,
}

/// RestoreMapping allows data to be migrated on restore.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct CouchbaseBackupRestoreDataMap {
    /// Source defines the data source of the mapping, this may be either
    /// a bucket, scope or collection.
    pub source: String,
    /// Target defines the data target of the mapping, this may be either
    /// a bucket, scope or collection, and must refer to the same type
    /// as the restore source.
    pub target: String,
}

/// End denotes the last backup to restore from.  Omitting this field will only
/// restore the backup referenced by start.  This may be specified as
/// an integer index (starting from 1), a string specifying a short date
/// DD-MM-YYYY, the backup name, or one of either `start` or `oldest` keywords.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct CouchbaseBackupRestoreEnd {
    /// Int references a relative backup by index.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub int: Option<i64>,
    /// Str references an absolute backup by name.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub str: Option<String>,
}

/// The remote destination for backup.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct CouchbaseBackupRestoreObjectStore {
    /// Endpoint contains the configuration for connecting to a custom Azure/S3/GCP compliant object store.
    /// If set will override `CouchbaseCluster.spec.backup.objectEndpoint`
    /// See <https://docs.couchbase.com/server/current/backup-restore/cbbackupmgr-cloud.html#compatible-object-stores>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub endpoint: Option<CouchbaseBackupRestoreObjectStoreEndpoint>,
    /// ObjStoreSecret must contain two fields, access-key-id, secret-access-key and optionally either region or refresh-token.
    /// These correspond to the fields used by cbbackupmgr
    /// <https://docs.couchbase.com/server/current/backup-restore/cbbackupmgr-backup.html#optional-2>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub secret: Option<String>,
    /// URI is a reference to a remote object store.
    /// This is the prefix of the object store and the bucket name.
    /// i.e s3://bucket, az://bucket or gs://bucket.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub uri: Option<String>,
    /// Whether to allow the backup SDK to attempt to authenticate
    /// using the instance metadata api.
    /// If set, will override `CouchbaseCluster.spec.backup.useIAM`.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "useIAM")]
    pub use_iam: Option<bool>,
}

/// Endpoint contains the configuration for connecting to a custom Azure/S3/GCP compliant object store.
/// If set will override `CouchbaseCluster.spec.backup.objectEndpoint`
/// See <https://docs.couchbase.com/server/current/backup-restore/cbbackupmgr-cloud.html#compatible-object-stores>
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct CouchbaseBackupRestoreObjectStoreEndpoint {
    /// The name of the secret, in this namespace, that contains the CA certificate for verification of a TLS endpoint
    /// The secret must have the key with the name "tls.crt"
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub secret: Option<String>,
    /// The host/address of the custom object endpoint.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub url: Option<String>,
    /// UseVirtualPath will force the AWS SDK to use the new virtual style paths
    /// which are often required by S3 compatible object stores.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "useVirtualPath")]
    pub use_virtual_path: Option<bool>,
}

/// This list accepts a certain set of parameters that will disable that data and prevent it being restored.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct CouchbaseBackupRestoreServices {
    /// Analytics restores analytics datasets from the backup.  This field
    /// defaults to true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub analytics: Option<bool>,
    /// BucketConfig restores all bucket configuration settings.
    /// If you are restoring to cluster with managed buckets, then this
    /// option may conflict with existing bucket settings, and the results
    /// are undefined, so avoid use.  This option is intended for use
    /// with unmanaged buckets.  Note that bucket durability settings are
    /// not restored in versions less than and equal to 1.1.0, and will
    /// need to be manually applied.  This field defaults to false.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "bucketConfig")]
    pub bucket_config: Option<bool>,
    /// BucketQuery enables the backup of query metadata for all buckets.
    /// This field defaults to `true`.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "bucketQuery")]
    pub bucket_query: Option<bool>,
    /// ClusterAnalytics enables the backup of cluster-wide analytics data, for example synonyms.
    /// This field defaults to `true`.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "clusterAnalytics")]
    pub cluster_analytics: Option<bool>,
    /// ClusterQuery enables the backup of cluster level query metadata.
    /// This field defaults to `true`.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "clusterQuery")]
    pub cluster_query: Option<bool>,
    /// Data restores document data from the backup.  This field defaults
    /// to true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub data: Option<bool>,
    /// Eventing restores eventing functions from the backup.  This field
    /// defaults to true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub eventing: Option<bool>,
    /// FTAlias restores full-text search aliases from the backup.  This
    /// field defaults to true.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "ftAlias")]
    pub ft_alias: Option<bool>,
    /// FTIndex restores full-text search indexes from the backup.  This
    /// field defaults to true.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "ftIndex")]
    pub ft_index: Option<bool>,
    /// GSIIndex restores document indexes from the backup.  This field
    /// defaults to true.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "gsiIndex")]
    pub gsi_index: Option<bool>,
    /// Users restores cluster level users, including their roles and permissions. This is
    /// only available for Couchbase Server 7.6 and later. This field defaults to `false`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub users: Option<bool>,
    /// Views restores views from the backup.  This field defaults to true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub views: Option<bool>,
}

/// StagingVolume contains configuration related to the
/// ephemeral volume used as staging when restoring from a cloud backup.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct CouchbaseBackupRestoreStagingVolume {
    /// Size allows the specification of a staging volume. More info:
    /// <https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#resource-units-in-kubernetes>
    /// The ephemeral volume will only be used when restoring from a cloud provider,
    /// if the backup job was created using ephemeral storage.
    /// Otherwise the restore job will share a staging volume with the backup job.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub size: Option<String>,
    /// Name of StorageClass to use.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "storageClassName")]
    pub storage_class_name: Option<String>,
}

/// Start denotes the first backup to restore from.  This may be specified as
/// an integer index (starting from 1), a string specifying a short date
/// DD-MM-YYYY, the backup name, or one of either `start` or `oldest` keywords.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct CouchbaseBackupRestoreStart {
    /// Int references a relative backup by index.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub int: Option<i64>,
    /// Str references an absolute backup by name.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub str: Option<String>,
}

/// CouchbaseBackupRestoreStatus provides status indications of a restore from
/// backup.  This includes whether or not the restore is running, whether the
/// restore succeed or not, and the duration the restore took.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct CouchbaseBackupRestoreStatus {
    /// Location of Backup Archive.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub archive: Option<String>,
    /// Backups gives us a full list of all backups
    /// and their respective repository locations.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub backups: Option<Vec<CouchbaseBackupRestoreStatusBackups>>,
    /// Duration tells us how long the last restore took.  More info:
    /// <https://golang.org/pkg/time/#ParseDuration>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub duration: Option<String>,
    /// Failed indicates whether the most recent restore has failed.
    pub failed: bool,
    /// DEPRECATED - field may no longer be populated.
    /// Job tells us which job is running/ran last.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub job: Option<String>,
    /// LastFailure tells us the time the last failed restore failed.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "lastFailure")]
    pub last_failure: Option<String>,
    /// LastRun tells us the time the last restore job started.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "lastRun")]
    pub last_run: Option<String>,
    /// LastSuccess gives us the time the last successful restore finished.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "lastSuccess")]
    pub last_success: Option<String>,
    /// DEPRECATED - field may no longer be populated.
    /// Output reports useful information from the backup process.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub output: Option<String>,
    /// DEPRECATED - field may no longer be populated.
    /// Pod tells us which pod is running/ran last.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub pod: Option<String>,
    /// Repo is where we are currently performing operations.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub repo: Option<String>,
    /// Running indicates whether a restore is currently being performed.
    pub running: bool,
}

#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct CouchbaseBackupRestoreStatusBackups {
    /// Full backup inside the repository.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub full: Option<String>,
    /// Incremental backups inside the repository.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub incrementals: Option<Vec<String>>,
    /// Name of the repository.
    pub name: String,
}