// 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.

import Foundation
import GoogleCloudWkt

/// Parameters that describe the nodes in a cluster.
///
/// GKE Autopilot clusters do not
/// recognize parameters in `NodeConfig`. Use
/// [AutoprovisioningNodePoolDefaults][google.container.v1.AutoprovisioningNodePoolDefaults]
/// instead.
///
/// [google.container.v1.AutoprovisioningNodePoolDefaults]: <doc:AutoprovisioningNodePoolDefaults>
public struct NodeConfig: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// The name of a Google Compute Engine [machine
  /// type](https://cloud.google.com/compute/docs/machine-types)
  ///
  /// If unspecified, the default machine type is `e2-medium`.
  public var machineType: Swift.String = Swift.String()

  /// Size of the disk attached to each node, specified in GB.
  /// The smallest allowed disk size is 10GB.
  ///
  /// If unspecified, the default disk size is 100GB.
  public var diskSizeGb: Swift.Int32 = Swift.Int32()

  /// The set of Google API scopes to be made available on all of the
  /// node VMs under the "default" service account.
  ///
  /// The following scopes are recommended, but not required, and by default are
  /// not included:
  ///
  /// * `https://www.googleapis.com/auth/compute` is required for mounting
  /// persistent storage on your nodes.
  /// * `https://www.googleapis.com/auth/devstorage.read_only` is required for
  /// communicating with **gcr.io**
  /// (the [Artifact Registry](https://cloud.google.com/artifact-registry/)).
  ///
  /// If unspecified, no scopes are added, unless Cloud Logging or Cloud
  /// Monitoring are enabled, in which case their required scopes will be added.
  public var oauthScopes: [Swift.String] = []

  /// The Google Cloud Platform Service Account to be used by the node VMs.
  /// Specify the email address of the Service Account; otherwise, if no Service
  /// Account is specified, the "default" service account is used.
  public var serviceAccount: Swift.String = Swift.String()

  /// The metadata key/value pairs assigned to instances in the cluster.
  ///
  /// Keys must conform to the regexp `[a-zA-Z0-9-_]+` and be less than 128 bytes
  /// in length. These are reflected as part of a URL in the metadata server.
  /// Additionally, to avoid ambiguity, keys must not conflict with any other
  /// metadata keys for the project or be one of the reserved keys:
  ///
  ///  - "cluster-location"
  ///  - "cluster-name"
  ///  - "cluster-uid"
  ///  - "configure-sh"
  ///  - "containerd-configure-sh"
  ///  - "enable-os-login"
  ///  - "gci-ensure-gke-docker"
  ///  - "gci-metrics-enabled"
  ///  - "gci-update-strategy"
  ///  - "instance-template"
  ///  - "kube-env"
  ///  - "startup-script"
  ///  - "user-data"
  ///  - "disable-address-manager"
  ///  - "windows-startup-script-ps1"
  ///  - "common-psm1"
  ///  - "k8s-node-setup-psm1"
  ///  - "install-ssh-psm1"
  ///  - "user-profile-psm1"
  ///
  /// Values are free-form strings, and only have meaning as interpreted by
  /// the image running in the instance. The only restriction placed on them is
  /// that each value's size must be less than or equal to 32 KB.
  ///
  /// The total size of all keys and values must be less than 512 KB.
  public var metadata: [Swift.String: Swift.String] = [:]

  /// The image type to use for this node. Note that for a given image type,
  /// the latest version of it will be used. Please see
  /// https://cloud.google.com/kubernetes-engine/docs/concepts/node-images
  /// for available image types.
  public var imageType: Swift.String = Swift.String()

  /// The node image configuration to use for this node pool.  Note that this is
  /// only applicable for node pools using image_type=CUSTOM.
  public var nodeImageConfig: CustomImageConfig? = nil

  /// The Kubernetes labels (key/value pairs) to apply to each node. The values
  /// in this field are added to the set of default labels Kubernetes applies to
  /// nodes.
  ///
  /// This field has the following restrictions:
  ///
  /// * Labels must use a valid Kubernetes syntax and character set, as defined
  ///   in
  ///   https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set.
  /// * This field supports up to 1,024 total characters in a single request.
  ///
  /// Depending on the Kubernetes version, keys in this field might conflict with
  /// the keys of the default labels, which might change which of your labels
  /// are applied to the nodes. Assume that the behavior is unpredictable and
  /// avoid label key conflicts. For more information about the default labels,
  /// see:
  /// https://kubernetes.io/docs/reference/labels-annotations-taints/
  public var labels: [Swift.String: Swift.String] = [:]

  /// The number of local SSD disks to be attached to the node.
  ///
  /// The limit for this value is dependent upon the maximum number of
  /// disks available on a machine per zone. See:
  /// https://cloud.google.com/compute/docs/disks/local-ssd
  /// for more information.
  public var localSsdCount: Swift.Int32 = Swift.Int32()

  /// The list of instance tags applied to all nodes. Tags are used to identify
  /// valid sources or targets for network firewalls and are specified by
  /// the client during cluster or node pool creation. Each tag within the list
  /// must comply with RFC1035.
  public var tags: [Swift.String] = []

  /// Whether the nodes are created as preemptible VM instances. See:
  /// https://cloud.google.com/compute/docs/instances/preemptible
  /// for more information about preemptible VM instances.
  public var preemptible: Swift.Bool = Swift.Bool()

  /// A list of hardware accelerators to be attached to each node.
  /// See
  /// https://cloud.google.com/compute/docs/gpus
  /// for more information about support for GPUs.
  public var accelerators: [AcceleratorConfig] = []

  /// Type of the disk attached to each node (e.g. 'pd-standard', 'pd-ssd' or
  /// 'pd-balanced')
  ///
  /// If unspecified, the default disk type is 'pd-standard'
  public var diskType: Swift.String = Swift.String()

  /// Minimum CPU platform to be used by this instance. The instance may be
  /// scheduled on the specified or newer CPU platform. Applicable values are the
  /// friendly names of CPU platforms, such as
  /// `minCpuPlatform: "Intel Haswell"` or
  /// `minCpuPlatform: "Intel Sandy Bridge"`. For more
  /// information, read [how to specify min CPU
  /// platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform)
  public var minCpuPlatform: Swift.String = Swift.String()

  /// The workload metadata configuration for this node.
  public var workloadMetadataConfig: WorkloadMetadataConfig? = nil

  /// List of kubernetes taints to be applied to each node.
  ///
  /// For more information, including usage and the valid values, see:
  /// https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
  public var taints: [NodeTaint] = []

  /// Sandbox configuration for this node.
  public var sandboxConfig: SandboxConfig? = nil

  /// Setting this field will assign instances of this
  /// pool to run on the specified node group. This is useful for running
  /// workloads on [sole tenant
  /// nodes](https://cloud.google.com/compute/docs/nodes/sole-tenant-nodes).
  public var nodeGroup: Swift.String = Swift.String()

  /// The optional reservation affinity. Setting this field will apply
  /// the specified [Zonal Compute
  /// Reservation](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources)
  /// to this node pool.
  public var reservationAffinity: ReservationAffinity? = nil

  /// Shielded Instance options.
  public var shieldedInstanceConfig: ShieldedInstanceConfig? = nil

  /// Parameters that can be configured on Linux nodes.
  public var linuxNodeConfig: LinuxNodeConfig? = nil

  /// Node kubelet configs.
  public var kubeletConfig: NodeKubeletConfig? = nil

  ///
  /// The Customer Managed Encryption Key used to encrypt the boot disk attached
  /// to each node in the node pool. This should be of the form
  /// projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME].
  /// For more information about protecting resources with Cloud KMS Keys please
  /// see:
  /// https://cloud.google.com/compute/docs/disks/customer-managed-encryption
  public var bootDiskKmsKey: Swift.String = Swift.String()

  /// Google Container File System (image streaming) configs.
  public var gcfsConfig: GcfsConfig? = nil

  /// Advanced features for the Compute Engine VM.
  public var advancedMachineFeatures: AdvancedMachineFeatures? = nil

  /// Enable or disable gvnic in the node pool.
  public var gvnic: VirtualNIC? = nil

  /// Spot flag for enabling Spot VM, which is a rebrand of
  /// the existing preemptible flag.
  public var spot: Swift.Bool = Swift.Bool()

  /// Confidential nodes config.
  /// All the nodes in the node pool will be Confidential VM once enabled.
  public var confidentialNodes: ConfidentialNodes? = nil

  /// Enable or disable NCCL fast socket for the node pool.
  public var fastSocket: FastSocket? = nil

  /// The resource labels for the node pool to use to annotate any related
  /// Google Compute Engine resources.
  public var resourceLabels: [Swift.String: Swift.String] = [:]

  /// Logging configuration.
  public var loggingConfig: NodePoolLoggingConfig? = nil

  /// Parameters that can be configured on Windows nodes.
  public var windowsNodeConfig: WindowsNodeConfig? = nil

  /// Parameters for using raw-block Local NVMe SSDs.
  public var localNvmeSsdBlockConfig: LocalNvmeSsdBlockConfig? = nil

  /// Parameters for the node ephemeral storage using Local SSDs.
  /// If unspecified, ephemeral storage is backed by the boot disk.
  public var ephemeralStorageLocalSsdConfig: EphemeralStorageLocalSsdConfig? = nil

  /// Parameters for node pools to be backed by shared sole tenant node groups.
  public var soleTenantConfig: SoleTenantConfig? = nil

  /// Parameters for containerd customization.
  public var containerdConfig: ContainerdConfig? = nil

  /// A map of resource manager tag keys and values to be attached to the nodes.
  public var resourceManagerTags: ResourceManagerTags? = nil

  /// Optional. Reserved for future use.
  public var enableConfidentialStorage: Swift.Bool = Swift.Bool()

  /// List of secondary boot disks attached to the nodes.
  public var secondaryBootDisks: [SecondaryBootDisk] = []

  /// List of Storage Pools where boot disks are provisioned.
  public var storagePools: [Swift.String] = []

  /// Secondary boot disk update strategy.
  public var secondaryBootDiskUpdateStrategy: SecondaryBootDiskUpdateStrategy? = nil

  /// The configuration for GPU Direct
  public var gpuDirectConfig: GPUDirectConfig? = nil

  /// The maximum duration for the nodes to exist.
  /// If unspecified, the nodes can exist indefinitely.
  public var maxRunDuration: GoogleCloudWkt.Duration? = nil

  /// Specifies which method should be used for encrypting the
  /// Local SSDs attached to the node.
  public var localSsdEncryptionMode: NodeConfig.LocalSsdEncryptionMode? = nil

  /// Output only. effective_cgroup_mode is the cgroup mode actually used by the
  /// node pool. It is determined by the cgroup mode specified in the
  /// LinuxNodeConfig or the default cgroup mode based on the cluster creation
  /// version.
  public var effectiveCgroupMode: NodeConfig.EffectiveCgroupMode = NodeConfig.EffectiveCgroupMode()

  /// Flex Start flag for enabling Flex Start VM.
  public var flexStart: Swift.Bool? = nil

  /// The boot disk configuration for the node pool.
  public var bootDisk: BootDisk? = nil

  /// Consolidation delay defines duration after which the Cluster Autoscaler can
  /// scale down underutilized nodes. If not set, nodes are scaled down by
  /// default behavior, i.e. according to the chosen autoscaling profile.
  public var consolidationDelay: GoogleCloudWkt.Duration? = nil

  /// Optional. The taint configuration for the node pool.
  public var taintConfig: TaintConfig? = nil

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

  /// LocalSsdEncryptionMode specifies the method used for encrypting the Local
  /// SSDs attached to the node.
  public enum LocalSsdEncryptionMode: Codable, Equatable, Sendable {
    /// The given node will be encrypted using keys managed by Google
    /// infrastructure and the keys will be deleted when the node is
    /// deleted.
    case unspecified
    /// The given node will be encrypted using keys managed by Google
    /// infrastructure and the keys will be deleted when the node is
    /// deleted.
    case standardEncryption
    /// The given node will opt-in for using ephemeral key for
    /// encryption of Local SSDs.
    /// The Local SSDs will not be able to recover data in case of node
    /// crash.
    case ephemeralKeyEncryption
    /// 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 .standardEncryption: return 1
      case .ephemeralKeyEncryption: 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 "LOCAL_SSD_ENCRYPTION_MODE_UNSPECIFIED"
      case .standardEncryption: return "STANDARD_ENCRYPTION"
      case .ephemeralKeyEncryption: return "EPHEMERAL_KEY_ENCRYPTION"
      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:LocalSsdEncryptionMode/unknownStringValue(_:)).
    public init(stringValue: Swift.String) {
      switch stringValue {
      case "LOCAL_SSD_ENCRYPTION_MODE_UNSPECIFIED": self = .unspecified
      case "STANDARD_ENCRYPTION": self = .standardEncryption
      case "EPHEMERAL_KEY_ENCRYPTION": self = .ephemeralKeyEncryption
      default: self = .unknownStringValue(stringValue)
      }
    }

    /// Initialize from an integer value.
    ///
    /// If the value is unknown, this initializes to [`unknownIntValue`](doc:LocalSsdEncryptionMode/unknownIntValue(_:)).
    public init(intValue: Int) {
      switch intValue {
      case 0: self = .unspecified
      case 1: self = .standardEncryption
      case 2: self = .ephemeralKeyEncryption
      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 .standardEncryption: return try container.encode(1)
      case .ephemeralKeyEncryption: return try container.encode(2)
      case .unknownIntValue(let v): return try container.encode(v)
      case .unknownStringValue(let v): return try container.encode(v)
      }
    }
  }

  /// Possible effective cgroup modes for the node.
  public enum EffectiveCgroupMode: Codable, Equatable, Sendable {
    /// EFFECTIVE_CGROUP_MODE_UNSPECIFIED means the cgroup configuration for the
    /// node pool is unspecified, i.e. the node pool is a Windows node pool.
    case unspecified
    /// CGROUP_MODE_V1 means the node pool is configured to use cgroupv1 for the
    /// cgroup configuration.
    case v1
    /// CGROUP_MODE_V2 means the node pool is configured to use cgroupv2 for the
    /// cgroup configuration.
    case v2
    /// 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 .v1: return 1
      case .v2: 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 "EFFECTIVE_CGROUP_MODE_UNSPECIFIED"
      case .v1: return "EFFECTIVE_CGROUP_MODE_V1"
      case .v2: return "EFFECTIVE_CGROUP_MODE_V2"
      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:EffectiveCgroupMode/unknownStringValue(_:)).
    public init(stringValue: Swift.String) {
      switch stringValue {
      case "EFFECTIVE_CGROUP_MODE_UNSPECIFIED": self = .unspecified
      case "EFFECTIVE_CGROUP_MODE_V1": self = .v1
      case "EFFECTIVE_CGROUP_MODE_V2": self = .v2
      default: self = .unknownStringValue(stringValue)
      }
    }

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