// WARNING: generated by kopium - manual changes will be overwritten
// kopium command: kopium -f backups.yml --schema=derived --docs -b --derive=Default --derive=PartialEq --smart-derive-elision
// kopium version: 0.21.2

#[allow(unused_imports)]
mod prelude {
    pub use kube_derive::CustomResource;
    #[cfg(feature = "schemars")]
    pub use schemars::JsonSchema;
    pub use serde::{Deserialize, Serialize};
    pub use std::collections::BTreeMap;
    #[cfg(feature = "builder")]
    pub use typed_builder::TypedBuilder;
}
use self::prelude::*;

/// Specification of the desired behavior of the backup.
/// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
#[cfg_attr(not(feature = "schemars"), kube(schema = "disabled"))]
#[kube(
    group = "postgresql.cnpg.io",
    version = "v1",
    kind = "Backup",
    plural = "backups"
)]
#[kube(namespaced)]
#[kube(status = "BackupStatus")]
#[kube(derive = "Default")]
#[kube(derive = "PartialEq")]
pub struct BackupSpec {
    /// The cluster to backup
    pub cluster: BackupCluster,
    /// The backup method to be used, possible options are `barmanObjectStore`,
    /// `volumeSnapshot` or `plugin`. Defaults to: `barmanObjectStore`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub method: Option<BackupMethod>,
    /// Whether the default type of backup with volume snapshots is
    /// online/hot (`true`, default) or offline/cold (`false`)
    /// Overrides the default setting specified in the cluster field '.spec.backup.volumeSnapshot.online'
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub online: Option<bool>,
    /// Configuration parameters to control the online/hot backup with volume snapshots
    /// Overrides the default settings specified in the cluster '.backup.volumeSnapshot.onlineConfiguration' stanza
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "onlineConfiguration"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub online_configuration: Option<BackupOnlineConfiguration>,
    /// Configuration parameters passed to the plugin managing this backup
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "pluginConfiguration"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub plugin_configuration: Option<BackupPluginConfiguration>,
    /// The policy to decide which instance should perform this backup. If empty,
    /// it defaults to `cluster.spec.backup.target`.
    /// Available options are empty string, `primary` and `prefer-standby`.
    /// `primary` to have backups run always on primary instances,
    /// `prefer-standby` to have backups run preferably on the most updated
    /// standby, if available.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub target: Option<BackupTarget>,
}

/// The cluster to backup
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupCluster {
    /// Name of the referent.
    pub name: String,
}

/// Specification of the desired behavior of the backup.
/// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum BackupMethod {
    #[serde(rename = "barmanObjectStore")]
    BarmanObjectStore,
    #[serde(rename = "volumeSnapshot")]
    VolumeSnapshot,
    #[serde(rename = "plugin")]
    Plugin,
}

/// Configuration parameters to control the online/hot backup with volume snapshots
/// Overrides the default settings specified in the cluster '.backup.volumeSnapshot.onlineConfiguration' stanza
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupOnlineConfiguration {
    /// Control whether the I/O workload for the backup initial checkpoint will
    /// be limited, according to the `checkpoint_completion_target` setting on
    /// the PostgreSQL server. If set to true, an immediate checkpoint will be
    /// used, meaning PostgreSQL will complete the checkpoint as soon as
    /// possible. `false` by default.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "immediateCheckpoint"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub immediate_checkpoint: Option<bool>,
    /// If false, the function will return immediately after the backup is completed,
    /// without waiting for WAL to be archived.
    /// This behavior is only useful with backup software that independently monitors WAL archiving.
    /// Otherwise, WAL required to make the backup consistent might be missing and make the backup useless.
    /// By default, or when this parameter is true, pg_backup_stop will wait for WAL to be archived when archiving is
    /// enabled.
    /// On a standby, this means that it will wait only when archive_mode = always.
    /// If write activity on the primary is low, it may be useful to run pg_switch_wal on the primary in order to trigger
    /// an immediate segment switch.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "waitForArchive"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub wait_for_archive: Option<bool>,
}

/// Configuration parameters passed to the plugin managing this backup
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupPluginConfiguration {
    /// Name is the name of the plugin managing this backup
    pub name: String,
    /// Parameters are the configuration parameters passed to the backup
    /// plugin for this backup
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub parameters: Option<BTreeMap<String, String>>,
}

/// Specification of the desired behavior of the backup.
/// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub enum BackupTarget {
    #[serde(rename = "primary")]
    Primary,
    #[serde(rename = "prefer-standby")]
    PreferStandby,
}

/// Most recently observed status of the backup. This data may not be up to
/// date. Populated by the system. Read-only.
/// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupStatus {
    /// The credentials to use to upload data to Azure Blob Storage
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "azureCredentials"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub azure_credentials: Option<BackupStatusAzureCredentials>,
    /// The ID of the Barman backup
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "backupId")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub backup_id: Option<String>,
    /// Backup label file content as returned by Postgres in case of online (hot) backups
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "backupLabelFile"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub backup_label_file: Option<String>,
    /// The Name of the Barman backup
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "backupName"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub backup_name: Option<String>,
    /// The starting xlog
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "beginLSN")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub begin_lsn: Option<String>,
    /// The starting WAL
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "beginWal")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub begin_wal: Option<String>,
    /// The backup command output in case of error
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "commandError"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub command_error: Option<String>,
    /// Unused. Retained for compatibility with old versions.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "commandOutput"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub command_output: Option<String>,
    /// The path where to store the backup (i.e. s3://bucket/path/to/folder)
    /// this path, with different destination folders, will be used for WALs
    /// and for data. This may not be populated in case of errors.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "destinationPath"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub destination_path: Option<String>,
    /// Encryption method required to S3 API
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub encryption: Option<String>,
    /// The ending xlog
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "endLSN")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub end_lsn: Option<String>,
    /// The ending WAL
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "endWal")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub end_wal: Option<String>,
    /// EndpointCA store the CA bundle of the barman endpoint.
    /// Useful when using self-signed certificates to avoid
    /// errors with certificate issuer and barman-cloud-wal-archive.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "endpointCA"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub endpoint_ca: Option<BackupStatusEndpointCa>,
    /// Endpoint to be used to upload data to the cloud,
    /// overriding the automatic endpoint discovery
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "endpointURL"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub endpoint_url: Option<String>,
    /// The detected error
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub error: Option<String>,
    /// The credentials to use to upload data to Google Cloud Storage
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "googleCredentials"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub google_credentials: Option<BackupStatusGoogleCredentials>,
    /// Information to identify the instance where the backup has been taken from
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "instanceID"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub instance_id: Option<BackupStatusInstanceId>,
    /// The PostgreSQL major version that was running when the
    /// backup was taken.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "majorVersion"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub major_version: Option<i64>,
    /// The backup method being used
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub method: Option<String>,
    /// Whether the backup was online/hot (`true`) or offline/cold (`false`)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub online: Option<bool>,
    /// The last backup status
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub phase: Option<String>,
    /// A map containing the plugin metadata
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "pluginMetadata"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub plugin_metadata: Option<BTreeMap<String, String>>,
    /// The credentials to use to upload data to S3
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "s3Credentials"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub s3_credentials: Option<BackupStatusS3Credentials>,
    /// The server name on S3, the cluster name is used if this
    /// parameter is omitted
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "serverName"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub server_name: Option<String>,
    /// Status of the volumeSnapshot backup
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "snapshotBackupStatus"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub snapshot_backup_status: Option<BackupStatusSnapshotBackupStatus>,
    /// When the backup was started
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "startedAt")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub started_at: Option<String>,
    /// When the backup was terminated
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "stoppedAt")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub stopped_at: Option<String>,
    /// Tablespace map file content as returned by Postgres in case of online (hot) backups
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "tablespaceMapFile"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub tablespace_map_file: Option<String>,
}

/// The credentials to use to upload data to Azure Blob Storage
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupStatusAzureCredentials {
    /// The connection string to be used
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "connectionString"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub connection_string: Option<BackupStatusAzureCredentialsConnectionString>,
    /// Use the Azure AD based authentication without providing explicitly the keys.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "inheritFromAzureAD"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub inherit_from_azure_ad: Option<bool>,
    /// The storage account where to upload data
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "storageAccount"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub storage_account: Option<BackupStatusAzureCredentialsStorageAccount>,
    /// The storage account key to be used in conjunction
    /// with the storage account name
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "storageKey"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub storage_key: Option<BackupStatusAzureCredentialsStorageKey>,
    /// A shared-access-signature to be used in conjunction with
    /// the storage account name
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "storageSasToken"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub storage_sas_token: Option<BackupStatusAzureCredentialsStorageSasToken>,
    /// Use the default Azure authentication flow, which includes DefaultAzureCredential.
    /// This allows authentication using environment variables and managed identities.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "useDefaultAzureCredentials"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub use_default_azure_credentials: Option<bool>,
}

/// The connection string to be used
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupStatusAzureCredentialsConnectionString {
    /// The key to select
    pub key: String,
    /// Name of the referent.
    pub name: String,
}

/// The storage account where to upload data
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupStatusAzureCredentialsStorageAccount {
    /// The key to select
    pub key: String,
    /// Name of the referent.
    pub name: String,
}

/// The storage account key to be used in conjunction
/// with the storage account name
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupStatusAzureCredentialsStorageKey {
    /// The key to select
    pub key: String,
    /// Name of the referent.
    pub name: String,
}

/// A shared-access-signature to be used in conjunction with
/// the storage account name
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupStatusAzureCredentialsStorageSasToken {
    /// The key to select
    pub key: String,
    /// Name of the referent.
    pub name: String,
}

/// EndpointCA store the CA bundle of the barman endpoint.
/// Useful when using self-signed certificates to avoid
/// errors with certificate issuer and barman-cloud-wal-archive.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupStatusEndpointCa {
    /// The key to select
    pub key: String,
    /// Name of the referent.
    pub name: String,
}

/// The credentials to use to upload data to Google Cloud Storage
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupStatusGoogleCredentials {
    /// The secret containing the Google Cloud Storage JSON file with the credentials
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "applicationCredentials"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub application_credentials: Option<BackupStatusGoogleCredentialsApplicationCredentials>,
    /// If set to true, will presume that it's running inside a GKE environment,
    /// default to false.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "gkeEnvironment"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub gke_environment: Option<bool>,
}

/// The secret containing the Google Cloud Storage JSON file with the credentials
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupStatusGoogleCredentialsApplicationCredentials {
    /// The key to select
    pub key: String,
    /// Name of the referent.
    pub name: String,
}

/// Information to identify the instance where the backup has been taken from
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupStatusInstanceId {
    /// The container ID
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "ContainerID"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub container_id: Option<String>,
    /// The pod name
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "podName")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub pod_name: Option<String>,
    /// The instance manager session ID. This is a unique identifier generated at instance manager
    /// startup and changes on every restart (including container reboots). Used to detect if
    /// the instance manager was restarted during long-running operations like backups, which
    /// would terminate any running backup process.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "sessionID")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub session_id: Option<String>,
}

/// The credentials to use to upload data to S3
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupStatusS3Credentials {
    /// The reference to the access key id
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "accessKeyId"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub access_key_id: Option<BackupStatusS3CredentialsAccessKeyId>,
    /// Use the role based authentication without providing explicitly the keys.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "inheritFromIAMRole"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub inherit_from_iam_role: Option<bool>,
    /// The reference to the secret containing the region name
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub region: Option<BackupStatusS3CredentialsRegion>,
    /// The reference to the secret access key
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "secretAccessKey"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub secret_access_key: Option<BackupStatusS3CredentialsSecretAccessKey>,
    /// The references to the session key
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "sessionToken"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub session_token: Option<BackupStatusS3CredentialsSessionToken>,
}

/// The reference to the access key id
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupStatusS3CredentialsAccessKeyId {
    /// The key to select
    pub key: String,
    /// Name of the referent.
    pub name: String,
}

/// The reference to the secret containing the region name
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupStatusS3CredentialsRegion {
    /// The key to select
    pub key: String,
    /// Name of the referent.
    pub name: String,
}

/// The reference to the secret access key
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupStatusS3CredentialsSecretAccessKey {
    /// The key to select
    pub key: String,
    /// Name of the referent.
    pub name: String,
}

/// The references to the session key
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupStatusS3CredentialsSessionToken {
    /// The key to select
    pub key: String,
    /// Name of the referent.
    pub name: String,
}

/// Status of the volumeSnapshot backup
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupStatusSnapshotBackupStatus {
    /// The elements list, populated with the gathered volume snapshots
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub elements: Option<Vec<BackupStatusSnapshotBackupStatusElements>>,
}

/// BackupSnapshotElementStatus is a volume snapshot that is part of a volume snapshot method backup
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "builder", derive(TypedBuilder))]
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
pub struct BackupStatusSnapshotBackupStatusElements {
    /// Name is the snapshot resource name
    pub name: String,
    /// TablespaceName is the name of the snapshotted tablespace. Only set
    /// when type is PG_TABLESPACE
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "tablespaceName"
    )]
    #[cfg_attr(feature = "builder", builder(default, setter(strip_option)))]
    pub tablespace_name: Option<String>,
    /// Type is tho role of the snapshot in the cluster, such as PG_DATA, PG_WAL and PG_TABLESPACE
    #[serde(rename = "type")]
    pub r#type: String,
}
