// 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 Routers
  import Foundation
  #if canImport(FoundationNetworking)
    import FoundationNetworking
  #endif
  import GoogleCloudWkt
  import GoogleCloudGax
  import struct Logging.Logger

  extension Clients {
    final class RoutersLogging: RoutersStub {
      let inner: any RoutersStub
      let logger: Logger

      public init(_ inner: any RoutersStub, 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"] = "Routers"
        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 aggregatedList(
        request: RoutersClient.AggregatedListRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.RouterAggregatedList {
        try await self._intercept(
          request: request,
          options: options,
          name: "aggregatedList",
          action: {
            (r: RoutersClient.AggregatedListRequest, o: GoogleCloudGax.RequestOptions) async throws
              -> GoogleCloudComputeV1.RouterAggregatedList
            in
            return try await self.inner.aggregatedList(request: r, options: o)
          })
      }

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

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

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

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

      public func getNamedSet(
        request: RoutersClient.GetNamedSetRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.RoutersGetNamedSetResponse {
        try await self._intercept(
          request: request,
          options: options,
          name: "getNamedSet",
          action: {
            (r: RoutersClient.GetNamedSetRequest, o: GoogleCloudGax.RequestOptions) async throws
              -> GoogleCloudComputeV1.RoutersGetNamedSetResponse
            in
            return try await self.inner.getNamedSet(request: r, options: o)
          })
      }

      public func getNatIpInfo(
        request: RoutersClient.GetNatIpInfoRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.NatIpInfoResponse {
        try await self._intercept(
          request: request,
          options: options,
          name: "getNatIpInfo",
          action: {
            (r: RoutersClient.GetNatIpInfoRequest, o: GoogleCloudGax.RequestOptions) async throws
              -> GoogleCloudComputeV1.NatIpInfoResponse
            in
            return try await self.inner.getNatIpInfo(request: r, options: o)
          })
      }

      public func getNatMappingInfo(
        request: RoutersClient.GetNatMappingInfoRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.VmEndpointNatMappingsList {
        try await self._intercept(
          request: request,
          options: options,
          name: "getNatMappingInfo",
          action: {
            (r: RoutersClient.GetNatMappingInfoRequest, o: GoogleCloudGax.RequestOptions)
              async throws -> GoogleCloudComputeV1.VmEndpointNatMappingsList
            in
            return try await self.inner.getNatMappingInfo(request: r, options: o)
          })
      }

      public func getRoutePolicy(
        request: RoutersClient.GetRoutePolicyRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.RoutersGetRoutePolicyResponse {
        try await self._intercept(
          request: request,
          options: options,
          name: "getRoutePolicy",
          action: {
            (r: RoutersClient.GetRoutePolicyRequest, o: GoogleCloudGax.RequestOptions) async throws
              -> GoogleCloudComputeV1.RoutersGetRoutePolicyResponse
            in
            return try await self.inner.getRoutePolicy(request: r, options: o)
          })
      }

      public func getRouterStatus(
        request: RoutersClient.GetRouterStatusRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.RouterStatusResponse {
        try await self._intercept(
          request: request,
          options: options,
          name: "getRouterStatus",
          action: {
            (r: RoutersClient.GetRouterStatusRequest, o: GoogleCloudGax.RequestOptions) async throws
              -> GoogleCloudComputeV1.RouterStatusResponse
            in
            return try await self.inner.getRouterStatus(request: r, options: o)
          })
      }

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

      public func list(
        request: RoutersClient.ListRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.RouterList {
        try await self._intercept(
          request: request,
          options: options,
          name: "list",
          action: {
            (r: RoutersClient.ListRequest, o: GoogleCloudGax.RequestOptions) async throws
              -> GoogleCloudComputeV1.RouterList
            in
            return try await self.inner.list(request: r, options: o)
          })
      }

      public func listBgpRoutes(
        request: RoutersClient.ListBgpRoutesRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.RoutersListBgpRoutes {
        try await self._intercept(
          request: request,
          options: options,
          name: "listBgpRoutes",
          action: {
            (r: RoutersClient.ListBgpRoutesRequest, o: GoogleCloudGax.RequestOptions) async throws
              -> GoogleCloudComputeV1.RoutersListBgpRoutes
            in
            return try await self.inner.listBgpRoutes(request: r, options: o)
          })
      }

      public func listNamedSets(
        request: RoutersClient.ListNamedSetsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.RoutersListNamedSets {
        try await self._intercept(
          request: request,
          options: options,
          name: "listNamedSets",
          action: {
            (r: RoutersClient.ListNamedSetsRequest, o: GoogleCloudGax.RequestOptions) async throws
              -> GoogleCloudComputeV1.RoutersListNamedSets
            in
            return try await self.inner.listNamedSets(request: r, options: o)
          })
      }

      public func listRoutePolicies(
        request: RoutersClient.ListRoutePoliciesRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.RoutersListRoutePolicies {
        try await self._intercept(
          request: request,
          options: options,
          name: "listRoutePolicies",
          action: {
            (r: RoutersClient.ListRoutePoliciesRequest, o: GoogleCloudGax.RequestOptions)
              async throws -> GoogleCloudComputeV1.RoutersListRoutePolicies
            in
            return try await self.inner.listRoutePolicies(request: r, options: o)
          })
      }

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

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

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

      public func preview(
        request: RoutersClient.PreviewRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.RoutersPreviewResponse {
        try await self._intercept(
          request: request,
          options: options,
          name: "preview",
          action: {
            (r: RoutersClient.PreviewRequest, o: GoogleCloudGax.RequestOptions) async throws
              -> GoogleCloudComputeV1.RoutersPreviewResponse
            in
            return try await self.inner.preview(request: r, options: o)
          })
      }

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

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

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

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