// Code generated by sidekick. DO NOT EDIT.
//
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#if Disks || RegionDisks
  import Foundation
  import GoogleCloudWkt

  /// Represents a Persistent Disk resource.
  ///
  /// Google Compute Engine has two Disk resources:
  ///
  /// * [Zonal](/compute/docs/reference/rest/v1/disks)
  /// * [Regional](/compute/docs/reference/rest/v1/regionDisks)
  ///
  /// Persistent disks are required for running your VM instances.
  /// Create both boot and non-boot (data) persistent disks. For more information,
  /// read Persistent Disks. For more
  /// storage options, read Storage options.
  ///
  /// The disks resource represents a zonal persistent disk.
  /// For more information, readZonal persistent disks.
  ///
  /// The regionDisks resource represents a
  /// regional persistent disk.  For more information, read
  /// Regional resources.
  public struct Disk: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// The access mode of the disk.
    ///
    ///
    ///      - READ_WRITE_SINGLE: The default AccessMode, means the
    ///      disk can be attached to single instance in RW mode.
    ///      - READ_WRITE_MANY: The AccessMode means the disk can be
    ///      attached to multiple instances in RW mode.
    ///      - READ_ONLY_MANY: The AccessMode means the disk can be
    ///      attached to multiple instances in RO mode.
    ///
    ///
    /// The AccessMode is only valid for Hyperdisk disk types.
    public var accessMode: Disk.AccessMode? = nil

    /// The architecture of the disk. Valid values are
    /// ARM64 or X86_64.
    public var architecture: Disk.Architecture? = nil

    /// Disk asynchronously replicated into this disk.
    public var asyncPrimaryDisk: DiskAsyncReplication? = nil

    /// Output only. [Output Only] A list of disks this disk is asynchronously replicated to.
    public var asyncSecondaryDisks: [Swift.String: DiskAsyncReplicationList] = [:]

    /// Output only. [Output Only] Creation timestamp inRFC3339
    /// text format.
    public var creationTimestamp: Swift.String? = nil

    /// An optional description of this resource. Provide this property when you
    /// create the resource.
    public var description: Swift.String? = nil

    /// Encrypts the disk using a
    /// customer-supplied encryption key or a
    /// customer-managed encryption key.
    ///
    /// Encryption keys do not protect access to metadata of the disk.
    ///
    /// After you encrypt a disk with a customer-supplied key, you must provide the
    /// same key if you use the disk later. For example, to create a disk snapshot,
    /// to create a disk image, to create a machine image, or to attach the disk to
    /// a virtual machine.
    ///
    /// After you encrypt a disk with a customer-managed key, thediskEncryptionKey.kmsKeyName is set to a key *version*
    /// name once the disk is created. The disk is encrypted with this version of
    /// the key. In the response, diskEncryptionKey.kmsKeyName appears
    /// in the following format:
    ///
    /// "diskEncryptionKey.kmsKeyName":
    /// "projects/kms_project_id/locations/region/keyRings/
    /// key_region/cryptoKeys/key
    /// /cryptoKeysVersions/version
    ///
    /// If you do not provide an encryption key when creating the disk, then the
    /// disk is encrypted using an automatically generated key and you don't need
    /// to provide a key to use the disk later.
    public var diskEncryptionKey: CustomerEncryptionKey? = nil

    /// Whether this disk is using confidential compute mode.
    public var enableConfidentialCompute: Swift.Bool? = nil

    /// 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.
    public var guestOsFeatures: [GuestOsFeature] = []

    /// Output only. [Output Only] The unique identifier for the resource. This identifier is
    /// defined by the server.
    public var id: Swift.UInt64? = nil

    /// Output only. [Output Only] Type of the resource. Always compute#disk for
    /// disks.
    public var kind: Swift.String? = nil

    /// A fingerprint for the labels being applied to this disk, 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 error412 conditionNotMet.
    ///
    /// To see the latest fingerprint, make a get() request to
    /// retrieve a disk.
    public var labelFingerprint: Foundation.Data? = nil

    /// Labels to apply to this disk. These can be later modified by
    /// the setLabels method.
    public var labels: [Swift.String: Swift.String] = [:]

    /// Output only. [Output Only] Last attach timestamp inRFC3339
    /// text format.
    public var lastAttachTimestamp: Swift.String? = nil

    /// Output only. [Output Only] Last detach timestamp inRFC3339
    /// text format.
    public var lastDetachTimestamp: Swift.String? = nil

    /// Integer license codes indicating which licenses are attached to this disk.
    public var licenseCodes: [Swift.Int64] = []

    /// A list of publicly visible licenses. Reserved for Google's use.
    public var licenses: [Swift.String] = []

    /// An opaque location hint used to place the disk close to other resources.
    /// This field is for use by internal tools that use the public API.
    public var locationHint: Swift.String? = nil

    /// Name of the resource. Provided by the client when the resource is created.
    /// The name must be 1-63 characters long, and comply withRFC1035.
    /// 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.
    public var name: Swift.String? = nil

    /// Internal use only.
    public var options: Swift.String? = nil

    /// Input only. [Input Only] Additional params passed with the request, but not persisted
    /// as part of resource payload.
    public var params: DiskParams? = nil

    /// Physical block size of the persistent disk, in bytes.
    /// If not present in a request, a default value is used.
    /// The currently supported size is 4096, other sizes may be added in
    /// the future.
    /// If an unsupported value is requested, the error message will list
    /// the supported values for the caller's project.
    public var physicalBlockSizeBytes: Swift.Int64? = nil

    /// 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 theExtreme persistent
    /// disk documentation.
    public var provisionedIops: Swift.Int64? = nil

    /// 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 be
    /// greater than or equal to 1.
    public var provisionedThroughput: Swift.Int64? = nil

    /// Output only. [Output Only] URL of the region where the disk resides. Only applicable for
    /// regional resources.
    /// You must specify this field as part of the HTTP request URL. It is
    /// not settable as a field in the request body.
    public var region: Swift.String? = nil

    /// URLs of the zones where the disk should be replicated to. Only applicable
    /// for regional resources.
    public var replicaZones: [Swift.String] = []

    /// Resource policies applied to this disk for automatic snapshot creations.
    public var resourcePolicies: [Swift.String] = []

    /// Output only. [Output Only] Status information for the disk resource.
    public var resourceStatus: DiskResourceStatus? = nil

    /// Output only. Reserved for future use.
    public var satisfiesPzi: Swift.Bool? = nil

    /// Output only. [Output Only] Reserved for future use.
    public var satisfiesPzs: Swift.Bool? = nil

    /// Output only. [Output Only] Server-defined fully-qualified URL for this resource.
    public var selfLink: Swift.String? = nil

    /// Size, in GB, of the persistent disk. You can specify
    /// this field when creating a persistent disk using thesourceImage, sourceSnapshot, orsourceDisk parameter, or specify it alone to create an empty
    /// persistent disk.
    ///
    /// If you specify this field along with a source, the value ofsizeGb must not be less than the size of the
    /// source.
    /// Acceptable values are greater than 0.
    public var sizeGb: Swift.Int64? = nil

    /// Output only. [Output Only] URL of the DiskConsistencyGroupPolicy for a secondary disk
    /// that was created using a consistency group.
    public var sourceConsistencyGroupPolicy: Swift.String? = nil

    /// Output only. [Output Only] ID of the DiskConsistencyGroupPolicy for a secondary disk
    /// that was created using a consistency group.
    public var sourceConsistencyGroupPolicyId: Swift.String? = nil

    /// The source disk used to create this disk. 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/disks/disk
    ///
    ///      -
    ///        https://www.googleapis.com/compute/v1/projects/project/regions/region/disks/disk
    ///
    ///      -
    ///        projects/project/zones/zone/disks/disk
    ///
    ///      -
    ///        projects/project/regions/region/disks/disk
    ///
    ///      -
    ///        zones/zone/disks/disk
    ///
    ///      -
    ///        regions/region/disks/disk
    public var sourceDisk: Swift.String? = nil

    /// Output only. [Output Only] The unique ID of the disk used to create this disk. This
    /// value identifies the exact disk that was used to create this persistent
    /// disk. For example, if you created the persistent disk from a disk that
    /// was later deleted and recreated under the same name, the source disk ID
    /// would identify the exact version of the disk that was used.
    public var sourceDiskId: Swift.String? = nil

    /// The source image used to create this disk. If the source image is
    /// deleted, this field will not be set.
    ///
    /// To create a disk with one of the public operating system images, specify
    /// the image by its family name. For example, specifyfamily/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
    public var sourceImage: Swift.String? = nil

    /// Thecustomer-supplied
    /// encryption key of the source image. Required if the source image is
    /// protected by a customer-supplied encryption key.
    public var sourceImageEncryptionKey: CustomerEncryptionKey? = nil

    /// Output only. [Output Only] The ID value of the image used to create this disk. This
    /// value identifies the exact image that was used to create this persistent
    /// disk. For example, if you created the persistent disk from an image that
    /// was later deleted and recreated under the same name, the source image ID
    /// would identify the exact version of the image that was used.
    public var sourceImageId: Swift.String? = nil

    /// The source instant snapshot used to create this disk. 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
    public var sourceInstantSnapshot: Swift.String? = nil

    /// Output only. [Output Only] The unique ID of the instant snapshot used to create this
    /// disk. 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
    /// version of the instant snapshot that was used.
    public var sourceInstantSnapshotId: Swift.String? = nil

    /// The source snapshot used to create this disk. 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/global/snapshots/snapshot
    ///    - projects/project/global/snapshots/snapshot
    ///      - global/snapshots/snapshot
    public var sourceSnapshot: Swift.String? = nil

    /// Thecustomer-supplied
    /// encryption key of the source snapshot. Required if the source snapshot
    /// is protected by a customer-supplied encryption key.
    public var sourceSnapshotEncryptionKey: CustomerEncryptionKey? = nil

    /// Output only. [Output Only] The unique ID of the snapshot used to create this disk. This
    /// value identifies the exact snapshot that was used to create this persistent
    /// disk. For example, if you created the persistent disk from a snapshot that
    /// was later deleted and recreated under the same name, the source snapshot ID
    /// would identify the exact version of the snapshot that was used.
    public var sourceSnapshotId: Swift.String? = nil

    /// The full Google Cloud Storage URI where the disk image is stored. This file
    /// must be a gzip-compressed tarball whose name ends in .tar.gz or virtual
    /// machine disk whose name ends in vmdk. Valid URIs may start with gs:// or
    /// https://storage.googleapis.com/. This flag is not optimized for creating
    /// multiple disks from a source storage object. To create many disks from a
    /// source storage object, use gcloud compute images
    /// import instead.
    public var sourceStorageObject: Swift.String? = nil

    /// Output only. [Output Only] The status of disk creation.
    ///
    ///
    ///      - CREATING: Disk is provisioning.
    ///      - RESTORING: Source data is being copied into the
    ///      disk.
    ///      - FAILED: Disk creation failed.
    ///      - READY: Disk is ready for use.
    ///      - DELETING: Disk is deleting.
    public var status: Disk.Status? = nil

    /// The storage pool in which the new disk is created. 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/storagePools/storagePool
    ///      - projects/project/zones/zone/storagePools/storagePool
    ///    - zones/zone/storagePools/storagePool
    public var storagePool: Swift.String? = nil

    /// URL of the disk type resource describing which disk type to use to create
    /// the disk. Provide this when creating the disk. For example:projects/project/zones/zone/diskTypes/pd-ssd. See Persistent disk
    /// types.
    public var type: Swift.String? = nil

    /// Output only. [Output Only] Links to the users of the disk (attached instances)
    /// in form:projects/project/zones/zone/instances/instance
    public var users: [Swift.String] = []

    /// Output only. [Output Only] URL of the zone where the disk resides.
    /// You must specify this field as part of the HTTP request URL. It is
    /// not settable as a field in the request body.
    public var zone: Swift.String? = nil

    /// Initialize a new instance of `Disk`.
    public init() {}

    /// Use `config` to return a new instance of this object, with some fields updated.
    ///
    /// Commonly used to initialize the value, for example:
    ///
    /// ```
    /// let value = Disk().with { $0.accessMode = ... }
    /// ```
    public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
      var copy = self
      try config(&copy)
      return copy
    }

    private enum CodingKeys: Swift.String, CodingKey {
      case accessMode = "accessMode"
      case architecture = "architecture"
      case asyncPrimaryDisk = "asyncPrimaryDisk"
      case asyncSecondaryDisks = "asyncSecondaryDisks"
      case creationTimestamp = "creationTimestamp"
      case description = "description"
      case diskEncryptionKey = "diskEncryptionKey"
      case enableConfidentialCompute = "enableConfidentialCompute"
      case guestOsFeatures = "guestOsFeatures"
      case id = "id"
      case kind = "kind"
      case labelFingerprint = "labelFingerprint"
      case labels = "labels"
      case lastAttachTimestamp = "lastAttachTimestamp"
      case lastDetachTimestamp = "lastDetachTimestamp"
      case licenseCodes = "licenseCodes"
      case licenses = "licenses"
      case locationHint = "locationHint"
      case name = "name"
      case options = "options"
      case params = "params"
      case physicalBlockSizeBytes = "physicalBlockSizeBytes"
      case provisionedIops = "provisionedIops"
      case provisionedThroughput = "provisionedThroughput"
      case region = "region"
      case replicaZones = "replicaZones"
      case resourcePolicies = "resourcePolicies"
      case resourceStatus = "resourceStatus"
      case satisfiesPzi = "satisfiesPzi"
      case satisfiesPzs = "satisfiesPzs"
      case selfLink = "selfLink"
      case sizeGb = "sizeGb"
      case sourceConsistencyGroupPolicy = "sourceConsistencyGroupPolicy"
      case sourceConsistencyGroupPolicyId = "sourceConsistencyGroupPolicyId"
      case sourceDisk = "sourceDisk"
      case sourceDiskId = "sourceDiskId"
      case sourceImage = "sourceImage"
      case sourceImageEncryptionKey = "sourceImageEncryptionKey"
      case sourceImageId = "sourceImageId"
      case sourceInstantSnapshot = "sourceInstantSnapshot"
      case sourceInstantSnapshotId = "sourceInstantSnapshotId"
      case sourceSnapshot = "sourceSnapshot"
      case sourceSnapshotEncryptionKey = "sourceSnapshotEncryptionKey"
      case sourceSnapshotId = "sourceSnapshotId"
      case sourceStorageObject = "sourceStorageObject"
      case status = "status"
      case storagePool = "storagePool"
      case type = "type"
      case users = "users"
      case zone = "zone"
    }

    public init(from decoder: Decoder) throws {
      let container = try decoder.container(keyedBy: CodingKeys.self)
      self.accessMode = try container.decodeIfPresent(Disk.AccessMode.self, forKey: .accessMode)
      self.architecture = try container.decodeIfPresent(
        Disk.Architecture.self, forKey: .architecture)
      self.asyncPrimaryDisk = try container.decodeIfPresent(
        DiskAsyncReplication.self, forKey: .asyncPrimaryDisk)
      self.asyncSecondaryDisks = try container.decode(
        [Swift.String: DiskAsyncReplicationList].self, forKey: .asyncSecondaryDisks)
      self.creationTimestamp = try container.decodeIfPresent(
        Swift.String.self, forKey: .creationTimestamp)
      self.description = try container.decodeIfPresent(Swift.String.self, forKey: .description)
      self.diskEncryptionKey = try container.decodeIfPresent(
        CustomerEncryptionKey.self, forKey: .diskEncryptionKey)
      self.enableConfidentialCompute = try container.decodeIfPresent(
        Swift.Bool.self, forKey: .enableConfidentialCompute)
      self.guestOsFeatures = try container.decode([GuestOsFeature].self, forKey: .guestOsFeatures)
      self.id = try container.decodeIfPresent(Swift.UInt64.self, forKey: .id)
      self.kind = try container.decodeIfPresent(Swift.String.self, forKey: .kind)
      if let s = try container.decodeIfPresent(Swift.String.self, forKey: .labelFingerprint) {
        guard let v = GoogleCloudWkt._DiscoveryBase64.decode(s) else {
          throw DecodingError.dataCorrupted(
            DecodingError.Context(
              codingPath: decoder.codingPath, debugDescription: "Expected url-safe encoded value")
          )
        }
        self.labelFingerprint = v
      }
      self.labels = try container.decode([Swift.String: Swift.String].self, forKey: .labels)
      self.lastAttachTimestamp = try container.decodeIfPresent(
        Swift.String.self, forKey: .lastAttachTimestamp)
      self.lastDetachTimestamp = try container.decodeIfPresent(
        Swift.String.self, forKey: .lastDetachTimestamp)
      self.licenseCodes = try container.decode([Swift.Int64].self, forKey: .licenseCodes)
      self.licenses = try container.decode([Swift.String].self, forKey: .licenses)
      self.locationHint = try container.decodeIfPresent(Swift.String.self, forKey: .locationHint)
      self.name = try container.decodeIfPresent(Swift.String.self, forKey: .name)
      self.options = try container.decodeIfPresent(Swift.String.self, forKey: .options)
      self.params = try container.decodeIfPresent(DiskParams.self, forKey: .params)
      self.physicalBlockSizeBytes = try container.decodeIfPresent(
        Swift.Int64.self, forKey: .physicalBlockSizeBytes)
      self.provisionedIops = try container.decodeIfPresent(
        Swift.Int64.self, forKey: .provisionedIops)
      self.provisionedThroughput = try container.decodeIfPresent(
        Swift.Int64.self, forKey: .provisionedThroughput)
      self.region = try container.decodeIfPresent(Swift.String.self, forKey: .region)
      self.replicaZones = try container.decode([Swift.String].self, forKey: .replicaZones)
      self.resourcePolicies = try container.decode([Swift.String].self, forKey: .resourcePolicies)
      self.resourceStatus = try container.decodeIfPresent(
        DiskResourceStatus.self, forKey: .resourceStatus)
      self.satisfiesPzi = try container.decodeIfPresent(Swift.Bool.self, forKey: .satisfiesPzi)
      self.satisfiesPzs = try container.decodeIfPresent(Swift.Bool.self, forKey: .satisfiesPzs)
      self.selfLink = try container.decodeIfPresent(Swift.String.self, forKey: .selfLink)
      self.sizeGb = try container.decodeIfPresent(Swift.Int64.self, forKey: .sizeGb)
      self.sourceConsistencyGroupPolicy = try container.decodeIfPresent(
        Swift.String.self, forKey: .sourceConsistencyGroupPolicy)
      self.sourceConsistencyGroupPolicyId = try container.decodeIfPresent(
        Swift.String.self, forKey: .sourceConsistencyGroupPolicyId)
      self.sourceDisk = try container.decodeIfPresent(Swift.String.self, forKey: .sourceDisk)
      self.sourceDiskId = try container.decodeIfPresent(Swift.String.self, forKey: .sourceDiskId)
      self.sourceImage = try container.decodeIfPresent(Swift.String.self, forKey: .sourceImage)
      self.sourceImageEncryptionKey = try container.decodeIfPresent(
        CustomerEncryptionKey.self, forKey: .sourceImageEncryptionKey)
      self.sourceImageId = try container.decodeIfPresent(Swift.String.self, forKey: .sourceImageId)
      self.sourceInstantSnapshot = try container.decodeIfPresent(
        Swift.String.self, forKey: .sourceInstantSnapshot)
      self.sourceInstantSnapshotId = try container.decodeIfPresent(
        Swift.String.self, forKey: .sourceInstantSnapshotId)
      self.sourceSnapshot = try container.decodeIfPresent(
        Swift.String.self, forKey: .sourceSnapshot)
      self.sourceSnapshotEncryptionKey = try container.decodeIfPresent(
        CustomerEncryptionKey.self, forKey: .sourceSnapshotEncryptionKey)
      self.sourceSnapshotId = try container.decodeIfPresent(
        Swift.String.self, forKey: .sourceSnapshotId)
      self.sourceStorageObject = try container.decodeIfPresent(
        Swift.String.self, forKey: .sourceStorageObject)
      self.status = try container.decodeIfPresent(Disk.Status.self, forKey: .status)
      self.storagePool = try container.decodeIfPresent(Swift.String.self, forKey: .storagePool)
      self.type = try container.decodeIfPresent(Swift.String.self, forKey: .type)
      self.users = try container.decode([Swift.String].self, forKey: .users)
      self.zone = try container.decodeIfPresent(Swift.String.self, forKey: .zone)
    }

    public func encode(to encoder: Encoder) throws {
      var container = encoder.container(keyedBy: CodingKeys.self)
      try container.encode(self.accessMode, forKey: .accessMode)
      try container.encode(self.architecture, forKey: .architecture)
      try container.encode(self.asyncPrimaryDisk, forKey: .asyncPrimaryDisk)
      try container.encode(self.asyncSecondaryDisks, forKey: .asyncSecondaryDisks)
      try container.encode(self.creationTimestamp, forKey: .creationTimestamp)
      try container.encode(self.description, forKey: .description)
      try container.encode(self.diskEncryptionKey, forKey: .diskEncryptionKey)
      try container.encode(self.enableConfidentialCompute, forKey: .enableConfidentialCompute)
      try container.encode(self.guestOsFeatures, forKey: .guestOsFeatures)
      try container.encode(self.id, forKey: .id)
      try container.encode(self.kind, forKey: .kind)
      if let v = labelFingerprint {
        try container.encode(
          GoogleCloudWkt._DiscoveryBase64.encode(v), forKey: .labelFingerprint
        )
      }
      try container.encode(self.labels, forKey: .labels)
      try container.encode(self.lastAttachTimestamp, forKey: .lastAttachTimestamp)
      try container.encode(self.lastDetachTimestamp, forKey: .lastDetachTimestamp)
      try container.encode(self.licenseCodes, forKey: .licenseCodes)
      try container.encode(self.licenses, forKey: .licenses)
      try container.encode(self.locationHint, forKey: .locationHint)
      try container.encode(self.name, forKey: .name)
      try container.encode(self.options, forKey: .options)
      try container.encode(self.params, forKey: .params)
      try container.encode(self.physicalBlockSizeBytes, forKey: .physicalBlockSizeBytes)
      try container.encode(self.provisionedIops, forKey: .provisionedIops)
      try container.encode(self.provisionedThroughput, forKey: .provisionedThroughput)
      try container.encode(self.region, forKey: .region)
      try container.encode(self.replicaZones, forKey: .replicaZones)
      try container.encode(self.resourcePolicies, forKey: .resourcePolicies)
      try container.encode(self.resourceStatus, forKey: .resourceStatus)
      try container.encode(self.satisfiesPzi, forKey: .satisfiesPzi)
      try container.encode(self.satisfiesPzs, forKey: .satisfiesPzs)
      try container.encode(self.selfLink, forKey: .selfLink)
      try container.encode(self.sizeGb, forKey: .sizeGb)
      try container.encode(self.sourceConsistencyGroupPolicy, forKey: .sourceConsistencyGroupPolicy)
      try container.encode(
        self.sourceConsistencyGroupPolicyId, forKey: .sourceConsistencyGroupPolicyId)
      try container.encode(self.sourceDisk, forKey: .sourceDisk)
      try container.encode(self.sourceDiskId, forKey: .sourceDiskId)
      try container.encode(self.sourceImage, forKey: .sourceImage)
      try container.encode(self.sourceImageEncryptionKey, forKey: .sourceImageEncryptionKey)
      try container.encode(self.sourceImageId, forKey: .sourceImageId)
      try container.encode(self.sourceInstantSnapshot, forKey: .sourceInstantSnapshot)
      try container.encode(self.sourceInstantSnapshotId, forKey: .sourceInstantSnapshotId)
      try container.encode(self.sourceSnapshot, forKey: .sourceSnapshot)
      try container.encode(self.sourceSnapshotEncryptionKey, forKey: .sourceSnapshotEncryptionKey)
      try container.encode(self.sourceSnapshotId, forKey: .sourceSnapshotId)
      try container.encode(self.sourceStorageObject, forKey: .sourceStorageObject)
      try container.encode(self.status, forKey: .status)
      try container.encode(self.storagePool, forKey: .storagePool)
      try container.encode(self.type, forKey: .type)
      try container.encode(self.users, forKey: .users)
      try container.encode(self.zone, forKey: .zone)
    }

    /// The enumerated type for the [accessMode][google.cloud.compute.v1.Disk.accessMode] field.
    ///
    /// [google.cloud.compute.v1.Disk.accessMode]: <doc:Disk/AccessMode>
    public enum AccessMode: Codable, Equatable, Sendable {
      /// The AccessMode means the disk can be attached to multiple instances in RO
      /// mode.
      case readOnlyMany
      /// The AccessMode means the disk can be attached to multiple instances in RW
      /// mode.
      case readWriteMany
      /// The default AccessMode, means the disk can be attached to single instance
      /// in RW mode.
      case readWriteSingle
      /// Encodes an unknown integer value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownIntValue(Int)
      /// Encodes an unknown string value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownStringValue(String)

      public init() {
        self = .readOnlyMany
      }

      /// Returns the integer value associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown string value, this returns `nil`.
      public var intValue: Int? {
        switch self {
        case .readOnlyMany: return 0
        case .readWriteMany: return 1
        case .readWriteSingle: return 2
        case .unknownIntValue(let v): return v
        case .unknownStringValue: return nil
        }
      }

      /// Returns the string value (or name) associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown integer value, this returns `nil`.
      public var stringValue: Swift.String? {
        switch self {
        case .readOnlyMany: return "READ_ONLY_MANY"
        case .readWriteMany: return "READ_WRITE_MANY"
        case .readWriteSingle: return "READ_WRITE_SINGLE"
        case .unknownIntValue: return nil
        case .unknownStringValue(let v): return v
        }
      }

      /// Initialize from a string value.
      ///
      /// If the value is unknown, this initializes to [`unknownStringValue`](doc:AccessMode/unknownStringValue(_:)).
      public init(stringValue: Swift.String) {
        switch stringValue {
        case "READ_ONLY_MANY": self = .readOnlyMany
        case "READ_WRITE_MANY": self = .readWriteMany
        case "READ_WRITE_SINGLE": self = .readWriteSingle
        default: self = .unknownStringValue(stringValue)
        }
      }

      /// Initialize from an integer value.
      ///
      /// If the value is unknown, this initializes to [`unknownIntValue`](doc:AccessMode/unknownIntValue(_:)).
      public init(intValue: Int) {
        switch intValue {
        case 0: self = .readOnlyMany
        case 1: self = .readWriteMany
        case 2: self = .readWriteSingle
        default: self = .unknownIntValue(intValue)
        }
      }

      public init(from decoder: Decoder) throws {
        let container = try decoder.singleValueContainer()
        if let v = try? container.decode(Int.self) {
          self.init(intValue: v)
          return
        }
        if let s = try? container.decode(String.self) {
          if let v = Int(s) {
            self.init(intValue: v)
          } else {
            self.init(stringValue: s)
          }
          return
        }
        throw DecodingError.dataCorruptedError(
          in: container, debugDescription: "Expected enum value, must be integer or string.")
      }

      public func encode(to encoder: Encoder) throws {
        var container = encoder.singleValueContainer()
        switch self {
        case .readOnlyMany: return try container.encode(0)
        case .readWriteMany: return try container.encode(1)
        case .readWriteSingle: return try container.encode(2)
        case .unknownIntValue(let v): return try container.encode(v)
        case .unknownStringValue(let v): return try container.encode(v)
        }
      }
    }

    /// The enumerated type for the [architecture][google.cloud.compute.v1.Disk.architecture] field.
    ///
    /// [google.cloud.compute.v1.Disk.architecture]: <doc:Disk/Architecture>
    public enum Architecture: Codable, Equatable, Sendable {
      /// Default value indicating Architecture is not set.
      case unspecified
      /// Machines with architecture ARM64
      case arm64
      /// Machines with architecture X86_64
      case x8664
      /// Encodes an unknown integer value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownIntValue(Int)
      /// Encodes an unknown string value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownStringValue(String)

      public init() {
        self = .unspecified
      }

      /// Returns the integer value associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown string value, this returns `nil`.
      public var intValue: Int? {
        switch self {
        case .unspecified: return 0
        case .arm64: return 1
        case .x8664: return 2
        case .unknownIntValue(let v): return v
        case .unknownStringValue: return nil
        }
      }

      /// Returns the string value (or name) associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown integer value, this returns `nil`.
      public var stringValue: Swift.String? {
        switch self {
        case .unspecified: return "ARCHITECTURE_UNSPECIFIED"
        case .arm64: return "ARM64"
        case .x8664: return "X86_64"
        case .unknownIntValue: return nil
        case .unknownStringValue(let v): return v
        }
      }

      /// Initialize from a string value.
      ///
      /// If the value is unknown, this initializes to [`unknownStringValue`](doc:Architecture/unknownStringValue(_:)).
      public init(stringValue: Swift.String) {
        switch stringValue {
        case "ARCHITECTURE_UNSPECIFIED": self = .unspecified
        case "ARM64": self = .arm64
        case "X86_64": self = .x8664
        default: self = .unknownStringValue(stringValue)
        }
      }

      /// Initialize from an integer value.
      ///
      /// If the value is unknown, this initializes to [`unknownIntValue`](doc:Architecture/unknownIntValue(_:)).
      public init(intValue: Int) {
        switch intValue {
        case 0: self = .unspecified
        case 1: self = .arm64
        case 2: self = .x8664
        default: self = .unknownIntValue(intValue)
        }
      }

      public init(from decoder: Decoder) throws {
        let container = try decoder.singleValueContainer()
        if let v = try? container.decode(Int.self) {
          self.init(intValue: v)
          return
        }
        if let s = try? container.decode(String.self) {
          if let v = Int(s) {
            self.init(intValue: v)
          } else {
            self.init(stringValue: s)
          }
          return
        }
        throw DecodingError.dataCorruptedError(
          in: container, debugDescription: "Expected enum value, must be integer or string.")
      }

      public func encode(to encoder: Encoder) throws {
        var container = encoder.singleValueContainer()
        switch self {
        case .unspecified: return try container.encode(0)
        case .arm64: return try container.encode(1)
        case .x8664: return try container.encode(2)
        case .unknownIntValue(let v): return try container.encode(v)
        case .unknownStringValue(let v): return try container.encode(v)
        }
      }
    }

    /// The enumerated type for the [status][google.cloud.compute.v1.Disk.status] field.
    ///
    /// [google.cloud.compute.v1.Disk.status]: <doc:Disk/Status>
    public enum Status: Codable, Equatable, Sendable {
      /// Disk is provisioning
      case creating
      /// Disk is deleting.
      case deleting
      /// Disk creation failed.
      case failed
      /// Disk is ready for use.
      case ready
      /// Source data is being copied into the disk.
      case restoring
      /// Disk is currently unavailable and cannot be accessed, attached or
      /// detached.
      case unavailable
      /// Encodes an unknown integer value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownIntValue(Int)
      /// Encodes an unknown string value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownStringValue(String)

      public init() {
        self = .creating
      }

      /// Returns the integer value associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown string value, this returns `nil`.
      public var intValue: Int? {
        switch self {
        case .creating: return 0
        case .deleting: return 1
        case .failed: return 2
        case .ready: return 3
        case .restoring: return 4
        case .unavailable: return 5
        case .unknownIntValue(let v): return v
        case .unknownStringValue: return nil
        }
      }

      /// Returns the string value (or name) associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown integer value, this returns `nil`.
      public var stringValue: Swift.String? {
        switch self {
        case .creating: return "CREATING"
        case .deleting: return "DELETING"
        case .failed: return "FAILED"
        case .ready: return "READY"
        case .restoring: return "RESTORING"
        case .unavailable: return "UNAVAILABLE"
        case .unknownIntValue: return nil
        case .unknownStringValue(let v): return v
        }
      }

      /// Initialize from a string value.
      ///
      /// If the value is unknown, this initializes to [`unknownStringValue`](doc:Status/unknownStringValue(_:)).
      public init(stringValue: Swift.String) {
        switch stringValue {
        case "CREATING": self = .creating
        case "DELETING": self = .deleting
        case "FAILED": self = .failed
        case "READY": self = .ready
        case "RESTORING": self = .restoring
        case "UNAVAILABLE": self = .unavailable
        default: self = .unknownStringValue(stringValue)
        }
      }

      /// Initialize from an integer value.
      ///
      /// If the value is unknown, this initializes to [`unknownIntValue`](doc:Status/unknownIntValue(_:)).
      public init(intValue: Int) {
        switch intValue {
        case 0: self = .creating
        case 1: self = .deleting
        case 2: self = .failed
        case 3: self = .ready
        case 4: self = .restoring
        case 5: self = .unavailable
        default: self = .unknownIntValue(intValue)
        }
      }

      public init(from decoder: Decoder) throws {
        let container = try decoder.singleValueContainer()
        if let v = try? container.decode(Int.self) {
          self.init(intValue: v)
          return
        }
        if let s = try? container.decode(String.self) {
          if let v = Int(s) {
            self.init(intValue: v)
          } else {
            self.init(stringValue: s)
          }
          return
        }
        throw DecodingError.dataCorruptedError(
          in: container, debugDescription: "Expected enum value, must be integer or string.")
      }

      public func encode(to encoder: Encoder) throws {
        var container = encoder.singleValueContainer()
        switch self {
        case .creating: return try container.encode(0)
        case .deleting: return try container.encode(1)
        case .failed: return try container.encode(2)
        case .ready: return try container.encode(3)
        case .restoring: return try container.encode(4)
        case .unavailable: return try container.encode(5)
        case .unknownIntValue(let v): return try container.encode(v)
        case .unknownStringValue(let v): return try container.encode(v)
        }
      }
    }

    public static var _anyTypeUrl: Swift.String {
      return "type.googleapis.com/google.cloud.compute.v1.Disk"
    }
    public init(fromAny any: GoogleCloudWkt.`Any`) throws {
      self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
    }
    public func _pack() throws -> GoogleCloudWkt.Struct {
      return try GoogleCloudWkt._slowAnySerialize(message: self)
    }
  }
#endif
