gcloud-sdk 0.30.0

Async Google gRPC/REST APIs and the client implementation hiding complexity of GCP authentication based on Tonic middleware and Reqwest.
Documentation
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
                                      */

use crate::google_rest_apis::sqladmin_v1::models;

/// User : A Cloud SQL user resource.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct User {
    /// Dual password status for the user.
    #[serde(rename = "dualPasswordType", skip_serializing_if = "Option::is_none")]
    pub dual_password_type: Option<DualPasswordType>,
    /// This field is deprecated and will be removed from a future version of the API.
    #[serde(rename = "etag", skip_serializing_if = "Option::is_none")]
    pub etag: Option<String>,
    /// Optional. The host from which the user can connect. For `insert` operations, host defaults to an empty string. For `update` operations, host is specified as part of the request URL. The host name cannot be updated after insertion. For a MySQL instance, it's required; for a PostgreSQL or SQL Server instance, it's optional.
    #[serde(rename = "host", skip_serializing_if = "Option::is_none")]
    pub host: Option<String>,
    /// The name of the Cloud SQL instance. This does not include the project ID. Can be omitted for `update` because it is already specified on the URL.
    #[serde(rename = "instance", skip_serializing_if = "Option::is_none")]
    pub instance: Option<String>,
    /// This is always `sql#user`.
    #[serde(rename = "kind", skip_serializing_if = "Option::is_none")]
    pub kind: Option<String>,
    /// The name of the user in the Cloud SQL instance. Can be omitted for `update` because it is already specified in the URL.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// The password for the user.
    #[serde(rename = "password", skip_serializing_if = "Option::is_none")]
    pub password: Option<String>,
    #[serde(rename = "passwordPolicy", skip_serializing_if = "Option::is_none")]
    pub password_policy: Option<Box<models::UserPasswordValidationPolicy>>,
    /// The project ID of the project containing the Cloud SQL database. The Google apps domain is prefixed if applicable. Can be omitted for `update` because it is already specified on the URL.
    #[serde(rename = "project", skip_serializing_if = "Option::is_none")]
    pub project: Option<String>,
    #[serde(
        rename = "sqlserverUserDetails",
        skip_serializing_if = "Option::is_none"
    )]
    pub sqlserver_user_details: Option<Box<models::SqlServerUserDetails>>,
    /// The user type. It determines the method to authenticate the user during login. The default is the database's built-in user type.
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub r#type: Option<Type>,
}

impl User {
    /// A Cloud SQL user resource.
    pub fn new() -> User {
        User {
            dual_password_type: None,
            etag: None,
            host: None,
            instance: None,
            kind: None,
            name: None,
            password: None,
            password_policy: None,
            project: None,
            sqlserver_user_details: None,
            r#type: None,
        }
    }
}
/// Dual password status for the user.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum DualPasswordType {
    #[serde(rename = "DUAL_PASSWORD_TYPE_UNSPECIFIED")]
    DualPasswordTypeUnspecified,
    #[serde(rename = "NO_MODIFY_DUAL_PASSWORD")]
    NoModifyDualPassword,
    #[serde(rename = "NO_DUAL_PASSWORD")]
    NoDualPassword,
    #[serde(rename = "DUAL_PASSWORD")]
    DualPassword,
}

impl Default for DualPasswordType {
    fn default() -> DualPasswordType {
        Self::DualPasswordTypeUnspecified
    }
}
/// The user type. It determines the method to authenticate the user during login. The default is the database's built-in user type.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "BUILT_IN")]
    BuiltIn,
    #[serde(rename = "CLOUD_IAM_USER")]
    CloudIamUser,
    #[serde(rename = "CLOUD_IAM_SERVICE_ACCOUNT")]
    CloudIamServiceAccount,
}

impl Default for Type {
    fn default() -> Type {
        Self::BuiltIn
    }
}