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

/// APIs for Identity-Aware Proxy Admin configurations.
///
/// @Snippet(path: "IdentityAwareProxyAdminServiceQuickstart")
public class IdentityAwareProxyAdminServiceClient: Clients.IdentityAwareProxyAdminServiceProtocol {
  let inner: any Clients.IdentityAwareProxyAdminServiceStub

  /// Creates a new `IdentityAwareProxyAdminServiceClient` instance.
  public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
    var inner: any Clients.IdentityAwareProxyAdminServiceStub =
      try Clients.IdentityAwareProxyAdminServiceTransport(options)
    inner = Clients.IdentityAwareProxyAdminServiceRetry(inner, options: options)
    if let logger = options.logger {
      inner = Clients.IdentityAwareProxyAdminServiceLogging(inner, logger: logger)
    }
    self.inner = inner
  }

  /// Sets the access control policy for an Identity-Aware Proxy protected
  /// resource. Replaces any existing policy.
  /// More information about managing access via IAP can be found at:
  /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
  ///
  /// @Snippet(path: "IdentityAwareProxyAdminService_SetIamPolicy")
  public func setIamPolicy(
    request: GoogleIAMV1.SetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV1.Policy {
    try await self.inner.setIamPolicy(request: request, options: options)
  }

  /// Gets the access control policy for an Identity-Aware Proxy protected
  /// resource.
  /// More information about managing access via IAP can be found at:
  /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
  ///
  /// @Snippet(path: "IdentityAwareProxyAdminService_GetIamPolicy")
  public func getIamPolicy(
    request: GoogleIAMV1.GetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV1.Policy {
    try await self.inner.getIamPolicy(request: request, options: options)
  }

  /// Returns permissions that a caller has on the Identity-Aware Proxy protected
  /// resource.
  /// More information about managing access via IAP can be found at:
  /// https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
  ///
  /// @Snippet(path: "IdentityAwareProxyAdminService_TestIamPermissions")
  public func testIamPermissions(
    request: GoogleIAMV1.TestIamPermissionsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleIAMV1.TestIamPermissionsResponse {
    try await self.inner.testIamPermissions(request: request, options: options)
  }

  /// Gets the IAP settings on a particular IAP protected resource.
  ///
  /// @Snippet(path: "IdentityAwareProxyAdminService_GetIapSettings")
  public func getIapSettings(
    request: GetIapSettingsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudIAPV1.IapSettings {
    try await self.inner.getIapSettings(request: request, options: options)
  }

  /// Updates the IAP settings on a particular IAP protected resource. It
  /// replaces all fields unless the `update_mask` is set.
  ///
  /// @Snippet(path: "IdentityAwareProxyAdminService_UpdateIapSettings")
  public func updateIapSettings(
    request: UpdateIapSettingsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudIAPV1.IapSettings {
    try await self.inner.updateIapSettings(request: request, options: options)
  }

  /// Validates that a given CEL expression conforms to IAP restrictions.
  ///
  /// @Snippet(path: "IdentityAwareProxyAdminService_ValidateIapAttributeExpression")
  public func validateIapAttributeExpression(
    request: ValidateIapAttributeExpressionRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudIAPV1.ValidateIapAttributeExpressionResponse {
    try await self.inner.validateIapAttributeExpression(request: request, options: options)
  }

  /// Lists the existing TunnelDestGroups. To group across all locations, use a
  /// `-` as the location ID. For example:
  /// `/v1/projects/123/iap_tunnel/locations/-/destGroups`
  ///
  /// @Snippet(path: "IdentityAwareProxyAdminService_ListTunnelDestGroups")
  public func listTunnelDestGroups(
    request: ListTunnelDestGroupsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudIAPV1.ListTunnelDestGroupsResponse {
    try await self.inner.listTunnelDestGroups(request: request, options: options)
  }

  /// Lists the existing TunnelDestGroups. To group across all locations, use a
  /// `-` as the location ID. For example:
  /// `/v1/projects/123/iap_tunnel/locations/-/destGroups`
  ///
  /// @Snippet(path: "IdentityAwareProxyAdminService_ListTunnelDestGroups")
  public func listTunnelDestGroups(
    byItem: ListTunnelDestGroupsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<TunnelDestGroup, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudIAPV1.ListTunnelDestGroupsResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listTunnelDestGroups(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Creates a new TunnelDestGroup.
  ///
  /// @Snippet(path: "IdentityAwareProxyAdminService_CreateTunnelDestGroup")
  public func createTunnelDestGroup(
    request: CreateTunnelDestGroupRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudIAPV1.TunnelDestGroup {
    try await self.inner.createTunnelDestGroup(request: request, options: options)
  }

  /// Retrieves an existing TunnelDestGroup.
  ///
  /// @Snippet(path: "IdentityAwareProxyAdminService_GetTunnelDestGroup")
  public func getTunnelDestGroup(
    request: GetTunnelDestGroupRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudIAPV1.TunnelDestGroup {
    try await self.inner.getTunnelDestGroup(request: request, options: options)
  }

  /// Deletes a TunnelDestGroup.
  ///
  /// @Snippet(path: "IdentityAwareProxyAdminService_DeleteTunnelDestGroup")
  public func deleteTunnelDestGroup(
    request: DeleteTunnelDestGroupRequest, options: GoogleCloudGax.RequestOptions
  ) async throws {
    try await self.inner.deleteTunnelDestGroup(request: request, options: options)
  }

  /// Updates a TunnelDestGroup.
  ///
  /// @Snippet(path: "IdentityAwareProxyAdminService_UpdateTunnelDestGroup")
  public func updateTunnelDestGroup(
    request: UpdateTunnelDestGroupRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudIAPV1.TunnelDestGroup {
    try await self.inner.updateTunnelDestGroup(request: request, options: options)
  }
}

extension Clients {
  /// A Swift protocol to mock `IdentityAwareProxyAdminServiceClient`.
  ///
  /// To mock `IdentityAwareProxyAdminServiceClient` change your functions to receive
  /// `some IdentityAwareProxyAdminServiceProtocol` or `any IdentityAwareProxyAdminServiceProtocol`
  /// and pass a mock implementation in your tests.
  public protocol IdentityAwareProxyAdminServiceProtocol {
    /// See `IdentityAwareProxyAdminServiceClient.setIamPolicy`.
    func setIamPolicy(request: GoogleIAMV1.SetIamPolicyRequest) async throws -> GoogleIAMV1.Policy

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

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

    /// See `IdentityAwareProxyAdminServiceClient.getIapSettings`.
    func getIapSettings(request: GetIapSettingsRequest) async throws -> GoogleCloudIAPV1.IapSettings

    /// See `IdentityAwareProxyAdminServiceClient.updateIapSettings`.
    func updateIapSettings(request: UpdateIapSettingsRequest) async throws
      -> GoogleCloudIAPV1.IapSettings

    /// See `IdentityAwareProxyAdminServiceClient.validateIapAttributeExpression`.
    func validateIapAttributeExpression(request: ValidateIapAttributeExpressionRequest) async throws
      -> GoogleCloudIAPV1.ValidateIapAttributeExpressionResponse

    /// See `IdentityAwareProxyAdminServiceClient.listTunnelDestGroups`.
    func listTunnelDestGroups(request: ListTunnelDestGroupsRequest) async throws
      -> GoogleCloudIAPV1.ListTunnelDestGroupsResponse

    /// See `IdentityAwareProxyAdminServiceClient.listTunnelDestGroups`.
    func listTunnelDestGroups(
      byItem: ListTunnelDestGroupsRequest
    ) throws -> any AsyncSequence<TunnelDestGroup, Swift.Error>

    /// See `IdentityAwareProxyAdminServiceClient.listTunnelDestGroups`.
    func listTunnelDestGroups(
      parent: Swift.String,
    ) throws -> any AsyncSequence<TunnelDestGroup, Swift.Error>

    /// See `IdentityAwareProxyAdminServiceClient.createTunnelDestGroup`.
    func createTunnelDestGroup(request: CreateTunnelDestGroupRequest) async throws
      -> GoogleCloudIAPV1.TunnelDestGroup

    /// See `IdentityAwareProxyAdminServiceClient.createTunnelDestGroup`.
    func createTunnelDestGroup(
      parent: Swift.String,
      tunnelDestGroup: TunnelDestGroup?,
      tunnelDestGroupId: Swift.String,
    ) async throws -> GoogleCloudIAPV1.TunnelDestGroup

    /// See `IdentityAwareProxyAdminServiceClient.getTunnelDestGroup`.
    func getTunnelDestGroup(request: GetTunnelDestGroupRequest) async throws
      -> GoogleCloudIAPV1.TunnelDestGroup

    /// See `IdentityAwareProxyAdminServiceClient.getTunnelDestGroup`.
    func getTunnelDestGroup(
      name: Swift.String,
    ) async throws -> GoogleCloudIAPV1.TunnelDestGroup

    /// See `IdentityAwareProxyAdminServiceClient.deleteTunnelDestGroup`.
    func deleteTunnelDestGroup(request: DeleteTunnelDestGroupRequest) async throws

    /// See `IdentityAwareProxyAdminServiceClient.deleteTunnelDestGroup`.
    func deleteTunnelDestGroup(
      name: Swift.String,
    ) async throws

    /// See `IdentityAwareProxyAdminServiceClient.updateTunnelDestGroup`.
    func updateTunnelDestGroup(request: UpdateTunnelDestGroupRequest) async throws
      -> GoogleCloudIAPV1.TunnelDestGroup

    /// See `IdentityAwareProxyAdminServiceClient.updateTunnelDestGroup`.
    func updateTunnelDestGroup(
      tunnelDestGroup: TunnelDestGroup?,
      updateMask: GoogleCloudWkt.FieldMask?,
    ) async throws -> GoogleCloudIAPV1.TunnelDestGroup

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

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

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

    /// See `IdentityAwareProxyAdminServiceClient.getIapSettings`.
    func getIapSettings(
      request: GetIapSettingsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudIAPV1.IapSettings

    /// See `IdentityAwareProxyAdminServiceClient.updateIapSettings`.
    func updateIapSettings(
      request: UpdateIapSettingsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudIAPV1.IapSettings

    /// See `IdentityAwareProxyAdminServiceClient.validateIapAttributeExpression`.
    func validateIapAttributeExpression(
      request: ValidateIapAttributeExpressionRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudIAPV1.ValidateIapAttributeExpressionResponse

    /// See `IdentityAwareProxyAdminServiceClient.listTunnelDestGroups`.
    func listTunnelDestGroups(
      request: ListTunnelDestGroupsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudIAPV1.ListTunnelDestGroupsResponse

    /// See `IdentityAwareProxyAdminServiceClient.listTunnelDestGroups`.
    func listTunnelDestGroups(
      byItem: ListTunnelDestGroupsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<TunnelDestGroup, Swift.Error>

    /// See `IdentityAwareProxyAdminServiceClient.createTunnelDestGroup`.
    func createTunnelDestGroup(
      request: CreateTunnelDestGroupRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudIAPV1.TunnelDestGroup

    /// See `IdentityAwareProxyAdminServiceClient.getTunnelDestGroup`.
    func getTunnelDestGroup(
      request: GetTunnelDestGroupRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudIAPV1.TunnelDestGroup

    /// See `IdentityAwareProxyAdminServiceClient.deleteTunnelDestGroup`.
    func deleteTunnelDestGroup(
      request: DeleteTunnelDestGroupRequest, options: GoogleCloudGax.RequestOptions
    ) async throws

    /// See `IdentityAwareProxyAdminServiceClient.updateTunnelDestGroup`.
    func updateTunnelDestGroup(
      request: UpdateTunnelDestGroupRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudIAPV1.TunnelDestGroup
  }
}

// Default implementations
extension Clients.IdentityAwareProxyAdminServiceProtocol {
  public func setIamPolicy(request: GoogleIAMV1.SetIamPolicyRequest) async throws
    -> GoogleIAMV1.Policy
  {
    try await self.setIamPolicy(request: request, options: .init())
  }

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

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

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

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

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

  public func getIapSettings(request: GetIapSettingsRequest) async throws
    -> GoogleCloudIAPV1.IapSettings
  {
    try await self.getIapSettings(request: request, options: .init())
  }

  public func getIapSettings(
    request: GetIapSettingsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudIAPV1.IapSettings {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func updateIapSettings(request: UpdateIapSettingsRequest) async throws
    -> GoogleCloudIAPV1.IapSettings
  {
    try await self.updateIapSettings(request: request, options: .init())
  }

  public func updateIapSettings(
    request: UpdateIapSettingsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudIAPV1.IapSettings {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func validateIapAttributeExpression(request: ValidateIapAttributeExpressionRequest)
    async throws -> GoogleCloudIAPV1.ValidateIapAttributeExpressionResponse
  {
    try await self.validateIapAttributeExpression(request: request, options: .init())
  }

  public func validateIapAttributeExpression(
    request: ValidateIapAttributeExpressionRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudIAPV1.ValidateIapAttributeExpressionResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listTunnelDestGroups(request: ListTunnelDestGroupsRequest) async throws
    -> GoogleCloudIAPV1.ListTunnelDestGroupsResponse
  {
    try await self.listTunnelDestGroups(request: request, options: .init())
  }

  public func listTunnelDestGroups(
    request: ListTunnelDestGroupsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudIAPV1.ListTunnelDestGroupsResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listTunnelDestGroups(
    byItem: ListTunnelDestGroupsRequest
  ) throws -> any AsyncSequence<TunnelDestGroup, Swift.Error> {
    try self.listTunnelDestGroups(byItem: byItem, options: .init())
  }

  public func listTunnelDestGroups(
    byItem: ListTunnelDestGroupsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<TunnelDestGroup, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudIAPV1.ListTunnelDestGroupsResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

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

  public func createTunnelDestGroup(request: CreateTunnelDestGroupRequest) async throws
    -> GoogleCloudIAPV1.TunnelDestGroup
  {
    try await self.createTunnelDestGroup(request: request, options: .init())
  }

  public func createTunnelDestGroup(
    request: CreateTunnelDestGroupRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudIAPV1.TunnelDestGroup {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func createTunnelDestGroup(
    parent: Swift.String,
    tunnelDestGroup: TunnelDestGroup?,
    tunnelDestGroupId: Swift.String,
  ) async throws -> GoogleCloudIAPV1.TunnelDestGroup {
    let request = CreateTunnelDestGroupRequest().with {
      $0.parent = parent
      $0.tunnelDestGroup = tunnelDestGroup
      $0.tunnelDestGroupId = tunnelDestGroupId
    }
    return try await self.createTunnelDestGroup(request: request)
  }

  public func getTunnelDestGroup(request: GetTunnelDestGroupRequest) async throws
    -> GoogleCloudIAPV1.TunnelDestGroup
  {
    try await self.getTunnelDestGroup(request: request, options: .init())
  }

  public func getTunnelDestGroup(
    request: GetTunnelDestGroupRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudIAPV1.TunnelDestGroup {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getTunnelDestGroup(
    name: Swift.String,
  ) async throws -> GoogleCloudIAPV1.TunnelDestGroup {
    let request = GetTunnelDestGroupRequest().with {
      $0.name = name
    }
    return try await self.getTunnelDestGroup(request: request)
  }

  public func deleteTunnelDestGroup(request: DeleteTunnelDestGroupRequest) async throws {
    try await self.deleteTunnelDestGroup(request: request, options: .init())
  }

  public func deleteTunnelDestGroup(
    request: DeleteTunnelDestGroupRequest, options: GoogleCloudGax.RequestOptions
  ) async throws {
    throw GoogleCloudGax.RequestError.unimplemented
  }

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

  public func updateTunnelDestGroup(request: UpdateTunnelDestGroupRequest) async throws
    -> GoogleCloudIAPV1.TunnelDestGroup
  {
    try await self.updateTunnelDestGroup(request: request, options: .init())
  }

  public func updateTunnelDestGroup(
    request: UpdateTunnelDestGroupRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudIAPV1.TunnelDestGroup {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func updateTunnelDestGroup(
    tunnelDestGroup: TunnelDestGroup?,
    updateMask: GoogleCloudWkt.FieldMask?,
  ) async throws -> GoogleCloudIAPV1.TunnelDestGroup {
    let request = UpdateTunnelDestGroupRequest().with {
      $0.tunnelDestGroup = tunnelDestGroup
      $0.updateMask = updateMask
    }
    return try await self.updateTunnelDestGroup(request: request)
  }
}
