// 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 InstanceTemplates || Instances || MachineImages || RegionInstanceTemplates || RegionInstances
  import Foundation
  import GoogleCloudWkt

  /// [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.
  public struct AttachedDiskInitializeParams: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// The architecture of the attached disk. Valid values are
    /// arm64 or x86_64.
    public var architecture: AttachedDiskInitializeParams.Architecture? = nil

    /// An optional description. Provide this property when creating the disk.
    public var description: Swift.String? = nil

    /// 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.
    public var diskName: Swift.String? = nil

    /// 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.
    public var diskSizeGb: Swift.Int64? = nil

    /// Specifies the disk type used for the boot disk or an additional data
    /// disk. For valid disk type values, see
    /// Supported types for Hyperdisk volumes and
    /// Persistent Disk type variables.
    ///
    /// When creating a single instance, you must provide either the full or
    /// partial URL of the disk type. 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
    ///
    ///
    ///
    /// When creating an instance template, instance flexibility policy, or when
    /// creating or updating an all-instances configuration, you specify the
    /// disk type without a URL, for example, hyperdisk-balanced.
    ///
    /// If you omit this field for a disk, the default disk type depends on
    /// the instance's machine series, as follows.
    ///
    ///
    ///     - For first- and second-generation machine series like N1, N2, T2, and
    ///     M1, the
    ///        default disk type is Standard Persistent Disk
    ///        (pd-standard).
    ///     - For C3, C3D, and M3 the default is Balanced Persistent Disk
    ///     (pd-balanced).
    ///    - For other third-generation machine
    ///     series like A3, H3, Z3, all
    ///         fourth-generation types like C4, N4, M4, and newer machine series,
    ///         the default is Hyperdisk Balanced
    ///         (hyperdisk-balanced).
    ///
    ///
    ///
    /// The disk type you specify must be compatible with the instance's machine
    /// series. For a list of machine series that support Persistent Disk, see Machine
    /// series support for Persistent Disk.
    ///
    /// For a list of machine series that support Hyperdisk, seeMachine
    /// series support for Hyperdisk.
    public var diskType: Swift.String? = nil

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

    /// Labels to apply to this disk. These can be later modified by thedisks.setLabels method. This field is only applicable for
    /// persistent disks.
    public var labels: [Swift.String: Swift.String] = [:]

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

    /// Specifies which action to take on instance update with this disk. Default
    /// is to use the existing disk.
    public var onUpdateAction: AttachedDiskInitializeParams.OnUpdateAction? = 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
    /// greater than or equal to 1.
    public var provisionedThroughput: Swift.Int64? = nil

    /// 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.
    public var replicaZones: [Swift.String] = []

    /// Input only. Resource manager tags to be bound to the disk. Tag keys and values
    /// have the same definition as resource
    /// manager tags. Keys and values can be either in numeric format,
    /// such as `tagKeys/{tag_key_id}` and `tagValues/{tag_value_id}` or in
    /// namespaced format such as `{org_id|project_id}/{tag_key_short_name}` and
    /// `{tag_value_short_name}`. The field is ignored (both PUT & PATCH) when
    /// empty.
    public var resourceManagerTags: [Swift.String: Swift.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.
    public var resourcePolicies: [Swift.String] = []

    /// The source image to create this disk. When creating a new instance boot
    /// disk, one of initializeParams.sourceImage orinitializeParams.sourceSnapshot or disks.source
    /// is required.
    ///
    /// 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
    ///
    ///
    /// If the source image is deleted later, this field will not be set.
    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.
    ///
    /// InstanceTemplate and InstancePropertiesPatch do not storecustomer-supplied
    /// encryption keys, so you cannot create disks for instances in a managed instance group if the
    /// source images are encrypted with your own keys.
    public var sourceImageEncryptionKey: CustomerEncryptionKey? = nil

    /// The source snapshot to create this disk. When creating a new instance
    /// boot disk, one of initializeParams.sourceSnapshot orinitializeParams.sourceImage or disks.source
    /// is required.
    ///
    /// 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.
    ///
    /// Note: You cannot create VMs in bulk using a snapshot as the source. Use
    /// an image instead when you create VMs using
    /// the bulk
    /// insert method.
    public var sourceSnapshot: Swift.String? = nil

    /// Thecustomer-supplied
    /// encryption key of the source snapshot.
    public var sourceSnapshotEncryptionKey: CustomerEncryptionKey? = 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

    /// Initialize a new instance of `AttachedDiskInitializeParams`.
    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 = AttachedDiskInitializeParams().with { $0.architecture = ... }
    /// ```
    public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
      var copy = self
      try config(&copy)
      return copy
    }

    /// The enumerated type for the [architecture][google.cloud.compute.v1.AttachedDiskInitializeParams.architecture] field.
    ///
    /// [google.cloud.compute.v1.AttachedDiskInitializeParams.architecture]: <doc:AttachedDiskInitializeParams/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 [onUpdateAction][google.cloud.compute.v1.AttachedDiskInitializeParams.onUpdateAction] field.
    ///
    /// [google.cloud.compute.v1.AttachedDiskInitializeParams.onUpdateAction]: <doc:AttachedDiskInitializeParams/OnUpdateAction>
    public enum OnUpdateAction: Codable, Equatable, Sendable {
      /// Always recreate the disk.
      case recreateDisk
      /// Recreate the disk if source (image, snapshot) of this disk is different
      /// from source of existing disk.
      case recreateDiskIfSourceChanged
      /// Use the existing disk, this is the default behaviour.
      case useExistingDisk
      /// 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 = .recreateDisk
      }

      /// 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 .recreateDisk: return 0
        case .recreateDiskIfSourceChanged: return 1
        case .useExistingDisk: 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 .recreateDisk: return "RECREATE_DISK"
        case .recreateDiskIfSourceChanged: return "RECREATE_DISK_IF_SOURCE_CHANGED"
        case .useExistingDisk: return "USE_EXISTING_DISK"
        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:OnUpdateAction/unknownStringValue(_:)).
      public init(stringValue: Swift.String) {
        switch stringValue {
        case "RECREATE_DISK": self = .recreateDisk
        case "RECREATE_DISK_IF_SOURCE_CHANGED": self = .recreateDiskIfSourceChanged
        case "USE_EXISTING_DISK": self = .useExistingDisk
        default: self = .unknownStringValue(stringValue)
        }
      }

      /// Initialize from an integer value.
      ///
      /// If the value is unknown, this initializes to [`unknownIntValue`](doc:OnUpdateAction/unknownIntValue(_:)).
      public init(intValue: Int) {
        switch intValue {
        case 0: self = .recreateDisk
        case 1: self = .recreateDiskIfSourceChanged
        case 2: self = .useExistingDisk
        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 .recreateDisk: return try container.encode(0)
        case .recreateDiskIfSourceChanged: return try container.encode(1)
        case .useExistingDisk: return try container.encode(2)
        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.AttachedDiskInitializeParams"
    }
    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
