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}; /*
                                      * 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;

/// Snapshot : Represents a Persistent Disk Snapshot resource. You can use snapshots to back up data on a regular interval. For more information, read Creating persistent disk snapshots.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Snapshot {
    /// [Output Only] The architecture of the snapshot. Valid values are ARM64 or X86_64.
    #[serde(rename = "architecture", skip_serializing_if = "Option::is_none")]
    pub architecture: Option<Architecture>,
    /// [Output Only] Set to true if snapshots are automatically created by applying resource policy on the target disk.
    #[serde(rename = "autoCreated", skip_serializing_if = "Option::is_none")]
    pub auto_created: Option<bool>,
    /// Creates the new snapshot in the snapshot chain labeled with the specified name. The chain name must be 1-63 characters long and comply with RFC1035. This is an uncommon option only for advanced service owners who needs to create separate snapshot chains, for example, for chargeback tracking. When you describe your snapshot resource, this field is visible only if it has a non-empty value.
    #[serde(rename = "chainName", skip_serializing_if = "Option::is_none")]
    pub chain_name: Option<String>,
    /// [Output Only] Size in bytes of the snapshot at creation time.
    #[serde(rename = "creationSizeBytes", skip_serializing_if = "Option::is_none")]
    pub creation_size_bytes: Option<String>,
    /// [Output Only] Creation timestamp in RFC3339 text format.
    #[serde(rename = "creationTimestamp", skip_serializing_if = "Option::is_none")]
    pub creation_timestamp: Option<String>,
    /// An optional description of this resource. Provide this property when you create the resource.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// [Output Only] Size of the source disk, specified in GB.
    #[serde(rename = "diskSizeGb", skip_serializing_if = "Option::is_none")]
    pub disk_size_gb: Option<String>,
    /// [Output Only] Number of bytes downloaded to restore a snapshot to a disk.
    #[serde(rename = "downloadBytes", skip_serializing_if = "Option::is_none")]
    pub download_bytes: Option<String>,
    /// Whether this snapshot is created from a confidential compute mode disk. [Output Only]: This field is not set by user, but from source disk.
    #[serde(
        rename = "enableConfidentialCompute",
        skip_serializing_if = "Option::is_none"
    )]
    pub enable_confidential_compute: Option<bool>,
    /// [Output Only] A list of features to enable on the guest operating system. Applicable only for bootable images. Read Enabling guest operating system features to see a list of available options.
    #[serde(rename = "guestOsFeatures", skip_serializing_if = "Option::is_none")]
    pub guest_os_features: Option<Vec<models::GuestOsFeature>>,
    /// [Output Only] The unique identifier for the resource. This identifier is defined by the server.
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// [Output Only] Type of the resource. Always compute#snapshot for Snapshot resources.
    #[serde(rename = "kind", skip_serializing_if = "Option::is_none")]
    pub kind: Option<String>,
    /// A fingerprint for the labels being applied to this snapshot, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve a snapshot.
    #[serde(rename = "labelFingerprint", skip_serializing_if = "Option::is_none")]
    pub label_fingerprint: Option<String>,
    /// Labels to apply to this snapshot. These can be later modified by the setLabels method. Label values may be empty.
    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
    pub labels: Option<std::collections::HashMap<String, String>>,
    /// [Output Only] Integer license codes indicating which licenses are attached to this snapshot.
    #[serde(rename = "licenseCodes", skip_serializing_if = "Option::is_none")]
    pub license_codes: Option<Vec<String>>,
    /// [Output Only] A list of public visible licenses that apply to this snapshot. This can be because the original image had licenses attached (such as a Windows image).
    #[serde(rename = "licenses", skip_serializing_if = "Option::is_none")]
    pub licenses: Option<Vec<String>>,
    /// An opaque location hint used to place the snapshot close to other resources. This field is for use by internal tools that use the public API.
    #[serde(rename = "locationHint", skip_serializing_if = "Option::is_none")]
    pub location_hint: Option<String>,
    /// Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// Output only. Reserved for future use.
    #[serde(rename = "satisfiesPzi", skip_serializing_if = "Option::is_none")]
    pub satisfies_pzi: Option<bool>,
    /// [Output Only] Reserved for future use.
    #[serde(rename = "satisfiesPzs", skip_serializing_if = "Option::is_none")]
    pub satisfies_pzs: Option<bool>,
    /// [Output Only] Server-defined URL for the resource.
    #[serde(rename = "selfLink", skip_serializing_if = "Option::is_none")]
    pub self_link: Option<String>,
    #[serde(
        rename = "snapshotEncryptionKey",
        skip_serializing_if = "Option::is_none"
    )]
    pub snapshot_encryption_key: Option<Box<models::CustomerEncryptionKey>>,
    /// Indicates the type of the snapshot.
    #[serde(rename = "snapshotType", skip_serializing_if = "Option::is_none")]
    pub snapshot_type: Option<SnapshotType>,
    /// The source disk used to create this snapshot.
    #[serde(rename = "sourceDisk", skip_serializing_if = "Option::is_none")]
    pub source_disk: Option<String>,
    #[serde(
        rename = "sourceDiskEncryptionKey",
        skip_serializing_if = "Option::is_none"
    )]
    pub source_disk_encryption_key: Option<Box<models::CustomerEncryptionKey>>,
    /// The source disk whose recovery checkpoint will be used to create this snapshot.
    #[serde(
        rename = "sourceDiskForRecoveryCheckpoint",
        skip_serializing_if = "Option::is_none"
    )]
    pub source_disk_for_recovery_checkpoint: Option<String>,
    /// [Output Only] The ID value of the disk used to create this snapshot. This value may be used to determine whether the snapshot was taken from the current or a previous instance of a given disk name.
    #[serde(rename = "sourceDiskId", skip_serializing_if = "Option::is_none")]
    pub source_disk_id: Option<String>,
    /// The source instant snapshot used to create this snapshot. You can provide this as a partial or full URL to the resource. For example, the following are valid values: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /instantSnapshots/instantSnapshot - projects/project/zones/zone/instantSnapshots/instantSnapshot - zones/zone/instantSnapshots/instantSnapshot
    #[serde(
        rename = "sourceInstantSnapshot",
        skip_serializing_if = "Option::is_none"
    )]
    pub source_instant_snapshot: Option<String>,
    #[serde(
        rename = "sourceInstantSnapshotEncryptionKey",
        skip_serializing_if = "Option::is_none"
    )]
    pub source_instant_snapshot_encryption_key: Option<Box<models::CustomerEncryptionKey>>,
    /// [Output Only] The unique ID of the instant snapshot used to create this snapshot. This value identifies the exact instant snapshot that was used to create this persistent disk. For example, if you created the persistent disk from an instant snapshot that was later deleted and recreated under the same name, the source instant snapshot ID would identify the exact instant snapshot that was used.
    #[serde(
        rename = "sourceInstantSnapshotId",
        skip_serializing_if = "Option::is_none"
    )]
    pub source_instant_snapshot_id: Option<String>,
    /// [Output Only] URL of the resource policy which created this scheduled snapshot.
    #[serde(
        rename = "sourceSnapshotSchedulePolicy",
        skip_serializing_if = "Option::is_none"
    )]
    pub source_snapshot_schedule_policy: Option<String>,
    /// [Output Only] ID of the resource policy which created this scheduled snapshot.
    #[serde(
        rename = "sourceSnapshotSchedulePolicyId",
        skip_serializing_if = "Option::is_none"
    )]
    pub source_snapshot_schedule_policy_id: Option<String>,
    /// [Output Only] The status of the snapshot. This can be CREATING, DELETING, FAILED, READY, or UPLOADING.
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<Status>,
    /// [Output Only] A size of the storage used by the snapshot. As snapshots share storage, this number is expected to change with snapshot creation/deletion.
    #[serde(rename = "storageBytes", skip_serializing_if = "Option::is_none")]
    pub storage_bytes: Option<String>,
    /// [Output Only] An indicator whether storageBytes is in a stable state or it is being adjusted as a result of shared storage reallocation. This status can either be UPDATING, meaning the size of the snapshot is being updated, or UP_TO_DATE, meaning the size of the snapshot is up-to-date.
    #[serde(rename = "storageBytesStatus", skip_serializing_if = "Option::is_none")]
    pub storage_bytes_status: Option<StorageBytesStatus>,
    /// Cloud Storage bucket storage location of the snapshot (regional or multi-regional).
    #[serde(rename = "storageLocations", skip_serializing_if = "Option::is_none")]
    pub storage_locations: Option<Vec<String>>,
}

impl Snapshot {
    /// Represents a Persistent Disk Snapshot resource. You can use snapshots to back up data on a regular interval. For more information, read Creating persistent disk snapshots.
    pub fn new() -> Snapshot {
        Snapshot {
            architecture: None,
            auto_created: None,
            chain_name: None,
            creation_size_bytes: None,
            creation_timestamp: None,
            description: None,
            disk_size_gb: None,
            download_bytes: None,
            enable_confidential_compute: None,
            guest_os_features: None,
            id: None,
            kind: None,
            label_fingerprint: None,
            labels: None,
            license_codes: None,
            licenses: None,
            location_hint: None,
            name: None,
            satisfies_pzi: None,
            satisfies_pzs: None,
            self_link: None,
            snapshot_encryption_key: None,
            snapshot_type: None,
            source_disk: None,
            source_disk_encryption_key: None,
            source_disk_for_recovery_checkpoint: None,
            source_disk_id: None,
            source_instant_snapshot: None,
            source_instant_snapshot_encryption_key: None,
            source_instant_snapshot_id: None,
            source_snapshot_schedule_policy: None,
            source_snapshot_schedule_policy_id: None,
            status: None,
            storage_bytes: None,
            storage_bytes_status: None,
            storage_locations: None,
        }
    }
}
/// [Output Only] The architecture of the snapshot. 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
    }
}
/// Indicates the type of the snapshot.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum SnapshotType {
    #[serde(rename = "ARCHIVE")]
    Archive,
    #[serde(rename = "STANDARD")]
    Standard,
}

impl Default for SnapshotType {
    fn default() -> SnapshotType {
        Self::Archive
    }
}
/// [Output Only] The status of the snapshot. This can be CREATING, DELETING, FAILED, READY, or UPLOADING.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "CREATING")]
    Creating,
    #[serde(rename = "DELETING")]
    Deleting,
    #[serde(rename = "FAILED")]
    Failed,
    #[serde(rename = "READY")]
    Ready,
    #[serde(rename = "UPLOADING")]
    Uploading,
}

impl Default for Status {
    fn default() -> Status {
        Self::Creating
    }
}
/// [Output Only] An indicator whether storageBytes is in a stable state or it is being adjusted as a result of shared storage reallocation. This status can either be UPDATING, meaning the size of the snapshot is being updated, or UP_TO_DATE, meaning the size of the snapshot is up-to-date.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum StorageBytesStatus {
    #[serde(rename = "UPDATING")]
    Updating,
    #[serde(rename = "UP_TO_DATE")]
    UpToDate,
}

impl Default for StorageBytesStatus {
    fn default() -> StorageBytesStatus {
        Self::Updating
    }
}