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

/// An `Automation` resource in the Cloud Deploy API.
///
/// An `Automation` enables the automation of manually driven actions for
/// a Delivery Pipeline, which includes Release promotion among Targets,
/// Rollout repair and Rollout deployment strategy advancement. The intention
/// of Automation is to reduce manual intervention in the continuous delivery
/// process.
public struct Automation: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Output only. Name of the `Automation`. Format is
  /// `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/automations/{automation}`.
  public var name: Swift.String = Swift.String()

  /// Output only. Unique identifier of the `Automation`.
  public var uid: Swift.String = Swift.String()

  /// Optional. Description of the `Automation`. Max length is 255 characters.
  public var description: Swift.String = Swift.String()

  /// Output only. Time at which the automation was created.
  public var createTime: GoogleCloudWkt.Timestamp? = nil

  /// Output only. Time at which the automation was updated.
  public var updateTime: GoogleCloudWkt.Timestamp? = nil

  /// Optional. User annotations. These attributes can only be set and used by
  /// the user, and not by Cloud Deploy. Annotations must meet the following
  /// constraints:
  ///
  /// * Annotations are key/value pairs.
  /// * Valid annotation keys have two segments: an optional prefix and name,
  /// separated by a slash (`/`).
  /// * The name segment is required and must be 63 characters or less,
  /// beginning and ending with an alphanumeric character (`[a-z0-9A-Z]`) with
  /// dashes (`-`), underscores (`_`), dots (`.`), and alphanumerics between.
  /// * The prefix is optional. If specified, the prefix must be a DNS subdomain:
  /// a series of DNS labels separated by dots(`.`), not longer than 253
  /// characters in total, followed by a slash (`/`).
  ///
  /// See
  /// https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/#syntax-and-character-set
  /// for more details.
  public var annotations: [Swift.String: Swift.String] = [:]

  /// Optional. Labels are attributes that can be set and used by both the
  /// user and by Cloud Deploy. Labels must meet the following constraints:
  ///
  /// * Keys and values can contain only lowercase letters, numeric characters,
  /// underscores, and dashes.
  /// * All characters must use UTF-8 encoding, and international characters are
  /// allowed.
  /// * Keys must start with a lowercase letter or international character.
  /// * Each resource is limited to a maximum of 64 labels.
  ///
  /// Both keys and values are additionally constrained to be <= 63 characters.
  public var labels: [Swift.String: Swift.String] = [:]

  /// Optional. The weak etag of the `Automation` resource.
  /// This checksum is computed by the server based on the value of other
  /// fields, and may be sent on update and delete requests to ensure the
  /// client has an up-to-date value before proceeding.
  public var etag: Swift.String = Swift.String()

  /// Optional. When Suspended, automation is deactivated from execution.
  public var suspended: Swift.Bool = Swift.Bool()

  /// Required. Email address of the user-managed IAM service account that
  /// creates Cloud Deploy release and rollout resources.
  public var serviceAccount: Swift.String = Swift.String()

  /// Required. Selected resources to which the automation will be applied.
  public var selector: AutomationResourceSelector? = nil

  /// Required. List of Automation rules associated with the Automation resource.
  /// Must have at least one rule and limited to 250 rules per Delivery Pipeline.
  /// Note: the order of the rules here is not the same as the order of
  /// execution.
  public var rules: [AutomationRule] = []

  /// Initialize a new instance of `Automation`.
  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 = Automation().with { $0.name = ... }
  /// ```
  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.deploy.v1.Automation"
  }
  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)
  }
}
