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

/// Configuration for a secret volume. It has the information necessary to fetch
/// the secret value from secret manager and make it available as files mounted
/// at the requested paths within the application container.
public struct SecretVolume: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// The path within the container to mount the secret volume. For example,
  /// setting the mount_path as `/etc/secrets` would mount the secret value files
  /// under the `/etc/secrets` directory. This directory will also be completely
  /// shadowed and unavailable to mount any other secrets.
  /// Recommended mount path: /etc/secrets
  public var mountPath: Swift.String = Swift.String()

  /// Project identifier (preferably project number but can also be the project
  /// ID) of the project that contains the secret. If not set, it is
  /// assumed that the secret is in the same project as the function.
  public var projectId: Swift.String = Swift.String()

  /// Name of the secret in secret manager (not the full resource name).
  public var secret: Swift.String = Swift.String()

  /// List of secret versions to mount for this secret. If empty, the `latest`
  /// version of the secret will be made available in a file named after the
  /// secret under the mount point.
  public var versions: [SecretVolume.SecretVersion] = []

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

  /// Configuration for a single version.
  public struct SecretVersion: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Version of the secret (version number or the string 'latest'). It is
    /// preferable to use `latest` version with secret volumes as secret value
    /// changes are reflected immediately.
    public var version: Swift.String = Swift.String()

    /// Relative path of the file under the mount path where the secret value for
    /// this version will be fetched and made available. For example, setting the
    /// mount_path as '/etc/secrets' and path as `secret_foo` would mount the
    /// secret value file at `/etc/secrets/secret_foo`.
    public var path: Swift.String = Swift.String()

    /// Initialize a new instance of `SecretVersion`.
    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 = SecretVersion().with { $0.version = ... }
    /// ```
    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.functions.v2.SecretVolume.SecretVersion"
    }
    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)
    }
  }

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