scaleway_api_rs 0.1.8

Generated library to interact with Scaleway API.
Documentation
/*
 * Account API
 *
 * # Introduction  The Account API allows you to manage projects. Project is Scaleway’s resource management feature. Designed to help you organize your infrastructure and cloud services, the feature allows resources to be isolated and grouped into specific projects.
 *
 * The version of the OpenAPI document: v2
 *
 * Generated by: https://openapi-generator.tech
 */

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct CreateInstanceRequest {
    /// Please use `project_id` instead
    #[serde(rename = "organization_id", skip_serializing_if = "Option::is_none")]
    pub organization_id: Option<String>,
    /// The project ID on which to create the instance
    #[serde(rename = "project_id", skip_serializing_if = "Option::is_none")]
    pub project_id: Option<String>,
    /// Name of the instance
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// Database engine of the database (PostgreSQL, MySQL, ...)
    #[serde(rename = "engine")]
    pub engine: String,
    /// Name of the user created when the instance is created
    #[serde(rename = "user_name")]
    pub user_name: String,
    /// Password of the user
    #[serde(rename = "password")]
    pub password: String,
    /// Type of node to use for the instance
    #[serde(rename = "node_type")]
    pub node_type: String,
    /// Whether or not High-Availability is enabled
    #[serde(rename = "is_ha_cluster", skip_serializing_if = "Option::is_none")]
    pub is_ha_cluster: Option<bool>,
    /// Whether or not backups are disabled
    #[serde(rename = "disable_backup", skip_serializing_if = "Option::is_none")]
    pub disable_backup: Option<bool>,
    /// Tags to apply to the instance
    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
    pub tags: Option<Vec<String>>,
    /// List of engine settings to be set at database initialisation
    #[serde(rename = "init_settings", skip_serializing_if = "Option::is_none")]
    pub init_settings: Option<Vec<crate::models::ScalewayPeriodRdbPeriodV1PeriodInstanceSetting>>,
    /// Type of volume where data are stored (lssd, bssd, ...)
    #[serde(rename = "volume_type", skip_serializing_if = "Option::is_none")]
    pub volume_type: Option<VolumeType>,
    /// Volume size when volume_type is not lssd (in bytes)
    #[serde(rename = "volume_size", skip_serializing_if = "Option::is_none")]
    pub volume_size: Option<i32>,
    /// One or multiple EndpointSpec used to expose your database instance. A load_balancer public endpoint is systematically created
    #[serde(rename = "init_endpoints", skip_serializing_if = "Option::is_none")]
    pub init_endpoints: Option<Vec<crate::models::ScalewayPeriodRdbPeriodV1PeriodEndpointSpec>>,
    /// Store logical backups in the same region as the database instance
    #[serde(rename = "backup_same_region", skip_serializing_if = "Option::is_none")]
    pub backup_same_region: Option<bool>,
}

impl CreateInstanceRequest {
    pub fn new(
        engine: String,
        user_name: String,
        password: String,
        node_type: String,
    ) -> CreateInstanceRequest {
        CreateInstanceRequest {
            organization_id: None,
            project_id: None,
            name: None,
            engine,
            user_name,
            password,
            node_type,
            is_ha_cluster: None,
            disable_backup: None,
            tags: None,
            init_settings: None,
            volume_type: None,
            volume_size: None,
            init_endpoints: None,
            backup_same_region: None,
        }
    }
}

/// Type of volume where data are stored (lssd, bssd, ...)
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum VolumeType {
    #[serde(rename = "lssd")]
    Lssd,
    #[serde(rename = "bssd")]
    Bssd,
}

impl Default for VolumeType {
    fn default() -> VolumeType {
        Self::Lssd
    }
}