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

/// Automatic scaling is based on request rate, response latencies, and other
/// application metrics.
public struct AutomaticScaling: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// The time period that the
  /// [Autoscaler](https://cloud.google.com/compute/docs/autoscaler/)
  /// should wait before it starts collecting information from a new instance.
  /// This prevents the autoscaler from collecting information when the instance
  /// is initializing, during which the collected usage would not be reliable.
  /// Only applicable in the App Engine flexible environment.
  public var coolDownPeriod: GoogleCloudWkt.Duration? = nil

  /// Target scaling by CPU usage.
  public var cpuUtilization: CpuUtilization? = nil

  /// Number of concurrent requests an automatic scaling instance can accept
  /// before the scheduler spawns a new instance.
  ///
  /// Defaults to a runtime-specific value.
  public var maxConcurrentRequests: Swift.Int32 = Swift.Int32()

  /// Maximum number of idle instances that should be maintained for this
  /// version.
  public var maxIdleInstances: Swift.Int32 = Swift.Int32()

  /// Maximum number of instances that should be started to handle requests for
  /// this version.
  public var maxTotalInstances: Swift.Int32 = Swift.Int32()

  /// Maximum amount of time that a request should wait in the pending queue
  /// before starting a new instance to handle it.
  public var maxPendingLatency: GoogleCloudWkt.Duration? = nil

  /// Minimum number of idle instances that should be maintained for
  /// this version. Only applicable for the default version of a service.
  public var minIdleInstances: Swift.Int32 = Swift.Int32()

  /// Minimum number of running instances that should be maintained for this
  /// version.
  public var minTotalInstances: Swift.Int32 = Swift.Int32()

  /// Minimum amount of time a request should wait in the pending queue before
  /// starting a new instance to handle it.
  public var minPendingLatency: GoogleCloudWkt.Duration? = nil

  /// Target scaling by request utilization.
  public var requestUtilization: RequestUtilization? = nil

  /// Target scaling by disk usage.
  public var diskUtilization: DiskUtilization? = nil

  /// Target scaling by network usage.
  public var networkUtilization: NetworkUtilization? = nil

  /// Scheduler settings for standard environment.
  public var standardSchedulerSettings: StandardSchedulerSettings? = nil

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