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

#if Projects
  import Foundation
  #if canImport(FoundationNetworking)
    import FoundationNetworking
  #endif
  import GoogleCloudWkt
  import GoogleCloudGax
  import struct Logging.Logger

  extension Clients {
    final class ProjectsLogging: ProjectsStub {
      let inner: any ProjectsStub
      let logger: Logger

      public init(_ inner: any ProjectsStub, logger: Logger) {
        var logger = logger
        logger[metadataKey: "gcp.artifact.id"] = "google-cloud-compute-v1"
        logger[metadataKey: "gcp.client.service"] = "compute"
        logger[metadataKey: "gcp.experimental.swift.client"] = "Projects"
        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 disableXpnHost(
        request: ProjectsClient.DisableXpnHostRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.Operation {
        try await self._intercept(
          request: request,
          options: options,
          name: "disableXpnHost",
          action: {
            (r: ProjectsClient.DisableXpnHostRequest, o: GoogleCloudGax.RequestOptions) async throws
              -> GoogleCloudComputeV1.Operation
            in
            return try await self.inner.disableXpnHost(request: r, options: o)
          })
      }

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

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

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

      public func `get`(
        request: ProjectsClient.GetRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.Project {
        try await self._intercept(
          request: request,
          options: options,
          name: "`get`",
          action: {
            (r: ProjectsClient.GetRequest, o: GoogleCloudGax.RequestOptions) async throws
              -> GoogleCloudComputeV1.Project
            in
            return try await self.inner.`get`(request: r, options: o)
          })
      }

      public func getXpnHost(
        request: ProjectsClient.GetXpnHostRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.Project {
        try await self._intercept(
          request: request,
          options: options,
          name: "getXpnHost",
          action: {
            (r: ProjectsClient.GetXpnHostRequest, o: GoogleCloudGax.RequestOptions) async throws
              -> GoogleCloudComputeV1.Project
            in
            return try await self.inner.getXpnHost(request: r, options: o)
          })
      }

      public func getXpnResources(
        request: ProjectsClient.GetXpnResourcesRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.ProjectsGetXpnResources {
        try await self._intercept(
          request: request,
          options: options,
          name: "getXpnResources",
          action: {
            (r: ProjectsClient.GetXpnResourcesRequest, o: GoogleCloudGax.RequestOptions)
              async throws -> GoogleCloudComputeV1.ProjectsGetXpnResources
            in
            return try await self.inner.getXpnResources(request: r, options: o)
          })
      }

      public func listXpnHosts(
        request: ProjectsClient.ListXpnHostsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.XpnHostList {
        try await self._intercept(
          request: request,
          options: options,
          name: "listXpnHosts",
          action: {
            (r: ProjectsClient.ListXpnHostsRequest, o: GoogleCloudGax.RequestOptions) async throws
              -> GoogleCloudComputeV1.XpnHostList
            in
            return try await self.inner.listXpnHosts(request: r, options: o)
          })
      }

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

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

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

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

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

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

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