// 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 GoogleLongRunning
import GoogleRpc
import GoogleCloudGax

/// Google Cloud HSM Management Service
///
/// Provides interfaces for managing HSM instances.
///
/// Implements a REST model with the following objects:
/// * [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
/// * [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
///
/// [google.cloud.kms.v1.SingleTenantHsmInstance]: <doc:SingleTenantHsmInstance>
/// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: <doc:SingleTenantHsmInstanceProposal>
///
/// @Snippet(path: "HsmManagementQuickstart")
public class HsmManagementClient: Clients.HsmManagementProtocol {
  let inner: any Clients.HsmManagementStub
  let pollingErrorPolicy: GoogleCloudGax.PollingErrorPolicy
  let pollingBackoffPolicy: GoogleCloudGax.BackoffPolicy

  /// Creates a new `HsmManagementClient` instance.
  public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
    var inner: any Clients.HsmManagementStub = try Clients.HsmManagementTransport(options)
    inner = Clients.HsmManagementRetry(inner, options: options)
    if let logger = options.logger {
      inner = Clients.HsmManagementLogging(inner, logger: logger)
    }
    self.inner = inner
    self.pollingErrorPolicy = options.pollingErrorPolicy
    self.pollingBackoffPolicy = options.pollingBackoffPolicy
  }

  /// Lists
  /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance].
  ///
  /// [google.cloud.kms.v1.SingleTenantHsmInstance]: <doc:SingleTenantHsmInstance>
  ///
  /// @Snippet(path: "HsmManagement_ListSingleTenantHsmInstances")
  public func listSingleTenantHsmInstances(
    request: ListSingleTenantHsmInstancesRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudKMSV1.ListSingleTenantHsmInstancesResponse {
    try await self.inner.listSingleTenantHsmInstances(request: request, options: options)
  }

  /// Lists
  /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance].
  ///
  /// [google.cloud.kms.v1.SingleTenantHsmInstance]: <doc:SingleTenantHsmInstance>
  ///
  /// @Snippet(path: "HsmManagement_ListSingleTenantHsmInstances")
  public func listSingleTenantHsmInstances(
    byItem: ListSingleTenantHsmInstancesRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<SingleTenantHsmInstance, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudKMSV1.ListSingleTenantHsmInstancesResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listSingleTenantHsmInstances(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Returns metadata for a given
  /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
  ///
  /// [google.cloud.kms.v1.SingleTenantHsmInstance]: <doc:SingleTenantHsmInstance>
  ///
  /// @Snippet(path: "HsmManagement_GetSingleTenantHsmInstance")
  public func getSingleTenantHsmInstance(
    request: GetSingleTenantHsmInstanceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudKMSV1.SingleTenantHsmInstance {
    try await self.inner.getSingleTenantHsmInstance(request: request, options: options)
  }

  /// Creates a new
  /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] in a
  /// given Project and Location. User must create a RegisterTwoFactorAuthKeys
  /// proposal with this single-tenant HSM instance to finish setup of the
  /// instance.
  ///
  /// [google.cloud.kms.v1.SingleTenantHsmInstance]: <doc:SingleTenantHsmInstance>
  ///
  /// @Snippet(path: "HsmManagement_CreateSingleTenantHsmInstance")
  public func createSingleTenantHsmInstance(
    request: CreateSingleTenantHsmInstanceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.createSingleTenantHsmInstance(request: request, options: options)
  }

  /// Creates a new
  /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] in a
  /// given Project and Location. User must create a RegisterTwoFactorAuthKeys
  /// proposal with this single-tenant HSM instance to finish setup of the
  /// instance.
  ///
  /// [google.cloud.kms.v1.SingleTenantHsmInstance]: <doc:SingleTenantHsmInstance>
  ///
  /// @Snippet(path: "HsmManagement_CreateSingleTenantHsmInstance")
  public func createSingleTenantHsmInstance(
    withPolling: CreateSingleTenantHsmInstanceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<SingleTenantHsmInstance> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<SingleTenantHsmInstance>.State in
      guard op.done else {
        return .init(done: false, result: nil)
      }

      switch op.result {
      case .response(let anyValue):
        guard let anyValueUnwrapped = anyValue else {
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding(
                "Operation completed but response value was missing")))
        }
        let response = try SingleTenantHsmInstance(fromAny: anyValueUnwrapped)
        return .init(done: true, result: .success(response))
      case .error(let status):
        guard let statusUnwrapped = status else {
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding("Operation completed but error value was missing")
            ))
        }
        let error = GoogleCloudGax.RequestError.service(
          GoogleCloudGax.ServiceError(
            code: GoogleRpc.Code(intValue: Int(statusUnwrapped.code)),
            message: statusUnwrapped.message))
        return .init(done: true, result: .failure(error))
      case .none:
        return .init(
          done: true,
          result: .failure(
            GoogleCloudGax.RequestError.binding("Operation completed but result was missing")))
      }
    }
    let rawOp = try await self.createSingleTenantHsmInstance(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = {
      () async throws -> GoogleCloudGax._PollableOperationImpl<SingleTenantHsmInstance>.State in
      let op = try await self.getOperation(
        request: .init().with { $0.name = rawOp.name }, options: options)
      return try extractStatus(op)
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: initialState,
      polling: options.pollingErrorPolicy ?? self.pollingErrorPolicy,
      backoff: options.pollingBackoffPolicy ?? self.pollingBackoffPolicy,
      poll: poll,
    )
  }

  /// Creates a new
  /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
  /// for a given
  /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
  ///
  /// [google.cloud.kms.v1.SingleTenantHsmInstance]: <doc:SingleTenantHsmInstance>
  /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: <doc:SingleTenantHsmInstanceProposal>
  ///
  /// @Snippet(path: "HsmManagement_CreateSingleTenantHsmInstanceProposal")
  public func createSingleTenantHsmInstanceProposal(
    request: CreateSingleTenantHsmInstanceProposalRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.createSingleTenantHsmInstanceProposal(request: request, options: options)
  }

  /// Creates a new
  /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
  /// for a given
  /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
  ///
  /// [google.cloud.kms.v1.SingleTenantHsmInstance]: <doc:SingleTenantHsmInstance>
  /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: <doc:SingleTenantHsmInstanceProposal>
  ///
  /// @Snippet(path: "HsmManagement_CreateSingleTenantHsmInstanceProposal")
  public func createSingleTenantHsmInstanceProposal(
    withPolling: CreateSingleTenantHsmInstanceProposalRequest,
    options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<SingleTenantHsmInstanceProposal> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<SingleTenantHsmInstanceProposal>.State in
      guard op.done else {
        return .init(done: false, result: nil)
      }

      switch op.result {
      case .response(let anyValue):
        guard let anyValueUnwrapped = anyValue else {
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding(
                "Operation completed but response value was missing")))
        }
        let response = try SingleTenantHsmInstanceProposal(fromAny: anyValueUnwrapped)
        return .init(done: true, result: .success(response))
      case .error(let status):
        guard let statusUnwrapped = status else {
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding("Operation completed but error value was missing")
            ))
        }
        let error = GoogleCloudGax.RequestError.service(
          GoogleCloudGax.ServiceError(
            code: GoogleRpc.Code(intValue: Int(statusUnwrapped.code)),
            message: statusUnwrapped.message))
        return .init(done: true, result: .failure(error))
      case .none:
        return .init(
          done: true,
          result: .failure(
            GoogleCloudGax.RequestError.binding("Operation completed but result was missing")))
      }
    }
    let rawOp = try await self.createSingleTenantHsmInstanceProposal(
      request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = {
      () async throws
        -> GoogleCloudGax._PollableOperationImpl<SingleTenantHsmInstanceProposal>.State in
      let op = try await self.getOperation(
        request: .init().with { $0.name = rawOp.name }, options: options)
      return try extractStatus(op)
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: initialState,
      polling: options.pollingErrorPolicy ?? self.pollingErrorPolicy,
      backoff: options.pollingBackoffPolicy ?? self.pollingBackoffPolicy,
      poll: poll,
    )
  }

  /// Approves a
  /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
  /// for a given
  /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]. The
  /// proposal must be in the
  /// [PENDING][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.State.PENDING]
  /// state.
  ///
  /// [google.cloud.kms.v1.SingleTenantHsmInstance]: <doc:SingleTenantHsmInstance>
  /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: <doc:SingleTenantHsmInstanceProposal>
  /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.State.PENDING]: <doc:SingleTenantHsmInstanceProposal/State/pending>
  ///
  /// @Snippet(path: "HsmManagement_ApproveSingleTenantHsmInstanceProposal")
  public func approveSingleTenantHsmInstanceProposal(
    request: ApproveSingleTenantHsmInstanceProposalRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudKMSV1.ApproveSingleTenantHsmInstanceProposalResponse {
    try await self.inner.approveSingleTenantHsmInstanceProposal(request: request, options: options)
  }

  /// Executes a
  /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
  /// for a given
  /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]. The
  /// proposal must be in the
  /// [APPROVED][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.State.APPROVED]
  /// state.
  ///
  /// [google.cloud.kms.v1.SingleTenantHsmInstance]: <doc:SingleTenantHsmInstance>
  /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: <doc:SingleTenantHsmInstanceProposal>
  /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.State.APPROVED]: <doc:SingleTenantHsmInstanceProposal/State/approved>
  ///
  /// @Snippet(path: "HsmManagement_ExecuteSingleTenantHsmInstanceProposal")
  public func executeSingleTenantHsmInstanceProposal(
    request: ExecuteSingleTenantHsmInstanceProposalRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.executeSingleTenantHsmInstanceProposal(request: request, options: options)
  }

  /// Executes a
  /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
  /// for a given
  /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]. The
  /// proposal must be in the
  /// [APPROVED][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.State.APPROVED]
  /// state.
  ///
  /// [google.cloud.kms.v1.SingleTenantHsmInstance]: <doc:SingleTenantHsmInstance>
  /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: <doc:SingleTenantHsmInstanceProposal>
  /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.State.APPROVED]: <doc:SingleTenantHsmInstanceProposal/State/approved>
  ///
  /// @Snippet(path: "HsmManagement_ExecuteSingleTenantHsmInstanceProposal")
  public func executeSingleTenantHsmInstanceProposal(
    withPolling: ExecuteSingleTenantHsmInstanceProposalRequest,
    options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<
    ExecuteSingleTenantHsmInstanceProposalResponse
  > {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<ExecuteSingleTenantHsmInstanceProposalResponse>
        .State in
      guard op.done else {
        return .init(done: false, result: nil)
      }

      switch op.result {
      case .response(let anyValue):
        guard let anyValueUnwrapped = anyValue else {
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding(
                "Operation completed but response value was missing")))
        }
        let response = try ExecuteSingleTenantHsmInstanceProposalResponse(
          fromAny: anyValueUnwrapped)
        return .init(done: true, result: .success(response))
      case .error(let status):
        guard let statusUnwrapped = status else {
          return .init(
            done: true,
            result: .failure(
              GoogleCloudGax.RequestError.binding("Operation completed but error value was missing")
            ))
        }
        let error = GoogleCloudGax.RequestError.service(
          GoogleCloudGax.ServiceError(
            code: GoogleRpc.Code(intValue: Int(statusUnwrapped.code)),
            message: statusUnwrapped.message))
        return .init(done: true, result: .failure(error))
      case .none:
        return .init(
          done: true,
          result: .failure(
            GoogleCloudGax.RequestError.binding("Operation completed but result was missing")))
      }
    }
    let rawOp = try await self.executeSingleTenantHsmInstanceProposal(
      request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = {
      () async throws
        -> GoogleCloudGax._PollableOperationImpl<ExecuteSingleTenantHsmInstanceProposalResponse>
        .State in
      let op = try await self.getOperation(
        request: .init().with { $0.name = rawOp.name }, options: options)
      return try extractStatus(op)
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: initialState,
      polling: options.pollingErrorPolicy ?? self.pollingErrorPolicy,
      backoff: options.pollingBackoffPolicy ?? self.pollingBackoffPolicy,
      poll: poll,
    )
  }

  /// Returns metadata for a given
  /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
  ///
  /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: <doc:SingleTenantHsmInstanceProposal>
  ///
  /// @Snippet(path: "HsmManagement_GetSingleTenantHsmInstanceProposal")
  public func getSingleTenantHsmInstanceProposal(
    request: GetSingleTenantHsmInstanceProposalRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudKMSV1.SingleTenantHsmInstanceProposal {
    try await self.inner.getSingleTenantHsmInstanceProposal(request: request, options: options)
  }

  /// Lists
  /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
  ///
  /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: <doc:SingleTenantHsmInstanceProposal>
  ///
  /// @Snippet(path: "HsmManagement_ListSingleTenantHsmInstanceProposals")
  public func listSingleTenantHsmInstanceProposals(
    request: ListSingleTenantHsmInstanceProposalsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudKMSV1.ListSingleTenantHsmInstanceProposalsResponse {
    try await self.inner.listSingleTenantHsmInstanceProposals(request: request, options: options)
  }

  /// Lists
  /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
  ///
  /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: <doc:SingleTenantHsmInstanceProposal>
  ///
  /// @Snippet(path: "HsmManagement_ListSingleTenantHsmInstanceProposals")
  public func listSingleTenantHsmInstanceProposals(
    byItem: ListSingleTenantHsmInstanceProposalsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<SingleTenantHsmInstanceProposal, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws
        -> GoogleCloudKMSV1.ListSingleTenantHsmInstanceProposalsResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listSingleTenantHsmInstanceProposals(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Deletes a
  /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
  ///
  /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: <doc:SingleTenantHsmInstanceProposal>
  ///
  /// @Snippet(path: "HsmManagement_DeleteSingleTenantHsmInstanceProposal")
  public func deleteSingleTenantHsmInstanceProposal(
    request: DeleteSingleTenantHsmInstanceProposalRequest, options: GoogleCloudGax.RequestOptions
  ) async throws {
    try await self.inner.deleteSingleTenantHsmInstanceProposal(request: request, options: options)
  }

  /// Lists information about the supported locations for this service.
  ///
  /// This method lists locations based on the resource scope provided in
  /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
  /// **Global locations**: If `name` is empty, the method lists the
  /// public locations available to all projects. * **Project-specific
  /// locations**: If `name` follows the format
  /// `projects/{project}`, the method lists locations visible to that
  /// specific project. This includes public, private, or other
  /// project-specific locations enabled for the project.
  ///
  /// For gRPC and client library implementations, the resource name is
  /// passed as the `name` field. For direct service calls, the resource
  /// name is
  /// incorporated into the request path based on the specific service
  /// implementation and version.
  ///
  /// [google.cloud.location.ListLocationsRequest.name]: https://www.google.com/search?q=Swift+google.cloud.location+GoogleCloudLocation.ListLocationsRequest/name
  ///
  /// @Snippet(path: "HsmManagement_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.
  ///
  /// This method lists locations based on the resource scope provided in
  /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
  /// **Global locations**: If `name` is empty, the method lists the
  /// public locations available to all projects. * **Project-specific
  /// locations**: If `name` follows the format
  /// `projects/{project}`, the method lists locations visible to that
  /// specific project. This includes public, private, or other
  /// project-specific locations enabled for the project.
  ///
  /// For gRPC and client library implementations, the resource name is
  /// passed as the `name` field. For direct service calls, the resource
  /// name is
  /// incorporated into the request path based on the specific service
  /// implementation and version.
  ///
  /// [google.cloud.location.ListLocationsRequest.name]: https://www.google.com/search?q=Swift+google.cloud.location+GoogleCloudLocation.ListLocationsRequest/name
  ///
  /// @Snippet(path: "HsmManagement_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: "HsmManagement_GetLocation")
  public func getLocation(
    request: GoogleCloudLocation.GetLocationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudLocation.Location {
    try await self.inner.getLocation(request: request, options: options)
  }

  /// Sets the access control policy on the specified resource. Replaces
  /// any existing policy.
  ///
  /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
  /// errors.
  ///
  /// @Snippet(path: "HsmManagement_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 resource. Returns an empty policy
  /// if the resource exists and does not have a policy set.
  ///
  /// @Snippet(path: "HsmManagement_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 on the specified resource. If the
  /// resource does not exist, this will return 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: "HsmManagement_TestIamPermissions")
  public func testIamPermissions(
    request: GoogleIAMV1.TestIamPermissionsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV1.TestIamPermissionsResponse {
    try await self.inner.testIamPermissions(request: request, options: options)
  }

  /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
  ///
  /// [google.longrunning.Operations]: https://www.google.com/search?q=Swift+google.longrunning+Operations
  ///
  /// @Snippet(path: "HsmManagement_GetOperation")
  func getOperation(
    request: GoogleLongRunning.GetOperationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.getOperation(request: request, options: options)
  }
}

extension Clients {
  /// A Swift protocol to mock `HsmManagementClient`.
  ///
  /// To mock `HsmManagementClient` change your functions to receive
  /// `some HsmManagementProtocol` or `any HsmManagementProtocol`
  /// and pass a mock implementation in your tests.
  public protocol HsmManagementProtocol {
    /// See `HsmManagementClient.listSingleTenantHsmInstances`.
    func listSingleTenantHsmInstances(request: ListSingleTenantHsmInstancesRequest) async throws
      -> GoogleCloudKMSV1.ListSingleTenantHsmInstancesResponse

    /// See `HsmManagementClient.listSingleTenantHsmInstances`.
    func listSingleTenantHsmInstances(
      byItem: ListSingleTenantHsmInstancesRequest
    ) throws -> any AsyncSequence<SingleTenantHsmInstance, Swift.Error>

    /// See `HsmManagementClient.listSingleTenantHsmInstances`.
    func listSingleTenantHsmInstances(
      parent: Swift.String,
    ) throws -> any AsyncSequence<SingleTenantHsmInstance, Swift.Error>

    /// See `HsmManagementClient.getSingleTenantHsmInstance`.
    func getSingleTenantHsmInstance(request: GetSingleTenantHsmInstanceRequest) async throws
      -> GoogleCloudKMSV1.SingleTenantHsmInstance

    /// See `HsmManagementClient.getSingleTenantHsmInstance`.
    func getSingleTenantHsmInstance(
      name: Swift.String,
    ) async throws -> GoogleCloudKMSV1.SingleTenantHsmInstance

    /// See `HsmManagementClient.createSingleTenantHsmInstance`.
    func createSingleTenantHsmInstance(request: CreateSingleTenantHsmInstanceRequest) async throws
      -> GoogleLongRunning.Operation

    /// See `HsmManagementClient.createSingleTenantHsmInstance`.
    func createSingleTenantHsmInstance(withPolling: CreateSingleTenantHsmInstanceRequest)
      async throws -> any GoogleCloudGax.PollableOperation<SingleTenantHsmInstance>

    /// See `HsmManagementClient.createSingleTenantHsmInstance`.
    func createSingleTenantHsmInstance(
      parent: Swift.String,
      singleTenantHsmInstance: SingleTenantHsmInstance?,
      singleTenantHsmInstanceId: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<SingleTenantHsmInstance>

    /// See `HsmManagementClient.createSingleTenantHsmInstanceProposal`.
    func createSingleTenantHsmInstanceProposal(
      request: CreateSingleTenantHsmInstanceProposalRequest
    ) async throws -> GoogleLongRunning.Operation

    /// See `HsmManagementClient.createSingleTenantHsmInstanceProposal`.
    func createSingleTenantHsmInstanceProposal(
      withPolling: CreateSingleTenantHsmInstanceProposalRequest
    ) async throws -> any GoogleCloudGax.PollableOperation<SingleTenantHsmInstanceProposal>

    /// See `HsmManagementClient.createSingleTenantHsmInstanceProposal`.
    func createSingleTenantHsmInstanceProposal(
      parent: Swift.String,
      singleTenantHsmInstanceProposal: SingleTenantHsmInstanceProposal?,
      singleTenantHsmInstanceProposalId: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<SingleTenantHsmInstanceProposal>

    /// See `HsmManagementClient.approveSingleTenantHsmInstanceProposal`.
    func approveSingleTenantHsmInstanceProposal(
      request: ApproveSingleTenantHsmInstanceProposalRequest
    ) async throws -> GoogleCloudKMSV1.ApproveSingleTenantHsmInstanceProposalResponse

    /// See `HsmManagementClient.approveSingleTenantHsmInstanceProposal`.
    func approveSingleTenantHsmInstanceProposal(
      name: Swift.String,
      quorumReply: ApproveSingleTenantHsmInstanceProposalRequest.QuorumReply?,
    ) async throws -> GoogleCloudKMSV1.ApproveSingleTenantHsmInstanceProposalResponse

    /// See `HsmManagementClient.executeSingleTenantHsmInstanceProposal`.
    func executeSingleTenantHsmInstanceProposal(
      request: ExecuteSingleTenantHsmInstanceProposalRequest
    ) async throws -> GoogleLongRunning.Operation

    /// See `HsmManagementClient.executeSingleTenantHsmInstanceProposal`.
    func executeSingleTenantHsmInstanceProposal(
      withPolling: ExecuteSingleTenantHsmInstanceProposalRequest
    ) async throws -> any GoogleCloudGax.PollableOperation<
      ExecuteSingleTenantHsmInstanceProposalResponse
    >

    /// See `HsmManagementClient.executeSingleTenantHsmInstanceProposal`.
    func executeSingleTenantHsmInstanceProposal(
      name: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<
      ExecuteSingleTenantHsmInstanceProposalResponse
    >

    /// See `HsmManagementClient.getSingleTenantHsmInstanceProposal`.
    func getSingleTenantHsmInstanceProposal(request: GetSingleTenantHsmInstanceProposalRequest)
      async throws -> GoogleCloudKMSV1.SingleTenantHsmInstanceProposal

    /// See `HsmManagementClient.getSingleTenantHsmInstanceProposal`.
    func getSingleTenantHsmInstanceProposal(
      name: Swift.String,
    ) async throws -> GoogleCloudKMSV1.SingleTenantHsmInstanceProposal

    /// See `HsmManagementClient.listSingleTenantHsmInstanceProposals`.
    func listSingleTenantHsmInstanceProposals(request: ListSingleTenantHsmInstanceProposalsRequest)
      async throws -> GoogleCloudKMSV1.ListSingleTenantHsmInstanceProposalsResponse

    /// See `HsmManagementClient.listSingleTenantHsmInstanceProposals`.
    func listSingleTenantHsmInstanceProposals(
      byItem: ListSingleTenantHsmInstanceProposalsRequest
    ) throws -> any AsyncSequence<SingleTenantHsmInstanceProposal, Swift.Error>

    /// See `HsmManagementClient.listSingleTenantHsmInstanceProposals`.
    func listSingleTenantHsmInstanceProposals(
      parent: Swift.String,
    ) throws -> any AsyncSequence<SingleTenantHsmInstanceProposal, Swift.Error>

    /// See `HsmManagementClient.deleteSingleTenantHsmInstanceProposal`.
    func deleteSingleTenantHsmInstanceProposal(
      request: DeleteSingleTenantHsmInstanceProposalRequest) async throws

    /// See `HsmManagementClient.deleteSingleTenantHsmInstanceProposal`.
    func deleteSingleTenantHsmInstanceProposal(
      name: Swift.String,
    ) async throws

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

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

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

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

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

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

    /// See `HsmManagementClient.listSingleTenantHsmInstances`.
    func listSingleTenantHsmInstances(
      request: ListSingleTenantHsmInstancesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudKMSV1.ListSingleTenantHsmInstancesResponse

    /// See `HsmManagementClient.listSingleTenantHsmInstances`.
    func listSingleTenantHsmInstances(
      byItem: ListSingleTenantHsmInstancesRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<SingleTenantHsmInstance, Swift.Error>

    /// See `HsmManagementClient.getSingleTenantHsmInstance`.
    func getSingleTenantHsmInstance(
      request: GetSingleTenantHsmInstanceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudKMSV1.SingleTenantHsmInstance

    /// See `HsmManagementClient.createSingleTenantHsmInstance`.
    func createSingleTenantHsmInstance(
      request: CreateSingleTenantHsmInstanceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `HsmManagementClient.createSingleTenantHsmInstance`.
    func createSingleTenantHsmInstance(
      withPolling: CreateSingleTenantHsmInstanceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<SingleTenantHsmInstance>

    /// See `HsmManagementClient.createSingleTenantHsmInstanceProposal`.
    func createSingleTenantHsmInstanceProposal(
      request: CreateSingleTenantHsmInstanceProposalRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `HsmManagementClient.createSingleTenantHsmInstanceProposal`.
    func createSingleTenantHsmInstanceProposal(
      withPolling: CreateSingleTenantHsmInstanceProposalRequest,
      options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<SingleTenantHsmInstanceProposal>

    /// See `HsmManagementClient.approveSingleTenantHsmInstanceProposal`.
    func approveSingleTenantHsmInstanceProposal(
      request: ApproveSingleTenantHsmInstanceProposalRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudKMSV1.ApproveSingleTenantHsmInstanceProposalResponse

    /// See `HsmManagementClient.executeSingleTenantHsmInstanceProposal`.
    func executeSingleTenantHsmInstanceProposal(
      request: ExecuteSingleTenantHsmInstanceProposalRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `HsmManagementClient.executeSingleTenantHsmInstanceProposal`.
    func executeSingleTenantHsmInstanceProposal(
      withPolling: ExecuteSingleTenantHsmInstanceProposalRequest,
      options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<
      ExecuteSingleTenantHsmInstanceProposalResponse
    >

    /// See `HsmManagementClient.getSingleTenantHsmInstanceProposal`.
    func getSingleTenantHsmInstanceProposal(
      request: GetSingleTenantHsmInstanceProposalRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudKMSV1.SingleTenantHsmInstanceProposal

    /// See `HsmManagementClient.listSingleTenantHsmInstanceProposals`.
    func listSingleTenantHsmInstanceProposals(
      request: ListSingleTenantHsmInstanceProposalsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudKMSV1.ListSingleTenantHsmInstanceProposalsResponse

    /// See `HsmManagementClient.listSingleTenantHsmInstanceProposals`.
    func listSingleTenantHsmInstanceProposals(
      byItem: ListSingleTenantHsmInstanceProposalsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<SingleTenantHsmInstanceProposal, Swift.Error>

    /// See `HsmManagementClient.deleteSingleTenantHsmInstanceProposal`.
    func deleteSingleTenantHsmInstanceProposal(
      request: DeleteSingleTenantHsmInstanceProposalRequest, options: GoogleCloudGax.RequestOptions
    ) async throws

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

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

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

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

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

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

// Default implementations
extension Clients.HsmManagementProtocol {
  public func listSingleTenantHsmInstances(request: ListSingleTenantHsmInstancesRequest)
    async throws -> GoogleCloudKMSV1.ListSingleTenantHsmInstancesResponse
  {
    try await self.listSingleTenantHsmInstances(request: request, options: .init())
  }

  public func listSingleTenantHsmInstances(
    request: ListSingleTenantHsmInstancesRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudKMSV1.ListSingleTenantHsmInstancesResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listSingleTenantHsmInstances(
    byItem: ListSingleTenantHsmInstancesRequest
  ) throws -> any AsyncSequence<SingleTenantHsmInstance, Swift.Error> {
    try self.listSingleTenantHsmInstances(byItem: byItem, options: .init())
  }

  public func listSingleTenantHsmInstances(
    byItem: ListSingleTenantHsmInstancesRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<SingleTenantHsmInstance, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudKMSV1.ListSingleTenantHsmInstancesResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

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

  public func getSingleTenantHsmInstance(request: GetSingleTenantHsmInstanceRequest) async throws
    -> GoogleCloudKMSV1.SingleTenantHsmInstance
  {
    try await self.getSingleTenantHsmInstance(request: request, options: .init())
  }

  public func getSingleTenantHsmInstance(
    request: GetSingleTenantHsmInstanceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudKMSV1.SingleTenantHsmInstance {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getSingleTenantHsmInstance(
    name: Swift.String,
  ) async throws -> GoogleCloudKMSV1.SingleTenantHsmInstance {
    let request = GetSingleTenantHsmInstanceRequest().with {
      $0.name = name
    }
    return try await self.getSingleTenantHsmInstance(request: request)
  }

  public func createSingleTenantHsmInstance(request: CreateSingleTenantHsmInstanceRequest)
    async throws -> GoogleLongRunning.Operation
  {
    try await self.createSingleTenantHsmInstance(request: request, options: .init())
  }

  public func createSingleTenantHsmInstance(
    request: CreateSingleTenantHsmInstanceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func createSingleTenantHsmInstance(withPolling: CreateSingleTenantHsmInstanceRequest)
    async throws -> any GoogleCloudGax.PollableOperation<SingleTenantHsmInstance>
  {
    try await self.createSingleTenantHsmInstance(withPolling: withPolling, options: .init())
  }

  public func createSingleTenantHsmInstance(
    withPolling: CreateSingleTenantHsmInstanceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<SingleTenantHsmInstance> {
    let poll = {
      () async throws -> GoogleCloudGax._PollableOperationImpl<SingleTenantHsmInstance>.State in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: .init(done: false, result: nil), poll: poll)
  }

  public func createSingleTenantHsmInstance(
    parent: Swift.String,
    singleTenantHsmInstance: SingleTenantHsmInstance?,
    singleTenantHsmInstanceId: Swift.String,
  ) async throws -> any GoogleCloudGax.PollableOperation<SingleTenantHsmInstance> {
    let request = CreateSingleTenantHsmInstanceRequest().with {
      $0.parent = parent
      $0.singleTenantHsmInstance = singleTenantHsmInstance
      $0.singleTenantHsmInstanceId = singleTenantHsmInstanceId
    }
    return try await self.createSingleTenantHsmInstance(withPolling: request)
  }

  public func createSingleTenantHsmInstanceProposal(
    request: CreateSingleTenantHsmInstanceProposalRequest
  ) async throws -> GoogleLongRunning.Operation {
    try await self.createSingleTenantHsmInstanceProposal(request: request, options: .init())
  }

  public func createSingleTenantHsmInstanceProposal(
    request: CreateSingleTenantHsmInstanceProposalRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func createSingleTenantHsmInstanceProposal(
    withPolling: CreateSingleTenantHsmInstanceProposalRequest
  ) async throws -> any GoogleCloudGax.PollableOperation<SingleTenantHsmInstanceProposal> {
    try await self.createSingleTenantHsmInstanceProposal(withPolling: withPolling, options: .init())
  }

  public func createSingleTenantHsmInstanceProposal(
    withPolling: CreateSingleTenantHsmInstanceProposalRequest,
    options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<SingleTenantHsmInstanceProposal> {
    let poll = {
      () async throws
        -> GoogleCloudGax._PollableOperationImpl<SingleTenantHsmInstanceProposal>.State in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: .init(done: false, result: nil), poll: poll)
  }

  public func createSingleTenantHsmInstanceProposal(
    parent: Swift.String,
    singleTenantHsmInstanceProposal: SingleTenantHsmInstanceProposal?,
    singleTenantHsmInstanceProposalId: Swift.String,
  ) async throws -> any GoogleCloudGax.PollableOperation<SingleTenantHsmInstanceProposal> {
    let request = CreateSingleTenantHsmInstanceProposalRequest().with {
      $0.parent = parent
      $0.singleTenantHsmInstanceProposal = singleTenantHsmInstanceProposal
      $0.singleTenantHsmInstanceProposalId = singleTenantHsmInstanceProposalId
    }
    return try await self.createSingleTenantHsmInstanceProposal(withPolling: request)
  }

  public func approveSingleTenantHsmInstanceProposal(
    request: ApproveSingleTenantHsmInstanceProposalRequest
  ) async throws -> GoogleCloudKMSV1.ApproveSingleTenantHsmInstanceProposalResponse {
    try await self.approveSingleTenantHsmInstanceProposal(request: request, options: .init())
  }

  public func approveSingleTenantHsmInstanceProposal(
    request: ApproveSingleTenantHsmInstanceProposalRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudKMSV1.ApproveSingleTenantHsmInstanceProposalResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func approveSingleTenantHsmInstanceProposal(
    name: Swift.String,
    quorumReply: ApproveSingleTenantHsmInstanceProposalRequest.QuorumReply?,
  ) async throws -> GoogleCloudKMSV1.ApproveSingleTenantHsmInstanceProposalResponse {
    let request = ApproveSingleTenantHsmInstanceProposalRequest().with {
      $0.name = name
      $0.approvalPayload = quorumReply.map { .quorumReply($0) }
    }
    return try await self.approveSingleTenantHsmInstanceProposal(request: request)
  }

  public func executeSingleTenantHsmInstanceProposal(
    request: ExecuteSingleTenantHsmInstanceProposalRequest
  ) async throws -> GoogleLongRunning.Operation {
    try await self.executeSingleTenantHsmInstanceProposal(request: request, options: .init())
  }

  public func executeSingleTenantHsmInstanceProposal(
    request: ExecuteSingleTenantHsmInstanceProposalRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func executeSingleTenantHsmInstanceProposal(
    withPolling: ExecuteSingleTenantHsmInstanceProposalRequest
  ) async throws -> any GoogleCloudGax.PollableOperation<
    ExecuteSingleTenantHsmInstanceProposalResponse
  > {
    try await self.executeSingleTenantHsmInstanceProposal(
      withPolling: withPolling, options: .init())
  }

  public func executeSingleTenantHsmInstanceProposal(
    withPolling: ExecuteSingleTenantHsmInstanceProposalRequest,
    options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<
    ExecuteSingleTenantHsmInstanceProposalResponse
  > {
    let poll = {
      () async throws
        -> GoogleCloudGax._PollableOperationImpl<ExecuteSingleTenantHsmInstanceProposalResponse>
        .State in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: .init(done: false, result: nil), poll: poll)
  }

  public func executeSingleTenantHsmInstanceProposal(
    name: Swift.String,
  ) async throws -> any GoogleCloudGax.PollableOperation<
    ExecuteSingleTenantHsmInstanceProposalResponse
  > {
    let request = ExecuteSingleTenantHsmInstanceProposalRequest().with {
      $0.name = name
    }
    return try await self.executeSingleTenantHsmInstanceProposal(withPolling: request)
  }

  public func getSingleTenantHsmInstanceProposal(request: GetSingleTenantHsmInstanceProposalRequest)
    async throws -> GoogleCloudKMSV1.SingleTenantHsmInstanceProposal
  {
    try await self.getSingleTenantHsmInstanceProposal(request: request, options: .init())
  }

  public func getSingleTenantHsmInstanceProposal(
    request: GetSingleTenantHsmInstanceProposalRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudKMSV1.SingleTenantHsmInstanceProposal {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getSingleTenantHsmInstanceProposal(
    name: Swift.String,
  ) async throws -> GoogleCloudKMSV1.SingleTenantHsmInstanceProposal {
    let request = GetSingleTenantHsmInstanceProposalRequest().with {
      $0.name = name
    }
    return try await self.getSingleTenantHsmInstanceProposal(request: request)
  }

  public func listSingleTenantHsmInstanceProposals(
    request: ListSingleTenantHsmInstanceProposalsRequest
  ) async throws -> GoogleCloudKMSV1.ListSingleTenantHsmInstanceProposalsResponse {
    try await self.listSingleTenantHsmInstanceProposals(request: request, options: .init())
  }

  public func listSingleTenantHsmInstanceProposals(
    request: ListSingleTenantHsmInstanceProposalsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudKMSV1.ListSingleTenantHsmInstanceProposalsResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listSingleTenantHsmInstanceProposals(
    byItem: ListSingleTenantHsmInstanceProposalsRequest
  ) throws -> any AsyncSequence<SingleTenantHsmInstanceProposal, Swift.Error> {
    try self.listSingleTenantHsmInstanceProposals(byItem: byItem, options: .init())
  }

  public func listSingleTenantHsmInstanceProposals(
    byItem: ListSingleTenantHsmInstanceProposalsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<SingleTenantHsmInstanceProposal, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws
        -> GoogleCloudKMSV1.ListSingleTenantHsmInstanceProposalsResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

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

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

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

  public func deleteSingleTenantHsmInstanceProposal(
    name: Swift.String,
  ) async throws {
    let request = DeleteSingleTenantHsmInstanceProposalRequest().with {
      $0.name = name
    }
    try await self.deleteSingleTenantHsmInstanceProposal(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
  }

  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 getOperation(request: GoogleLongRunning.GetOperationRequest) async throws
    -> GoogleLongRunning.Operation
  {
    try await self.getOperation(request: request, options: .init())
  }

  public func getOperation(
    request: GoogleLongRunning.GetOperationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getOperation(
    name: Swift.String,
  ) async throws -> GoogleLongRunning.Operation {
    let request = GoogleLongRunning.GetOperationRequest().with {
      $0.name = name
    }
    return try await self.getOperation(request: request)
  }
}
