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

/// Service describing handlers for resources
///
/// @Snippet(path: "MemorystoreQuickstart")
public class MemorystoreClient: Clients.MemorystoreProtocol {
  let inner: any Clients.MemorystoreStub
  let pollingErrorPolicy: GoogleCloudGax.PollingErrorPolicy
  let pollingBackoffPolicy: GoogleCloudGax.BackoffPolicy

  /// Creates a new `MemorystoreClient` instance.
  public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
    var inner: any Clients.MemorystoreStub = try Clients.MemorystoreTransport(options)
    inner = Clients.MemorystoreRetry(inner, options: options)
    if let logger = options.logger {
      inner = Clients.MemorystoreLogging(inner, logger: logger)
    }
    self.inner = inner
    self.pollingErrorPolicy = options.pollingErrorPolicy
    self.pollingBackoffPolicy = options.pollingBackoffPolicy
  }

  /// Lists Instances in a given project and location.
  ///
  /// @Snippet(path: "Memorystore_ListInstances")
  public func listInstances(
    request: ListInstancesRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.ListInstancesResponse {
    try await self.inner.listInstances(request: request, options: options)
  }

  /// Lists Instances in a given project and location.
  ///
  /// @Snippet(path: "Memorystore_ListInstances")
  public func listInstances(
    byItem: ListInstancesRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Instance, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudMemoryStoreV1.ListInstancesResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listInstances(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Gets details of a single Instance.
  ///
  /// @Snippet(path: "Memorystore_GetInstance")
  public func getInstance(
    request: GetInstanceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.Instance {
    try await self.inner.getInstance(request: request, options: options)
  }

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

  /// Creates a new Instance in a given project and location.
  ///
  /// @Snippet(path: "Memorystore_CreateInstance")
  public func createInstance(
    withPolling: CreateInstanceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Instance> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Instance>.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 Instance(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.createInstance(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Instance>.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 Instance.
  ///
  /// @Snippet(path: "Memorystore_UpdateInstance")
  public func updateInstance(
    request: UpdateInstanceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.updateInstance(request: request, options: options)
  }

  /// Updates the parameters of a single Instance.
  ///
  /// @Snippet(path: "Memorystore_UpdateInstance")
  public func updateInstance(
    withPolling: UpdateInstanceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Instance> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Instance>.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 Instance(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.updateInstance(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Instance>.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 Instance.
  ///
  /// @Snippet(path: "Memorystore_DeleteInstance")
  public func deleteInstance(
    request: DeleteInstanceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.deleteInstance(request: request, options: options)
  }

  /// Deletes a single Instance.
  ///
  /// @Snippet(path: "Memorystore_DeleteInstance")
  public func deleteInstance(
    withPolling: DeleteInstanceRequest, 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.deleteInstance(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 details about the certificate authority for an Instance.
  ///
  /// @Snippet(path: "Memorystore_GetCertificateAuthority")
  public func getCertificateAuthority(
    request: GetCertificateAuthorityRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.CertificateAuthority {
    try await self.inner.getCertificateAuthority(request: request, options: options)
  }

  /// Gets the details of shared regional certificate authority information for
  /// Memorystore instance.
  ///
  /// @Snippet(path: "Memorystore_GetSharedRegionalCertificateAuthority")
  public func getSharedRegionalCertificateAuthority(
    request: GetSharedRegionalCertificateAuthorityRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.SharedRegionalCertificateAuthority {
    try await self.inner.getSharedRegionalCertificateAuthority(request: request, options: options)
  }

  /// Reschedules upcoming maintenance event.
  ///
  /// @Snippet(path: "Memorystore_RescheduleMaintenance")
  public func rescheduleMaintenance(
    request: RescheduleMaintenanceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.rescheduleMaintenance(request: request, options: options)
  }

  /// Reschedules upcoming maintenance event.
  ///
  /// @Snippet(path: "Memorystore_RescheduleMaintenance")
  public func rescheduleMaintenance(
    withPolling: RescheduleMaintenanceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Instance> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Instance>.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 Instance(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.rescheduleMaintenance(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Instance>.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 all backup collections owned by a consumer project in either the
  /// specified location (region) or all locations.
  ///
  /// If `location_id` is specified as `-` (wildcard), then all regions
  /// available to the project are queried, and the results are aggregated.
  ///
  /// @Snippet(path: "Memorystore_ListBackupCollections")
  public func listBackupCollections(
    request: ListBackupCollectionsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.ListBackupCollectionsResponse {
    try await self.inner.listBackupCollections(request: request, options: options)
  }

  /// Lists all backup collections owned by a consumer project in either the
  /// specified location (region) or all locations.
  ///
  /// If `location_id` is specified as `-` (wildcard), then all regions
  /// available to the project are queried, and the results are aggregated.
  ///
  /// @Snippet(path: "Memorystore_ListBackupCollections")
  public func listBackupCollections(
    byItem: ListBackupCollectionsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<BackupCollection, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudMemoryStoreV1.ListBackupCollectionsResponse
      in
      var request = byItem
      request.pageToken = token
      return try await self.listBackupCollections(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Get a backup collection.
  ///
  /// @Snippet(path: "Memorystore_GetBackupCollection")
  public func getBackupCollection(
    request: GetBackupCollectionRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.BackupCollection {
    try await self.inner.getBackupCollection(request: request, options: options)
  }

  /// Lists all backups owned by a backup collection.
  ///
  /// @Snippet(path: "Memorystore_ListBackups")
  public func listBackups(
    request: ListBackupsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.ListBackupsResponse {
    try await self.inner.listBackups(request: request, options: options)
  }

  /// Lists all backups owned by a backup collection.
  ///
  /// @Snippet(path: "Memorystore_ListBackups")
  public func listBackups(
    byItem: ListBackupsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Backup, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudMemoryStoreV1.ListBackupsResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listBackups(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Gets the details of a specific backup.
  ///
  /// @Snippet(path: "Memorystore_GetBackup")
  public func getBackup(
    request: GetBackupRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.Backup {
    try await self.inner.getBackup(request: request, options: options)
  }

  /// Deletes a specific backup.
  ///
  /// @Snippet(path: "Memorystore_DeleteBackup")
  public func deleteBackup(
    request: DeleteBackupRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.deleteBackup(request: request, options: options)
  }

  /// Deletes a specific backup.
  ///
  /// @Snippet(path: "Memorystore_DeleteBackup")
  public func deleteBackup(
    withPolling: DeleteBackupRequest, 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.deleteBackup(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,
    )
  }

  /// Exports a specific backup to a customer target Cloud Storage URI.
  ///
  /// @Snippet(path: "Memorystore_ExportBackup")
  public func exportBackup(
    request: ExportBackupRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.exportBackup(request: request, options: options)
  }

  /// Exports a specific backup to a customer target Cloud Storage URI.
  ///
  /// @Snippet(path: "Memorystore_ExportBackup")
  public func exportBackup(
    withPolling: ExportBackupRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Backup> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Backup>.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 Backup(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.exportBackup(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Backup>.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,
    )
  }

  /// Backup Instance.
  /// If this is the first time a backup is being created, a backup collection
  /// will be created at the backend, and this backup belongs to this collection.
  /// Both collection and backup will have a resource name. Backup will be
  /// executed for each shard. A replica (primary if nonHA) will be selected to
  /// perform the execution. Backup call will be rejected if there is an ongoing
  /// backup or update operation. Be aware that during preview, if the instance's
  /// internal software version is too old, critical update will be performed
  /// before actual backup. Once the internal software version is updated to the
  /// minimum version required by the backup feature, subsequent backups will not
  /// require critical update. After preview, there will be no critical update
  /// needed for backup.
  ///
  /// @Snippet(path: "Memorystore_BackupInstance")
  public func backupInstance(
    request: BackupInstanceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.backupInstance(request: request, options: options)
  }

  /// Backup Instance.
  /// If this is the first time a backup is being created, a backup collection
  /// will be created at the backend, and this backup belongs to this collection.
  /// Both collection and backup will have a resource name. Backup will be
  /// executed for each shard. A replica (primary if nonHA) will be selected to
  /// perform the execution. Backup call will be rejected if there is an ongoing
  /// backup or update operation. Be aware that during preview, if the instance's
  /// internal software version is too old, critical update will be performed
  /// before actual backup. Once the internal software version is updated to the
  /// minimum version required by the backup feature, subsequent backups will not
  /// require critical update. After preview, there will be no critical update
  /// needed for backup.
  ///
  /// @Snippet(path: "Memorystore_BackupInstance")
  public func backupInstance(
    withPolling: BackupInstanceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Instance> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Instance>.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 Instance(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.backupInstance(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Instance>.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,
    )
  }

  /// Initiates the migration of a source instance to the target Memorystore
  /// instance.
  ///
  /// After the successful completion of this operation, the target instance
  /// will:
  /// 1. Set up replication with the source instance and replicate any writes to
  /// the source instance.
  /// 2. Only allow reads.
  ///
  /// @Snippet(path: "Memorystore_StartMigration")
  public func startMigration(
    request: StartMigrationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.startMigration(request: request, options: options)
  }

  /// Initiates the migration of a source instance to the target Memorystore
  /// instance.
  ///
  /// After the successful completion of this operation, the target instance
  /// will:
  /// 1. Set up replication with the source instance and replicate any writes to
  /// the source instance.
  /// 2. Only allow reads.
  ///
  /// @Snippet(path: "Memorystore_StartMigration")
  public func startMigration(
    withPolling: StartMigrationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Instance> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Instance>.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 Instance(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.startMigration(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Instance>.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,
    )
  }

  /// Finalizes the migration process.
  ///
  /// After the successful completion of this operation, the target instance
  /// will:
  /// 1. Stop replicating from the source instance.
  /// 2. Allow both reads and writes.
  ///
  /// @Snippet(path: "Memorystore_FinishMigration")
  public func finishMigration(
    request: FinishMigrationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.finishMigration(request: request, options: options)
  }

  /// Finalizes the migration process.
  ///
  /// After the successful completion of this operation, the target instance
  /// will:
  /// 1. Stop replicating from the source instance.
  /// 2. Allow both reads and writes.
  ///
  /// @Snippet(path: "Memorystore_FinishMigration")
  public func finishMigration(
    withPolling: FinishMigrationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Instance> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Instance>.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 Instance(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.finishMigration(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Instance>.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 all the token auth users for a token based auth enabled instance.
  ///
  /// @Snippet(path: "Memorystore_ListTokenAuthUsers")
  public func listTokenAuthUsers(
    request: ListTokenAuthUsersRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.ListTokenAuthUsersResponse {
    try await self.inner.listTokenAuthUsers(request: request, options: options)
  }

  /// Lists all the token auth users for a token based auth enabled instance.
  ///
  /// @Snippet(path: "Memorystore_ListTokenAuthUsers")
  public func listTokenAuthUsers(
    byItem: ListTokenAuthUsersRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<TokenAuthUser, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudMemoryStoreV1.ListTokenAuthUsersResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listTokenAuthUsers(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Gets a specific token auth user for a token based auth enabled instance.
  ///
  /// @Snippet(path: "Memorystore_GetTokenAuthUser")
  public func getTokenAuthUser(
    request: GetTokenAuthUserRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.TokenAuthUser {
    try await self.inner.getTokenAuthUser(request: request, options: options)
  }

  /// Lists all the auth tokens for a specific token auth user.
  ///
  /// @Snippet(path: "Memorystore_ListAuthTokens")
  public func listAuthTokens(
    request: ListAuthTokensRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.ListAuthTokensResponse {
    try await self.inner.listAuthTokens(request: request, options: options)
  }

  /// Lists all the auth tokens for a specific token auth user.
  ///
  /// @Snippet(path: "Memorystore_ListAuthTokens")
  public func listAuthTokens(
    byItem: ListAuthTokensRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<AuthToken, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudMemoryStoreV1.ListAuthTokensResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listAuthTokens(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Gets a token based auth enabled instance's auth token for a given user.
  ///
  /// @Snippet(path: "Memorystore_GetAuthToken")
  public func getAuthToken(
    request: GetAuthTokenRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.AuthToken {
    try await self.inner.getAuthToken(request: request, options: options)
  }

  /// Adds a token auth user for a token based auth enabled instance.
  ///
  /// @Snippet(path: "Memorystore_AddTokenAuthUser")
  public func addTokenAuthUser(
    request: AddTokenAuthUserRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.addTokenAuthUser(request: request, options: options)
  }

  /// Adds a token auth user for a token based auth enabled instance.
  ///
  /// @Snippet(path: "Memorystore_AddTokenAuthUser")
  public func addTokenAuthUser(
    withPolling: AddTokenAuthUserRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Instance> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Instance>.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 Instance(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.addTokenAuthUser(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Instance>.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 token auth user for a token based auth enabled instance.
  ///
  /// @Snippet(path: "Memorystore_DeleteTokenAuthUser")
  public func deleteTokenAuthUser(
    request: DeleteTokenAuthUserRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.deleteTokenAuthUser(request: request, options: options)
  }

  /// Deletes a token auth user for a token based auth enabled instance.
  ///
  /// @Snippet(path: "Memorystore_DeleteTokenAuthUser")
  public func deleteTokenAuthUser(
    withPolling: DeleteTokenAuthUserRequest, 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.deleteTokenAuthUser(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,
    )
  }

  /// Adds a token for a user of a token based auth enabled instance.
  ///
  /// @Snippet(path: "Memorystore_AddAuthToken")
  public func addAuthToken(
    request: AddAuthTokenRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.addAuthToken(request: request, options: options)
  }

  /// Adds a token for a user of a token based auth enabled instance.
  ///
  /// @Snippet(path: "Memorystore_AddAuthToken")
  public func addAuthToken(
    withPolling: AddAuthTokenRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<TokenAuthUser> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<TokenAuthUser>.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 TokenAuthUser(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.addAuthToken(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<TokenAuthUser>.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 token for a user of a token based auth enabled instance.
  ///
  /// @Snippet(path: "Memorystore_DeleteAuthToken")
  public func deleteAuthToken(
    request: DeleteAuthTokenRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.deleteAuthToken(request: request, options: options)
  }

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

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

    /// See `MemorystoreClient.listInstances`.
    func listInstances(
      byItem: ListInstancesRequest
    ) throws -> any AsyncSequence<Instance, Swift.Error>

    /// See `MemorystoreClient.listInstances`.
    func listInstances(
      parent: Swift.String,
    ) throws -> any AsyncSequence<Instance, Swift.Error>

    /// See `MemorystoreClient.getInstance`.
    func getInstance(request: GetInstanceRequest) async throws -> GoogleCloudMemoryStoreV1.Instance

    /// See `MemorystoreClient.getInstance`.
    func getInstance(
      name: Swift.String,
    ) async throws -> GoogleCloudMemoryStoreV1.Instance

    /// See `MemorystoreClient.createInstance`.
    func createInstance(request: CreateInstanceRequest) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.createInstance`.
    func createInstance(withPolling: CreateInstanceRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Instance>

    /// See `MemorystoreClient.createInstance`.
    func createInstance(
      parent: Swift.String,
      instance: Instance?,
      instanceId: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<Instance>

    /// See `MemorystoreClient.updateInstance`.
    func updateInstance(request: UpdateInstanceRequest) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.updateInstance`.
    func updateInstance(withPolling: UpdateInstanceRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Instance>

    /// See `MemorystoreClient.updateInstance`.
    func updateInstance(
      instance: Instance?,
      updateMask: GoogleCloudWkt.FieldMask?,
    ) async throws -> any GoogleCloudGax.PollableOperation<Instance>

    /// See `MemorystoreClient.deleteInstance`.
    func deleteInstance(request: DeleteInstanceRequest) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.deleteInstance`.
    func deleteInstance(withPolling: DeleteInstanceRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Void>

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

    /// See `MemorystoreClient.getCertificateAuthority`.
    func getCertificateAuthority(request: GetCertificateAuthorityRequest) async throws
      -> GoogleCloudMemoryStoreV1.CertificateAuthority

    /// See `MemorystoreClient.getCertificateAuthority`.
    func getCertificateAuthority(
      name: Swift.String,
    ) async throws -> GoogleCloudMemoryStoreV1.CertificateAuthority

    /// See `MemorystoreClient.getSharedRegionalCertificateAuthority`.
    func getSharedRegionalCertificateAuthority(
      request: GetSharedRegionalCertificateAuthorityRequest
    ) async throws -> GoogleCloudMemoryStoreV1.SharedRegionalCertificateAuthority

    /// See `MemorystoreClient.getSharedRegionalCertificateAuthority`.
    func getSharedRegionalCertificateAuthority(
      name: Swift.String,
    ) async throws -> GoogleCloudMemoryStoreV1.SharedRegionalCertificateAuthority

    /// See `MemorystoreClient.rescheduleMaintenance`.
    func rescheduleMaintenance(request: RescheduleMaintenanceRequest) async throws
      -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.rescheduleMaintenance`.
    func rescheduleMaintenance(withPolling: RescheduleMaintenanceRequest) async throws
      -> any GoogleCloudGax.PollableOperation<Instance>

    /// See `MemorystoreClient.rescheduleMaintenance`.
    func rescheduleMaintenance(
      name: Swift.String,
      rescheduleType: RescheduleMaintenanceRequest.RescheduleType,
      scheduleTime: GoogleCloudWkt.Timestamp?,
    ) async throws -> any GoogleCloudGax.PollableOperation<Instance>

    /// See `MemorystoreClient.listBackupCollections`.
    func listBackupCollections(request: ListBackupCollectionsRequest) async throws
      -> GoogleCloudMemoryStoreV1.ListBackupCollectionsResponse

    /// See `MemorystoreClient.listBackupCollections`.
    func listBackupCollections(
      byItem: ListBackupCollectionsRequest
    ) throws -> any AsyncSequence<BackupCollection, Swift.Error>

    /// See `MemorystoreClient.listBackupCollections`.
    func listBackupCollections(
      parent: Swift.String,
    ) throws -> any AsyncSequence<BackupCollection, Swift.Error>

    /// See `MemorystoreClient.getBackupCollection`.
    func getBackupCollection(request: GetBackupCollectionRequest) async throws
      -> GoogleCloudMemoryStoreV1.BackupCollection

    /// See `MemorystoreClient.getBackupCollection`.
    func getBackupCollection(
      name: Swift.String,
    ) async throws -> GoogleCloudMemoryStoreV1.BackupCollection

    /// See `MemorystoreClient.listBackups`.
    func listBackups(request: ListBackupsRequest) async throws
      -> GoogleCloudMemoryStoreV1.ListBackupsResponse

    /// See `MemorystoreClient.listBackups`.
    func listBackups(
      byItem: ListBackupsRequest
    ) throws -> any AsyncSequence<Backup, Swift.Error>

    /// See `MemorystoreClient.listBackups`.
    func listBackups(
      parent: Swift.String,
    ) throws -> any AsyncSequence<Backup, Swift.Error>

    /// See `MemorystoreClient.getBackup`.
    func getBackup(request: GetBackupRequest) async throws -> GoogleCloudMemoryStoreV1.Backup

    /// See `MemorystoreClient.getBackup`.
    func getBackup(
      name: Swift.String,
    ) async throws -> GoogleCloudMemoryStoreV1.Backup

    /// See `MemorystoreClient.deleteBackup`.
    func deleteBackup(request: DeleteBackupRequest) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.deleteBackup`.
    func deleteBackup(withPolling: DeleteBackupRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Void>

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

    /// See `MemorystoreClient.exportBackup`.
    func exportBackup(request: ExportBackupRequest) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.exportBackup`.
    func exportBackup(withPolling: ExportBackupRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Backup>

    /// See `MemorystoreClient.backupInstance`.
    func backupInstance(request: BackupInstanceRequest) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.backupInstance`.
    func backupInstance(withPolling: BackupInstanceRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Instance>

    /// See `MemorystoreClient.backupInstance`.
    func backupInstance(
      name: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<Instance>

    /// See `MemorystoreClient.startMigration`.
    func startMigration(request: StartMigrationRequest) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.startMigration`.
    func startMigration(withPolling: StartMigrationRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Instance>

    /// See `MemorystoreClient.finishMigration`.
    func finishMigration(request: FinishMigrationRequest) async throws
      -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.finishMigration`.
    func finishMigration(withPolling: FinishMigrationRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Instance>

    /// See `MemorystoreClient.finishMigration`.
    func finishMigration(
      name: Swift.String,
      force: Swift.Bool,
    ) async throws -> any GoogleCloudGax.PollableOperation<Instance>

    /// See `MemorystoreClient.listTokenAuthUsers`.
    func listTokenAuthUsers(request: ListTokenAuthUsersRequest) async throws
      -> GoogleCloudMemoryStoreV1.ListTokenAuthUsersResponse

    /// See `MemorystoreClient.listTokenAuthUsers`.
    func listTokenAuthUsers(
      byItem: ListTokenAuthUsersRequest
    ) throws -> any AsyncSequence<TokenAuthUser, Swift.Error>

    /// See `MemorystoreClient.listTokenAuthUsers`.
    func listTokenAuthUsers(
      parent: Swift.String,
    ) throws -> any AsyncSequence<TokenAuthUser, Swift.Error>

    /// See `MemorystoreClient.getTokenAuthUser`.
    func getTokenAuthUser(request: GetTokenAuthUserRequest) async throws
      -> GoogleCloudMemoryStoreV1.TokenAuthUser

    /// See `MemorystoreClient.getTokenAuthUser`.
    func getTokenAuthUser(
      name: Swift.String,
    ) async throws -> GoogleCloudMemoryStoreV1.TokenAuthUser

    /// See `MemorystoreClient.listAuthTokens`.
    func listAuthTokens(request: ListAuthTokensRequest) async throws
      -> GoogleCloudMemoryStoreV1.ListAuthTokensResponse

    /// See `MemorystoreClient.listAuthTokens`.
    func listAuthTokens(
      byItem: ListAuthTokensRequest
    ) throws -> any AsyncSequence<AuthToken, Swift.Error>

    /// See `MemorystoreClient.listAuthTokens`.
    func listAuthTokens(
      parent: Swift.String,
    ) throws -> any AsyncSequence<AuthToken, Swift.Error>

    /// See `MemorystoreClient.getAuthToken`.
    func getAuthToken(request: GetAuthTokenRequest) async throws
      -> GoogleCloudMemoryStoreV1.AuthToken

    /// See `MemorystoreClient.getAuthToken`.
    func getAuthToken(
      name: Swift.String,
    ) async throws -> GoogleCloudMemoryStoreV1.AuthToken

    /// See `MemorystoreClient.addTokenAuthUser`.
    func addTokenAuthUser(request: AddTokenAuthUserRequest) async throws
      -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.addTokenAuthUser`.
    func addTokenAuthUser(withPolling: AddTokenAuthUserRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Instance>

    /// See `MemorystoreClient.addTokenAuthUser`.
    func addTokenAuthUser(
      instance: Swift.String,
      tokenAuthUser: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<Instance>

    /// See `MemorystoreClient.deleteTokenAuthUser`.
    func deleteTokenAuthUser(request: DeleteTokenAuthUserRequest) async throws
      -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.deleteTokenAuthUser`.
    func deleteTokenAuthUser(withPolling: DeleteTokenAuthUserRequest) async throws
      -> any GoogleCloudGax.PollableOperation<Void>

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

    /// See `MemorystoreClient.addAuthToken`.
    func addAuthToken(request: AddAuthTokenRequest) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.addAuthToken`.
    func addAuthToken(withPolling: AddAuthTokenRequest) async throws -> any GoogleCloudGax
      .PollableOperation<TokenAuthUser>

    /// See `MemorystoreClient.addAuthToken`.
    func addAuthToken(
      tokenAuthUser: Swift.String,
      authToken: AuthToken?,
    ) async throws -> any GoogleCloudGax.PollableOperation<TokenAuthUser>

    /// See `MemorystoreClient.deleteAuthToken`.
    func deleteAuthToken(request: DeleteAuthTokenRequest) async throws
      -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.deleteAuthToken`.
    func deleteAuthToken(withPolling: DeleteAuthTokenRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Void>

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

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

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

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

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

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

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

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

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

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

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

    /// See `MemorystoreClient.listInstances`.
    func listInstances(
      request: ListInstancesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudMemoryStoreV1.ListInstancesResponse

    /// See `MemorystoreClient.listInstances`.
    func listInstances(
      byItem: ListInstancesRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<Instance, Swift.Error>

    /// See `MemorystoreClient.getInstance`.
    func getInstance(
      request: GetInstanceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudMemoryStoreV1.Instance

    /// See `MemorystoreClient.createInstance`.
    func createInstance(
      request: CreateInstanceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.createInstance`.
    func createInstance(
      withPolling: CreateInstanceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Instance>

    /// See `MemorystoreClient.updateInstance`.
    func updateInstance(
      request: UpdateInstanceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.updateInstance`.
    func updateInstance(
      withPolling: UpdateInstanceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Instance>

    /// See `MemorystoreClient.deleteInstance`.
    func deleteInstance(
      request: DeleteInstanceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.deleteInstance`.
    func deleteInstance(
      withPolling: DeleteInstanceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Void>

    /// See `MemorystoreClient.getCertificateAuthority`.
    func getCertificateAuthority(
      request: GetCertificateAuthorityRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudMemoryStoreV1.CertificateAuthority

    /// See `MemorystoreClient.getSharedRegionalCertificateAuthority`.
    func getSharedRegionalCertificateAuthority(
      request: GetSharedRegionalCertificateAuthorityRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudMemoryStoreV1.SharedRegionalCertificateAuthority

    /// See `MemorystoreClient.rescheduleMaintenance`.
    func rescheduleMaintenance(
      request: RescheduleMaintenanceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.rescheduleMaintenance`.
    func rescheduleMaintenance(
      withPolling: RescheduleMaintenanceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Instance>

    /// See `MemorystoreClient.listBackupCollections`.
    func listBackupCollections(
      request: ListBackupCollectionsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudMemoryStoreV1.ListBackupCollectionsResponse

    /// See `MemorystoreClient.listBackupCollections`.
    func listBackupCollections(
      byItem: ListBackupCollectionsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<BackupCollection, Swift.Error>

    /// See `MemorystoreClient.getBackupCollection`.
    func getBackupCollection(
      request: GetBackupCollectionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudMemoryStoreV1.BackupCollection

    /// See `MemorystoreClient.listBackups`.
    func listBackups(
      request: ListBackupsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudMemoryStoreV1.ListBackupsResponse

    /// See `MemorystoreClient.listBackups`.
    func listBackups(
      byItem: ListBackupsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<Backup, Swift.Error>

    /// See `MemorystoreClient.getBackup`.
    func getBackup(
      request: GetBackupRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudMemoryStoreV1.Backup

    /// See `MemorystoreClient.deleteBackup`.
    func deleteBackup(
      request: DeleteBackupRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.deleteBackup`.
    func deleteBackup(
      withPolling: DeleteBackupRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Void>

    /// See `MemorystoreClient.exportBackup`.
    func exportBackup(
      request: ExportBackupRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.exportBackup`.
    func exportBackup(
      withPolling: ExportBackupRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Backup>

    /// See `MemorystoreClient.backupInstance`.
    func backupInstance(
      request: BackupInstanceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.backupInstance`.
    func backupInstance(
      withPolling: BackupInstanceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Instance>

    /// See `MemorystoreClient.startMigration`.
    func startMigration(
      request: StartMigrationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.startMigration`.
    func startMigration(
      withPolling: StartMigrationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Instance>

    /// See `MemorystoreClient.finishMigration`.
    func finishMigration(
      request: FinishMigrationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.finishMigration`.
    func finishMigration(
      withPolling: FinishMigrationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Instance>

    /// See `MemorystoreClient.listTokenAuthUsers`.
    func listTokenAuthUsers(
      request: ListTokenAuthUsersRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudMemoryStoreV1.ListTokenAuthUsersResponse

    /// See `MemorystoreClient.listTokenAuthUsers`.
    func listTokenAuthUsers(
      byItem: ListTokenAuthUsersRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<TokenAuthUser, Swift.Error>

    /// See `MemorystoreClient.getTokenAuthUser`.
    func getTokenAuthUser(
      request: GetTokenAuthUserRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudMemoryStoreV1.TokenAuthUser

    /// See `MemorystoreClient.listAuthTokens`.
    func listAuthTokens(
      request: ListAuthTokensRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudMemoryStoreV1.ListAuthTokensResponse

    /// See `MemorystoreClient.listAuthTokens`.
    func listAuthTokens(
      byItem: ListAuthTokensRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<AuthToken, Swift.Error>

    /// See `MemorystoreClient.getAuthToken`.
    func getAuthToken(
      request: GetAuthTokenRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudMemoryStoreV1.AuthToken

    /// See `MemorystoreClient.addTokenAuthUser`.
    func addTokenAuthUser(
      request: AddTokenAuthUserRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.addTokenAuthUser`.
    func addTokenAuthUser(
      withPolling: AddTokenAuthUserRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Instance>

    /// See `MemorystoreClient.deleteTokenAuthUser`.
    func deleteTokenAuthUser(
      request: DeleteTokenAuthUserRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.deleteTokenAuthUser`.
    func deleteTokenAuthUser(
      withPolling: DeleteTokenAuthUserRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Void>

    /// See `MemorystoreClient.addAuthToken`.
    func addAuthToken(
      request: AddAuthTokenRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.addAuthToken`.
    func addAuthToken(
      withPolling: AddAuthTokenRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<TokenAuthUser>

    /// See `MemorystoreClient.deleteAuthToken`.
    func deleteAuthToken(
      request: DeleteAuthTokenRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `MemorystoreClient.deleteAuthToken`.
    func deleteAuthToken(
      withPolling: DeleteAuthTokenRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Void>

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

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

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

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

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

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

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

// Default implementations
extension Clients.MemorystoreProtocol {
  public func listInstances(request: ListInstancesRequest) async throws
    -> GoogleCloudMemoryStoreV1.ListInstancesResponse
  {
    try await self.listInstances(request: request, options: .init())
  }

  public func listInstances(
    request: ListInstancesRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.ListInstancesResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listInstances(
    byItem: ListInstancesRequest
  ) throws -> any AsyncSequence<Instance, Swift.Error> {
    try self.listInstances(byItem: byItem, options: .init())
  }

  public func listInstances(
    byItem: ListInstancesRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Instance, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudMemoryStoreV1.ListInstancesResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

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

  public func getInstance(request: GetInstanceRequest) async throws
    -> GoogleCloudMemoryStoreV1.Instance
  {
    try await self.getInstance(request: request, options: .init())
  }

  public func getInstance(
    request: GetInstanceRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.Instance {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getInstance(
    name: Swift.String,
  ) async throws -> GoogleCloudMemoryStoreV1.Instance {
    let request = GetInstanceRequest().with {
      $0.name = name
    }
    return try await self.getInstance(request: request)
  }

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

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

  public func createInstance(withPolling: CreateInstanceRequest) async throws -> any GoogleCloudGax
    .PollableOperation<Instance>
  {
    try await self.createInstance(withPolling: withPolling, options: .init())
  }

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

  public func createInstance(
    parent: Swift.String,
    instance: Instance?,
    instanceId: Swift.String,
  ) async throws -> any GoogleCloudGax.PollableOperation<Instance> {
    let request = CreateInstanceRequest().with {
      $0.parent = parent
      $0.instance = instance
      $0.instanceId = instanceId
    }
    return try await self.createInstance(withPolling: request)
  }

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

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

  public func updateInstance(withPolling: UpdateInstanceRequest) async throws -> any GoogleCloudGax
    .PollableOperation<Instance>
  {
    try await self.updateInstance(withPolling: withPolling, options: .init())
  }

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

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

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

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

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

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

  public func getCertificateAuthority(request: GetCertificateAuthorityRequest) async throws
    -> GoogleCloudMemoryStoreV1.CertificateAuthority
  {
    try await self.getCertificateAuthority(request: request, options: .init())
  }

  public func getCertificateAuthority(
    request: GetCertificateAuthorityRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.CertificateAuthority {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getCertificateAuthority(
    name: Swift.String,
  ) async throws -> GoogleCloudMemoryStoreV1.CertificateAuthority {
    let request = GetCertificateAuthorityRequest().with {
      $0.name = name
    }
    return try await self.getCertificateAuthority(request: request)
  }

  public func getSharedRegionalCertificateAuthority(
    request: GetSharedRegionalCertificateAuthorityRequest
  ) async throws -> GoogleCloudMemoryStoreV1.SharedRegionalCertificateAuthority {
    try await self.getSharedRegionalCertificateAuthority(request: request, options: .init())
  }

  public func getSharedRegionalCertificateAuthority(
    request: GetSharedRegionalCertificateAuthorityRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.SharedRegionalCertificateAuthority {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getSharedRegionalCertificateAuthority(
    name: Swift.String,
  ) async throws -> GoogleCloudMemoryStoreV1.SharedRegionalCertificateAuthority {
    let request = GetSharedRegionalCertificateAuthorityRequest().with {
      $0.name = name
    }
    return try await self.getSharedRegionalCertificateAuthority(request: request)
  }

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

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

  public func rescheduleMaintenance(withPolling: RescheduleMaintenanceRequest) async throws
    -> any GoogleCloudGax.PollableOperation<Instance>
  {
    try await self.rescheduleMaintenance(withPolling: withPolling, options: .init())
  }

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

  public func rescheduleMaintenance(
    name: Swift.String,
    rescheduleType: RescheduleMaintenanceRequest.RescheduleType,
    scheduleTime: GoogleCloudWkt.Timestamp?,
  ) async throws -> any GoogleCloudGax.PollableOperation<Instance> {
    let request = RescheduleMaintenanceRequest().with {
      $0.name = name
      $0.rescheduleType = rescheduleType
      $0.scheduleTime = scheduleTime
    }
    return try await self.rescheduleMaintenance(withPolling: request)
  }

  public func listBackupCollections(request: ListBackupCollectionsRequest) async throws
    -> GoogleCloudMemoryStoreV1.ListBackupCollectionsResponse
  {
    try await self.listBackupCollections(request: request, options: .init())
  }

  public func listBackupCollections(
    request: ListBackupCollectionsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.ListBackupCollectionsResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listBackupCollections(
    byItem: ListBackupCollectionsRequest
  ) throws -> any AsyncSequence<BackupCollection, Swift.Error> {
    try self.listBackupCollections(byItem: byItem, options: .init())
  }

  public func listBackupCollections(
    byItem: ListBackupCollectionsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<BackupCollection, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudMemoryStoreV1.ListBackupCollectionsResponse
      in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

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

  public func getBackupCollection(request: GetBackupCollectionRequest) async throws
    -> GoogleCloudMemoryStoreV1.BackupCollection
  {
    try await self.getBackupCollection(request: request, options: .init())
  }

  public func getBackupCollection(
    request: GetBackupCollectionRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.BackupCollection {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getBackupCollection(
    name: Swift.String,
  ) async throws -> GoogleCloudMemoryStoreV1.BackupCollection {
    let request = GetBackupCollectionRequest().with {
      $0.name = name
    }
    return try await self.getBackupCollection(request: request)
  }

  public func listBackups(request: ListBackupsRequest) async throws
    -> GoogleCloudMemoryStoreV1.ListBackupsResponse
  {
    try await self.listBackups(request: request, options: .init())
  }

  public func listBackups(
    request: ListBackupsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.ListBackupsResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listBackups(
    byItem: ListBackupsRequest
  ) throws -> any AsyncSequence<Backup, Swift.Error> {
    try self.listBackups(byItem: byItem, options: .init())
  }

  public func listBackups(
    byItem: ListBackupsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Backup, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudMemoryStoreV1.ListBackupsResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

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

  public func getBackup(request: GetBackupRequest) async throws -> GoogleCloudMemoryStoreV1.Backup {
    try await self.getBackup(request: request, options: .init())
  }

  public func getBackup(
    request: GetBackupRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.Backup {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getBackup(
    name: Swift.String,
  ) async throws -> GoogleCloudMemoryStoreV1.Backup {
    let request = GetBackupRequest().with {
      $0.name = name
    }
    return try await self.getBackup(request: request)
  }

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

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

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

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

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

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

  public func exportBackup(withPolling: ExportBackupRequest) async throws -> any GoogleCloudGax
    .PollableOperation<Backup>
  {
    try await self.exportBackup(withPolling: withPolling, options: .init())
  }

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

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

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

  public func backupInstance(withPolling: BackupInstanceRequest) async throws -> any GoogleCloudGax
    .PollableOperation<Instance>
  {
    try await self.backupInstance(withPolling: withPolling, options: .init())
  }

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

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

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

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

  public func startMigration(withPolling: StartMigrationRequest) async throws -> any GoogleCloudGax
    .PollableOperation<Instance>
  {
    try await self.startMigration(withPolling: withPolling, options: .init())
  }

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

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

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

  public func finishMigration(withPolling: FinishMigrationRequest) async throws
    -> any GoogleCloudGax.PollableOperation<Instance>
  {
    try await self.finishMigration(withPolling: withPolling, options: .init())
  }

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

  public func finishMigration(
    name: Swift.String,
    force: Swift.Bool,
  ) async throws -> any GoogleCloudGax.PollableOperation<Instance> {
    let request = FinishMigrationRequest().with {
      $0.name = name
      $0.force = force
    }
    return try await self.finishMigration(withPolling: request)
  }

  public func listTokenAuthUsers(request: ListTokenAuthUsersRequest) async throws
    -> GoogleCloudMemoryStoreV1.ListTokenAuthUsersResponse
  {
    try await self.listTokenAuthUsers(request: request, options: .init())
  }

  public func listTokenAuthUsers(
    request: ListTokenAuthUsersRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.ListTokenAuthUsersResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listTokenAuthUsers(
    byItem: ListTokenAuthUsersRequest
  ) throws -> any AsyncSequence<TokenAuthUser, Swift.Error> {
    try self.listTokenAuthUsers(byItem: byItem, options: .init())
  }

  public func listTokenAuthUsers(
    byItem: ListTokenAuthUsersRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<TokenAuthUser, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudMemoryStoreV1.ListTokenAuthUsersResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

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

  public func getTokenAuthUser(request: GetTokenAuthUserRequest) async throws
    -> GoogleCloudMemoryStoreV1.TokenAuthUser
  {
    try await self.getTokenAuthUser(request: request, options: .init())
  }

  public func getTokenAuthUser(
    request: GetTokenAuthUserRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.TokenAuthUser {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getTokenAuthUser(
    name: Swift.String,
  ) async throws -> GoogleCloudMemoryStoreV1.TokenAuthUser {
    let request = GetTokenAuthUserRequest().with {
      $0.name = name
    }
    return try await self.getTokenAuthUser(request: request)
  }

  public func listAuthTokens(request: ListAuthTokensRequest) async throws
    -> GoogleCloudMemoryStoreV1.ListAuthTokensResponse
  {
    try await self.listAuthTokens(request: request, options: .init())
  }

  public func listAuthTokens(
    request: ListAuthTokensRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.ListAuthTokensResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listAuthTokens(
    byItem: ListAuthTokensRequest
  ) throws -> any AsyncSequence<AuthToken, Swift.Error> {
    try self.listAuthTokens(byItem: byItem, options: .init())
  }

  public func listAuthTokens(
    byItem: ListAuthTokensRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<AuthToken, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudMemoryStoreV1.ListAuthTokensResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

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

  public func getAuthToken(request: GetAuthTokenRequest) async throws
    -> GoogleCloudMemoryStoreV1.AuthToken
  {
    try await self.getAuthToken(request: request, options: .init())
  }

  public func getAuthToken(
    request: GetAuthTokenRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMemoryStoreV1.AuthToken {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getAuthToken(
    name: Swift.String,
  ) async throws -> GoogleCloudMemoryStoreV1.AuthToken {
    let request = GetAuthTokenRequest().with {
      $0.name = name
    }
    return try await self.getAuthToken(request: request)
  }

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

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

  public func addTokenAuthUser(withPolling: AddTokenAuthUserRequest) async throws
    -> any GoogleCloudGax.PollableOperation<Instance>
  {
    try await self.addTokenAuthUser(withPolling: withPolling, options: .init())
  }

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

  public func addTokenAuthUser(
    instance: Swift.String,
    tokenAuthUser: Swift.String,
  ) async throws -> any GoogleCloudGax.PollableOperation<Instance> {
    let request = AddTokenAuthUserRequest().with {
      $0.instance = instance
      $0.tokenAuthUser = tokenAuthUser
    }
    return try await self.addTokenAuthUser(withPolling: request)
  }

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

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

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

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

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

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

  public func addAuthToken(withPolling: AddAuthTokenRequest) async throws -> any GoogleCloudGax
    .PollableOperation<TokenAuthUser>
  {
    try await self.addAuthToken(withPolling: withPolling, options: .init())
  }

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

  public func addAuthToken(
    tokenAuthUser: Swift.String,
    authToken: AuthToken?,
  ) async throws -> any GoogleCloudGax.PollableOperation<TokenAuthUser> {
    let request = AddAuthTokenRequest().with {
      $0.tokenAuthUser = tokenAuthUser
      $0.authToken = authToken
    }
    return try await self.addAuthToken(withPolling: request)
  }

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

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

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

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