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

/// API Overview:
///
/// The `beyondcorp.googleapis.com` service implements the Google Cloud
/// BeyondCorp API.
///
/// Data Model:
///
/// The ClientConnectorServicesService exposes the following resources:
///
/// * Client Connector Services, named as follows:
///   `projects/{project_id}/locations/{location_id}/client_connector_services/{client_connector_service_id}`.
///
/// @Snippet(path: "ClientConnectorServicesServiceQuickstart")
public class ClientConnectorServicesServiceClient: Clients.ClientConnectorServicesServiceProtocol {
  let inner: any Clients.ClientConnectorServicesServiceStub
  let pollingErrorPolicy: GoogleCloudGax.PollingErrorPolicy
  let pollingBackoffPolicy: GoogleCloudGax.BackoffPolicy

  /// Creates a new `ClientConnectorServicesServiceClient` instance.
  public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
    var inner: any Clients.ClientConnectorServicesServiceStub =
      try Clients.ClientConnectorServicesServiceTransport(options)
    inner = Clients.ClientConnectorServicesServiceRetry(inner, options: options)
    if let logger = options.logger {
      inner = Clients.ClientConnectorServicesServiceLogging(inner, logger: logger)
    }
    self.inner = inner
    self.pollingErrorPolicy = options.pollingErrorPolicy
    self.pollingBackoffPolicy = options.pollingBackoffPolicy
  }

  /// Lists ClientConnectorServices in a given project and location.
  ///
  /// @Snippet(path: "ClientConnectorServicesService_ListClientConnectorServices")
  public func listClientConnectorServices(
    request: ListClientConnectorServicesRequest, options: GoogleCloudGax.RequestOptions
  ) async throws
    -> GoogleCloudBeyondCorpClientConnectorServicesV1.ListClientConnectorServicesResponse
  {
    try await self.inner.listClientConnectorServices(request: request, options: options)
  }

  /// Lists ClientConnectorServices in a given project and location.
  ///
  /// @Snippet(path: "ClientConnectorServicesService_ListClientConnectorServices")
  public func listClientConnectorServices(
    byItem: ListClientConnectorServicesRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<ClientConnectorService, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws
        -> GoogleCloudBeyondCorpClientConnectorServicesV1.ListClientConnectorServicesResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listClientConnectorServices(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Gets details of a single ClientConnectorService.
  ///
  /// @Snippet(path: "ClientConnectorServicesService_GetClientConnectorService")
  public func getClientConnectorService(
    request: GetClientConnectorServiceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudBeyondCorpClientConnectorServicesV1.ClientConnectorService {
    try await self.inner.getClientConnectorService(request: request, options: options)
  }

  /// Creates a new ClientConnectorService in a given project and location.
  ///
  /// @Snippet(path: "ClientConnectorServicesService_CreateClientConnectorService")
  public func createClientConnectorService(
    request: CreateClientConnectorServiceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.createClientConnectorService(request: request, options: options)
  }

  /// Creates a new ClientConnectorService in a given project and location.
  ///
  /// @Snippet(path: "ClientConnectorServicesService_CreateClientConnectorService")
  public func createClientConnectorService(
    withPolling: CreateClientConnectorServiceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<ClientConnectorService> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<ClientConnectorService>.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 ClientConnectorService(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.createClientConnectorService(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = {
      () async throws -> GoogleCloudGax._PollableOperationImpl<ClientConnectorService>.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 the parameters of a single ClientConnectorService.
  ///
  /// @Snippet(path: "ClientConnectorServicesService_UpdateClientConnectorService")
  public func updateClientConnectorService(
    request: UpdateClientConnectorServiceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.updateClientConnectorService(request: request, options: options)
  }

  /// Updates the parameters of a single ClientConnectorService.
  ///
  /// @Snippet(path: "ClientConnectorServicesService_UpdateClientConnectorService")
  public func updateClientConnectorService(
    withPolling: UpdateClientConnectorServiceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<ClientConnectorService> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<ClientConnectorService>.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 ClientConnectorService(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.updateClientConnectorService(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = {
      () async throws -> GoogleCloudGax._PollableOperationImpl<ClientConnectorService>.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 single ClientConnectorService.
  ///
  /// @Snippet(path: "ClientConnectorServicesService_DeleteClientConnectorService")
  public func deleteClientConnectorService(
    request: DeleteClientConnectorServiceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.deleteClientConnectorService(request: request, options: options)
  }

  /// Deletes a single ClientConnectorService.
  ///
  /// @Snippet(path: "ClientConnectorServicesService_DeleteClientConnectorService")
  public func deleteClientConnectorService(
    withPolling: DeleteClientConnectorServiceRequest, 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.deleteClientConnectorService(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,
    )
  }

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

  /// Lists information about the supported locations for this service.
  ///
  /// @Snippet(path: "ClientConnectorServicesService_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: "ClientConnectorServicesService_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: "ClientConnectorServicesService_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: "ClientConnectorServicesService_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: "ClientConnectorServicesService_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: "ClientConnectorServicesService_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: "ClientConnectorServicesService_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: "ClientConnectorServicesService_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: "ClientConnectorServicesService_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: "ClientConnectorServicesService_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 `ClientConnectorServicesServiceClient`.
  ///
  /// To mock `ClientConnectorServicesServiceClient` change your functions to receive
  /// `some ClientConnectorServicesServiceProtocol` or `any ClientConnectorServicesServiceProtocol`
  /// and pass a mock implementation in your tests.
  public protocol ClientConnectorServicesServiceProtocol {
    /// See `ClientConnectorServicesServiceClient.listClientConnectorServices`.
    func listClientConnectorServices(request: ListClientConnectorServicesRequest) async throws
      -> GoogleCloudBeyondCorpClientConnectorServicesV1.ListClientConnectorServicesResponse

    /// See `ClientConnectorServicesServiceClient.listClientConnectorServices`.
    func listClientConnectorServices(
      byItem: ListClientConnectorServicesRequest
    ) throws -> any AsyncSequence<ClientConnectorService, Swift.Error>

    /// See `ClientConnectorServicesServiceClient.listClientConnectorServices`.
    func listClientConnectorServices(
      parent: Swift.String,
    ) throws -> any AsyncSequence<ClientConnectorService, Swift.Error>

    /// See `ClientConnectorServicesServiceClient.getClientConnectorService`.
    func getClientConnectorService(request: GetClientConnectorServiceRequest) async throws
      -> GoogleCloudBeyondCorpClientConnectorServicesV1.ClientConnectorService

    /// See `ClientConnectorServicesServiceClient.getClientConnectorService`.
    func getClientConnectorService(
      name: Swift.String,
    ) async throws -> GoogleCloudBeyondCorpClientConnectorServicesV1.ClientConnectorService

    /// See `ClientConnectorServicesServiceClient.createClientConnectorService`.
    func createClientConnectorService(request: CreateClientConnectorServiceRequest) async throws
      -> GoogleLongRunning.Operation

    /// See `ClientConnectorServicesServiceClient.createClientConnectorService`.
    func createClientConnectorService(withPolling: CreateClientConnectorServiceRequest) async throws
      -> any GoogleCloudGax.PollableOperation<ClientConnectorService>

    /// See `ClientConnectorServicesServiceClient.createClientConnectorService`.
    func createClientConnectorService(
      parent: Swift.String,
      clientConnectorService: ClientConnectorService?,
      clientConnectorServiceId: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<ClientConnectorService>

    /// See `ClientConnectorServicesServiceClient.updateClientConnectorService`.
    func updateClientConnectorService(request: UpdateClientConnectorServiceRequest) async throws
      -> GoogleLongRunning.Operation

    /// See `ClientConnectorServicesServiceClient.updateClientConnectorService`.
    func updateClientConnectorService(withPolling: UpdateClientConnectorServiceRequest) async throws
      -> any GoogleCloudGax.PollableOperation<ClientConnectorService>

    /// See `ClientConnectorServicesServiceClient.updateClientConnectorService`.
    func updateClientConnectorService(
      clientConnectorService: ClientConnectorService?,
      updateMask: GoogleCloudWkt.FieldMask?,
    ) async throws -> any GoogleCloudGax.PollableOperation<ClientConnectorService>

    /// See `ClientConnectorServicesServiceClient.deleteClientConnectorService`.
    func deleteClientConnectorService(request: DeleteClientConnectorServiceRequest) async throws
      -> GoogleLongRunning.Operation

    /// See `ClientConnectorServicesServiceClient.deleteClientConnectorService`.
    func deleteClientConnectorService(withPolling: DeleteClientConnectorServiceRequest) async throws
      -> any GoogleCloudGax.PollableOperation<Void>

    /// See `ClientConnectorServicesServiceClient.deleteClientConnectorService`.
    func deleteClientConnectorService(
      name: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<Void>

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

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

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

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

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

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

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

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

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

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

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

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

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

    /// See `ClientConnectorServicesServiceClient.listClientConnectorServices`.
    func listClientConnectorServices(
      request: ListClientConnectorServicesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws
      -> GoogleCloudBeyondCorpClientConnectorServicesV1.ListClientConnectorServicesResponse

    /// See `ClientConnectorServicesServiceClient.listClientConnectorServices`.
    func listClientConnectorServices(
      byItem: ListClientConnectorServicesRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<ClientConnectorService, Swift.Error>

    /// See `ClientConnectorServicesServiceClient.getClientConnectorService`.
    func getClientConnectorService(
      request: GetClientConnectorServiceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudBeyondCorpClientConnectorServicesV1.ClientConnectorService

    /// See `ClientConnectorServicesServiceClient.createClientConnectorService`.
    func createClientConnectorService(
      request: CreateClientConnectorServiceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `ClientConnectorServicesServiceClient.createClientConnectorService`.
    func createClientConnectorService(
      withPolling: CreateClientConnectorServiceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<ClientConnectorService>

    /// See `ClientConnectorServicesServiceClient.updateClientConnectorService`.
    func updateClientConnectorService(
      request: UpdateClientConnectorServiceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `ClientConnectorServicesServiceClient.updateClientConnectorService`.
    func updateClientConnectorService(
      withPolling: UpdateClientConnectorServiceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<ClientConnectorService>

    /// See `ClientConnectorServicesServiceClient.deleteClientConnectorService`.
    func deleteClientConnectorService(
      request: DeleteClientConnectorServiceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `ClientConnectorServicesServiceClient.deleteClientConnectorService`.
    func deleteClientConnectorService(
      withPolling: DeleteClientConnectorServiceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Void>

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

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

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

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

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

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

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

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

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

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

// Default implementations
extension Clients.ClientConnectorServicesServiceProtocol {
  public func listClientConnectorServices(request: ListClientConnectorServicesRequest) async throws
    -> GoogleCloudBeyondCorpClientConnectorServicesV1.ListClientConnectorServicesResponse
  {
    try await self.listClientConnectorServices(request: request, options: .init())
  }

  public func listClientConnectorServices(
    request: ListClientConnectorServicesRequest, options: GoogleCloudGax.RequestOptions
  ) async throws
    -> GoogleCloudBeyondCorpClientConnectorServicesV1.ListClientConnectorServicesResponse
  {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listClientConnectorServices(
    byItem: ListClientConnectorServicesRequest
  ) throws -> any AsyncSequence<ClientConnectorService, Swift.Error> {
    try self.listClientConnectorServices(byItem: byItem, options: .init())
  }

  public func listClientConnectorServices(
    byItem: ListClientConnectorServicesRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<ClientConnectorService, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws
        -> GoogleCloudBeyondCorpClientConnectorServicesV1.ListClientConnectorServicesResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

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

  public func getClientConnectorService(request: GetClientConnectorServiceRequest) async throws
    -> GoogleCloudBeyondCorpClientConnectorServicesV1.ClientConnectorService
  {
    try await self.getClientConnectorService(request: request, options: .init())
  }

  public func getClientConnectorService(
    request: GetClientConnectorServiceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudBeyondCorpClientConnectorServicesV1.ClientConnectorService {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getClientConnectorService(
    name: Swift.String,
  ) async throws -> GoogleCloudBeyondCorpClientConnectorServicesV1.ClientConnectorService {
    let request = GetClientConnectorServiceRequest().with {
      $0.name = name
    }
    return try await self.getClientConnectorService(request: request)
  }

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

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

  public func createClientConnectorService(withPolling: CreateClientConnectorServiceRequest)
    async throws -> any GoogleCloudGax.PollableOperation<ClientConnectorService>
  {
    try await self.createClientConnectorService(withPolling: withPolling, options: .init())
  }

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

  public func createClientConnectorService(
    parent: Swift.String,
    clientConnectorService: ClientConnectorService?,
    clientConnectorServiceId: Swift.String,
  ) async throws -> any GoogleCloudGax.PollableOperation<ClientConnectorService> {
    let request = CreateClientConnectorServiceRequest().with {
      $0.parent = parent
      $0.clientConnectorService = clientConnectorService
      $0.clientConnectorServiceId = clientConnectorServiceId
    }
    return try await self.createClientConnectorService(withPolling: request)
  }

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

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

  public func updateClientConnectorService(withPolling: UpdateClientConnectorServiceRequest)
    async throws -> any GoogleCloudGax.PollableOperation<ClientConnectorService>
  {
    try await self.updateClientConnectorService(withPolling: withPolling, options: .init())
  }

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

  public func updateClientConnectorService(
    clientConnectorService: ClientConnectorService?,
    updateMask: GoogleCloudWkt.FieldMask?,
  ) async throws -> any GoogleCloudGax.PollableOperation<ClientConnectorService> {
    let request = UpdateClientConnectorServiceRequest().with {
      $0.clientConnectorService = clientConnectorService
      $0.updateMask = updateMask
    }
    return try await self.updateClientConnectorService(withPolling: request)
  }

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

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

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

  public func deleteClientConnectorService(
    withPolling: DeleteClientConnectorServiceRequest, 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 deleteClientConnectorService(
    name: Swift.String,
  ) async throws -> any GoogleCloudGax.PollableOperation<Void> {
    let request = DeleteClientConnectorServiceRequest().with {
      $0.name = name
    }
    return try await self.deleteClientConnectorService(withPolling: 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 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)
  }
}
