// 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 StoragePools
  import Foundation
  #if canImport(FoundationNetworking)
    import FoundationNetworking
  #endif
  import GoogleCloudWkt
  import GoogleCloudGax

  extension Clients {
    protocol StoragePoolsStub {
      func aggregatedList(
        request: StoragePoolsClient.AggregatedListRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.StoragePoolAggregatedList

      func delete(
        request: StoragePoolsClient.DeleteRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.Operation

      func `get`(
        request: StoragePoolsClient.GetRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.StoragePool

      func getIamPolicy(
        request: StoragePoolsClient.GetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.Policy

      func insert(
        request: StoragePoolsClient.InsertRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.Operation

      func list(
        request: StoragePoolsClient.ListRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.StoragePoolList

      func listDisks(
        request: StoragePoolsClient.ListDisksRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.StoragePoolListDisks

      func setIamPolicy(
        request: StoragePoolsClient.SetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.Policy

      func testIamPermissions(
        request: StoragePoolsClient.TestIamPermissionsRequest,
        options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.TestPermissionsResponse

      func update(
        request: StoragePoolsClient.UpdateRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.Operation

      func getOperation(
        request: ZoneOperationsClient.GetRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.Operation
    }

    class StoragePoolsTransport: StoragePoolsStub {
      let inner: GoogleCloudGax.HTTPClient

      public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
        self.inner = try GoogleCloudGax.HTTPClient(
          from: options, withDefaultEndpoint: "https://compute.googleapis.com")
      }

      public func aggregatedList(
        request: StoragePoolsClient.AggregatedListRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.StoragePoolAggregatedList {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.project as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.project' is not set or is empty")
          }
          return "/compute/v1/projects/\(pathVariable0)/aggregated/storagePools"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.filter, prefix: "filter"))
        query.append(
          contentsOf: try encoder.encode(request.includeAllScopes, prefix: "includeAllScopes"))
        query.append(contentsOf: try encoder.encode(request.maxResults, prefix: "maxResults"))
        query.append(contentsOf: try encoder.encode(request.orderBy, prefix: "orderBy"))
        query.append(contentsOf: try encoder.encode(request.pageToken, prefix: "pageToken"))
        query.append(
          contentsOf: try encoder.encode(
            request.returnPartialSuccess, prefix: "returnPartialSuccess"))
        query.append(
          contentsOf: try encoder.encode(
            request.serviceProjectNumber, prefix: "serviceProjectNumber"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudComputeV1.StoragePoolAggregatedList.self, from: data)
      }

      public func delete(
        request: StoragePoolsClient.DeleteRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.Operation {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.project as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.project' is not set or is empty")
          }
          guard let pathVariable1 = request.zone as Swift.String?, !pathVariable1.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.zone' is not set or is empty")
          }
          guard let pathVariable2 = request.storagePool as Swift.String?, !pathVariable2.isEmpty
          else {
            throw GoogleCloudGax.RequestError.binding(
              "'request.storagePool' is not set or is empty")
          }
          return
            "/compute/v1/projects/\(pathVariable0)/zones/\(pathVariable1)/storagePools/\(pathVariable2)"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.requestId, prefix: "requestId"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "DELETE"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudComputeV1.Operation.self, from: data)
      }

      public func `get`(
        request: StoragePoolsClient.GetRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.StoragePool {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.project as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.project' is not set or is empty")
          }
          guard let pathVariable1 = request.zone as Swift.String?, !pathVariable1.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.zone' is not set or is empty")
          }
          guard let pathVariable2 = request.storagePool as Swift.String?, !pathVariable2.isEmpty
          else {
            throw GoogleCloudGax.RequestError.binding(
              "'request.storagePool' is not set or is empty")
          }
          return
            "/compute/v1/projects/\(pathVariable0)/zones/\(pathVariable1)/storagePools/\(pathVariable2)"
        }()
        let query = [
          URLQueryItem(name: "$alt", value: "json")
        ]
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudComputeV1.StoragePool.self, from: data)
      }

      public func getIamPolicy(
        request: StoragePoolsClient.GetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.Policy {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.project as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.project' is not set or is empty")
          }
          guard let pathVariable1 = request.zone as Swift.String?, !pathVariable1.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.zone' is not set or is empty")
          }
          guard let pathVariable2 = request.resource as Swift.String?, !pathVariable2.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.resource' is not set or is empty")
          }
          return
            "/compute/v1/projects/\(pathVariable0)/zones/\(pathVariable1)/storagePools/\(pathVariable2)/getIamPolicy"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(
          contentsOf: try encoder.encode(
            request.optionsRequestedPolicyVersion, prefix: "optionsRequestedPolicyVersion"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudComputeV1.Policy.self, from: data)
      }

      public func insert(
        request: StoragePoolsClient.InsertRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.Operation {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.project as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.project' is not set or is empty")
          }
          guard let pathVariable1 = request.zone as Swift.String?, !pathVariable1.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.zone' is not set or is empty")
          }
          return "/compute/v1/projects/\(pathVariable0)/zones/\(pathVariable1)/storagePools"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.requestId, prefix: "requestId"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "POST"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        if let body = request.body {
          req.setValue("application/json", forHTTPHeaderField: "Content-Type")
          req.httpBody = try JSONEncoder().encode(body)
        }
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudComputeV1.Operation.self, from: data)
      }

      public func list(
        request: StoragePoolsClient.ListRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.StoragePoolList {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.project as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.project' is not set or is empty")
          }
          guard let pathVariable1 = request.zone as Swift.String?, !pathVariable1.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.zone' is not set or is empty")
          }
          return "/compute/v1/projects/\(pathVariable0)/zones/\(pathVariable1)/storagePools"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.filter, prefix: "filter"))
        query.append(contentsOf: try encoder.encode(request.maxResults, prefix: "maxResults"))
        query.append(contentsOf: try encoder.encode(request.orderBy, prefix: "orderBy"))
        query.append(contentsOf: try encoder.encode(request.pageToken, prefix: "pageToken"))
        query.append(
          contentsOf: try encoder.encode(
            request.returnPartialSuccess, prefix: "returnPartialSuccess"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudComputeV1.StoragePoolList.self, from: data)
      }

      public func listDisks(
        request: StoragePoolsClient.ListDisksRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.StoragePoolListDisks {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.project as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.project' is not set or is empty")
          }
          guard let pathVariable1 = request.zone as Swift.String?, !pathVariable1.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.zone' is not set or is empty")
          }
          guard let pathVariable2 = request.storagePool as Swift.String?, !pathVariable2.isEmpty
          else {
            throw GoogleCloudGax.RequestError.binding(
              "'request.storagePool' is not set or is empty")
          }
          return
            "/compute/v1/projects/\(pathVariable0)/zones/\(pathVariable1)/storagePools/\(pathVariable2)/listDisks"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.filter, prefix: "filter"))
        query.append(contentsOf: try encoder.encode(request.maxResults, prefix: "maxResults"))
        query.append(contentsOf: try encoder.encode(request.orderBy, prefix: "orderBy"))
        query.append(contentsOf: try encoder.encode(request.pageToken, prefix: "pageToken"))
        query.append(
          contentsOf: try encoder.encode(
            request.returnPartialSuccess, prefix: "returnPartialSuccess"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudComputeV1.StoragePoolListDisks.self, from: data)
      }

      public func setIamPolicy(
        request: StoragePoolsClient.SetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.Policy {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.project as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.project' is not set or is empty")
          }
          guard let pathVariable1 = request.zone as Swift.String?, !pathVariable1.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.zone' is not set or is empty")
          }
          guard let pathVariable2 = request.resource as Swift.String?, !pathVariable2.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.resource' is not set or is empty")
          }
          return
            "/compute/v1/projects/\(pathVariable0)/zones/\(pathVariable1)/storagePools/\(pathVariable2)/setIamPolicy"
        }()
        let query = [
          URLQueryItem(name: "$alt", value: "json")
        ]
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "POST"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        if let body = request.body {
          req.setValue("application/json", forHTTPHeaderField: "Content-Type")
          req.httpBody = try JSONEncoder().encode(body)
        }
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudComputeV1.Policy.self, from: data)
      }

      public func testIamPermissions(
        request: StoragePoolsClient.TestIamPermissionsRequest,
        options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.TestPermissionsResponse {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.project as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.project' is not set or is empty")
          }
          guard let pathVariable1 = request.zone as Swift.String?, !pathVariable1.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.zone' is not set or is empty")
          }
          guard let pathVariable2 = request.resource as Swift.String?, !pathVariable2.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.resource' is not set or is empty")
          }
          return
            "/compute/v1/projects/\(pathVariable0)/zones/\(pathVariable1)/storagePools/\(pathVariable2)/testIamPermissions"
        }()
        let query = [
          URLQueryItem(name: "$alt", value: "json")
        ]
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "POST"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        if let body = request.body {
          req.setValue("application/json", forHTTPHeaderField: "Content-Type")
          req.httpBody = try JSONEncoder().encode(body)
        }
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudComputeV1.TestPermissionsResponse.self, from: data)
      }

      public func update(
        request: StoragePoolsClient.UpdateRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.Operation {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.project as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.project' is not set or is empty")
          }
          guard let pathVariable1 = request.zone as Swift.String?, !pathVariable1.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.zone' is not set or is empty")
          }
          guard let pathVariable2 = request.storagePool as Swift.String?, !pathVariable2.isEmpty
          else {
            throw GoogleCloudGax.RequestError.binding(
              "'request.storagePool' is not set or is empty")
          }
          return
            "/compute/v1/projects/\(pathVariable0)/zones/\(pathVariable1)/storagePools/\(pathVariable2)"
        }()
        var query = [
          URLQueryItem(name: "$alt", value: "json")
        ]
        let encoder = GoogleCloudGax.QueryParameterEncoder()
        query.append(contentsOf: try encoder.encode(request.requestId, prefix: "requestId"))
        query.append(contentsOf: try encoder.encode(request.updateMask, prefix: "updateMask"))
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "PATCH"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        if let body = request.body {
          req.setValue("application/json", forHTTPHeaderField: "Content-Type")
          req.httpBody = try JSONEncoder().encode(body)
        }
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudComputeV1.Operation.self, from: data)
      }

      public func getOperation(
        request: ZoneOperationsClient.GetRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.Operation {
        let path = try { () throws -> Swift.String in
          guard let pathVariable0 = request.project as Swift.String?, !pathVariable0.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.project' is not set or is empty")
          }
          guard let pathVariable1 = request.zone as Swift.String?, !pathVariable1.isEmpty else {
            throw GoogleCloudGax.RequestError.binding("'request.zone' is not set or is empty")
          }
          guard let pathVariable2 = request.operation as Swift.String?, !pathVariable2.isEmpty
          else {
            throw GoogleCloudGax.RequestError.binding("'request.operation' is not set or is empty")
          }
          return
            "/compute/v1/projects/\(pathVariable0)/zones/\(pathVariable1)/operations/\(pathVariable2)"
        }()
        let query = [
          URLQueryItem(name: "$alt", value: "json")
        ]
        var req = try await self.inner.Request(path: path, query: query)
        req.httpMethod = "GET"
        req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
        let (data, _) = try await self.inner.rpc(for: req).get()
        return try GoogleCloudWkt._ProtoJSONDecoder().decode(
          GoogleCloudComputeV1.Operation.self, from: data)
      }
    }
  }
#endif
