// Code generated by sidekick. DO NOT EDIT.
//
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import Foundation
#if canImport(FoundationNetworking)
  import FoundationNetworking
#endif
import GoogleCloudWkt
import GoogleIAMV1
import GoogleLongRunning
import GoogleRpc
import GoogleCloudGax

/// Manages Google Cloud Projects.
///
/// @Snippet(path: "ProjectsQuickstart")
public class ProjectsClient: Clients.ProjectsProtocol {
  let inner: any Clients.ProjectsStub
  let pollingErrorPolicy: GoogleCloudGax.PollingErrorPolicy
  let pollingBackoffPolicy: GoogleCloudGax.BackoffPolicy

  /// Creates a new `ProjectsClient` instance.
  public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
    var inner: any Clients.ProjectsStub = try Clients.ProjectsTransport(options)
    inner = Clients.ProjectsRetry(inner, options: options)
    if let logger = options.logger {
      inner = Clients.ProjectsLogging(inner, logger: logger)
    }
    self.inner = inner
    self.pollingErrorPolicy = options.pollingErrorPolicy
    self.pollingBackoffPolicy = options.pollingBackoffPolicy
  }

  /// Retrieves the project identified by the specified `name` (for example,
  /// `projects/415104041262`).
  ///
  /// The caller must have `resourcemanager.projects.get` permission
  /// for this project.
  ///
  /// @Snippet(path: "Projects_GetProject")
  public func getProject(
    request: GetProjectRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudResourceManagerV3.Project {
    try await self.inner.getProject(request: request, options: options)
  }

  /// Lists projects that are direct children of the specified folder or
  /// organization resource. `list()` provides a strongly consistent view of the
  /// projects underneath the specified parent resource. `list()` returns
  /// projects sorted based upon the (ascending) lexical ordering of their
  /// `display_name`. The caller must have `resourcemanager.projects.list`
  /// permission on the identified parent.
  ///
  /// @Snippet(path: "Projects_ListProjects")
  public func listProjects(
    request: ListProjectsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudResourceManagerV3.ListProjectsResponse {
    try await self.inner.listProjects(request: request, options: options)
  }

  /// Lists projects that are direct children of the specified folder or
  /// organization resource. `list()` provides a strongly consistent view of the
  /// projects underneath the specified parent resource. `list()` returns
  /// projects sorted based upon the (ascending) lexical ordering of their
  /// `display_name`. The caller must have `resourcemanager.projects.list`
  /// permission on the identified parent.
  ///
  /// @Snippet(path: "Projects_ListProjects")
  public func listProjects(
    byItem: ListProjectsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Project, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudResourceManagerV3.ListProjectsResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listProjects(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Search for projects that the caller has both `resourcemanager.projects.get`
  /// permission on, and also satisfy the specified query.
  ///
  /// This method returns projects in an unspecified order.
  ///
  /// This method is eventually consistent with project mutations; this means
  /// that a newly created project may not appear in the results or recent
  /// updates to an existing project may not be reflected in the results. To
  /// retrieve the latest state of a project, use the
  /// [GetProject][google.cloud.resourcemanager.v3.Projects.GetProject] method.
  ///
  /// [google.cloud.resourcemanager.v3.Projects.GetProject]: <doc:Projects/getProject(request:)>
  ///
  /// @Snippet(path: "Projects_SearchProjects")
  public func searchProjects(
    request: SearchProjectsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudResourceManagerV3.SearchProjectsResponse {
    try await self.inner.searchProjects(request: request, options: options)
  }

  /// Search for projects that the caller has both `resourcemanager.projects.get`
  /// permission on, and also satisfy the specified query.
  ///
  /// This method returns projects in an unspecified order.
  ///
  /// This method is eventually consistent with project mutations; this means
  /// that a newly created project may not appear in the results or recent
  /// updates to an existing project may not be reflected in the results. To
  /// retrieve the latest state of a project, use the
  /// [GetProject][google.cloud.resourcemanager.v3.Projects.GetProject] method.
  ///
  /// [google.cloud.resourcemanager.v3.Projects.GetProject]: <doc:Projects/getProject(request:)>
  ///
  /// @Snippet(path: "Projects_SearchProjects")
  public func searchProjects(
    byItem: SearchProjectsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Project, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudResourceManagerV3.SearchProjectsResponse in
      var request = byItem
      request.pageToken = token
      return try await self.searchProjects(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Request that a new project be created. The result is an `Operation` which
  /// can be used to track the creation process. This process usually takes a few
  /// seconds, but can sometimes take much longer. The tracking `Operation` is
  /// automatically deleted after a few hours, so there is no need to call
  /// `DeleteOperation`.
  ///
  /// @Snippet(path: "Projects_CreateProject")
  public func createProject(
    request: CreateProjectRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.createProject(request: request, options: options)
  }

  /// Request that a new project be created. The result is an `Operation` which
  /// can be used to track the creation process. This process usually takes a few
  /// seconds, but can sometimes take much longer. The tracking `Operation` is
  /// automatically deleted after a few hours, so there is no need to call
  /// `DeleteOperation`.
  ///
  /// @Snippet(path: "Projects_CreateProject")
  public func createProject(
    withPolling: CreateProjectRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Project> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Project>.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 Project(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.createProject(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Project>.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 `display_name` and labels of the project identified by the
  /// specified `name` (for example, `projects/415104041262`). Deleting all
  /// labels requires an update mask for labels field.
  ///
  /// The caller must have `resourcemanager.projects.update` permission for this
  /// project.
  ///
  /// @Snippet(path: "Projects_UpdateProject")
  public func updateProject(
    request: UpdateProjectRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.updateProject(request: request, options: options)
  }

  /// Updates the `display_name` and labels of the project identified by the
  /// specified `name` (for example, `projects/415104041262`). Deleting all
  /// labels requires an update mask for labels field.
  ///
  /// The caller must have `resourcemanager.projects.update` permission for this
  /// project.
  ///
  /// @Snippet(path: "Projects_UpdateProject")
  public func updateProject(
    withPolling: UpdateProjectRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Project> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Project>.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 Project(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.updateProject(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Project>.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,
    )
  }

  /// Move a project to another place in your resource hierarchy, under a new
  /// resource parent.
  ///
  /// Returns an operation which can be used to track the process of the project
  /// move workflow.
  /// Upon success, the `Operation.response` field will be populated with the
  /// moved project.
  ///
  /// The caller must have `resourcemanager.projects.move` permission on the
  /// project, on the project's current and proposed new parent.
  ///
  /// If project has no current parent, or it currently does not have an
  /// associated organization resource, you will also need the
  /// `resourcemanager.projects.setIamPolicy` permission in the project.
  ///
  ///
  ///
  /// @Snippet(path: "Projects_MoveProject")
  public func moveProject(
    request: MoveProjectRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.moveProject(request: request, options: options)
  }

  /// Move a project to another place in your resource hierarchy, under a new
  /// resource parent.
  ///
  /// Returns an operation which can be used to track the process of the project
  /// move workflow.
  /// Upon success, the `Operation.response` field will be populated with the
  /// moved project.
  ///
  /// The caller must have `resourcemanager.projects.move` permission on the
  /// project, on the project's current and proposed new parent.
  ///
  /// If project has no current parent, or it currently does not have an
  /// associated organization resource, you will also need the
  /// `resourcemanager.projects.setIamPolicy` permission in the project.
  ///
  ///
  ///
  /// @Snippet(path: "Projects_MoveProject")
  public func moveProject(
    withPolling: MoveProjectRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Project> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Project>.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 Project(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.moveProject(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Project>.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,
    )
  }

  /// Marks the project identified by the specified
  /// `name` (for example, `projects/415104041262`) for deletion.
  ///
  /// This method will only affect the project if it has a lifecycle state of
  /// [ACTIVE][google.cloud.resourcemanager.v3.Project.State.ACTIVE].
  ///
  /// This method changes the Project's lifecycle state from
  /// [ACTIVE][google.cloud.resourcemanager.v3.Project.State.ACTIVE]
  /// to
  /// [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Project.State.DELETE_REQUESTED].
  /// The deletion starts at an unspecified time,
  /// at which point the Project is no longer accessible.
  ///
  /// Until the deletion completes, you can check the lifecycle state
  /// checked by retrieving the project with [GetProject]
  /// [google.cloud.resourcemanager.v3.Projects.GetProject],
  /// and the project remains visible to [ListProjects]
  /// [google.cloud.resourcemanager.v3.Projects.ListProjects].
  /// However, you cannot update the project.
  ///
  /// After the deletion completes, the project is not retrievable by
  /// the  [GetProject]
  /// [google.cloud.resourcemanager.v3.Projects.GetProject],
  /// [ListProjects]
  /// [google.cloud.resourcemanager.v3.Projects.ListProjects], and
  /// [SearchProjects][google.cloud.resourcemanager.v3.Projects.SearchProjects]
  /// methods.
  ///
  /// This method behaves idempotently, such that deleting a `DELETE_REQUESTED`
  /// project will not cause an error, but also won't do anything.
  ///
  /// The caller must have `resourcemanager.projects.delete` permissions for this
  /// project.
  ///
  /// [google.cloud.resourcemanager.v3.Project.State.ACTIVE]: <doc:Project/State/active>
  /// [google.cloud.resourcemanager.v3.Project.State.DELETE_REQUESTED]: <doc:Project/State/deleteRequested>
  /// [google.cloud.resourcemanager.v3.Projects.SearchProjects]: <doc:Projects/searchProjects(request:)>
  ///
  /// @Snippet(path: "Projects_DeleteProject")
  public func deleteProject(
    request: DeleteProjectRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.deleteProject(request: request, options: options)
  }

  /// Marks the project identified by the specified
  /// `name` (for example, `projects/415104041262`) for deletion.
  ///
  /// This method will only affect the project if it has a lifecycle state of
  /// [ACTIVE][google.cloud.resourcemanager.v3.Project.State.ACTIVE].
  ///
  /// This method changes the Project's lifecycle state from
  /// [ACTIVE][google.cloud.resourcemanager.v3.Project.State.ACTIVE]
  /// to
  /// [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Project.State.DELETE_REQUESTED].
  /// The deletion starts at an unspecified time,
  /// at which point the Project is no longer accessible.
  ///
  /// Until the deletion completes, you can check the lifecycle state
  /// checked by retrieving the project with [GetProject]
  /// [google.cloud.resourcemanager.v3.Projects.GetProject],
  /// and the project remains visible to [ListProjects]
  /// [google.cloud.resourcemanager.v3.Projects.ListProjects].
  /// However, you cannot update the project.
  ///
  /// After the deletion completes, the project is not retrievable by
  /// the  [GetProject]
  /// [google.cloud.resourcemanager.v3.Projects.GetProject],
  /// [ListProjects]
  /// [google.cloud.resourcemanager.v3.Projects.ListProjects], and
  /// [SearchProjects][google.cloud.resourcemanager.v3.Projects.SearchProjects]
  /// methods.
  ///
  /// This method behaves idempotently, such that deleting a `DELETE_REQUESTED`
  /// project will not cause an error, but also won't do anything.
  ///
  /// The caller must have `resourcemanager.projects.delete` permissions for this
  /// project.
  ///
  /// [google.cloud.resourcemanager.v3.Project.State.ACTIVE]: <doc:Project/State/active>
  /// [google.cloud.resourcemanager.v3.Project.State.DELETE_REQUESTED]: <doc:Project/State/deleteRequested>
  /// [google.cloud.resourcemanager.v3.Projects.SearchProjects]: <doc:Projects/searchProjects(request:)>
  ///
  /// @Snippet(path: "Projects_DeleteProject")
  public func deleteProject(
    withPolling: DeleteProjectRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Project> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Project>.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 Project(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.deleteProject(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Project>.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,
    )
  }

  /// Restores the project identified by the specified
  /// `name` (for example, `projects/415104041262`).
  /// You can only use this method for a project that has a lifecycle state of
  /// [DELETE_REQUESTED]
  /// [Projects.State.DELETE_REQUESTED].
  /// After deletion starts, the project cannot be restored.
  ///
  /// The caller must have `resourcemanager.projects.undelete` permission for
  /// this project.
  ///
  /// @Snippet(path: "Projects_UndeleteProject")
  public func undeleteProject(
    request: UndeleteProjectRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.undeleteProject(request: request, options: options)
  }

  /// Restores the project identified by the specified
  /// `name` (for example, `projects/415104041262`).
  /// You can only use this method for a project that has a lifecycle state of
  /// [DELETE_REQUESTED]
  /// [Projects.State.DELETE_REQUESTED].
  /// After deletion starts, the project cannot be restored.
  ///
  /// The caller must have `resourcemanager.projects.undelete` permission for
  /// this project.
  ///
  /// @Snippet(path: "Projects_UndeleteProject")
  public func undeleteProject(
    withPolling: UndeleteProjectRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<Project> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<Project>.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 Project(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.undeleteProject(request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = { () async throws -> GoogleCloudGax._PollableOperationImpl<Project>.State in
      let op = try await self.getOperation(
        request: .init().with { $0.name = rawOp.name }, options: options)
      return try extractStatus(op)
    }
    return GoogleCloudGax._PollableOperationImpl(
      initialState: initialState,
      polling: options.pollingErrorPolicy ?? self.pollingErrorPolicy,
      backoff: options.pollingBackoffPolicy ?? self.pollingBackoffPolicy,
      poll: poll,
    )
  }

  /// Returns the IAM access control policy for the specified project, in the
  /// format `projects/{ProjectIdOrNumber}` e.g. projects/123.
  /// Permission is denied if the policy or the resource do not exist.
  ///
  /// @Snippet(path: "Projects_GetIamPolicy")
  public func getIamPolicy(
    request: GoogleIAMV1.GetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV1.Policy {
    try await self.inner.getIamPolicy(request: request, options: options)
  }

  /// Sets the IAM access control policy for the specified project, in the
  /// format `projects/{ProjectIdOrNumber}` e.g. projects/123.
  ///
  /// CAUTION: This method will replace the existing policy, and cannot be used
  /// to append additional IAM settings.
  ///
  /// Note: Removing service accounts from policies or changing their roles can
  /// render services completely inoperable. It is important to understand how
  /// the service account is being used before removing or updating its roles.
  ///
  /// The following constraints apply when using `setIamPolicy()`:
  ///
  /// + Project does not support `allUsers` and `allAuthenticatedUsers` as
  /// `members` in a `Binding` of a `Policy`.
  ///
  /// + The owner role can be granted to a `user`, `serviceAccount`, or a group
  /// that is part of an organization. For example,
  /// group@myownpersonaldomain.com could be added as an owner to a project in
  /// the myownpersonaldomain.com organization, but not the examplepetstore.com
  /// organization.
  ///
  /// + Service accounts can be made owners of a project directly
  /// without any restrictions. However, to be added as an owner, a user must be
  /// invited using the Cloud Platform console and must accept the invitation.
  ///
  /// + A user cannot be granted the owner role using `setIamPolicy()`. The user
  /// must be granted the owner role using the Cloud Platform Console and must
  /// explicitly accept the invitation.
  ///
  /// + Invitations to grant the owner role cannot be sent using
  /// `setIamPolicy()`;
  /// they must be sent only using the Cloud Platform Console.
  ///
  /// + If the project is not part of an organization, there must be at least
  /// one owner who has accepted the Terms of Service (ToS) agreement in the
  /// policy. Calling `setIamPolicy()` to remove the last ToS-accepted owner
  /// from the policy will fail. This restriction also applies to legacy
  /// projects that no longer have owners who have accepted the ToS. Edits to
  /// IAM policies will be rejected until the lack of a ToS-accepting owner is
  /// rectified. If the project is part of an organization, you can remove all
  /// owners, potentially making the organization inaccessible.
  ///
  /// @Snippet(path: "Projects_SetIamPolicy")
  public func setIamPolicy(
    request: GoogleIAMV1.SetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV1.Policy {
    try await self.inner.setIamPolicy(request: request, options: options)
  }

  /// Returns permissions that a caller has on the specified project, in the
  /// format `projects/{ProjectIdOrNumber}` e.g. projects/123..
  ///
  /// @Snippet(path: "Projects_TestIamPermissions")
  public func testIamPermissions(
    request: GoogleIAMV1.TestIamPermissionsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV1.TestIamPermissionsResponse {
    try await self.inner.testIamPermissions(request: request, options: options)
  }

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

extension Clients {
  /// A Swift protocol to mock `ProjectsClient`.
  ///
  /// To mock `ProjectsClient` change your functions to receive
  /// `some ProjectsProtocol` or `any ProjectsProtocol`
  /// and pass a mock implementation in your tests.
  public protocol ProjectsProtocol {
    /// See `ProjectsClient.getProject`.
    func getProject(request: GetProjectRequest) async throws -> GoogleCloudResourceManagerV3.Project

    /// See `ProjectsClient.getProject`.
    func getProject(
      name: Swift.String,
    ) async throws -> GoogleCloudResourceManagerV3.Project

    /// See `ProjectsClient.listProjects`.
    func listProjects(request: ListProjectsRequest) async throws
      -> GoogleCloudResourceManagerV3.ListProjectsResponse

    /// See `ProjectsClient.listProjects`.
    func listProjects(
      byItem: ListProjectsRequest
    ) throws -> any AsyncSequence<Project, Swift.Error>

    /// See `ProjectsClient.listProjects`.
    func listProjects(
      parent: Swift.String,
    ) throws -> any AsyncSequence<Project, Swift.Error>

    /// See `ProjectsClient.searchProjects`.
    func searchProjects(request: SearchProjectsRequest) async throws
      -> GoogleCloudResourceManagerV3.SearchProjectsResponse

    /// See `ProjectsClient.searchProjects`.
    func searchProjects(
      byItem: SearchProjectsRequest
    ) throws -> any AsyncSequence<Project, Swift.Error>

    /// See `ProjectsClient.searchProjects`.
    func searchProjects(
      query: Swift.String,
    ) throws -> any AsyncSequence<Project, Swift.Error>

    /// See `ProjectsClient.createProject`.
    func createProject(request: CreateProjectRequest) async throws -> GoogleLongRunning.Operation

    /// See `ProjectsClient.createProject`.
    func createProject(withPolling: CreateProjectRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Project>

    /// See `ProjectsClient.createProject`.
    func createProject(
      project: Project?,
    ) async throws -> any GoogleCloudGax.PollableOperation<Project>

    /// See `ProjectsClient.updateProject`.
    func updateProject(request: UpdateProjectRequest) async throws -> GoogleLongRunning.Operation

    /// See `ProjectsClient.updateProject`.
    func updateProject(withPolling: UpdateProjectRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Project>

    /// See `ProjectsClient.updateProject`.
    func updateProject(
      project: Project?,
      updateMask: GoogleCloudWkt.FieldMask?,
    ) async throws -> any GoogleCloudGax.PollableOperation<Project>

    /// See `ProjectsClient.moveProject`.
    func moveProject(request: MoveProjectRequest) async throws -> GoogleLongRunning.Operation

    /// See `ProjectsClient.moveProject`.
    func moveProject(withPolling: MoveProjectRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Project>

    /// See `ProjectsClient.moveProject`.
    func moveProject(
      name: Swift.String,
      destinationParent: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<Project>

    /// See `ProjectsClient.deleteProject`.
    func deleteProject(request: DeleteProjectRequest) async throws -> GoogleLongRunning.Operation

    /// See `ProjectsClient.deleteProject`.
    func deleteProject(withPolling: DeleteProjectRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Project>

    /// See `ProjectsClient.deleteProject`.
    func deleteProject(
      name: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<Project>

    /// See `ProjectsClient.undeleteProject`.
    func undeleteProject(request: UndeleteProjectRequest) async throws
      -> GoogleLongRunning.Operation

    /// See `ProjectsClient.undeleteProject`.
    func undeleteProject(withPolling: UndeleteProjectRequest) async throws -> any GoogleCloudGax
      .PollableOperation<Project>

    /// See `ProjectsClient.undeleteProject`.
    func undeleteProject(
      name: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<Project>

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

    /// See `ProjectsClient.getIamPolicy`.
    func getIamPolicy(
      resource: Swift.String,
    ) async throws -> GoogleIAMV1.Policy

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

    /// See `ProjectsClient.setIamPolicy`.
    func setIamPolicy(
      resource: Swift.String,
      policy: GoogleIAMV1.Policy?,
    ) async throws -> GoogleIAMV1.Policy

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

    /// See `ProjectsClient.testIamPermissions`.
    func testIamPermissions(
      resource: Swift.String,
      permissions: [Swift.String],
    ) async throws -> GoogleIAMV1.TestIamPermissionsResponse

    /// See `ProjectsClient.getProject`.
    func getProject(
      request: GetProjectRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudResourceManagerV3.Project

    /// See `ProjectsClient.listProjects`.
    func listProjects(
      request: ListProjectsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudResourceManagerV3.ListProjectsResponse

    /// See `ProjectsClient.listProjects`.
    func listProjects(
      byItem: ListProjectsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<Project, Swift.Error>

    /// See `ProjectsClient.searchProjects`.
    func searchProjects(
      request: SearchProjectsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudResourceManagerV3.SearchProjectsResponse

    /// See `ProjectsClient.searchProjects`.
    func searchProjects(
      byItem: SearchProjectsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<Project, Swift.Error>

    /// See `ProjectsClient.createProject`.
    func createProject(
      request: CreateProjectRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `ProjectsClient.createProject`.
    func createProject(
      withPolling: CreateProjectRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Project>

    /// See `ProjectsClient.updateProject`.
    func updateProject(
      request: UpdateProjectRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `ProjectsClient.updateProject`.
    func updateProject(
      withPolling: UpdateProjectRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Project>

    /// See `ProjectsClient.moveProject`.
    func moveProject(
      request: MoveProjectRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `ProjectsClient.moveProject`.
    func moveProject(
      withPolling: MoveProjectRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Project>

    /// See `ProjectsClient.deleteProject`.
    func deleteProject(
      request: DeleteProjectRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `ProjectsClient.deleteProject`.
    func deleteProject(
      withPolling: DeleteProjectRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Project>

    /// See `ProjectsClient.undeleteProject`.
    func undeleteProject(
      request: UndeleteProjectRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `ProjectsClient.undeleteProject`.
    func undeleteProject(
      withPolling: UndeleteProjectRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Project>

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

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

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

// Default implementations
extension Clients.ProjectsProtocol {
  public func getProject(request: GetProjectRequest) async throws
    -> GoogleCloudResourceManagerV3.Project
  {
    try await self.getProject(request: request, options: .init())
  }

  public func getProject(
    request: GetProjectRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudResourceManagerV3.Project {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getProject(
    name: Swift.String,
  ) async throws -> GoogleCloudResourceManagerV3.Project {
    let request = GetProjectRequest().with {
      $0.name = name
    }
    return try await self.getProject(request: request)
  }

  public func listProjects(request: ListProjectsRequest) async throws
    -> GoogleCloudResourceManagerV3.ListProjectsResponse
  {
    try await self.listProjects(request: request, options: .init())
  }

  public func listProjects(
    request: ListProjectsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudResourceManagerV3.ListProjectsResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listProjects(
    byItem: ListProjectsRequest
  ) throws -> any AsyncSequence<Project, Swift.Error> {
    try self.listProjects(byItem: byItem, options: .init())
  }

  public func listProjects(
    byItem: ListProjectsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Project, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudResourceManagerV3.ListProjectsResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

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

  public func searchProjects(request: SearchProjectsRequest) async throws
    -> GoogleCloudResourceManagerV3.SearchProjectsResponse
  {
    try await self.searchProjects(request: request, options: .init())
  }

  public func searchProjects(
    request: SearchProjectsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudResourceManagerV3.SearchProjectsResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func searchProjects(
    byItem: SearchProjectsRequest
  ) throws -> any AsyncSequence<Project, Swift.Error> {
    try self.searchProjects(byItem: byItem, options: .init())
  }

  public func searchProjects(
    byItem: SearchProjectsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Project, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudResourceManagerV3.SearchProjectsResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  public func searchProjects(
    query: Swift.String,
  ) throws -> any AsyncSequence<Project, Swift.Error> {
    let request = SearchProjectsRequest().with {
      $0.query = query
    }
    return try self.searchProjects(byItem: request)
  }

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

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

  public func createProject(withPolling: CreateProjectRequest) async throws -> any GoogleCloudGax
    .PollableOperation<Project>
  {
    try await self.createProject(withPolling: withPolling, options: .init())
  }

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

  public func createProject(
    project: Project?,
  ) async throws -> any GoogleCloudGax.PollableOperation<Project> {
    let request = CreateProjectRequest().with {
      $0.project = project
    }
    return try await self.createProject(withPolling: request)
  }

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

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

  public func updateProject(withPolling: UpdateProjectRequest) async throws -> any GoogleCloudGax
    .PollableOperation<Project>
  {
    try await self.updateProject(withPolling: withPolling, options: .init())
  }

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

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

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

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

  public func moveProject(withPolling: MoveProjectRequest) async throws -> any GoogleCloudGax
    .PollableOperation<Project>
  {
    try await self.moveProject(withPolling: withPolling, options: .init())
  }

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

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

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

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

  public func deleteProject(withPolling: DeleteProjectRequest) async throws -> any GoogleCloudGax
    .PollableOperation<Project>
  {
    try await self.deleteProject(withPolling: withPolling, options: .init())
  }

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

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

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

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

  public func undeleteProject(withPolling: UndeleteProjectRequest) async throws
    -> any GoogleCloudGax.PollableOperation<Project>
  {
    try await self.undeleteProject(withPolling: withPolling, options: .init())
  }

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

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

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

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

  public func getIamPolicy(
    resource: Swift.String,
  ) async throws -> GoogleIAMV1.Policy {
    let request = GoogleIAMV1.GetIamPolicyRequest().with {
      $0.resource = resource
    }
    return try await self.getIamPolicy(request: request)
  }

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

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

  public func setIamPolicy(
    resource: Swift.String,
    policy: GoogleIAMV1.Policy?,
  ) async throws -> GoogleIAMV1.Policy {
    let request = GoogleIAMV1.SetIamPolicyRequest().with {
      $0.resource = resource
      $0.policy = policy
    }
    return try await self.setIamPolicy(request: request)
  }

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

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

  public func testIamPermissions(
    resource: Swift.String,
    permissions: [Swift.String],
  ) async throws -> GoogleIAMV1.TestIamPermissionsResponse {
    let request = GoogleIAMV1.TestIamPermissionsRequest().with {
      $0.resource = resource
      $0.permissions = permissions
    }
    return try await self.testIamPermissions(request: 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)
  }
}
