use serde::{Deserialize, Serialize}; /*
                                      * Compute Engine API
                                      *
                                      * Creates and runs virtual machines on Google Cloud Platform.
                                      *
                                      * The version of the OpenAPI document: v1
                                      *
                                      * Generated by: https://openapi-generator.tech
                                      */

use crate::google_rest_apis::compute_v1::models;

/// AttachedDiskInitializeParams : [Input Only] Specifies the parameters for a new disk that will be created alongside the new instance. Use initialization parameters to create boot disks or local SSDs attached to the new instance. This field is persisted and returned for instanceTemplate and not returned in the context of instance. This property is mutually exclusive with the source property; you can only define one or the other, but not both.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AttachedDiskInitializeParams {
    /// The architecture of the attached disk. Valid values are arm64 or x86_64.
    #[serde(rename = "architecture", skip_serializing_if = "Option::is_none")]
    pub architecture: Option<Architecture>,
    /// An optional description. Provide this property when creating the disk.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Specifies the disk name. If not specified, the default is to use the name of the instance. If a disk with the same name already exists in the given region, the existing disk is attached to the new instance and the new disk is not created.
    #[serde(rename = "diskName", skip_serializing_if = "Option::is_none")]
    pub disk_name: Option<String>,
    /// Specifies the size of the disk in base-2 GB. The size must be at least 10 GB. If you specify a sourceImage, which is required for boot disks, the default size is the size of the sourceImage. If you do not specify a sourceImage, the default disk size is 500 GB.
    #[serde(rename = "diskSizeGb", skip_serializing_if = "Option::is_none")]
    pub disk_size_gb: Option<String>,
    /// Specifies the disk type to use to create the instance. If not specified, the default is pd-standard, specified using the full URL. For example: https://www.googleapis.com/compute/v1/projects/project/zones/zone /diskTypes/pd-standard For a full list of acceptable values, see Persistent disk types. If you specify this field when creating a VM, you can provide either the full or partial URL. For example, the following values are valid: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /diskTypes/diskType - projects/project/zones/zone/diskTypes/diskType - zones/zone/diskTypes/diskType If you specify this field when creating or updating an instance template or all-instances configuration, specify the type of the disk, not the URL. For example: pd-standard.
    #[serde(rename = "diskType", skip_serializing_if = "Option::is_none")]
    pub disk_type: Option<String>,
    /// Whether this disk is using confidential compute mode.
    #[serde(
        rename = "enableConfidentialCompute",
        skip_serializing_if = "Option::is_none"
    )]
    pub enable_confidential_compute: Option<bool>,
    /// Labels to apply to this disk. These can be later modified by the disks.setLabels method. This field is only applicable for persistent disks.
    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
    pub labels: Option<std::collections::HashMap<String, String>>,
    /// A list of publicly visible licenses. Reserved for Google's use.
    #[serde(rename = "licenses", skip_serializing_if = "Option::is_none")]
    pub licenses: Option<Vec<String>>,
    /// Specifies which action to take on instance update with this disk. Default is to use the existing disk.
    #[serde(rename = "onUpdateAction", skip_serializing_if = "Option::is_none")]
    pub on_update_action: Option<OnUpdateAction>,
    /// Indicates how many IOPS to provision for the disk. This sets the number of I/O operations per second that the disk can handle. Values must be between 10,000 and 120,000. For more details, see the Extreme persistent disk documentation.
    #[serde(rename = "provisionedIops", skip_serializing_if = "Option::is_none")]
    pub provisioned_iops: Option<String>,
    /// Indicates how much throughput to provision for the disk. This sets the number of throughput mb per second that the disk can handle. Values must greater than or equal to 1.
    #[serde(
        rename = "provisionedThroughput",
        skip_serializing_if = "Option::is_none"
    )]
    pub provisioned_throughput: Option<String>,
    /// Required for each regional disk associated with the instance. Specify the URLs of the zones where the disk should be replicated to. You must provide exactly two replica zones, and one zone must be the same as the instance zone.
    #[serde(rename = "replicaZones", skip_serializing_if = "Option::is_none")]
    pub replica_zones: Option<Vec<String>>,
    /// Resource manager tags to be bound to the disk. Tag keys and values have the same definition as resource manager tags. Keys must be in the format `tagKeys/{tag_key_id}`, and values are in the format `tagValues/456`. The field is ignored (both PUT & PATCH) when empty.
    #[serde(
        rename = "resourceManagerTags",
        skip_serializing_if = "Option::is_none"
    )]
    pub resource_manager_tags: Option<std::collections::HashMap<String, String>>,
    /// Resource policies applied to this disk for automatic snapshot creations. Specified using the full or partial URL. For instance template, specify only the resource policy name.
    #[serde(rename = "resourcePolicies", skip_serializing_if = "Option::is_none")]
    pub resource_policies: Option<Vec<String>>,
    /// The source image to create this disk. When creating a new instance, one of initializeParams.sourceImage or initializeParams.sourceSnapshot or disks.source is required except for local SSD. To create a disk with one of the public operating system images, specify the image by its family name. For example, specify family/debian-9 to use the latest Debian 9 image: projects/debian-cloud/global/images/family/debian-9 Alternatively, use a specific version of a public operating system image: projects/debian-cloud/global/images/debian-9-stretch-vYYYYMMDD To create a disk with a custom image that you created, specify the image name in the following format: global/images/my-custom-image You can also specify a custom image by its image family, which returns the latest version of the image in that family. Replace the image name with family/family-name: global/images/family/my-image-family If the source image is deleted later, this field will not be set.
    #[serde(rename = "sourceImage", skip_serializing_if = "Option::is_none")]
    pub source_image: Option<String>,
    #[serde(
        rename = "sourceImageEncryptionKey",
        skip_serializing_if = "Option::is_none"
    )]
    pub source_image_encryption_key: Option<Box<models::CustomerEncryptionKey>>,
    /// The source snapshot to create this disk. When creating a new instance, one of initializeParams.sourceSnapshot or initializeParams.sourceImage or disks.source is required except for local SSD. To create a disk with a snapshot that you created, specify the snapshot name in the following format: global/snapshots/my-backup If the source snapshot is deleted later, this field will not be set.
    #[serde(rename = "sourceSnapshot", skip_serializing_if = "Option::is_none")]
    pub source_snapshot: Option<String>,
    #[serde(
        rename = "sourceSnapshotEncryptionKey",
        skip_serializing_if = "Option::is_none"
    )]
    pub source_snapshot_encryption_key: Option<Box<models::CustomerEncryptionKey>>,
}

impl AttachedDiskInitializeParams {
    /// [Input Only] Specifies the parameters for a new disk that will be created alongside the new instance. Use initialization parameters to create boot disks or local SSDs attached to the new instance. This field is persisted and returned for instanceTemplate and not returned in the context of instance. This property is mutually exclusive with the source property; you can only define one or the other, but not both.
    pub fn new() -> AttachedDiskInitializeParams {
        AttachedDiskInitializeParams {
            architecture: None,
            description: None,
            disk_name: None,
            disk_size_gb: None,
            disk_type: None,
            enable_confidential_compute: None,
            labels: None,
            licenses: None,
            on_update_action: None,
            provisioned_iops: None,
            provisioned_throughput: None,
            replica_zones: None,
            resource_manager_tags: None,
            resource_policies: None,
            source_image: None,
            source_image_encryption_key: None,
            source_snapshot: None,
            source_snapshot_encryption_key: None,
        }
    }
}
/// The architecture of the attached disk. Valid values are arm64 or x86_64.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Architecture {
    #[serde(rename = "ARCHITECTURE_UNSPECIFIED")]
    ArchitectureUnspecified,
    #[serde(rename = "ARM64")]
    Arm64,
    #[serde(rename = "X86_64")]
    X8664,
}

impl Default for Architecture {
    fn default() -> Architecture {
        Self::ArchitectureUnspecified
    }
}
/// Specifies which action to take on instance update with this disk. Default is to use the existing disk.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum OnUpdateAction {
    #[serde(rename = "RECREATE_DISK")]
    RecreateDisk,
    #[serde(rename = "RECREATE_DISK_IF_SOURCE_CHANGED")]
    RecreateDiskIfSourceChanged,
    #[serde(rename = "USE_EXISTING_DISK")]
    UseExistingDisk,
}

impl Default for OnUpdateAction {
    fn default() -> OnUpdateAction {
        Self::RecreateDisk
    }
}
