// 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
import struct Logging.Logger

extension Clients {
  final class BigtableInstanceAdminLogging: BigtableInstanceAdminStub {
    let inner: any BigtableInstanceAdminStub
    let logger: Logger

    public init(_ inner: any BigtableInstanceAdminStub, logger: Logger) {
      var logger = logger
      logger[metadataKey: "gcp.artifact.id"] = "google-bigtable-admin-v2"
      logger[metadataKey: "gcp.client.service"] = "bigtableadmin"
      logger[metadataKey: "gcp.experimental.swift.client"] = "BigtableInstanceAdmin"
      self.inner = inner
      self.logger = logger
    }

    func _intercept<Input, Output>(
      request: Input,
      options: GoogleCloudGax.RequestOptions,
      name: Swift.String,
      action: (Input, GoogleCloudGax.RequestOptions) async throws -> Output,
    ) async throws -> Output {
      var logger = logger
      logger[metadataKey: "gcp.experimental.swift.request.id"] = "\(UUID())"
      logger[metadataKey: "gcp.experimental.swift.method"] = .string(name)
      logger.debug("enter  : \(request) \(options)")
      do {
        let output = try await action(request, options)
        logger.debug("success: \(request) \(options) \(output)")
        return output
      } catch let error {
        logger.debug("error  : \(request) \(options) \(error)")
        throw error
      }
    }

    public func createInstance(
      request: CreateInstanceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        name: "createInstance",
        action: {
          (r: CreateInstanceRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.createInstance(request: r, options: o)
        })
    }

    public func getInstance(
      request: GetInstanceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudBigtableAdminV2.Instance {
      try await self._intercept(
        request: request,
        options: options,
        name: "getInstance",
        action: {
          (r: GetInstanceRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudBigtableAdminV2.Instance
          in
          return try await self.inner.getInstance(request: r, options: o)
        })
    }

    public func listInstances(
      request: ListInstancesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudBigtableAdminV2.ListInstancesResponse {
      try await self._intercept(
        request: request,
        options: options,
        name: "listInstances",
        action: {
          (r: ListInstancesRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudBigtableAdminV2.ListInstancesResponse
          in
          return try await self.inner.listInstances(request: r, options: o)
        })
    }

    public func updateInstance(
      request: Instance, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudBigtableAdminV2.Instance {
      try await self._intercept(
        request: request,
        options: options,
        name: "updateInstance",
        action: {
          (r: Instance, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudBigtableAdminV2.Instance
          in
          return try await self.inner.updateInstance(request: r, options: o)
        })
    }

    public func partialUpdateInstance(
      request: PartialUpdateInstanceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        name: "partialUpdateInstance",
        action: {
          (r: PartialUpdateInstanceRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.partialUpdateInstance(request: r, options: o)
        })
    }

    public func deleteInstance(
      request: DeleteInstanceRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      try await self._intercept(
        request: request,
        options: options,
        name: "deleteInstance",
        action: {
          (r: DeleteInstanceRequest, o: GoogleCloudGax.RequestOptions) async throws -> Void in
          return try await self.inner.deleteInstance(request: r, options: o)
        })
    }

    public func createCluster(
      request: CreateClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        name: "createCluster",
        action: {
          (r: CreateClusterRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.createCluster(request: r, options: o)
        })
    }

    public func getCluster(
      request: GetClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudBigtableAdminV2.Cluster {
      try await self._intercept(
        request: request,
        options: options,
        name: "getCluster",
        action: {
          (r: GetClusterRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudBigtableAdminV2.Cluster
          in
          return try await self.inner.getCluster(request: r, options: o)
        })
    }

    public func listClusters(
      request: ListClustersRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudBigtableAdminV2.ListClustersResponse {
      try await self._intercept(
        request: request,
        options: options,
        name: "listClusters",
        action: {
          (r: ListClustersRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudBigtableAdminV2.ListClustersResponse
          in
          return try await self.inner.listClusters(request: r, options: o)
        })
    }

    public func updateCluster(
      request: Cluster, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        name: "updateCluster",
        action: {
          (r: Cluster, o: GoogleCloudGax.RequestOptions) async throws -> GoogleLongRunning.Operation
          in
          return try await self.inner.updateCluster(request: r, options: o)
        })
    }

    public func partialUpdateCluster(
      request: PartialUpdateClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        name: "partialUpdateCluster",
        action: {
          (r: PartialUpdateClusterRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.partialUpdateCluster(request: r, options: o)
        })
    }

    public func deleteCluster(
      request: DeleteClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      try await self._intercept(
        request: request,
        options: options,
        name: "deleteCluster",
        action: {
          (r: DeleteClusterRequest, o: GoogleCloudGax.RequestOptions) async throws -> Void in
          return try await self.inner.deleteCluster(request: r, options: o)
        })
    }

    public func createAppProfile(
      request: CreateAppProfileRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudBigtableAdminV2.AppProfile {
      try await self._intercept(
        request: request,
        options: options,
        name: "createAppProfile",
        action: {
          (r: CreateAppProfileRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudBigtableAdminV2.AppProfile
          in
          return try await self.inner.createAppProfile(request: r, options: o)
        })
    }

    public func getAppProfile(
      request: GetAppProfileRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudBigtableAdminV2.AppProfile {
      try await self._intercept(
        request: request,
        options: options,
        name: "getAppProfile",
        action: {
          (r: GetAppProfileRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudBigtableAdminV2.AppProfile
          in
          return try await self.inner.getAppProfile(request: r, options: o)
        })
    }

    public func listAppProfiles(
      request: ListAppProfilesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudBigtableAdminV2.ListAppProfilesResponse {
      try await self._intercept(
        request: request,
        options: options,
        name: "listAppProfiles",
        action: {
          (r: ListAppProfilesRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudBigtableAdminV2.ListAppProfilesResponse
          in
          return try await self.inner.listAppProfiles(request: r, options: o)
        })
    }

    public func updateAppProfile(
      request: UpdateAppProfileRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        name: "updateAppProfile",
        action: {
          (r: UpdateAppProfileRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.updateAppProfile(request: r, options: o)
        })
    }

    public func deleteAppProfile(
      request: DeleteAppProfileRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      try await self._intercept(
        request: request,
        options: options,
        name: "deleteAppProfile",
        action: {
          (r: DeleteAppProfileRequest, o: GoogleCloudGax.RequestOptions) async throws -> Void in
          return try await self.inner.deleteAppProfile(request: r, options: o)
        })
    }

    public func getIamPolicy(
      request: GoogleIAMV1.GetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleIAMV1.Policy {
      try await self._intercept(
        request: request,
        options: options,
        name: "getIamPolicy",
        action: {
          (r: GoogleIAMV1.GetIamPolicyRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleIAMV1.Policy
          in
          return try await self.inner.getIamPolicy(request: r, options: o)
        })
    }

    public func setIamPolicy(
      request: GoogleIAMV1.SetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleIAMV1.Policy {
      try await self._intercept(
        request: request,
        options: options,
        name: "setIamPolicy",
        action: {
          (r: GoogleIAMV1.SetIamPolicyRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleIAMV1.Policy
          in
          return try await self.inner.setIamPolicy(request: r, options: o)
        })
    }

    public func testIamPermissions(
      request: GoogleIAMV1.TestIamPermissionsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleIAMV1.TestIamPermissionsResponse {
      try await self._intercept(
        request: request,
        options: options,
        name: "testIamPermissions",
        action: {
          (r: GoogleIAMV1.TestIamPermissionsRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleIAMV1.TestIamPermissionsResponse
          in
          return try await self.inner.testIamPermissions(request: r, options: o)
        })
    }

    public func listHotTablets(
      request: ListHotTabletsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudBigtableAdminV2.ListHotTabletsResponse {
      try await self._intercept(
        request: request,
        options: options,
        name: "listHotTablets",
        action: {
          (r: ListHotTabletsRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudBigtableAdminV2.ListHotTabletsResponse
          in
          return try await self.inner.listHotTablets(request: r, options: o)
        })
    }

    public func createLogicalView(
      request: CreateLogicalViewRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        name: "createLogicalView",
        action: {
          (r: CreateLogicalViewRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.createLogicalView(request: r, options: o)
        })
    }

    public func getLogicalView(
      request: GetLogicalViewRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudBigtableAdminV2.LogicalView {
      try await self._intercept(
        request: request,
        options: options,
        name: "getLogicalView",
        action: {
          (r: GetLogicalViewRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudBigtableAdminV2.LogicalView
          in
          return try await self.inner.getLogicalView(request: r, options: o)
        })
    }

    public func listLogicalViews(
      request: ListLogicalViewsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudBigtableAdminV2.ListLogicalViewsResponse {
      try await self._intercept(
        request: request,
        options: options,
        name: "listLogicalViews",
        action: {
          (r: ListLogicalViewsRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudBigtableAdminV2.ListLogicalViewsResponse
          in
          return try await self.inner.listLogicalViews(request: r, options: o)
        })
    }

    public func updateLogicalView(
      request: UpdateLogicalViewRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        name: "updateLogicalView",
        action: {
          (r: UpdateLogicalViewRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.updateLogicalView(request: r, options: o)
        })
    }

    public func deleteLogicalView(
      request: DeleteLogicalViewRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      try await self._intercept(
        request: request,
        options: options,
        name: "deleteLogicalView",
        action: {
          (r: DeleteLogicalViewRequest, o: GoogleCloudGax.RequestOptions) async throws -> Void in
          return try await self.inner.deleteLogicalView(request: r, options: o)
        })
    }

    public func createMaterializedView(
      request: CreateMaterializedViewRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        name: "createMaterializedView",
        action: {
          (r: CreateMaterializedViewRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.createMaterializedView(request: r, options: o)
        })
    }

    public func getMaterializedView(
      request: GetMaterializedViewRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudBigtableAdminV2.MaterializedView {
      try await self._intercept(
        request: request,
        options: options,
        name: "getMaterializedView",
        action: {
          (r: GetMaterializedViewRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudBigtableAdminV2.MaterializedView
          in
          return try await self.inner.getMaterializedView(request: r, options: o)
        })
    }

    public func listMaterializedViews(
      request: ListMaterializedViewsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudBigtableAdminV2.ListMaterializedViewsResponse {
      try await self._intercept(
        request: request,
        options: options,
        name: "listMaterializedViews",
        action: {
          (r: ListMaterializedViewsRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudBigtableAdminV2.ListMaterializedViewsResponse
          in
          return try await self.inner.listMaterializedViews(request: r, options: o)
        })
    }

    public func updateMaterializedView(
      request: UpdateMaterializedViewRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        name: "updateMaterializedView",
        action: {
          (r: UpdateMaterializedViewRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.updateMaterializedView(request: r, options: o)
        })
    }

    public func deleteMaterializedView(
      request: DeleteMaterializedViewRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      try await self._intercept(
        request: request,
        options: options,
        name: "deleteMaterializedView",
        action: {
          (r: DeleteMaterializedViewRequest, o: GoogleCloudGax.RequestOptions) async throws -> Void
          in
          return try await self.inner.deleteMaterializedView(request: r, options: o)
        })
    }

    public func listOperations(
      request: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.ListOperationsResponse {
      try await self._intercept(
        request: request,
        options: options,
        name: "listOperations",
        action: {
          (r: GoogleLongRunning.ListOperationsRequest, o: GoogleCloudGax.RequestOptions)
            async throws -> GoogleLongRunning.ListOperationsResponse
          in
          return try await self.inner.listOperations(request: r, options: o)
        })
    }

    public func getOperation(
      request: GoogleLongRunning.GetOperationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        name: "getOperation",
        action: {
          (r: GoogleLongRunning.GetOperationRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.getOperation(request: r, options: o)
        })
    }

    public func deleteOperation(
      request: GoogleLongRunning.DeleteOperationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      try await self._intercept(
        request: request,
        options: options,
        name: "deleteOperation",
        action: {
          (r: GoogleLongRunning.DeleteOperationRequest, o: GoogleCloudGax.RequestOptions)
            async throws -> Void in
          return try await self.inner.deleteOperation(request: r, options: o)
        })
    }

    public func cancelOperation(
      request: GoogleLongRunning.CancelOperationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      try await self._intercept(
        request: request,
        options: options,
        name: "cancelOperation",
        action: {
          (r: GoogleLongRunning.CancelOperationRequest, o: GoogleCloudGax.RequestOptions)
            async throws -> Void in
          return try await self.inner.cancelOperation(request: r, options: o)
        })
    }
  }
}
