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

/// Manages Identity and Access Management (IAM) principal access boundary
/// policies.
///
/// @Snippet(path: "PrincipalAccessBoundaryPoliciesQuickstart")
public class PrincipalAccessBoundaryPoliciesClient: Clients.PrincipalAccessBoundaryPoliciesProtocol
{
  let inner: any Clients.PrincipalAccessBoundaryPoliciesStub
  let pollingErrorPolicy: GoogleCloudGax.PollingErrorPolicy
  let pollingBackoffPolicy: GoogleCloudGax.BackoffPolicy

  /// Creates a new `PrincipalAccessBoundaryPoliciesClient` instance.
  public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
    var inner: any Clients.PrincipalAccessBoundaryPoliciesStub =
      try Clients.PrincipalAccessBoundaryPoliciesTransport(options)
    inner = Clients.PrincipalAccessBoundaryPoliciesRetry(inner, options: options)
    if let logger = options.logger {
      inner = Clients.PrincipalAccessBoundaryPoliciesLogging(inner, logger: logger)
    }
    self.inner = inner
    self.pollingErrorPolicy = options.pollingErrorPolicy
    self.pollingBackoffPolicy = options.pollingBackoffPolicy
  }

  /// Creates a principal access boundary policy, and returns a long running
  /// operation.
  ///
  /// @Snippet(path: "PrincipalAccessBoundaryPolicies_CreatePrincipalAccessBoundaryPolicy")
  public func createPrincipalAccessBoundaryPolicy(
    request: CreatePrincipalAccessBoundaryPolicyRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.createPrincipalAccessBoundaryPolicy(request: request, options: options)
  }

  /// Creates a principal access boundary policy, and returns a long running
  /// operation.
  ///
  /// @Snippet(path: "PrincipalAccessBoundaryPolicies_CreatePrincipalAccessBoundaryPolicy")
  public func createPrincipalAccessBoundaryPolicy(
    withPolling: CreatePrincipalAccessBoundaryPolicyRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<PrincipalAccessBoundaryPolicy> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<PrincipalAccessBoundaryPolicy>.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 PrincipalAccessBoundaryPolicy(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.createPrincipalAccessBoundaryPolicy(
      request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = {
      () async throws -> GoogleCloudGax._PollableOperationImpl<PrincipalAccessBoundaryPolicy>.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 a principal access boundary policy.
  ///
  /// @Snippet(path: "PrincipalAccessBoundaryPolicies_GetPrincipalAccessBoundaryPolicy")
  public func getPrincipalAccessBoundaryPolicy(
    request: GetPrincipalAccessBoundaryPolicyRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV3.PrincipalAccessBoundaryPolicy {
    try await self.inner.getPrincipalAccessBoundaryPolicy(request: request, options: options)
  }

  /// Updates a principal access boundary policy.
  ///
  /// @Snippet(path: "PrincipalAccessBoundaryPolicies_UpdatePrincipalAccessBoundaryPolicy")
  public func updatePrincipalAccessBoundaryPolicy(
    request: UpdatePrincipalAccessBoundaryPolicyRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.updatePrincipalAccessBoundaryPolicy(request: request, options: options)
  }

  /// Updates a principal access boundary policy.
  ///
  /// @Snippet(path: "PrincipalAccessBoundaryPolicies_UpdatePrincipalAccessBoundaryPolicy")
  public func updatePrincipalAccessBoundaryPolicy(
    withPolling: UpdatePrincipalAccessBoundaryPolicyRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> any GoogleCloudGax.PollableOperation<PrincipalAccessBoundaryPolicy> {
    let extractStatus = {
      (op: GoogleLongRunning.Operation) throws
        -> GoogleCloudGax._PollableOperationImpl<PrincipalAccessBoundaryPolicy>.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 PrincipalAccessBoundaryPolicy(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.updatePrincipalAccessBoundaryPolicy(
      request: withPolling, options: options)
    let initialState = try extractStatus(rawOp)
    let poll = {
      () async throws -> GoogleCloudGax._PollableOperationImpl<PrincipalAccessBoundaryPolicy>.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 principal access boundary policy.
  ///
  /// @Snippet(path: "PrincipalAccessBoundaryPolicies_DeletePrincipalAccessBoundaryPolicy")
  public func deletePrincipalAccessBoundaryPolicy(
    request: DeletePrincipalAccessBoundaryPolicyRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.deletePrincipalAccessBoundaryPolicy(request: request, options: options)
  }

  /// Deletes a principal access boundary policy.
  ///
  /// @Snippet(path: "PrincipalAccessBoundaryPolicies_DeletePrincipalAccessBoundaryPolicy")
  public func deletePrincipalAccessBoundaryPolicy(
    withPolling: DeletePrincipalAccessBoundaryPolicyRequest, 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.deletePrincipalAccessBoundaryPolicy(
      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 principal access boundary policies.
  ///
  /// @Snippet(path: "PrincipalAccessBoundaryPolicies_ListPrincipalAccessBoundaryPolicies")
  public func listPrincipalAccessBoundaryPolicies(
    request: ListPrincipalAccessBoundaryPoliciesRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV3.ListPrincipalAccessBoundaryPoliciesResponse {
    try await self.inner.listPrincipalAccessBoundaryPolicies(request: request, options: options)
  }

  /// Lists principal access boundary policies.
  ///
  /// @Snippet(path: "PrincipalAccessBoundaryPolicies_ListPrincipalAccessBoundaryPolicies")
  public func listPrincipalAccessBoundaryPolicies(
    byItem: ListPrincipalAccessBoundaryPoliciesRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<PrincipalAccessBoundaryPolicy, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleIAMV3.ListPrincipalAccessBoundaryPoliciesResponse
      in
      var request = byItem
      request.pageToken = token
      return try await self.listPrincipalAccessBoundaryPolicies(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Returns all policy bindings that bind a specific policy if a user has
  /// searchPolicyBindings permission on that policy.
  ///
  /// @Snippet(path: "PrincipalAccessBoundaryPolicies_SearchPrincipalAccessBoundaryPolicyBindings")
  public func searchPrincipalAccessBoundaryPolicyBindings(
    request: SearchPrincipalAccessBoundaryPolicyBindingsRequest,
    options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV3.SearchPrincipalAccessBoundaryPolicyBindingsResponse {
    try await self.inner.searchPrincipalAccessBoundaryPolicyBindings(
      request: request, options: options)
  }

  /// Returns all policy bindings that bind a specific policy if a user has
  /// searchPolicyBindings permission on that policy.
  ///
  /// @Snippet(path: "PrincipalAccessBoundaryPolicies_SearchPrincipalAccessBoundaryPolicyBindings")
  public func searchPrincipalAccessBoundaryPolicyBindings(
    byItem: SearchPrincipalAccessBoundaryPolicyBindingsRequest,
    options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<PolicyBinding, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws
        -> GoogleIAMV3.SearchPrincipalAccessBoundaryPolicyBindingsResponse in
      var request = byItem
      request.pageToken = token
      return try await self.searchPrincipalAccessBoundaryPolicyBindings(
        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: "PrincipalAccessBoundaryPolicies_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 `PrincipalAccessBoundaryPoliciesClient`.
  ///
  /// To mock `PrincipalAccessBoundaryPoliciesClient` change your functions to receive
  /// `some PrincipalAccessBoundaryPoliciesProtocol` or `any PrincipalAccessBoundaryPoliciesProtocol`
  /// and pass a mock implementation in your tests.
  public protocol PrincipalAccessBoundaryPoliciesProtocol {
    /// See `PrincipalAccessBoundaryPoliciesClient.createPrincipalAccessBoundaryPolicy`.
    func createPrincipalAccessBoundaryPolicy(request: CreatePrincipalAccessBoundaryPolicyRequest)
      async throws -> GoogleLongRunning.Operation

    /// See `PrincipalAccessBoundaryPoliciesClient.createPrincipalAccessBoundaryPolicy`.
    func createPrincipalAccessBoundaryPolicy(
      withPolling: CreatePrincipalAccessBoundaryPolicyRequest
    ) async throws -> any GoogleCloudGax.PollableOperation<PrincipalAccessBoundaryPolicy>

    /// See `PrincipalAccessBoundaryPoliciesClient.createPrincipalAccessBoundaryPolicy`.
    func createPrincipalAccessBoundaryPolicy(
      parent: Swift.String,
      principalAccessBoundaryPolicy: PrincipalAccessBoundaryPolicy?,
      principalAccessBoundaryPolicyId: Swift.String,
    ) async throws -> any GoogleCloudGax.PollableOperation<PrincipalAccessBoundaryPolicy>

    /// See `PrincipalAccessBoundaryPoliciesClient.getPrincipalAccessBoundaryPolicy`.
    func getPrincipalAccessBoundaryPolicy(request: GetPrincipalAccessBoundaryPolicyRequest)
      async throws -> GoogleIAMV3.PrincipalAccessBoundaryPolicy

    /// See `PrincipalAccessBoundaryPoliciesClient.getPrincipalAccessBoundaryPolicy`.
    func getPrincipalAccessBoundaryPolicy(
      name: Swift.String,
    ) async throws -> GoogleIAMV3.PrincipalAccessBoundaryPolicy

    /// See `PrincipalAccessBoundaryPoliciesClient.updatePrincipalAccessBoundaryPolicy`.
    func updatePrincipalAccessBoundaryPolicy(request: UpdatePrincipalAccessBoundaryPolicyRequest)
      async throws -> GoogleLongRunning.Operation

    /// See `PrincipalAccessBoundaryPoliciesClient.updatePrincipalAccessBoundaryPolicy`.
    func updatePrincipalAccessBoundaryPolicy(
      withPolling: UpdatePrincipalAccessBoundaryPolicyRequest
    ) async throws -> any GoogleCloudGax.PollableOperation<PrincipalAccessBoundaryPolicy>

    /// See `PrincipalAccessBoundaryPoliciesClient.updatePrincipalAccessBoundaryPolicy`.
    func updatePrincipalAccessBoundaryPolicy(
      principalAccessBoundaryPolicy: PrincipalAccessBoundaryPolicy?,
      updateMask: GoogleCloudWkt.FieldMask?,
    ) async throws -> any GoogleCloudGax.PollableOperation<PrincipalAccessBoundaryPolicy>

    /// See `PrincipalAccessBoundaryPoliciesClient.deletePrincipalAccessBoundaryPolicy`.
    func deletePrincipalAccessBoundaryPolicy(request: DeletePrincipalAccessBoundaryPolicyRequest)
      async throws -> GoogleLongRunning.Operation

    /// See `PrincipalAccessBoundaryPoliciesClient.deletePrincipalAccessBoundaryPolicy`.
    func deletePrincipalAccessBoundaryPolicy(
      withPolling: DeletePrincipalAccessBoundaryPolicyRequest
    ) async throws -> any GoogleCloudGax.PollableOperation<Void>

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

    /// See `PrincipalAccessBoundaryPoliciesClient.listPrincipalAccessBoundaryPolicies`.
    func listPrincipalAccessBoundaryPolicies(request: ListPrincipalAccessBoundaryPoliciesRequest)
      async throws -> GoogleIAMV3.ListPrincipalAccessBoundaryPoliciesResponse

    /// See `PrincipalAccessBoundaryPoliciesClient.listPrincipalAccessBoundaryPolicies`.
    func listPrincipalAccessBoundaryPolicies(
      byItem: ListPrincipalAccessBoundaryPoliciesRequest
    ) throws -> any AsyncSequence<PrincipalAccessBoundaryPolicy, Swift.Error>

    /// See `PrincipalAccessBoundaryPoliciesClient.listPrincipalAccessBoundaryPolicies`.
    func listPrincipalAccessBoundaryPolicies(
      parent: Swift.String,
    ) throws -> any AsyncSequence<PrincipalAccessBoundaryPolicy, Swift.Error>

    /// See `PrincipalAccessBoundaryPoliciesClient.searchPrincipalAccessBoundaryPolicyBindings`.
    func searchPrincipalAccessBoundaryPolicyBindings(
      request: SearchPrincipalAccessBoundaryPolicyBindingsRequest
    ) async throws -> GoogleIAMV3.SearchPrincipalAccessBoundaryPolicyBindingsResponse

    /// See `PrincipalAccessBoundaryPoliciesClient.searchPrincipalAccessBoundaryPolicyBindings`.
    func searchPrincipalAccessBoundaryPolicyBindings(
      byItem: SearchPrincipalAccessBoundaryPolicyBindingsRequest
    ) throws -> any AsyncSequence<PolicyBinding, Swift.Error>

    /// See `PrincipalAccessBoundaryPoliciesClient.searchPrincipalAccessBoundaryPolicyBindings`.
    func searchPrincipalAccessBoundaryPolicyBindings(
      name: Swift.String,
    ) throws -> any AsyncSequence<PolicyBinding, Swift.Error>

    /// See `PrincipalAccessBoundaryPoliciesClient.createPrincipalAccessBoundaryPolicy`.
    func createPrincipalAccessBoundaryPolicy(
      request: CreatePrincipalAccessBoundaryPolicyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `PrincipalAccessBoundaryPoliciesClient.createPrincipalAccessBoundaryPolicy`.
    func createPrincipalAccessBoundaryPolicy(
      withPolling: CreatePrincipalAccessBoundaryPolicyRequest,
      options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<PrincipalAccessBoundaryPolicy>

    /// See `PrincipalAccessBoundaryPoliciesClient.getPrincipalAccessBoundaryPolicy`.
    func getPrincipalAccessBoundaryPolicy(
      request: GetPrincipalAccessBoundaryPolicyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleIAMV3.PrincipalAccessBoundaryPolicy

    /// See `PrincipalAccessBoundaryPoliciesClient.updatePrincipalAccessBoundaryPolicy`.
    func updatePrincipalAccessBoundaryPolicy(
      request: UpdatePrincipalAccessBoundaryPolicyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `PrincipalAccessBoundaryPoliciesClient.updatePrincipalAccessBoundaryPolicy`.
    func updatePrincipalAccessBoundaryPolicy(
      withPolling: UpdatePrincipalAccessBoundaryPolicyRequest,
      options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<PrincipalAccessBoundaryPolicy>

    /// See `PrincipalAccessBoundaryPoliciesClient.deletePrincipalAccessBoundaryPolicy`.
    func deletePrincipalAccessBoundaryPolicy(
      request: DeletePrincipalAccessBoundaryPolicyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation

    /// See `PrincipalAccessBoundaryPoliciesClient.deletePrincipalAccessBoundaryPolicy`.
    func deletePrincipalAccessBoundaryPolicy(
      withPolling: DeletePrincipalAccessBoundaryPolicyRequest,
      options: GoogleCloudGax.RequestOptions
    ) async throws -> any GoogleCloudGax.PollableOperation<Void>

    /// See `PrincipalAccessBoundaryPoliciesClient.listPrincipalAccessBoundaryPolicies`.
    func listPrincipalAccessBoundaryPolicies(
      request: ListPrincipalAccessBoundaryPoliciesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleIAMV3.ListPrincipalAccessBoundaryPoliciesResponse

    /// See `PrincipalAccessBoundaryPoliciesClient.listPrincipalAccessBoundaryPolicies`.
    func listPrincipalAccessBoundaryPolicies(
      byItem: ListPrincipalAccessBoundaryPoliciesRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<PrincipalAccessBoundaryPolicy, Swift.Error>

    /// See `PrincipalAccessBoundaryPoliciesClient.searchPrincipalAccessBoundaryPolicyBindings`.
    func searchPrincipalAccessBoundaryPolicyBindings(
      request: SearchPrincipalAccessBoundaryPolicyBindingsRequest,
      options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleIAMV3.SearchPrincipalAccessBoundaryPolicyBindingsResponse

    /// See `PrincipalAccessBoundaryPoliciesClient.searchPrincipalAccessBoundaryPolicyBindings`.
    func searchPrincipalAccessBoundaryPolicyBindings(
      byItem: SearchPrincipalAccessBoundaryPolicyBindingsRequest,
      options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<PolicyBinding, Swift.Error>
  }
}

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

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

  public func createPrincipalAccessBoundaryPolicy(
    withPolling: CreatePrincipalAccessBoundaryPolicyRequest
  ) async throws -> any GoogleCloudGax.PollableOperation<PrincipalAccessBoundaryPolicy> {
    try await self.createPrincipalAccessBoundaryPolicy(withPolling: withPolling, options: .init())
  }

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

  public func createPrincipalAccessBoundaryPolicy(
    parent: Swift.String,
    principalAccessBoundaryPolicy: PrincipalAccessBoundaryPolicy?,
    principalAccessBoundaryPolicyId: Swift.String,
  ) async throws -> any GoogleCloudGax.PollableOperation<PrincipalAccessBoundaryPolicy> {
    let request = CreatePrincipalAccessBoundaryPolicyRequest().with {
      $0.parent = parent
      $0.principalAccessBoundaryPolicy = principalAccessBoundaryPolicy
      $0.principalAccessBoundaryPolicyId = principalAccessBoundaryPolicyId
    }
    return try await self.createPrincipalAccessBoundaryPolicy(withPolling: request)
  }

  public func getPrincipalAccessBoundaryPolicy(request: GetPrincipalAccessBoundaryPolicyRequest)
    async throws -> GoogleIAMV3.PrincipalAccessBoundaryPolicy
  {
    try await self.getPrincipalAccessBoundaryPolicy(request: request, options: .init())
  }

  public func getPrincipalAccessBoundaryPolicy(
    request: GetPrincipalAccessBoundaryPolicyRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV3.PrincipalAccessBoundaryPolicy {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getPrincipalAccessBoundaryPolicy(
    name: Swift.String,
  ) async throws -> GoogleIAMV3.PrincipalAccessBoundaryPolicy {
    let request = GetPrincipalAccessBoundaryPolicyRequest().with {
      $0.name = name
    }
    return try await self.getPrincipalAccessBoundaryPolicy(request: request)
  }

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

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

  public func updatePrincipalAccessBoundaryPolicy(
    withPolling: UpdatePrincipalAccessBoundaryPolicyRequest
  ) async throws -> any GoogleCloudGax.PollableOperation<PrincipalAccessBoundaryPolicy> {
    try await self.updatePrincipalAccessBoundaryPolicy(withPolling: withPolling, options: .init())
  }

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

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

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

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

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

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

  public func listPrincipalAccessBoundaryPolicies(
    request: ListPrincipalAccessBoundaryPoliciesRequest
  ) async throws -> GoogleIAMV3.ListPrincipalAccessBoundaryPoliciesResponse {
    try await self.listPrincipalAccessBoundaryPolicies(request: request, options: .init())
  }

  public func listPrincipalAccessBoundaryPolicies(
    request: ListPrincipalAccessBoundaryPoliciesRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV3.ListPrincipalAccessBoundaryPoliciesResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listPrincipalAccessBoundaryPolicies(
    byItem: ListPrincipalAccessBoundaryPoliciesRequest
  ) throws -> any AsyncSequence<PrincipalAccessBoundaryPolicy, Swift.Error> {
    try self.listPrincipalAccessBoundaryPolicies(byItem: byItem, options: .init())
  }

  public func listPrincipalAccessBoundaryPolicies(
    byItem: ListPrincipalAccessBoundaryPoliciesRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<PrincipalAccessBoundaryPolicy, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleIAMV3.ListPrincipalAccessBoundaryPoliciesResponse
      in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

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

  public func searchPrincipalAccessBoundaryPolicyBindings(
    request: SearchPrincipalAccessBoundaryPolicyBindingsRequest
  ) async throws -> GoogleIAMV3.SearchPrincipalAccessBoundaryPolicyBindingsResponse {
    try await self.searchPrincipalAccessBoundaryPolicyBindings(request: request, options: .init())
  }

  public func searchPrincipalAccessBoundaryPolicyBindings(
    request: SearchPrincipalAccessBoundaryPolicyBindingsRequest,
    options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV3.SearchPrincipalAccessBoundaryPolicyBindingsResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func searchPrincipalAccessBoundaryPolicyBindings(
    byItem: SearchPrincipalAccessBoundaryPolicyBindingsRequest
  ) throws -> any AsyncSequence<PolicyBinding, Swift.Error> {
    try self.searchPrincipalAccessBoundaryPolicyBindings(byItem: byItem, options: .init())
  }

  public func searchPrincipalAccessBoundaryPolicyBindings(
    byItem: SearchPrincipalAccessBoundaryPolicyBindingsRequest,
    options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<PolicyBinding, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws
        -> GoogleIAMV3.SearchPrincipalAccessBoundaryPolicyBindingsResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  public func searchPrincipalAccessBoundaryPolicyBindings(
    name: Swift.String,
  ) throws -> any AsyncSequence<PolicyBinding, Swift.Error> {
    let request = SearchPrincipalAccessBoundaryPolicyBindingsRequest().with {
      $0.name = name
    }
    return try self.searchPrincipalAccessBoundaryPolicyBindings(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)
  }
}
