// 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
#if canImport(FoundationNetworking)
  import FoundationNetworking
#endif
import GoogleCloudLocation
import GoogleCloudWkt
import GoogleIAMV1
import GoogleCloudGax

/// Secret Manager Service
///
/// Manages secrets and operations using those secrets. Implements a REST
/// model with the following objects:
///
/// * [Secret][google.cloud.secretmanager.v1.Secret]
/// * [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]
///
/// [google.cloud.secretmanager.v1.Secret]: <doc:Secret>
/// [google.cloud.secretmanager.v1.SecretVersion]: <doc:SecretVersion>
///
/// @Snippet(path: "SecretManagerServiceQuickstart")
public class SecretManagerServiceClient: Clients.SecretManagerServiceProtocol {
  let inner: any Clients.SecretManagerServiceStub

  /// Creates a new `SecretManagerServiceClient` instance.
  public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
    var inner: any Clients.SecretManagerServiceStub = try Clients.SecretManagerServiceTransport(
      options)
    inner = Clients.SecretManagerServiceRetry(inner, options: options)
    if let logger = options.logger {
      inner = Clients.SecretManagerServiceLogging(inner, logger: logger)
    }
    self.inner = inner
  }

  /// Lists [Secrets][google.cloud.secretmanager.v1.Secret].
  ///
  /// [google.cloud.secretmanager.v1.Secret]: <doc:Secret>
  ///
  /// @Snippet(path: "SecretManagerService_ListSecrets")
  public func listSecrets(
    request: ListSecretsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.ListSecretsResponse {
    try await self.inner.listSecrets(request: request, options: options)
  }

  /// Lists [Secrets][google.cloud.secretmanager.v1.Secret].
  ///
  /// [google.cloud.secretmanager.v1.Secret]: <doc:Secret>
  ///
  /// @Snippet(path: "SecretManagerService_ListSecrets")
  public func listSecrets(
    byItem: ListSecretsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Secret, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudSecretManagerV1.ListSecretsResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listSecrets(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Creates a new [Secret][google.cloud.secretmanager.v1.Secret] containing no
  /// [SecretVersions][google.cloud.secretmanager.v1.SecretVersion].
  ///
  /// [google.cloud.secretmanager.v1.Secret]: <doc:Secret>
  /// [google.cloud.secretmanager.v1.SecretVersion]: <doc:SecretVersion>
  ///
  /// @Snippet(path: "SecretManagerService_CreateSecret")
  public func createSecret(
    request: CreateSecretRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.Secret {
    try await self.inner.createSecret(request: request, options: options)
  }

  /// Creates a new [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]
  /// containing secret data and attaches it to an existing
  /// [Secret][google.cloud.secretmanager.v1.Secret].
  ///
  /// [google.cloud.secretmanager.v1.Secret]: <doc:Secret>
  /// [google.cloud.secretmanager.v1.SecretVersion]: <doc:SecretVersion>
  ///
  /// @Snippet(path: "SecretManagerService_AddSecretVersion")
  public func addSecretVersion(
    request: AddSecretVersionRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    try await self.inner.addSecretVersion(request: request, options: options)
  }

  /// Gets metadata for a given [Secret][google.cloud.secretmanager.v1.Secret].
  ///
  /// [google.cloud.secretmanager.v1.Secret]: <doc:Secret>
  ///
  /// @Snippet(path: "SecretManagerService_GetSecret")
  public func getSecret(
    request: GetSecretRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.Secret {
    try await self.inner.getSecret(request: request, options: options)
  }

  /// Updates metadata of an existing
  /// [Secret][google.cloud.secretmanager.v1.Secret].
  ///
  /// [google.cloud.secretmanager.v1.Secret]: <doc:Secret>
  ///
  /// @Snippet(path: "SecretManagerService_UpdateSecret")
  public func updateSecret(
    request: UpdateSecretRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.Secret {
    try await self.inner.updateSecret(request: request, options: options)
  }

  /// Deletes a [Secret][google.cloud.secretmanager.v1.Secret].
  ///
  /// [google.cloud.secretmanager.v1.Secret]: <doc:Secret>
  ///
  /// @Snippet(path: "SecretManagerService_DeleteSecret")
  public func deleteSecret(
    request: DeleteSecretRequest, options: GoogleCloudGax.RequestOptions
  ) async throws {
    try await self.inner.deleteSecret(request: request, options: options)
  }

  /// Lists [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]. This
  /// call does not return secret data.
  ///
  /// [google.cloud.secretmanager.v1.SecretVersion]: <doc:SecretVersion>
  ///
  /// @Snippet(path: "SecretManagerService_ListSecretVersions")
  public func listSecretVersions(
    request: ListSecretVersionsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.ListSecretVersionsResponse {
    try await self.inner.listSecretVersions(request: request, options: options)
  }

  /// Lists [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]. This
  /// call does not return secret data.
  ///
  /// [google.cloud.secretmanager.v1.SecretVersion]: <doc:SecretVersion>
  ///
  /// @Snippet(path: "SecretManagerService_ListSecretVersions")
  public func listSecretVersions(
    byItem: ListSecretVersionsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<SecretVersion, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudSecretManagerV1.ListSecretVersionsResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listSecretVersions(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Gets metadata for a
  /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
  ///
  /// `projects/*/secrets/*/versions/latest` is an alias to the most recently
  /// created [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
  ///
  /// [google.cloud.secretmanager.v1.SecretVersion]: <doc:SecretVersion>
  ///
  /// @Snippet(path: "SecretManagerService_GetSecretVersion")
  public func getSecretVersion(
    request: GetSecretVersionRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    try await self.inner.getSecretVersion(request: request, options: options)
  }

  /// Accesses a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
  /// This call returns the secret data.
  ///
  /// `projects/*/secrets/*/versions/latest` is an alias to the most recently
  /// created [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
  ///
  /// [google.cloud.secretmanager.v1.SecretVersion]: <doc:SecretVersion>
  ///
  /// @Snippet(path: "SecretManagerService_AccessSecretVersion")
  public func accessSecretVersion(
    request: AccessSecretVersionRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.AccessSecretVersionResponse {
    try await self.inner.accessSecretVersion(request: request, options: options)
  }

  /// Disables a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
  ///
  /// Sets the [state][google.cloud.secretmanager.v1.SecretVersion.state] of the
  /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to
  /// [DISABLED][google.cloud.secretmanager.v1.SecretVersion.State.DISABLED].
  ///
  /// [google.cloud.secretmanager.v1.SecretVersion]: <doc:SecretVersion>
  /// [google.cloud.secretmanager.v1.SecretVersion.State.DISABLED]: <doc:SecretVersion/State/disabled>
  /// [google.cloud.secretmanager.v1.SecretVersion.state]: <doc:SecretVersion/state>
  ///
  /// @Snippet(path: "SecretManagerService_DisableSecretVersion")
  public func disableSecretVersion(
    request: DisableSecretVersionRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    try await self.inner.disableSecretVersion(request: request, options: options)
  }

  /// Enables a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
  ///
  /// Sets the [state][google.cloud.secretmanager.v1.SecretVersion.state] of the
  /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to
  /// [ENABLED][google.cloud.secretmanager.v1.SecretVersion.State.ENABLED].
  ///
  /// [google.cloud.secretmanager.v1.SecretVersion]: <doc:SecretVersion>
  /// [google.cloud.secretmanager.v1.SecretVersion.State.ENABLED]: <doc:SecretVersion/State/enabled>
  /// [google.cloud.secretmanager.v1.SecretVersion.state]: <doc:SecretVersion/state>
  ///
  /// @Snippet(path: "SecretManagerService_EnableSecretVersion")
  public func enableSecretVersion(
    request: EnableSecretVersionRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    try await self.inner.enableSecretVersion(request: request, options: options)
  }

  /// Destroys a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
  ///
  /// Sets the [state][google.cloud.secretmanager.v1.SecretVersion.state] of the
  /// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to
  /// [DESTROYED][google.cloud.secretmanager.v1.SecretVersion.State.DESTROYED]
  /// and irrevocably destroys the secret data.
  ///
  /// [google.cloud.secretmanager.v1.SecretVersion]: <doc:SecretVersion>
  /// [google.cloud.secretmanager.v1.SecretVersion.State.DESTROYED]: <doc:SecretVersion/State/destroyed>
  /// [google.cloud.secretmanager.v1.SecretVersion.state]: <doc:SecretVersion/state>
  ///
  /// @Snippet(path: "SecretManagerService_DestroySecretVersion")
  public func destroySecretVersion(
    request: DestroySecretVersionRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    try await self.inner.destroySecretVersion(request: request, options: options)
  }

  /// Sets the access control policy on the specified secret. Replaces any
  /// existing policy.
  ///
  /// Permissions on
  /// [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] are enforced
  /// according to the policy set on the associated
  /// [Secret][google.cloud.secretmanager.v1.Secret].
  ///
  /// [google.cloud.secretmanager.v1.Secret]: <doc:Secret>
  /// [google.cloud.secretmanager.v1.SecretVersion]: <doc:SecretVersion>
  ///
  /// @Snippet(path: "SecretManagerService_SetIamPolicy")
  public func setIamPolicy(
    request: GoogleIAMV1.SetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV1.Policy {
    try await self.inner.setIamPolicy(request: request, options: options)
  }

  /// Gets the access control policy for a secret.
  /// Returns empty policy if the secret exists and does not have a policy set.
  ///
  /// @Snippet(path: "SecretManagerService_GetIamPolicy")
  public func getIamPolicy(
    request: GoogleIAMV1.GetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV1.Policy {
    try await self.inner.getIamPolicy(request: request, options: options)
  }

  /// Returns permissions that a caller has for the specified secret.
  /// If the secret does not exist, this call returns an empty set of
  /// permissions, not a NOT_FOUND error.
  ///
  /// Note: This operation is designed to be used for building permission-aware
  /// UIs and command-line tools, not for authorization checking. This operation
  /// may "fail open" without warning.
  ///
  /// @Snippet(path: "SecretManagerService_TestIamPermissions")
  public func testIamPermissions(
    request: GoogleIAMV1.TestIamPermissionsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV1.TestIamPermissionsResponse {
    try await self.inner.testIamPermissions(request: request, options: options)
  }

  /// Enables the managed rotation feature for a
  /// [Secret][google.cloud.secretmanager.v1.Secret]. This method can only be
  /// triggered once for a secret. In order to do further rotations, RotateSecret
  /// should be used. This method will add a secret version and update the
  /// password in Cloud SQL.
  ///
  /// [google.cloud.secretmanager.v1.Secret]: <doc:Secret>
  ///
  /// @Snippet(path: "SecretManagerService_EnableManagedRotation")
  public func enableManagedRotation(
    request: EnableManagedRotationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    try await self.inner.enableManagedRotation(request: request, options: options)
  }

  /// Do a managed rotation for a [Secret][google.cloud.secretmanager.v1.Secret].
  /// This can only be triggered after Managed rotation has been enabled.
  /// This method will add a secret version and update the password in Cloud SQL.
  ///
  /// [google.cloud.secretmanager.v1.Secret]: <doc:Secret>
  ///
  /// @Snippet(path: "SecretManagerService_RotateSecret")
  public func rotateSecret(
    request: RotateSecretRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    try await self.inner.rotateSecret(request: request, options: options)
  }

  /// Lists information about the supported locations for this service.
  ///
  /// @Snippet(path: "SecretManagerService_ListLocations")
  public func listLocations(
    request: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudLocation.ListLocationsResponse {
    try await self.inner.listLocations(request: request, options: options)
  }

  /// Lists information about the supported locations for this service.
  ///
  /// @Snippet(path: "SecretManagerService_ListLocations")
  public func listLocations(
    byItem: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudLocation.ListLocationsResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listLocations(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Gets information about a location.
  ///
  /// @Snippet(path: "SecretManagerService_GetLocation")
  public func getLocation(
    request: GoogleCloudLocation.GetLocationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudLocation.Location {
    try await self.inner.getLocation(request: request, options: options)
  }
}

extension Clients {
  /// A Swift protocol to mock `SecretManagerServiceClient`.
  ///
  /// To mock `SecretManagerServiceClient` change your functions to receive
  /// `some SecretManagerServiceProtocol` or `any SecretManagerServiceProtocol`
  /// and pass a mock implementation in your tests.
  public protocol SecretManagerServiceProtocol {
    /// See `SecretManagerServiceClient.listSecrets`.
    func listSecrets(request: ListSecretsRequest) async throws
      -> GoogleCloudSecretManagerV1.ListSecretsResponse

    /// See `SecretManagerServiceClient.listSecrets`.
    func listSecrets(
      byItem: ListSecretsRequest
    ) throws -> any AsyncSequence<Secret, Swift.Error>

    /// See `SecretManagerServiceClient.listSecrets`.
    func listSecrets(
      parent: Swift.String,
    ) throws -> any AsyncSequence<Secret, Swift.Error>

    /// See `SecretManagerServiceClient.createSecret`.
    func createSecret(request: CreateSecretRequest) async throws
      -> GoogleCloudSecretManagerV1.Secret

    /// See `SecretManagerServiceClient.createSecret`.
    func createSecret(
      parent: Swift.String,
      secretId: Swift.String,
      secret: Secret?,
    ) async throws -> GoogleCloudSecretManagerV1.Secret

    /// See `SecretManagerServiceClient.addSecretVersion`.
    func addSecretVersion(request: AddSecretVersionRequest) async throws
      -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.addSecretVersion`.
    func addSecretVersion(
      parent: Swift.String,
      payload: SecretPayload?,
    ) async throws -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.getSecret`.
    func getSecret(request: GetSecretRequest) async throws -> GoogleCloudSecretManagerV1.Secret

    /// See `SecretManagerServiceClient.getSecret`.
    func getSecret(
      name: Swift.String,
    ) async throws -> GoogleCloudSecretManagerV1.Secret

    /// See `SecretManagerServiceClient.updateSecret`.
    func updateSecret(request: UpdateSecretRequest) async throws
      -> GoogleCloudSecretManagerV1.Secret

    /// See `SecretManagerServiceClient.updateSecret`.
    func updateSecret(
      secret: Secret?,
      updateMask: GoogleCloudWkt.FieldMask?,
    ) async throws -> GoogleCloudSecretManagerV1.Secret

    /// See `SecretManagerServiceClient.deleteSecret`.
    func deleteSecret(request: DeleteSecretRequest) async throws

    /// See `SecretManagerServiceClient.deleteSecret`.
    func deleteSecret(
      name: Swift.String,
    ) async throws

    /// See `SecretManagerServiceClient.listSecretVersions`.
    func listSecretVersions(request: ListSecretVersionsRequest) async throws
      -> GoogleCloudSecretManagerV1.ListSecretVersionsResponse

    /// See `SecretManagerServiceClient.listSecretVersions`.
    func listSecretVersions(
      byItem: ListSecretVersionsRequest
    ) throws -> any AsyncSequence<SecretVersion, Swift.Error>

    /// See `SecretManagerServiceClient.listSecretVersions`.
    func listSecretVersions(
      parent: Swift.String,
    ) throws -> any AsyncSequence<SecretVersion, Swift.Error>

    /// See `SecretManagerServiceClient.getSecretVersion`.
    func getSecretVersion(request: GetSecretVersionRequest) async throws
      -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.getSecretVersion`.
    func getSecretVersion(
      name: Swift.String,
    ) async throws -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.accessSecretVersion`.
    func accessSecretVersion(request: AccessSecretVersionRequest) async throws
      -> GoogleCloudSecretManagerV1.AccessSecretVersionResponse

    /// See `SecretManagerServiceClient.accessSecretVersion`.
    func accessSecretVersion(
      name: Swift.String,
    ) async throws -> GoogleCloudSecretManagerV1.AccessSecretVersionResponse

    /// See `SecretManagerServiceClient.disableSecretVersion`.
    func disableSecretVersion(request: DisableSecretVersionRequest) async throws
      -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.disableSecretVersion`.
    func disableSecretVersion(
      name: Swift.String,
    ) async throws -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.enableSecretVersion`.
    func enableSecretVersion(request: EnableSecretVersionRequest) async throws
      -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.enableSecretVersion`.
    func enableSecretVersion(
      name: Swift.String,
    ) async throws -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.destroySecretVersion`.
    func destroySecretVersion(request: DestroySecretVersionRequest) async throws
      -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.destroySecretVersion`.
    func destroySecretVersion(
      name: Swift.String,
    ) async throws -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.setIamPolicy`.
    func setIamPolicy(request: GoogleIAMV1.SetIamPolicyRequest) async throws -> GoogleIAMV1.Policy

    /// See `SecretManagerServiceClient.getIamPolicy`.
    func getIamPolicy(request: GoogleIAMV1.GetIamPolicyRequest) async throws -> GoogleIAMV1.Policy

    /// See `SecretManagerServiceClient.testIamPermissions`.
    func testIamPermissions(request: GoogleIAMV1.TestIamPermissionsRequest) async throws
      -> GoogleIAMV1.TestIamPermissionsResponse

    /// See `SecretManagerServiceClient.enableManagedRotation`.
    func enableManagedRotation(request: EnableManagedRotationRequest) async throws
      -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.enableManagedRotation`.
    func enableManagedRotation(
      parent: Swift.String,
      cloudSqlSingleUserCredentials: EnableManagedRotationRequest.CloudSQLSingleUserCredentials?,
    ) async throws -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.rotateSecret`.
    func rotateSecret(request: RotateSecretRequest) async throws
      -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.rotateSecret`.
    func rotateSecret(
      parent: Swift.String,
    ) async throws -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.listLocations`.
    func listLocations(request: GoogleCloudLocation.ListLocationsRequest) async throws
      -> GoogleCloudLocation.ListLocationsResponse

    /// See `SecretManagerServiceClient.listLocations`.
    func listLocations(
      byItem: GoogleCloudLocation.ListLocationsRequest
    ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error>

    /// See `SecretManagerServiceClient.getLocation`.
    func getLocation(request: GoogleCloudLocation.GetLocationRequest) async throws
      -> GoogleCloudLocation.Location

    /// See `SecretManagerServiceClient.listSecrets`.
    func listSecrets(
      request: ListSecretsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecretManagerV1.ListSecretsResponse

    /// See `SecretManagerServiceClient.listSecrets`.
    func listSecrets(
      byItem: ListSecretsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<Secret, Swift.Error>

    /// See `SecretManagerServiceClient.createSecret`.
    func createSecret(
      request: CreateSecretRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecretManagerV1.Secret

    /// See `SecretManagerServiceClient.addSecretVersion`.
    func addSecretVersion(
      request: AddSecretVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.getSecret`.
    func getSecret(
      request: GetSecretRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecretManagerV1.Secret

    /// See `SecretManagerServiceClient.updateSecret`.
    func updateSecret(
      request: UpdateSecretRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecretManagerV1.Secret

    /// See `SecretManagerServiceClient.deleteSecret`.
    func deleteSecret(
      request: DeleteSecretRequest, options: GoogleCloudGax.RequestOptions
    ) async throws

    /// See `SecretManagerServiceClient.listSecretVersions`.
    func listSecretVersions(
      request: ListSecretVersionsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecretManagerV1.ListSecretVersionsResponse

    /// See `SecretManagerServiceClient.listSecretVersions`.
    func listSecretVersions(
      byItem: ListSecretVersionsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<SecretVersion, Swift.Error>

    /// See `SecretManagerServiceClient.getSecretVersion`.
    func getSecretVersion(
      request: GetSecretVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.accessSecretVersion`.
    func accessSecretVersion(
      request: AccessSecretVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecretManagerV1.AccessSecretVersionResponse

    /// See `SecretManagerServiceClient.disableSecretVersion`.
    func disableSecretVersion(
      request: DisableSecretVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.enableSecretVersion`.
    func enableSecretVersion(
      request: EnableSecretVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.destroySecretVersion`.
    func destroySecretVersion(
      request: DestroySecretVersionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.setIamPolicy`.
    func setIamPolicy(
      request: GoogleIAMV1.SetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleIAMV1.Policy

    /// See `SecretManagerServiceClient.getIamPolicy`.
    func getIamPolicy(
      request: GoogleIAMV1.GetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleIAMV1.Policy

    /// See `SecretManagerServiceClient.testIamPermissions`.
    func testIamPermissions(
      request: GoogleIAMV1.TestIamPermissionsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleIAMV1.TestIamPermissionsResponse

    /// See `SecretManagerServiceClient.enableManagedRotation`.
    func enableManagedRotation(
      request: EnableManagedRotationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.rotateSecret`.
    func rotateSecret(
      request: RotateSecretRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSecretManagerV1.SecretVersion

    /// See `SecretManagerServiceClient.listLocations`.
    func listLocations(
      request: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudLocation.ListLocationsResponse

    /// See `SecretManagerServiceClient.listLocations`.
    func listLocations(
      byItem: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error>

    /// See `SecretManagerServiceClient.getLocation`.
    func getLocation(
      request: GoogleCloudLocation.GetLocationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudLocation.Location
  }
}

// Default implementations
extension Clients.SecretManagerServiceProtocol {
  public func listSecrets(request: ListSecretsRequest) async throws
    -> GoogleCloudSecretManagerV1.ListSecretsResponse
  {
    try await self.listSecrets(request: request, options: .init())
  }

  public func listSecrets(
    request: ListSecretsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.ListSecretsResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listSecrets(
    byItem: ListSecretsRequest
  ) throws -> any AsyncSequence<Secret, Swift.Error> {
    try self.listSecrets(byItem: byItem, options: .init())
  }

  public func listSecrets(
    byItem: ListSecretsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Secret, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudSecretManagerV1.ListSecretsResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  public func listSecrets(
    parent: Swift.String,
  ) throws -> any AsyncSequence<Secret, Swift.Error> {
    let request = ListSecretsRequest().with {
      $0.parent = parent
    }
    return try self.listSecrets(byItem: request)
  }

  public func createSecret(request: CreateSecretRequest) async throws
    -> GoogleCloudSecretManagerV1.Secret
  {
    try await self.createSecret(request: request, options: .init())
  }

  public func createSecret(
    request: CreateSecretRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.Secret {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func createSecret(
    parent: Swift.String,
    secretId: Swift.String,
    secret: Secret?,
  ) async throws -> GoogleCloudSecretManagerV1.Secret {
    let request = CreateSecretRequest().with {
      $0.parent = parent
      $0.secretId = secretId
      $0.secret = secret
    }
    return try await self.createSecret(request: request)
  }

  public func addSecretVersion(request: AddSecretVersionRequest) async throws
    -> GoogleCloudSecretManagerV1.SecretVersion
  {
    try await self.addSecretVersion(request: request, options: .init())
  }

  public func addSecretVersion(
    request: AddSecretVersionRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func addSecretVersion(
    parent: Swift.String,
    payload: SecretPayload?,
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    let request = AddSecretVersionRequest().with {
      $0.parent = parent
      $0.payload = payload
    }
    return try await self.addSecretVersion(request: request)
  }

  public func getSecret(request: GetSecretRequest) async throws -> GoogleCloudSecretManagerV1.Secret
  {
    try await self.getSecret(request: request, options: .init())
  }

  public func getSecret(
    request: GetSecretRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.Secret {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getSecret(
    name: Swift.String,
  ) async throws -> GoogleCloudSecretManagerV1.Secret {
    let request = GetSecretRequest().with {
      $0.name = name
    }
    return try await self.getSecret(request: request)
  }

  public func updateSecret(request: UpdateSecretRequest) async throws
    -> GoogleCloudSecretManagerV1.Secret
  {
    try await self.updateSecret(request: request, options: .init())
  }

  public func updateSecret(
    request: UpdateSecretRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.Secret {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func updateSecret(
    secret: Secret?,
    updateMask: GoogleCloudWkt.FieldMask?,
  ) async throws -> GoogleCloudSecretManagerV1.Secret {
    let request = UpdateSecretRequest().with {
      $0.secret = secret
      $0.updateMask = updateMask
    }
    return try await self.updateSecret(request: request)
  }

  public func deleteSecret(request: DeleteSecretRequest) async throws {
    try await self.deleteSecret(request: request, options: .init())
  }

  public func deleteSecret(
    request: DeleteSecretRequest, options: GoogleCloudGax.RequestOptions
  ) async throws {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func deleteSecret(
    name: Swift.String,
  ) async throws {
    let request = DeleteSecretRequest().with {
      $0.name = name
    }
    try await self.deleteSecret(request: request)
  }

  public func listSecretVersions(request: ListSecretVersionsRequest) async throws
    -> GoogleCloudSecretManagerV1.ListSecretVersionsResponse
  {
    try await self.listSecretVersions(request: request, options: .init())
  }

  public func listSecretVersions(
    request: ListSecretVersionsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.ListSecretVersionsResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listSecretVersions(
    byItem: ListSecretVersionsRequest
  ) throws -> any AsyncSequence<SecretVersion, Swift.Error> {
    try self.listSecretVersions(byItem: byItem, options: .init())
  }

  public func listSecretVersions(
    byItem: ListSecretVersionsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<SecretVersion, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudSecretManagerV1.ListSecretVersionsResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  public func listSecretVersions(
    parent: Swift.String,
  ) throws -> any AsyncSequence<SecretVersion, Swift.Error> {
    let request = ListSecretVersionsRequest().with {
      $0.parent = parent
    }
    return try self.listSecretVersions(byItem: request)
  }

  public func getSecretVersion(request: GetSecretVersionRequest) async throws
    -> GoogleCloudSecretManagerV1.SecretVersion
  {
    try await self.getSecretVersion(request: request, options: .init())
  }

  public func getSecretVersion(
    request: GetSecretVersionRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getSecretVersion(
    name: Swift.String,
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    let request = GetSecretVersionRequest().with {
      $0.name = name
    }
    return try await self.getSecretVersion(request: request)
  }

  public func accessSecretVersion(request: AccessSecretVersionRequest) async throws
    -> GoogleCloudSecretManagerV1.AccessSecretVersionResponse
  {
    try await self.accessSecretVersion(request: request, options: .init())
  }

  public func accessSecretVersion(
    request: AccessSecretVersionRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.AccessSecretVersionResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func accessSecretVersion(
    name: Swift.String,
  ) async throws -> GoogleCloudSecretManagerV1.AccessSecretVersionResponse {
    let request = AccessSecretVersionRequest().with {
      $0.name = name
    }
    return try await self.accessSecretVersion(request: request)
  }

  public func disableSecretVersion(request: DisableSecretVersionRequest) async throws
    -> GoogleCloudSecretManagerV1.SecretVersion
  {
    try await self.disableSecretVersion(request: request, options: .init())
  }

  public func disableSecretVersion(
    request: DisableSecretVersionRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func disableSecretVersion(
    name: Swift.String,
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    let request = DisableSecretVersionRequest().with {
      $0.name = name
    }
    return try await self.disableSecretVersion(request: request)
  }

  public func enableSecretVersion(request: EnableSecretVersionRequest) async throws
    -> GoogleCloudSecretManagerV1.SecretVersion
  {
    try await self.enableSecretVersion(request: request, options: .init())
  }

  public func enableSecretVersion(
    request: EnableSecretVersionRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func enableSecretVersion(
    name: Swift.String,
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    let request = EnableSecretVersionRequest().with {
      $0.name = name
    }
    return try await self.enableSecretVersion(request: request)
  }

  public func destroySecretVersion(request: DestroySecretVersionRequest) async throws
    -> GoogleCloudSecretManagerV1.SecretVersion
  {
    try await self.destroySecretVersion(request: request, options: .init())
  }

  public func destroySecretVersion(
    request: DestroySecretVersionRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func destroySecretVersion(
    name: Swift.String,
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    let request = DestroySecretVersionRequest().with {
      $0.name = name
    }
    return try await self.destroySecretVersion(request: request)
  }

  public func setIamPolicy(request: GoogleIAMV1.SetIamPolicyRequest) async throws
    -> GoogleIAMV1.Policy
  {
    try await self.setIamPolicy(request: request, options: .init())
  }

  public func setIamPolicy(
    request: GoogleIAMV1.SetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV1.Policy {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getIamPolicy(request: GoogleIAMV1.GetIamPolicyRequest) async throws
    -> GoogleIAMV1.Policy
  {
    try await self.getIamPolicy(request: request, options: .init())
  }

  public func getIamPolicy(
    request: GoogleIAMV1.GetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV1.Policy {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func testIamPermissions(request: GoogleIAMV1.TestIamPermissionsRequest) async throws
    -> GoogleIAMV1.TestIamPermissionsResponse
  {
    try await self.testIamPermissions(request: request, options: .init())
  }

  public func testIamPermissions(
    request: GoogleIAMV1.TestIamPermissionsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV1.TestIamPermissionsResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func enableManagedRotation(request: EnableManagedRotationRequest) async throws
    -> GoogleCloudSecretManagerV1.SecretVersion
  {
    try await self.enableManagedRotation(request: request, options: .init())
  }

  public func enableManagedRotation(
    request: EnableManagedRotationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func enableManagedRotation(
    parent: Swift.String,
    cloudSqlSingleUserCredentials: EnableManagedRotationRequest.CloudSQLSingleUserCredentials?,
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    let request = EnableManagedRotationRequest().with {
      $0.parent = parent
      $0.credentials = cloudSqlSingleUserCredentials.map { .cloudSqlSingleUserCredentials($0) }
    }
    return try await self.enableManagedRotation(request: request)
  }

  public func rotateSecret(request: RotateSecretRequest) async throws
    -> GoogleCloudSecretManagerV1.SecretVersion
  {
    try await self.rotateSecret(request: request, options: .init())
  }

  public func rotateSecret(
    request: RotateSecretRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func rotateSecret(
    parent: Swift.String,
  ) async throws -> GoogleCloudSecretManagerV1.SecretVersion {
    let request = RotateSecretRequest().with {
      $0.parent = parent
    }
    return try await self.rotateSecret(request: request)
  }

  public func listLocations(request: GoogleCloudLocation.ListLocationsRequest) async throws
    -> GoogleCloudLocation.ListLocationsResponse
  {
    try await self.listLocations(request: request, options: .init())
  }

  public func listLocations(
    request: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudLocation.ListLocationsResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listLocations(
    byItem: GoogleCloudLocation.ListLocationsRequest
  ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error> {
    try self.listLocations(byItem: byItem, options: .init())
  }

  public func listLocations(
    byItem: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudLocation.ListLocationsResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  public func getLocation(request: GoogleCloudLocation.GetLocationRequest) async throws
    -> GoogleCloudLocation.Location
  {
    try await self.getLocation(request: request, options: .init())
  }

  public func getLocation(
    request: GoogleCloudLocation.GetLocationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudLocation.Location {
    throw GoogleCloudGax.RequestError.unimplemented
  }
}
