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

/// The ClusterControllerService provides methods to manage clusters
/// of Compute Engine instances.
///
/// @Snippet(path: "ClusterControllerQuickstart")
public class ClusterControllerClient: Clients.ClusterControllerProtocol {
  let inner: any Clients.ClusterControllerStub
  let pollingErrorPolicy: GoogleCloudGax.PollingErrorPolicy
  let pollingBackoffPolicy: GoogleCloudGax.BackoffPolicy

  /// Creates a new `ClusterControllerClient` instance.
  public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
    var inner: any Clients.ClusterControllerStub = try Clients.ClusterControllerTransport(options)
    inner = Clients.ClusterControllerRetry(inner, options: options)
    if let logger = options.logger {
      inner = Clients.ClusterControllerLogging(inner, logger: logger)
    }
    self.inner = inner
    self.pollingErrorPolicy = options.pollingErrorPolicy
    self.pollingBackoffPolicy = options.pollingBackoffPolicy
  }

  /// Creates a cluster in a project. The returned
  /// [Operation.metadata][google.longrunning.Operation.metadata] will be
  /// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
  ///
  /// [google.longrunning.Operation.metadata]: https://www.google.com/search?q=Swift+google.longrunning+GoogleLongRunning.Operation/metadata
  ///
  /// @Snippet(path: "ClusterController_CreateCluster")
  public func createCluster(
    request: CreateClusterRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.createCluster(request: request, options: options)
  }

  /// Creates a cluster in a project. The returned
  /// [Operation.metadata][google.longrunning.Operation.metadata] will be
  /// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
  ///
  /// [google.longrunning.Operation.metadata]: https://www.google.com/search?q=Swift+google.longrunning+GoogleLongRunning.Operation/metadata
  ///
  /// @Snippet(path: "ClusterController_CreateCluster")
  public func createCluster(
    withPolling: CreateClusterRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Cluster> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Cluster>.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 Cluster(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.createCluster(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Cluster>.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,
    )
  }

  /// Updates a cluster in a project. The returned
  /// [Operation.metadata][google.longrunning.Operation.metadata] will be
  /// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
  /// The cluster must be in a
  /// [`RUNNING`][google.cloud.dataproc.v1.ClusterStatus.State] state or an error
  /// is returned.
  ///
  /// [google.cloud.dataproc.v1.ClusterStatus.State]: <doc:ClusterStatus/State>
  /// [google.longrunning.Operation.metadata]: https://www.google.com/search?q=Swift+google.longrunning+GoogleLongRunning.Operation/metadata
  ///
  /// @Snippet(path: "ClusterController_UpdateCluster")
  public func updateCluster(
    request: UpdateClusterRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.updateCluster(request: request, options: options)
  }

  /// Updates a cluster in a project. The returned
  /// [Operation.metadata][google.longrunning.Operation.metadata] will be
  /// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
  /// The cluster must be in a
  /// [`RUNNING`][google.cloud.dataproc.v1.ClusterStatus.State] state or an error
  /// is returned.
  ///
  /// [google.cloud.dataproc.v1.ClusterStatus.State]: <doc:ClusterStatus/State>
  /// [google.longrunning.Operation.metadata]: https://www.google.com/search?q=Swift+google.longrunning+GoogleLongRunning.Operation/metadata
  ///
  /// @Snippet(path: "ClusterController_UpdateCluster")
  public func updateCluster(
    withPolling: UpdateClusterRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Cluster> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Cluster>.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 Cluster(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.updateCluster(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Cluster>.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,
    )
  }

  /// Stops a cluster in a project.
  ///
  /// @Snippet(path: "ClusterController_StopCluster")
  public func stopCluster(
    request: StopClusterRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.stopCluster(request: request, options: options)
  }

  /// Stops a cluster in a project.
  ///
  /// @Snippet(path: "ClusterController_StopCluster")
  public func stopCluster(
    withPolling: StopClusterRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Cluster> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Cluster>.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 Cluster(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.stopCluster(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Cluster>.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,
    )
  }

  /// Starts a cluster in a project.
  ///
  /// @Snippet(path: "ClusterController_StartCluster")
  public func startCluster(
    request: StartClusterRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.startCluster(request: request, options: options)
  }

  /// Starts a cluster in a project.
  ///
  /// @Snippet(path: "ClusterController_StartCluster")
  public func startCluster(
    withPolling: StartClusterRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Cluster> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Cluster>.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 Cluster(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.startCluster(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Cluster>.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,
    )
  }

  /// Deletes a cluster in a project. The returned
  /// [Operation.metadata][google.longrunning.Operation.metadata] will be
  /// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
  ///
  /// [google.longrunning.Operation.metadata]: https://www.google.com/search?q=Swift+google.longrunning+GoogleLongRunning.Operation/metadata
  ///
  /// @Snippet(path: "ClusterController_DeleteCluster")
  public func deleteCluster(
    request: DeleteClusterRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.deleteCluster(request: request, options: options)
  }

  /// Deletes a cluster in a project. The returned
  /// [Operation.metadata][google.longrunning.Operation.metadata] will be
  /// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
  ///
  /// [google.longrunning.Operation.metadata]: https://www.google.com/search?q=Swift+google.longrunning+GoogleLongRunning.Operation/metadata
  ///
  /// @Snippet(path: "ClusterController_DeleteCluster")
  public func deleteCluster(
    withPolling: DeleteClusterRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Void> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws -> GoogleCloudGax._PollableOperationImpl<Void>.State
      in
      guard op.done else {
        return .init(done: false, result: nil)
      }

      switch op.result {
      case .response:
        return .init(done: true, result: .success(()))
      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.deleteCluster(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Void>.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,
    )
  }

  /// Gets the resource representation for a cluster in a project.
  ///
  /// @Snippet(path: "ClusterController_GetCluster")
  public func getCluster(
    request: GetClusterRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudDataprocV1.Cluster {
    try await self.inner.getCluster(request: request, options: options)
  }

  /// Lists all regions/{region}/clusters in a project alphabetically.
  ///
  /// @Snippet(path: "ClusterController_ListClusters")
  public func listClusters(
    request: ListClustersRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudDataprocV1.ListClustersResponse {
    try await self.inner.listClusters(request: request, options: options)
  }

  /// Lists all regions/{region}/clusters in a project alphabetically.
  ///
  /// @Snippet(path: "ClusterController_ListClusters")
  public func listClusters(
    byItem: ListClustersRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Cluster, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudDataprocV1.ListClustersResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listClusters(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Gets cluster diagnostic information. The returned
  /// [Operation.metadata][google.longrunning.Operation.metadata] will be
  /// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
  /// After the operation completes,
  /// [Operation.response][google.longrunning.Operation.response]
  /// contains
  /// [DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults).
  ///
  /// [google.longrunning.Operation.metadata]: https://www.google.com/search?q=Swift+google.longrunning+GoogleLongRunning.Operation/metadata
  /// [google.longrunning.Operation.response]: https://www.google.com/search?q=Swift+google.longrunning+GoogleLongRunning.Operation/response
  ///
  /// @Snippet(path: "ClusterController_DiagnoseCluster")
  public func diagnoseCluster(
    request: DiagnoseClusterRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.diagnoseCluster(request: request, options: options)
  }

  /// Gets cluster diagnostic information. The returned
  /// [Operation.metadata][google.longrunning.Operation.metadata] will be
  /// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
  /// After the operation completes,
  /// [Operation.response][google.longrunning.Operation.response]
  /// contains
  /// [DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults).
  ///
  /// [google.longrunning.Operation.metadata]: https://www.google.com/search?q=Swift+google.longrunning+GoogleLongRunning.Operation/metadata
  /// [google.longrunning.Operation.response]: https://www.google.com/search?q=Swift+google.longrunning+GoogleLongRunning.Operation/response
  ///
  /// @Snippet(path: "ClusterController_DiagnoseCluster")
  public func diagnoseCluster(
    withPolling: DiagnoseClusterRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<DiagnoseClusterResults> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<DiagnoseClusterResults>.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 DiagnoseClusterResults(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.diagnoseCluster(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = {
      () async throws -> GoogleCloudGax._PollableOperationImpl<DiagnoseClusterResults>.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,
    )
  }

  /// 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: "ClusterController_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: "ClusterController_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: "ClusterController_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: "ClusterController_ListOperations")
  public func listOperations(
    request: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.ListOperationsResponse {
    try await self.inner.listOperations(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: "ClusterController_ListOperations")
  public func listOperations(
    byItem: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleLongRunning.ListOperationsResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listOperations(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// 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: "ClusterController_GetOperation")
  func getOperation(
    request: GoogleLongRunning.GetOperationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.getOperation(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: "ClusterController_DeleteOperation")
  public func deleteOperation(
    request: GoogleLongRunning.DeleteOperationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws {
    try await self.inner.deleteOperation(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: "ClusterController_CancelOperation")
  public func cancelOperation(
    request: GoogleLongRunning.CancelOperationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws {
    try await self.inner.cancelOperation(request: request, options: options)
  }
}

extension Clients {
  /// A Swift protocol to mock `ClusterControllerClient`.
  ///
  /// To mock `ClusterControllerClient` change your functions to receive
  /// `some ClusterControllerProtocol` or `any ClusterControllerProtocol`
  /// and pass a mock implementation in your tests.
  public protocol ClusterControllerProtocol {
    /// See `ClusterControllerClient.createCluster`.
    func createCluster(request: CreateClusterRequest) async throws -> GoogleLongRunning.Operation

    /// See `ClusterControllerClient.createCluster`.
    func createCluster(withPolling: CreateClusterRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Cluster>

    /// See `ClusterControllerClient.createCluster`.
    func createCluster(
      projectId: Swift.String,
      region: Swift.String,
      cluster: Cluster?,
    ) async throws -> any GoogleCloudGax.PollableOperation<Cluster>

    /// See `ClusterControllerClient.updateCluster`.
    func updateCluster(request: UpdateClusterRequest) async throws -> GoogleLongRunning.Operation

    /// See `ClusterControllerClient.updateCluster`.
    func updateCluster(withPolling: UpdateClusterRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Cluster>

    /// See `ClusterControllerClient.updateCluster`.
    func updateCluster(
      projectId: Swift.String,
      region: Swift.String,
      clusterName: Swift.String,
      cluster: Cluster?,
      updateMask: GoogleCloudWkt.FieldMask?,
    ) async throws -> any GoogleCloudGax.PollableOperation<Cluster>

    /// See `ClusterControllerClient.stopCluster`.
    func stopCluster(request: StopClusterRequest) async throws -> GoogleLongRunning.Operation

    /// See `ClusterControllerClient.stopCluster`.
    func stopCluster(withPolling: StopClusterRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Cluster>

    /// See `ClusterControllerClient.startCluster`.
    func startCluster(request: StartClusterRequest) async throws -> GoogleLongRunning.Operation

    /// See `ClusterControllerClient.startCluster`.
    func startCluster(withPolling: StartClusterRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Cluster>

    /// See `ClusterControllerClient.deleteCluster`.
    func deleteCluster(request: DeleteClusterRequest) async throws -> GoogleLongRunning.Operation

    /// See `ClusterControllerClient.deleteCluster`.
    func deleteCluster(withPolling: DeleteClusterRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Void>

    /// See `ClusterControllerClient.deleteCluster`.
    func deleteCluster(
      projectId: Swift.String,
      region: Swift.String,
      clusterName: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<Void>

    /// See `ClusterControllerClient.getCluster`.
    func getCluster(request: GetClusterRequest) async throws -> GoogleCloudDataprocV1.Cluster

    /// See `ClusterControllerClient.getCluster`.
    func getCluster(
      projectId: Swift.String,
      region: Swift.String,
      clusterName: Swift.String,
    ) async throws -> GoogleCloudDataprocV1.Cluster

    /// See `ClusterControllerClient.listClusters`.
    func listClusters(request: ListClustersRequest) async throws
      -> GoogleCloudDataprocV1.ListClustersResponse

    /// See `ClusterControllerClient.listClusters`.
    func listClusters(
      byItem: ListClustersRequest
    ) throws -> any AsyncSequence<Cluster, Swift.Error>

    /// See `ClusterControllerClient.listClusters`.
    func listClusters(
      projectId: Swift.String,
      region: Swift.String,
    ) throws -> any AsyncSequence<Cluster, Swift.Error>

    /// See `ClusterControllerClient.listClusters`.
    func listClusters(
      projectId: Swift.String,
      region: Swift.String,
      filter: Swift.String,
    ) throws -> any AsyncSequence<Cluster, Swift.Error>

    /// See `ClusterControllerClient.diagnoseCluster`.
    func diagnoseCluster(request: DiagnoseClusterRequest) async throws
      -> GoogleLongRunning.Operation

    /// See `ClusterControllerClient.diagnoseCluster`.
    func diagnoseCluster(withPolling: DiagnoseClusterRequest) async throws -> any GoogleCloudGax
      .PollableOperation<DiagnoseClusterResults>

    /// See `ClusterControllerClient.diagnoseCluster`.
    func diagnoseCluster(
      projectId: Swift.String,
      region: Swift.String,
      clusterName: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<DiagnoseClusterResults>

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

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

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

    /// See `ClusterControllerClient.listOperations`.
    func listOperations(request: GoogleLongRunning.ListOperationsRequest) async throws
      -> GoogleLongRunning.ListOperationsResponse

    /// See `ClusterControllerClient.listOperations`.
    func listOperations(
      byItem: GoogleLongRunning.ListOperationsRequest
    ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error>

    /// See `ClusterControllerClient.listOperations`.
    func listOperations(
      name: Swift.String,
      filter: Swift.String,
    ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error>

    /// See `ClusterControllerClient.deleteOperation`.
    func deleteOperation(request: GoogleLongRunning.DeleteOperationRequest) async throws

    /// See `ClusterControllerClient.deleteOperation`.
    func deleteOperation(
      name: Swift.String,
    ) async throws

    /// See `ClusterControllerClient.cancelOperation`.
    func cancelOperation(request: GoogleLongRunning.CancelOperationRequest) async throws

    /// See `ClusterControllerClient.cancelOperation`.
    func cancelOperation(
      name: Swift.String,
    ) async throws

    /// See `ClusterControllerClient.createCluster`.
    func createCluster(
      request: CreateClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `ClusterControllerClient.createCluster`.
    func createCluster(
      withPolling: CreateClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Cluster>

    /// See `ClusterControllerClient.updateCluster`.
    func updateCluster(
      request: UpdateClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `ClusterControllerClient.updateCluster`.
    func updateCluster(
      withPolling: UpdateClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Cluster>

    /// See `ClusterControllerClient.stopCluster`.
    func stopCluster(
      request: StopClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `ClusterControllerClient.stopCluster`.
    func stopCluster(
      withPolling: StopClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Cluster>

    /// See `ClusterControllerClient.startCluster`.
    func startCluster(
      request: StartClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `ClusterControllerClient.startCluster`.
    func startCluster(
      withPolling: StartClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Cluster>

    /// See `ClusterControllerClient.deleteCluster`.
    func deleteCluster(
      request: DeleteClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `ClusterControllerClient.deleteCluster`.
    func deleteCluster(
      withPolling: DeleteClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Void>

    /// See `ClusterControllerClient.getCluster`.
    func getCluster(
      request: GetClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDataprocV1.Cluster

    /// See `ClusterControllerClient.listClusters`.
    func listClusters(
      request: ListClustersRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDataprocV1.ListClustersResponse

    /// See `ClusterControllerClient.listClusters`.
    func listClusters(
      byItem: ListClustersRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<Cluster, Swift.Error>

    /// See `ClusterControllerClient.diagnoseCluster`.
    func diagnoseCluster(
      request: DiagnoseClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `ClusterControllerClient.diagnoseCluster`.
    func diagnoseCluster(
      withPolling: DiagnoseClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<DiagnoseClusterResults>

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

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

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

    /// See `ClusterControllerClient.listOperations`.
    func listOperations(
      request: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.ListOperationsResponse

    /// See `ClusterControllerClient.listOperations`.
    func listOperations(
      byItem: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error>

    /// See `ClusterControllerClient.deleteOperation`.
    func deleteOperation(
      request: GoogleLongRunning.DeleteOperationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws

    /// See `ClusterControllerClient.cancelOperation`.
    func cancelOperation(
      request: GoogleLongRunning.CancelOperationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws
  }
}

// Default implementations
extension Clients.ClusterControllerProtocol {
  public func createCluster(request: CreateClusterRequest) async throws
    -> GoogleLongRunning.Operation
  {
    try await self.createCluster(request: request, options: .init())
  }

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

  public func createCluster(withPolling: CreateClusterRequest) async throws -> any GoogleCloudGax
    .PollableOperation<Cluster>
  {
    try await self.createCluster(withPolling: withPolling, options: .init())
  }

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

  public func createCluster(
    projectId: Swift.String,
    region: Swift.String,
    cluster: Cluster?,
  ) async throws -> any GoogleCloudGax.PollableOperation<Cluster> {
    let request = CreateClusterRequest().with {
      $0.projectId = projectId
      $0.region = region
      $0.cluster = cluster
    }
    return try await self.createCluster(withPolling: request)
  }

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

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

  public func updateCluster(withPolling: UpdateClusterRequest) async throws -> any GoogleCloudGax
    .PollableOperation<Cluster>
  {
    try await self.updateCluster(withPolling: withPolling, options: .init())
  }

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

  public func updateCluster(
    projectId: Swift.String,
    region: Swift.String,
    clusterName: Swift.String,
    cluster: Cluster?,
    updateMask: GoogleCloudWkt.FieldMask?,
  ) async throws -> any GoogleCloudGax.PollableOperation<Cluster> {
    let request = UpdateClusterRequest().with {
      $0.projectId = projectId
      $0.region = region
      $0.clusterName = clusterName
      $0.cluster = cluster
      $0.updateMask = updateMask
    }
    return try await self.updateCluster(withPolling: request)
  }

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

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

  public func stopCluster(withPolling: StopClusterRequest) async throws -> any GoogleCloudGax
    .PollableOperation<Cluster>
  {
    try await self.stopCluster(withPolling: withPolling, options: .init())
  }

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

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

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

  public func startCluster(withPolling: StartClusterRequest) async throws -> any GoogleCloudGax
    .PollableOperation<Cluster>
  {
    try await self.startCluster(withPolling: withPolling, options: .init())
  }

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

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

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

  public func deleteCluster(withPolling: DeleteClusterRequest) async throws -> any GoogleCloudGax
    .PollableOperation<Void>
  {
    try await self.deleteCluster(withPolling: withPolling, options: .init())
  }

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

  public func deleteCluster(
    projectId: Swift.String,
    region: Swift.String,
    clusterName: Swift.String,
  ) async throws -> any GoogleCloudGax.PollableOperation<Void> {
    let request = DeleteClusterRequest().with {
      $0.projectId = projectId
      $0.region = region
      $0.clusterName = clusterName
    }
    return try await self.deleteCluster(withPolling: request)
  }

  public func getCluster(request: GetClusterRequest) async throws -> GoogleCloudDataprocV1.Cluster {
    try await self.getCluster(request: request, options: .init())
  }

  public func getCluster(
    request: GetClusterRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudDataprocV1.Cluster {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getCluster(
    projectId: Swift.String,
    region: Swift.String,
    clusterName: Swift.String,
  ) async throws -> GoogleCloudDataprocV1.Cluster {
    let request = GetClusterRequest().with {
      $0.projectId = projectId
      $0.region = region
      $0.clusterName = clusterName
    }
    return try await self.getCluster(request: request)
  }

  public func listClusters(request: ListClustersRequest) async throws
    -> GoogleCloudDataprocV1.ListClustersResponse
  {
    try await self.listClusters(request: request, options: .init())
  }

  public func listClusters(
    request: ListClustersRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudDataprocV1.ListClustersResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listClusters(
    byItem: ListClustersRequest
  ) throws -> any AsyncSequence<Cluster, Swift.Error> {
    try self.listClusters(byItem: byItem, options: .init())
  }

  public func listClusters(
    byItem: ListClustersRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Cluster, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudDataprocV1.ListClustersResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  public func listClusters(
    projectId: Swift.String,
    region: Swift.String,
  ) throws -> any AsyncSequence<Cluster, Swift.Error> {
    let request = ListClustersRequest().with {
      $0.projectId = projectId
      $0.region = region
    }
    return try self.listClusters(byItem: request)
  }

  public func listClusters(
    projectId: Swift.String,
    region: Swift.String,
    filter: Swift.String,
  ) throws -> any AsyncSequence<Cluster, Swift.Error> {
    let request = ListClustersRequest().with {
      $0.projectId = projectId
      $0.region = region
      $0.filter = filter
    }
    return try self.listClusters(byItem: request)
  }

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

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

  public func diagnoseCluster(withPolling: DiagnoseClusterRequest) async throws
    -> any GoogleCloudGax.PollableOperation<DiagnoseClusterResults>
  {
    try await self.diagnoseCluster(withPolling: withPolling, options: .init())
  }

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

  public func diagnoseCluster(
    projectId: Swift.String,
    region: Swift.String,
    clusterName: Swift.String,
  ) async throws -> any GoogleCloudGax.PollableOperation<DiagnoseClusterResults> {
    let request = DiagnoseClusterRequest().with {
      $0.projectId = projectId
      $0.region = region
      $0.clusterName = clusterName
    }
    return try await self.diagnoseCluster(withPolling: 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 listOperations(request: GoogleLongRunning.ListOperationsRequest) async throws
    -> GoogleLongRunning.ListOperationsResponse
  {
    try await self.listOperations(request: request, options: .init())
  }

  public func listOperations(
    request: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.ListOperationsResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listOperations(
    byItem: GoogleLongRunning.ListOperationsRequest
  ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error> {
    try self.listOperations(byItem: byItem, options: .init())
  }

  public func listOperations(
    byItem: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleLongRunning.ListOperationsResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  public func listOperations(
    name: Swift.String,
    filter: Swift.String,
  ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error> {
    let request = GoogleLongRunning.ListOperationsRequest().with {
      $0.name = name
      $0.filter = filter
    }
    return try self.listOperations(byItem: request)
  }

  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)
  }

  public func deleteOperation(request: GoogleLongRunning.DeleteOperationRequest) async throws {
    try await self.deleteOperation(request: request, options: .init())
  }

  public func deleteOperation(
    request: GoogleLongRunning.DeleteOperationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws {
    throw GoogleCloudGax.RequestError.unimplemented
  }

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

  public func cancelOperation(request: GoogleLongRunning.CancelOperationRequest) async throws {
    try await self.cancelOperation(request: request, options: .init())
  }

  public func cancelOperation(
    request: GoogleLongRunning.CancelOperationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws {
    throw GoogleCloudGax.RequestError.unimplemented
  }

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