use serde::{Deserialize, Serialize}; /*
                                      * Cloud SQL Admin API
                                      *
                                      * API for Cloud SQL database instance management
                                      *
                                      * The version of the OpenAPI document: v1
                                      *
                                      * Generated by: https://openapi-generator.tech
                                      */

/// DatabaseInstance : A Cloud SQL instance resource.

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct DatabaseInstance {
    /// List all maintenance versions applicable on the instance
    #[serde(
        rename = "availableMaintenanceVersions",
        skip_serializing_if = "Option::is_none"
    )]
    pub available_maintenance_versions: Option<Vec<String>>,
    /// The backend type. `SECOND_GEN`: Cloud SQL database instance. `EXTERNAL`: A database server that is not managed by Google. This property is read-only; use the `tier` property in the `settings` object to determine the database type.
    #[serde(rename = "backendType", skip_serializing_if = "Option::is_none")]
    pub backend_type: Option<BackendType>,
    /// Connection name of the Cloud SQL instance used in connection strings.
    #[serde(rename = "connectionName", skip_serializing_if = "Option::is_none")]
    pub connection_name: Option<String>,
    /// Output only. The time when the instance was created in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example `2012-11-15T16:19:00.094Z`.
    #[serde(rename = "createTime", skip_serializing_if = "Option::is_none")]
    pub create_time: Option<String>,
    /// The current disk usage of the instance in bytes. This property has been deprecated. Use the \"cloudsql.googleapis.com/database/disk/bytes_used\" metric in Cloud Monitoring API instead. Please see [this announcement](https://groups.google.com/d/msg/google-cloud-sql-announce/I_7-F9EBhT0/BtvFtdFeAgAJ) for details.
    #[serde(rename = "currentDiskSize", skip_serializing_if = "Option::is_none")]
    pub current_disk_size: Option<String>,
    /// Output only. Stores the current database version running on the instance including minor version such as `MYSQL_8_0_18`.
    #[serde(
        rename = "databaseInstalledVersion",
        skip_serializing_if = "Option::is_none"
    )]
    pub database_installed_version: Option<String>,
    /// The database engine type and version. The `databaseVersion` field cannot be changed after instance creation.
    #[serde(rename = "databaseVersion", skip_serializing_if = "Option::is_none")]
    pub database_version: Option<DatabaseVersion>,
    #[serde(
        rename = "diskEncryptionConfiguration",
        skip_serializing_if = "Option::is_none"
    )]
    pub disk_encryption_configuration:
        Option<Box<crate::google_rest_apis::sqladmin_v1::models::DiskEncryptionConfiguration>>,
    #[serde(
        rename = "diskEncryptionStatus",
        skip_serializing_if = "Option::is_none"
    )]
    pub disk_encryption_status:
        Option<Box<crate::google_rest_apis::sqladmin_v1::models::DiskEncryptionStatus>>,
    /// This field is deprecated and will be removed from a future version of the API. Use the `settings.settingsVersion` field instead.
    #[serde(rename = "etag", skip_serializing_if = "Option::is_none")]
    pub etag: Option<String>,
    #[serde(rename = "failoverReplica", skip_serializing_if = "Option::is_none")]
    pub failover_replica:
        Option<Box<crate::google_rest_apis::sqladmin_v1::models::DatabaseInstanceFailoverReplica>>,
    /// The Compute Engine zone that the instance is currently serving from. This value could be different from the zone that was specified when the instance was created if the instance has failed over to its secondary zone. WARNING: Changing this might restart the instance.
    #[serde(rename = "gceZone", skip_serializing_if = "Option::is_none")]
    pub gce_zone: Option<String>,
    /// The instance type.
    #[serde(rename = "instanceType", skip_serializing_if = "Option::is_none")]
    pub instance_type: Option<InstanceType>,
    /// The assigned IP addresses for the instance.
    #[serde(rename = "ipAddresses", skip_serializing_if = "Option::is_none")]
    pub ip_addresses: Option<Vec<crate::google_rest_apis::sqladmin_v1::models::IpMapping>>,
    /// The IPv6 address assigned to the instance. (Deprecated) This property was applicable only to First Generation instances.
    #[serde(rename = "ipv6Address", skip_serializing_if = "Option::is_none")]
    pub ipv6_address: Option<String>,
    /// This is always `sql#instance`.
    #[serde(rename = "kind", skip_serializing_if = "Option::is_none")]
    pub kind: Option<String>,
    /// The current software version on the instance.
    #[serde(rename = "maintenanceVersion", skip_serializing_if = "Option::is_none")]
    pub maintenance_version: Option<String>,
    /// The name of the instance which will act as primary in the replication setup.
    #[serde(rename = "masterInstanceName", skip_serializing_if = "Option::is_none")]
    pub master_instance_name: Option<String>,
    /// The maximum disk size of the instance in bytes.
    #[serde(rename = "maxDiskSize", skip_serializing_if = "Option::is_none")]
    pub max_disk_size: Option<String>,
    /// Name of the Cloud SQL instance. This does not include the project ID.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    #[serde(
        rename = "onPremisesConfiguration",
        skip_serializing_if = "Option::is_none"
    )]
    pub on_premises_configuration:
        Option<Box<crate::google_rest_apis::sqladmin_v1::models::OnPremisesConfiguration>>,
    #[serde(rename = "outOfDiskReport", skip_serializing_if = "Option::is_none")]
    pub out_of_disk_report:
        Option<Box<crate::google_rest_apis::sqladmin_v1::models::SqlOutOfDiskReport>>,
    /// The project ID of the project containing the Cloud SQL instance. The Google apps domain is prefixed if applicable.
    #[serde(rename = "project", skip_serializing_if = "Option::is_none")]
    pub project: Option<String>,
    /// The geographical region. Can be: * `us-central` (`FIRST_GEN` instances only) * `us-central1` (`SECOND_GEN` instances only) * `asia-east1` or `europe-west1`. Defaults to `us-central` or `us-central1` depending on the instance type. The region cannot be changed after instance creation.
    #[serde(rename = "region", skip_serializing_if = "Option::is_none")]
    pub region: Option<String>,
    #[serde(
        rename = "replicaConfiguration",
        skip_serializing_if = "Option::is_none"
    )]
    pub replica_configuration:
        Option<Box<crate::google_rest_apis::sqladmin_v1::models::ReplicaConfiguration>>,
    /// The replicas of the instance.
    #[serde(rename = "replicaNames", skip_serializing_if = "Option::is_none")]
    pub replica_names: Option<Vec<String>>,
    /// Initial root password. Use only on creation. You must set root passwords before you can connect to PostgreSQL instances.
    #[serde(rename = "rootPassword", skip_serializing_if = "Option::is_none")]
    pub root_password: Option<String>,
    /// The status indicating if instance satisfiesPzs. Reserved for future use.
    #[serde(rename = "satisfiesPzs", skip_serializing_if = "Option::is_none")]
    pub satisfies_pzs: Option<bool>,
    #[serde(
        rename = "scheduledMaintenance",
        skip_serializing_if = "Option::is_none"
    )]
    pub scheduled_maintenance:
        Option<Box<crate::google_rest_apis::sqladmin_v1::models::SqlScheduledMaintenance>>,
    /// The Compute Engine zone that the failover instance is currently serving from for a regional instance. This value could be different from the zone that was specified when the instance was created if the instance has failed over to its secondary/failover zone.
    #[serde(rename = "secondaryGceZone", skip_serializing_if = "Option::is_none")]
    pub secondary_gce_zone: Option<String>,
    /// The URI of this resource.
    #[serde(rename = "selfLink", skip_serializing_if = "Option::is_none")]
    pub self_link: Option<String>,
    #[serde(rename = "serverCaCert", skip_serializing_if = "Option::is_none")]
    pub server_ca_cert: Option<Box<crate::google_rest_apis::sqladmin_v1::models::SslCert>>,
    /// The service account email address assigned to the instance.\\This property is read-only.
    #[serde(
        rename = "serviceAccountEmailAddress",
        skip_serializing_if = "Option::is_none"
    )]
    pub service_account_email_address: Option<String>,
    #[serde(rename = "settings", skip_serializing_if = "Option::is_none")]
    pub settings: Option<Box<crate::google_rest_apis::sqladmin_v1::models::Settings>>,
    /// The current serving state of the Cloud SQL instance.
    #[serde(rename = "state", skip_serializing_if = "Option::is_none")]
    pub state: Option<State>,
    /// If the instance state is SUSPENDED, the reason for the suspension.
    #[serde(rename = "suspensionReason", skip_serializing_if = "Option::is_none")]
    pub suspension_reason: Option<Vec<SuspensionReason>>,
}

impl DatabaseInstance {
    /// A Cloud SQL instance resource.
    pub fn new() -> DatabaseInstance {
        DatabaseInstance {
            available_maintenance_versions: None,
            backend_type: None,
            connection_name: None,
            create_time: None,
            current_disk_size: None,
            database_installed_version: None,
            database_version: None,
            disk_encryption_configuration: None,
            disk_encryption_status: None,
            etag: None,
            failover_replica: None,
            gce_zone: None,
            instance_type: None,
            ip_addresses: None,
            ipv6_address: None,
            kind: None,
            maintenance_version: None,
            master_instance_name: None,
            max_disk_size: None,
            name: None,
            on_premises_configuration: None,
            out_of_disk_report: None,
            project: None,
            region: None,
            replica_configuration: None,
            replica_names: None,
            root_password: None,
            satisfies_pzs: None,
            scheduled_maintenance: None,
            secondary_gce_zone: None,
            self_link: None,
            server_ca_cert: None,
            service_account_email_address: None,
            settings: None,
            state: None,
            suspension_reason: None,
        }
    }
}

/// The backend type. `SECOND_GEN`: Cloud SQL database instance. `EXTERNAL`: A database server that is not managed by Google. This property is read-only; use the `tier` property in the `settings` object to determine the database type.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum BackendType {
    #[serde(rename = "SQL_BACKEND_TYPE_UNSPECIFIED")]
    SqlBackendTypeUnspecified,
    #[serde(rename = "FIRST_GEN")]
    FirstGen,
    #[serde(rename = "SECOND_GEN")]
    SecondGen,
    #[serde(rename = "EXTERNAL")]
    External,
}

impl Default for BackendType {
    fn default() -> BackendType {
        Self::SqlBackendTypeUnspecified
    }
}
/// The database engine type and version. The `databaseVersion` field cannot be changed after instance creation.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum DatabaseVersion {
    #[serde(rename = "SQL_DATABASE_VERSION_UNSPECIFIED")]
    SqlDatabaseVersionUnspecified,
    #[serde(rename = "MYSQL_5_1")]
    Mysql51,
    #[serde(rename = "MYSQL_5_5")]
    Mysql55,
    #[serde(rename = "MYSQL_5_6")]
    Mysql56,
    #[serde(rename = "MYSQL_5_7")]
    Mysql57,
    #[serde(rename = "SQLSERVER_2017_STANDARD")]
    Sqlserver2017Standard,
    #[serde(rename = "SQLSERVER_2017_ENTERPRISE")]
    Sqlserver2017Enterprise,
    #[serde(rename = "SQLSERVER_2017_EXPRESS")]
    Sqlserver2017Express,
    #[serde(rename = "SQLSERVER_2017_WEB")]
    Sqlserver2017Web,
    #[serde(rename = "POSTGRES_9_6")]
    Postgres96,
    #[serde(rename = "POSTGRES_10")]
    Postgres10,
    #[serde(rename = "POSTGRES_11")]
    Postgres11,
    #[serde(rename = "POSTGRES_12")]
    Postgres12,
    #[serde(rename = "POSTGRES_13")]
    Postgres13,
    #[serde(rename = "POSTGRES_14")]
    Postgres14,
    #[serde(rename = "MYSQL_8_0")]
    Mysql80,
    #[serde(rename = "MYSQL_8_0_18")]
    Mysql8018,
    #[serde(rename = "MYSQL_8_0_26")]
    Mysql8026,
    #[serde(rename = "MYSQL_8_0_27")]
    Mysql8027,
    #[serde(rename = "MYSQL_8_0_28")]
    Mysql8028,
    #[serde(rename = "MYSQL_8_0_29")]
    Mysql8029,
    #[serde(rename = "MYSQL_8_0_30")]
    Mysql8030,
    #[serde(rename = "MYSQL_8_0_31")]
    Mysql8031,
    #[serde(rename = "SQLSERVER_2019_STANDARD")]
    Sqlserver2019Standard,
    #[serde(rename = "SQLSERVER_2019_ENTERPRISE")]
    Sqlserver2019Enterprise,
    #[serde(rename = "SQLSERVER_2019_EXPRESS")]
    Sqlserver2019Express,
    #[serde(rename = "SQLSERVER_2019_WEB")]
    Sqlserver2019Web,
}

impl Default for DatabaseVersion {
    fn default() -> DatabaseVersion {
        Self::SqlDatabaseVersionUnspecified
    }
}
/// The instance type.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum InstanceType {
    #[serde(rename = "SQL_INSTANCE_TYPE_UNSPECIFIED")]
    SqlInstanceTypeUnspecified,
    #[serde(rename = "CLOUD_SQL_INSTANCE")]
    CloudSqlInstance,
    #[serde(rename = "ON_PREMISES_INSTANCE")]
    OnPremisesInstance,
    #[serde(rename = "READ_REPLICA_INSTANCE")]
    ReadReplicaInstance,
}

impl Default for InstanceType {
    fn default() -> InstanceType {
        Self::SqlInstanceTypeUnspecified
    }
}
/// The current serving state of the Cloud SQL instance.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum State {
    #[serde(rename = "SQL_INSTANCE_STATE_UNSPECIFIED")]
    SqlInstanceStateUnspecified,
    #[serde(rename = "RUNNABLE")]
    Runnable,
    #[serde(rename = "SUSPENDED")]
    Suspended,
    #[serde(rename = "PENDING_DELETE")]
    PendingDelete,
    #[serde(rename = "PENDING_CREATE")]
    PendingCreate,
    #[serde(rename = "MAINTENANCE")]
    Maintenance,
    #[serde(rename = "FAILED")]
    Failed,
    #[serde(rename = "ONLINE_MAINTENANCE")]
    OnlineMaintenance,
}

impl Default for State {
    fn default() -> State {
        Self::SqlInstanceStateUnspecified
    }
}
/// If the instance state is SUSPENDED, the reason for the suspension.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum SuspensionReason {
    #[serde(rename = "SQL_SUSPENSION_REASON_UNSPECIFIED")]
    SqlSuspensionReasonUnspecified,
    #[serde(rename = "BILLING_ISSUE")]
    BillingIssue,
    #[serde(rename = "LEGAL_ISSUE")]
    LegalIssue,
    #[serde(rename = "OPERATIONAL_ISSUE")]
    OperationalIssue,
    #[serde(rename = "KMS_KEY_ISSUE")]
    KmsKeyIssue,
}

impl Default for SuspensionReason {
    fn default() -> SuspensionReason {
        Self::SqlSuspensionReasonUnspecified
    }
}
