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

/// Cluster that is managed by the workflow.
public struct ManagedCluster: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Required. The cluster name prefix. A unique cluster name will be formed by
  /// appending a random suffix.
  ///
  /// The name must contain only lower-case letters (a-z), numbers (0-9),
  /// and hyphens (-). Must begin with a letter. Cannot begin or end with
  /// hyphen. Must consist of between 2 and 35 characters.
  public var clusterName: Swift.String = Swift.String()

  /// Required. The cluster configuration.
  public var config: ClusterConfig? = nil

  /// Optional. The labels to associate with this cluster.
  ///
  /// Label keys must be between 1 and 63 characters long, and must conform to
  /// the following PCRE regular expression:
  /// [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
  ///
  /// Label values must be between 1 and 63 characters long, and must conform to
  /// the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63}
  ///
  /// No more than 32 labels can be associated with a given cluster.
  public var labels: [Swift.String: Swift.String] = [:]

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

  public static var _anyTypeUrl: Swift.String {
    return "type.googleapis.com/google.cloud.dataproc.v1.ManagedCluster"
  }
  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)
  }
}
