// 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 GoogleLongRunning
import GoogleRpc
import GoogleCloudGax

extension Clients {
  final class AzureClustersRetry: AzureClustersStub {
    let inner: any AzureClustersStub
    let options: GoogleCloudGax.ClientOptions

    public init(_ inner: any AzureClustersStub, options: GoogleCloudGax.ClientOptions) {
      self.inner = inner
      self.options = options
    }

    func _intercept<Input, Output>(
      request: Input,
      options: GoogleCloudGax.RequestOptions,
      idempotent: Swift.Bool,
      action: (Input, GoogleCloudGax.RequestOptions) async throws -> Output,
    ) async throws -> Output {
      let loop = GoogleCloudGax._RetryLoop(
        options: options, withDefault: self.options, idempotent: idempotent,
      )
      let attempt = { (attemptTimeout: Swift.Duration?) async throws -> Output in
        var attemptOptions = options
        attemptOptions.attemptTimeout = attemptTimeout
        return try await action(request, attemptOptions)
      }
      return try await loop.run(attempt: attempt)
    }

    public func createAzureClient(
      request: CreateAzureClientRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        idempotent: false,
        action: {
          (r: CreateAzureClientRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.createAzureClient(request: r, options: o)
        })
    }

    public func getAzureClient(
      request: GetAzureClientRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKEMultiCloudV1.AzureClient {
      try await self._intercept(
        request: request,
        options: options,
        idempotent: true,
        action: {
          (r: GetAzureClientRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudGKEMultiCloudV1.AzureClient
          in
          return try await self.inner.getAzureClient(request: r, options: o)
        })
    }

    public func listAzureClients(
      request: ListAzureClientsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKEMultiCloudV1.ListAzureClientsResponse {
      try await self._intercept(
        request: request,
        options: options,
        idempotent: true,
        action: {
          (r: ListAzureClientsRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudGKEMultiCloudV1.ListAzureClientsResponse
          in
          return try await self.inner.listAzureClients(request: r, options: o)
        })
    }

    public func deleteAzureClient(
      request: DeleteAzureClientRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        idempotent: false,
        action: {
          (r: DeleteAzureClientRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.deleteAzureClient(request: r, options: o)
        })
    }

    public func createAzureCluster(
      request: CreateAzureClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        idempotent: false,
        action: {
          (r: CreateAzureClusterRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.createAzureCluster(request: r, options: o)
        })
    }

    public func updateAzureCluster(
      request: UpdateAzureClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        idempotent: false,
        action: {
          (r: UpdateAzureClusterRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.updateAzureCluster(request: r, options: o)
        })
    }

    public func getAzureCluster(
      request: GetAzureClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKEMultiCloudV1.AzureCluster {
      try await self._intercept(
        request: request,
        options: options,
        idempotent: true,
        action: {
          (r: GetAzureClusterRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudGKEMultiCloudV1.AzureCluster
          in
          return try await self.inner.getAzureCluster(request: r, options: o)
        })
    }

    public func listAzureClusters(
      request: ListAzureClustersRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKEMultiCloudV1.ListAzureClustersResponse {
      try await self._intercept(
        request: request,
        options: options,
        idempotent: true,
        action: {
          (r: ListAzureClustersRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudGKEMultiCloudV1.ListAzureClustersResponse
          in
          return try await self.inner.listAzureClusters(request: r, options: o)
        })
    }

    public func deleteAzureCluster(
      request: DeleteAzureClusterRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        idempotent: false,
        action: {
          (r: DeleteAzureClusterRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.deleteAzureCluster(request: r, options: o)
        })
    }

    public func generateAzureClusterAgentToken(
      request: GenerateAzureClusterAgentTokenRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKEMultiCloudV1.GenerateAzureClusterAgentTokenResponse {
      try await self._intercept(
        request: request,
        options: options,
        idempotent: false,
        action: {
          (r: GenerateAzureClusterAgentTokenRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudGKEMultiCloudV1.GenerateAzureClusterAgentTokenResponse
          in
          return try await self.inner.generateAzureClusterAgentToken(request: r, options: o)
        })
    }

    public func generateAzureAccessToken(
      request: GenerateAzureAccessTokenRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKEMultiCloudV1.GenerateAzureAccessTokenResponse {
      try await self._intercept(
        request: request,
        options: options,
        idempotent: true,
        action: {
          (r: GenerateAzureAccessTokenRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudGKEMultiCloudV1.GenerateAzureAccessTokenResponse
          in
          return try await self.inner.generateAzureAccessToken(request: r, options: o)
        })
    }

    public func createAzureNodePool(
      request: CreateAzureNodePoolRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        idempotent: false,
        action: {
          (r: CreateAzureNodePoolRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.createAzureNodePool(request: r, options: o)
        })
    }

    public func updateAzureNodePool(
      request: UpdateAzureNodePoolRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        idempotent: false,
        action: {
          (r: UpdateAzureNodePoolRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.updateAzureNodePool(request: r, options: o)
        })
    }

    public func getAzureNodePool(
      request: GetAzureNodePoolRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKEMultiCloudV1.AzureNodePool {
      try await self._intercept(
        request: request,
        options: options,
        idempotent: true,
        action: {
          (r: GetAzureNodePoolRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudGKEMultiCloudV1.AzureNodePool
          in
          return try await self.inner.getAzureNodePool(request: r, options: o)
        })
    }

    public func listAzureNodePools(
      request: ListAzureNodePoolsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKEMultiCloudV1.ListAzureNodePoolsResponse {
      try await self._intercept(
        request: request,
        options: options,
        idempotent: true,
        action: {
          (r: ListAzureNodePoolsRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudGKEMultiCloudV1.ListAzureNodePoolsResponse
          in
          return try await self.inner.listAzureNodePools(request: r, options: o)
        })
    }

    public func deleteAzureNodePool(
      request: DeleteAzureNodePoolRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        idempotent: false,
        action: {
          (r: DeleteAzureNodePoolRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.deleteAzureNodePool(request: r, options: o)
        })
    }

    public func getAzureOpenIdConfig(
      request: GetAzureOpenIdConfigRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKEMultiCloudV1.AzureOpenIdConfig {
      try await self._intercept(
        request: request,
        options: options,
        idempotent: true,
        action: {
          (r: GetAzureOpenIdConfigRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudGKEMultiCloudV1.AzureOpenIdConfig
          in
          return try await self.inner.getAzureOpenIdConfig(request: r, options: o)
        })
    }

    public func getAzureJsonWebKeys(
      request: GetAzureJsonWebKeysRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKEMultiCloudV1.AzureJsonWebKeys {
      try await self._intercept(
        request: request,
        options: options,
        idempotent: true,
        action: {
          (r: GetAzureJsonWebKeysRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudGKEMultiCloudV1.AzureJsonWebKeys
          in
          return try await self.inner.getAzureJsonWebKeys(request: r, options: o)
        })
    }

    public func getAzureServerConfig(
      request: GetAzureServerConfigRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKEMultiCloudV1.AzureServerConfig {
      try await self._intercept(
        request: request,
        options: options,
        idempotent: true,
        action: {
          (r: GetAzureServerConfigRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudGKEMultiCloudV1.AzureServerConfig
          in
          return try await self.inner.getAzureServerConfig(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,
        idempotent: true,
        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,
        idempotent: true,
        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,
        idempotent: false,
        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,
        idempotent: false,
        action: {
          (r: GoogleLongRunning.CancelOperationRequest, o: GoogleCloudGax.RequestOptions)
            async throws -> Void in
          return try await self.inner.cancelOperation(request: r, options: o)
        })
    }
  }
}
