All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dominodatalab.pub.rest.ComputeProvidersApi Maven / Gradle / Ivy

Go to download

Domino Data Lab API Client to connect to Domino web services using Java HTTP Client.

There is a newer version: 6.0.1.0
Show newest version
/*
 * Domino Public API
 * Domino Public API Endpoints
 *
 * The version of the OpenAPI document: 0.0.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

package com.dominodatalab.pub.rest;

import com.dominodatalab.pub.invoker.ApiClient;
import com.dominodatalab.pub.invoker.ApiException;
import com.dominodatalab.pub.invoker.ApiResponse;
import com.dominodatalab.pub.invoker.Pair;

import com.dominodatalab.pub.model.ComputeProvider;
import com.dominodatalab.pub.model.ComputeProviderCreation;
import com.dominodatalab.pub.model.ComputeProviderType;
import com.dominodatalab.pub.model.ComputeTier;
import com.dominodatalab.pub.model.ComputeTierCreation;
import com.dominodatalab.pub.model.ComputeTierFullConfiguration;
import com.dominodatalab.pub.model.FailureEnvelopeV1;
import com.dominodatalab.pub.model.GetAIGatewayAuditData400Response;
import com.dominodatalab.pub.model.PaginatedComputeTiers;
import com.dominodatalab.pub.model.PaginatedSelectableComputeTiers;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.InputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.net.http.HttpRequest;
import java.nio.channels.Channels;
import java.nio.channels.Pipe;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;

import java.util.ArrayList;
import java.util.StringJoiner;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;

@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-04T16:37:28.765500600-04:00[America/New_York]", comments = "Generator version: 7.8.0")
public class ComputeProvidersApi {
  protected final HttpClient memberVarHttpClient;
  protected final ObjectMapper memberVarObjectMapper;
  protected final String memberVarBaseUri;
  protected final Consumer memberVarInterceptor;
  protected final Duration memberVarReadTimeout;
  protected final Consumer> memberVarResponseInterceptor;
  protected final Consumer> memberVarAsyncResponseInterceptor;

  public ComputeProvidersApi() {
    this(new ApiClient());
  }

  public ComputeProvidersApi(ApiClient apiClient) {
    memberVarHttpClient = apiClient.getHttpClient();
    memberVarObjectMapper = apiClient.getObjectMapper();
    memberVarBaseUri = apiClient.getBaseUri();
    memberVarInterceptor = apiClient.getRequestInterceptor();
    memberVarReadTimeout = apiClient.getReadTimeout();
    memberVarResponseInterceptor = apiClient.getResponseInterceptor();
    memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
  }

  protected ApiException getApiException(String operationId, HttpResponse response) throws IOException {
    String body = response.body() == null ? null : new String(response.body().readAllBytes());
    String message = formatExceptionMessage(operationId, response.statusCode(), body);
    return new ApiException(response.statusCode(), message, response.headers(), body);
  }

  protected String formatExceptionMessage(String operationId, int statusCode, String body) {
    if (body == null || body.isEmpty()) {
      body = "[no body]";
    }
    return operationId + " call failed with: " + statusCode + " - " + body;
  }

  /**
   * Create a new Compute Provider
   * Create a new Compute Provider.
   * @param computeProviderCreation Details of the Compute Provider to create (required)
   * @return ComputeProvider
   * @throws ApiException if fails to make API call
   */
  public ComputeProvider createComputeProvider(ComputeProviderCreation computeProviderCreation) throws ApiException {
    ApiResponse localVarResponse = createComputeProviderWithHttpInfo(computeProviderCreation);
    return localVarResponse.getData();
  }

  /**
   * Create a new Compute Provider
   * Create a new Compute Provider.
   * @param computeProviderCreation Details of the Compute Provider to create (required)
   * @return ApiResponse<ComputeProvider>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse createComputeProviderWithHttpInfo(ComputeProviderCreation computeProviderCreation) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = createComputeProviderRequestBuilder(computeProviderCreation);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("createComputeProvider", localVarResponse);
        }
        return new ApiResponse(
          localVarResponse.statusCode(),
          localVarResponse.headers().map(),
          localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
        );
      } finally {
      }
    } catch (IOException e) {
      throw new ApiException(e);
    }
    catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new ApiException(e);
    }
  }

  protected HttpRequest.Builder createComputeProviderRequestBuilder(ComputeProviderCreation computeProviderCreation) throws ApiException {
    // verify the required parameter 'computeProviderCreation' is set
    if (computeProviderCreation == null) {
      throw new ApiException(400, "Missing the required parameter 'computeProviderCreation' when calling createComputeProvider");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/computeProviders/beta/computeProviders";

    localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));

    localVarRequestBuilder.header("Content-Type", "application/json");
    localVarRequestBuilder.header("Accept", "application/json");

    try {
      byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(computeProviderCreation);
      localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
    } catch (IOException e) {
      throw new ApiException(e);
    }
    if (memberVarReadTimeout != null) {
      localVarRequestBuilder.timeout(memberVarReadTimeout);
    }
    if (memberVarInterceptor != null) {
      memberVarInterceptor.accept(localVarRequestBuilder);
    }
    return localVarRequestBuilder;
  }
  /**
   * Create a new Compute Tier
   * Create a new Compute Tier.
   * @param computeTierCreation Details of the Compute Tier to create (required)
   * @return ComputeTier
   * @throws ApiException if fails to make API call
   */
  public ComputeTier createComputeTier(ComputeTierCreation computeTierCreation) throws ApiException {
    ApiResponse localVarResponse = createComputeTierWithHttpInfo(computeTierCreation);
    return localVarResponse.getData();
  }

  /**
   * Create a new Compute Tier
   * Create a new Compute Tier.
   * @param computeTierCreation Details of the Compute Tier to create (required)
   * @return ApiResponse<ComputeTier>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse createComputeTierWithHttpInfo(ComputeTierCreation computeTierCreation) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = createComputeTierRequestBuilder(computeTierCreation);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("createComputeTier", localVarResponse);
        }
        return new ApiResponse(
          localVarResponse.statusCode(),
          localVarResponse.headers().map(),
          localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
        );
      } finally {
      }
    } catch (IOException e) {
      throw new ApiException(e);
    }
    catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new ApiException(e);
    }
  }

  protected HttpRequest.Builder createComputeTierRequestBuilder(ComputeTierCreation computeTierCreation) throws ApiException {
    // verify the required parameter 'computeTierCreation' is set
    if (computeTierCreation == null) {
      throw new ApiException(400, "Missing the required parameter 'computeTierCreation' when calling createComputeTier");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/computeProviders/beta/computeTiers";

    localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));

    localVarRequestBuilder.header("Content-Type", "application/json");
    localVarRequestBuilder.header("Accept", "application/json");

    try {
      byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(computeTierCreation);
      localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
    } catch (IOException e) {
      throw new ApiException(e);
    }
    if (memberVarReadTimeout != null) {
      localVarRequestBuilder.timeout(memberVarReadTimeout);
    }
    if (memberVarInterceptor != null) {
      memberVarInterceptor.accept(localVarRequestBuilder);
    }
    return localVarRequestBuilder;
  }
  /**
   * Delete a Compute Provider
   * Delete a Compute Provider.
   * @param computeProviderId ID of Compute Provider (required)
   * @throws ApiException if fails to make API call
   */
  public void deleteComputeProvider(String computeProviderId) throws ApiException {
    deleteComputeProviderWithHttpInfo(computeProviderId);
  }

  /**
   * Delete a Compute Provider
   * Delete a Compute Provider.
   * @param computeProviderId ID of Compute Provider (required)
   * @return ApiResponse<Void>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse deleteComputeProviderWithHttpInfo(String computeProviderId) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = deleteComputeProviderRequestBuilder(computeProviderId);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("deleteComputeProvider", localVarResponse);
        }
        return new ApiResponse(
          localVarResponse.statusCode(),
          localVarResponse.headers().map(),
          null
        );
      } finally {
        // Drain the InputStream
        while (localVarResponse.body().read() != -1) {
            // Ignore
        }
        localVarResponse.body().close();
      }
    } catch (IOException e) {
      throw new ApiException(e);
    }
    catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new ApiException(e);
    }
  }

  protected HttpRequest.Builder deleteComputeProviderRequestBuilder(String computeProviderId) throws ApiException {
    // verify the required parameter 'computeProviderId' is set
    if (computeProviderId == null) {
      throw new ApiException(400, "Missing the required parameter 'computeProviderId' when calling deleteComputeProvider");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/computeProviders/beta/computeProviders/{computeProviderId}"
        .replace("{computeProviderId}", ApiClient.urlEncode(computeProviderId.toString()));

    localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));

    localVarRequestBuilder.header("Accept", "application/json");

    localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody());
    if (memberVarReadTimeout != null) {
      localVarRequestBuilder.timeout(memberVarReadTimeout);
    }
    if (memberVarInterceptor != null) {
      memberVarInterceptor.accept(localVarRequestBuilder);
    }
    return localVarRequestBuilder;
  }
  /**
   * Delete a Compute Tier
   * Delete a Compute Tier.
   * @param computeTierId ID of Compute Tier (required)
   * @throws ApiException if fails to make API call
   */
  public void deleteComputeTier(String computeTierId) throws ApiException {
    deleteComputeTierWithHttpInfo(computeTierId);
  }

  /**
   * Delete a Compute Tier
   * Delete a Compute Tier.
   * @param computeTierId ID of Compute Tier (required)
   * @return ApiResponse<Void>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse deleteComputeTierWithHttpInfo(String computeTierId) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = deleteComputeTierRequestBuilder(computeTierId);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("deleteComputeTier", localVarResponse);
        }
        return new ApiResponse(
          localVarResponse.statusCode(),
          localVarResponse.headers().map(),
          null
        );
      } finally {
        // Drain the InputStream
        while (localVarResponse.body().read() != -1) {
            // Ignore
        }
        localVarResponse.body().close();
      }
    } catch (IOException e) {
      throw new ApiException(e);
    }
    catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new ApiException(e);
    }
  }

  protected HttpRequest.Builder deleteComputeTierRequestBuilder(String computeTierId) throws ApiException {
    // verify the required parameter 'computeTierId' is set
    if (computeTierId == null) {
      throw new ApiException(400, "Missing the required parameter 'computeTierId' when calling deleteComputeTier");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/computeProviders/beta/computeTiers/{computeTierId}"
        .replace("{computeTierId}", ApiClient.urlEncode(computeTierId.toString()));

    localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));

    localVarRequestBuilder.header("Accept", "application/json");

    localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody());
    if (memberVarReadTimeout != null) {
      localVarRequestBuilder.timeout(memberVarReadTimeout);
    }
    if (memberVarInterceptor != null) {
      memberVarInterceptor.accept(localVarRequestBuilder);
    }
    return localVarRequestBuilder;
  }
  /**
   * Gets all non-archived Compute Tiers based on the provided filters
   * Gets all non-archived Compute Tiers based on the provided filters.
   * @param search Search filter by Compute Tier name (optional)
   * @param offset How many Compute Tiers from the start to skip. Defaults to 0. (optional, default to 0)
   * @param limit Max number of Compute Tiers to fetch. Defaults to 10. (optional, default to 10)
   * @param computeProviderId Compute Provider that Compute Tier belongs to. (optional)
   * @return PaginatedComputeTiers
   * @throws ApiException if fails to make API call
   */
  public PaginatedComputeTiers getAllComputeTiers(String search, Integer offset, Integer limit, String computeProviderId) throws ApiException {
    ApiResponse localVarResponse = getAllComputeTiersWithHttpInfo(search, offset, limit, computeProviderId);
    return localVarResponse.getData();
  }

  /**
   * Gets all non-archived Compute Tiers based on the provided filters
   * Gets all non-archived Compute Tiers based on the provided filters.
   * @param search Search filter by Compute Tier name (optional)
   * @param offset How many Compute Tiers from the start to skip. Defaults to 0. (optional, default to 0)
   * @param limit Max number of Compute Tiers to fetch. Defaults to 10. (optional, default to 10)
   * @param computeProviderId Compute Provider that Compute Tier belongs to. (optional)
   * @return ApiResponse<PaginatedComputeTiers>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getAllComputeTiersWithHttpInfo(String search, Integer offset, Integer limit, String computeProviderId) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getAllComputeTiersRequestBuilder(search, offset, limit, computeProviderId);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getAllComputeTiers", localVarResponse);
        }
        return new ApiResponse(
          localVarResponse.statusCode(),
          localVarResponse.headers().map(),
          localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
        );
      } finally {
      }
    } catch (IOException e) {
      throw new ApiException(e);
    }
    catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new ApiException(e);
    }
  }

  protected HttpRequest.Builder getAllComputeTiersRequestBuilder(String search, Integer offset, Integer limit, String computeProviderId) throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/computeProviders/beta/computeTiers";

    List localVarQueryParams = new ArrayList<>();
    StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
    String localVarQueryParameterBaseName;
    localVarQueryParameterBaseName = "search";
    localVarQueryParams.addAll(ApiClient.parameterToPairs("search", search));
    localVarQueryParameterBaseName = "offset";
    localVarQueryParams.addAll(ApiClient.parameterToPairs("offset", offset));
    localVarQueryParameterBaseName = "limit";
    localVarQueryParams.addAll(ApiClient.parameterToPairs("limit", limit));
    localVarQueryParameterBaseName = "computeProviderId";
    localVarQueryParams.addAll(ApiClient.parameterToPairs("computeProviderId", computeProviderId));

    if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
      StringJoiner queryJoiner = new StringJoiner("&");
      localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
      if (localVarQueryStringJoiner.length() != 0) {
        queryJoiner.add(localVarQueryStringJoiner.toString());
      }
      localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
    } else {
      localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
    }

    localVarRequestBuilder.header("Accept", "application/json");

    localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
    if (memberVarReadTimeout != null) {
      localVarRequestBuilder.timeout(memberVarReadTimeout);
    }
    if (memberVarInterceptor != null) {
      memberVarInterceptor.accept(localVarRequestBuilder);
    }
    return localVarRequestBuilder;
  }
  /**
   * Get all Compute Provider Types
   * Get all Compute Provider Types.
   * @return List<ComputeProviderType>
   * @throws ApiException if fails to make API call
   */
  public List getComputeProviderTypes() throws ApiException {
    ApiResponse> localVarResponse = getComputeProviderTypesWithHttpInfo();
    return localVarResponse.getData();
  }

  /**
   * Get all Compute Provider Types
   * Get all Compute Provider Types.
   * @return ApiResponse<List<ComputeProviderType>>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse> getComputeProviderTypesWithHttpInfo() throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getComputeProviderTypesRequestBuilder();
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getComputeProviderTypes", localVarResponse);
        }
        return new ApiResponse>(
          localVarResponse.statusCode(),
          localVarResponse.headers().map(),
          localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference>() {}) // closes the InputStream
        );
      } finally {
      }
    } catch (IOException e) {
      throw new ApiException(e);
    }
    catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new ApiException(e);
    }
  }

  protected HttpRequest.Builder getComputeProviderTypesRequestBuilder() throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/computeProviders/beta/computeProviderTypes";

    localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));

    localVarRequestBuilder.header("Accept", "application/json");

    localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
    if (memberVarReadTimeout != null) {
      localVarRequestBuilder.timeout(memberVarReadTimeout);
    }
    if (memberVarInterceptor != null) {
      memberVarInterceptor.accept(localVarRequestBuilder);
    }
    return localVarRequestBuilder;
  }
  /**
   * Get all non-archived Compute Provider
   * Get all non-archived Compute Provider.
   * @return List<ComputeProvider>
   * @throws ApiException if fails to make API call
   */
  public List getComputeProviders() throws ApiException {
    ApiResponse> localVarResponse = getComputeProvidersWithHttpInfo();
    return localVarResponse.getData();
  }

  /**
   * Get all non-archived Compute Provider
   * Get all non-archived Compute Provider.
   * @return ApiResponse<List<ComputeProvider>>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse> getComputeProvidersWithHttpInfo() throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getComputeProvidersRequestBuilder();
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getComputeProviders", localVarResponse);
        }
        return new ApiResponse>(
          localVarResponse.statusCode(),
          localVarResponse.headers().map(),
          localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference>() {}) // closes the InputStream
        );
      } finally {
      }
    } catch (IOException e) {
      throw new ApiException(e);
    }
    catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new ApiException(e);
    }
  }

  protected HttpRequest.Builder getComputeProvidersRequestBuilder() throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/computeProviders/beta/computeProviders";

    localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));

    localVarRequestBuilder.header("Accept", "application/json");

    localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
    if (memberVarReadTimeout != null) {
      localVarRequestBuilder.timeout(memberVarReadTimeout);
    }
    if (memberVarInterceptor != null) {
      memberVarInterceptor.accept(localVarRequestBuilder);
    }
    return localVarRequestBuilder;
  }
  /**
   * Get full configuration details for a Compute Tier
   * Get full configuration details for a Compute Tier.
   * @param computeTierId ID of Compute Tier (required)
   * @return ComputeTierFullConfiguration
   * @throws ApiException if fails to make API call
   */
  public ComputeTierFullConfiguration getFullComputeTier(String computeTierId) throws ApiException {
    ApiResponse localVarResponse = getFullComputeTierWithHttpInfo(computeTierId);
    return localVarResponse.getData();
  }

  /**
   * Get full configuration details for a Compute Tier
   * Get full configuration details for a Compute Tier.
   * @param computeTierId ID of Compute Tier (required)
   * @return ApiResponse<ComputeTierFullConfiguration>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getFullComputeTierWithHttpInfo(String computeTierId) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getFullComputeTierRequestBuilder(computeTierId);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getFullComputeTier", localVarResponse);
        }
        return new ApiResponse(
          localVarResponse.statusCode(),
          localVarResponse.headers().map(),
          localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
        );
      } finally {
      }
    } catch (IOException e) {
      throw new ApiException(e);
    }
    catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new ApiException(e);
    }
  }

  protected HttpRequest.Builder getFullComputeTierRequestBuilder(String computeTierId) throws ApiException {
    // verify the required parameter 'computeTierId' is set
    if (computeTierId == null) {
      throw new ApiException(400, "Missing the required parameter 'computeTierId' when calling getFullComputeTier");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/computeProviders/beta/computeTiers/full/{computeTierId}"
        .replace("{computeTierId}", ApiClient.urlEncode(computeTierId.toString()));

    localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));

    localVarRequestBuilder.header("Accept", "application/json");

    localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
    if (memberVarReadTimeout != null) {
      localVarRequestBuilder.timeout(memberVarReadTimeout);
    }
    if (memberVarInterceptor != null) {
      memberVarInterceptor.accept(localVarRequestBuilder);
    }
    return localVarRequestBuilder;
  }
  /**
   * Gets selectable Compute Tiers based on the provided filters
   * Gets selectable Compute Tiers based on the provided filters.
   * @param search Search filter by Compute Tier name (optional)
   * @param offset How many Compute Tiers from the start to skip. Defaults to 0. (optional, default to 0)
   * @param limit Max number of Compute Tiers to fetch. Defaults to 10. (optional, default to 10)
   * @param computeProviderId Compute Provider that Compute Tier belongs to. (optional)
   * @return PaginatedSelectableComputeTiers
   * @throws ApiException if fails to make API call
   */
  public PaginatedSelectableComputeTiers getSelectableComputeTiers(String search, Integer offset, Integer limit, String computeProviderId) throws ApiException {
    ApiResponse localVarResponse = getSelectableComputeTiersWithHttpInfo(search, offset, limit, computeProviderId);
    return localVarResponse.getData();
  }

  /**
   * Gets selectable Compute Tiers based on the provided filters
   * Gets selectable Compute Tiers based on the provided filters.
   * @param search Search filter by Compute Tier name (optional)
   * @param offset How many Compute Tiers from the start to skip. Defaults to 0. (optional, default to 0)
   * @param limit Max number of Compute Tiers to fetch. Defaults to 10. (optional, default to 10)
   * @param computeProviderId Compute Provider that Compute Tier belongs to. (optional)
   * @return ApiResponse<PaginatedSelectableComputeTiers>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getSelectableComputeTiersWithHttpInfo(String search, Integer offset, Integer limit, String computeProviderId) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getSelectableComputeTiersRequestBuilder(search, offset, limit, computeProviderId);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getSelectableComputeTiers", localVarResponse);
        }
        return new ApiResponse(
          localVarResponse.statusCode(),
          localVarResponse.headers().map(),
          localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
        );
      } finally {
      }
    } catch (IOException e) {
      throw new ApiException(e);
    }
    catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new ApiException(e);
    }
  }

  protected HttpRequest.Builder getSelectableComputeTiersRequestBuilder(String search, Integer offset, Integer limit, String computeProviderId) throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/computeProviders/beta/computeTiers/selectable";

    List localVarQueryParams = new ArrayList<>();
    StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
    String localVarQueryParameterBaseName;
    localVarQueryParameterBaseName = "search";
    localVarQueryParams.addAll(ApiClient.parameterToPairs("search", search));
    localVarQueryParameterBaseName = "offset";
    localVarQueryParams.addAll(ApiClient.parameterToPairs("offset", offset));
    localVarQueryParameterBaseName = "limit";
    localVarQueryParams.addAll(ApiClient.parameterToPairs("limit", limit));
    localVarQueryParameterBaseName = "computeProviderId";
    localVarQueryParams.addAll(ApiClient.parameterToPairs("computeProviderId", computeProviderId));

    if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
      StringJoiner queryJoiner = new StringJoiner("&");
      localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
      if (localVarQueryStringJoiner.length() != 0) {
        queryJoiner.add(localVarQueryStringJoiner.toString());
      }
      localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
    } else {
      localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
    }

    localVarRequestBuilder.header("Accept", "application/json");

    localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
    if (memberVarReadTimeout != null) {
      localVarRequestBuilder.timeout(memberVarReadTimeout);
    }
    if (memberVarInterceptor != null) {
      memberVarInterceptor.accept(localVarRequestBuilder);
    }
    return localVarRequestBuilder;
  }
  /**
   * Update a Compute Provider
   * Update a Compute Provider.
   * @param computeProviderId ID of Compute Provider (required)
   * @param computeProviderCreation Details of the Compute Provider to create (required)
   * @return ComputeProvider
   * @throws ApiException if fails to make API call
   */
  public ComputeProvider updateComputeProvider(String computeProviderId, ComputeProviderCreation computeProviderCreation) throws ApiException {
    ApiResponse localVarResponse = updateComputeProviderWithHttpInfo(computeProviderId, computeProviderCreation);
    return localVarResponse.getData();
  }

  /**
   * Update a Compute Provider
   * Update a Compute Provider.
   * @param computeProviderId ID of Compute Provider (required)
   * @param computeProviderCreation Details of the Compute Provider to create (required)
   * @return ApiResponse<ComputeProvider>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse updateComputeProviderWithHttpInfo(String computeProviderId, ComputeProviderCreation computeProviderCreation) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = updateComputeProviderRequestBuilder(computeProviderId, computeProviderCreation);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("updateComputeProvider", localVarResponse);
        }
        return new ApiResponse(
          localVarResponse.statusCode(),
          localVarResponse.headers().map(),
          localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
        );
      } finally {
      }
    } catch (IOException e) {
      throw new ApiException(e);
    }
    catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new ApiException(e);
    }
  }

  protected HttpRequest.Builder updateComputeProviderRequestBuilder(String computeProviderId, ComputeProviderCreation computeProviderCreation) throws ApiException {
    // verify the required parameter 'computeProviderId' is set
    if (computeProviderId == null) {
      throw new ApiException(400, "Missing the required parameter 'computeProviderId' when calling updateComputeProvider");
    }
    // verify the required parameter 'computeProviderCreation' is set
    if (computeProviderCreation == null) {
      throw new ApiException(400, "Missing the required parameter 'computeProviderCreation' when calling updateComputeProvider");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/computeProviders/beta/computeProviders/{computeProviderId}"
        .replace("{computeProviderId}", ApiClient.urlEncode(computeProviderId.toString()));

    localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));

    localVarRequestBuilder.header("Content-Type", "application/json");
    localVarRequestBuilder.header("Accept", "application/json");

    try {
      byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(computeProviderCreation);
      localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
    } catch (IOException e) {
      throw new ApiException(e);
    }
    if (memberVarReadTimeout != null) {
      localVarRequestBuilder.timeout(memberVarReadTimeout);
    }
    if (memberVarInterceptor != null) {
      memberVarInterceptor.accept(localVarRequestBuilder);
    }
    return localVarRequestBuilder;
  }
  /**
   * Update a Compute Tier
   * Update a Compute Tier.
   * @param computeTierId ID of Compute Tier (required)
   * @param computeTierCreation Details of the Compute Tier to create (required)
   * @return ComputeTier
   * @throws ApiException if fails to make API call
   */
  public ComputeTier updateComputeTier(String computeTierId, ComputeTierCreation computeTierCreation) throws ApiException {
    ApiResponse localVarResponse = updateComputeTierWithHttpInfo(computeTierId, computeTierCreation);
    return localVarResponse.getData();
  }

  /**
   * Update a Compute Tier
   * Update a Compute Tier.
   * @param computeTierId ID of Compute Tier (required)
   * @param computeTierCreation Details of the Compute Tier to create (required)
   * @return ApiResponse<ComputeTier>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse updateComputeTierWithHttpInfo(String computeTierId, ComputeTierCreation computeTierCreation) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = updateComputeTierRequestBuilder(computeTierId, computeTierCreation);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("updateComputeTier", localVarResponse);
        }
        return new ApiResponse(
          localVarResponse.statusCode(),
          localVarResponse.headers().map(),
          localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
        );
      } finally {
      }
    } catch (IOException e) {
      throw new ApiException(e);
    }
    catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new ApiException(e);
    }
  }

  protected HttpRequest.Builder updateComputeTierRequestBuilder(String computeTierId, ComputeTierCreation computeTierCreation) throws ApiException {
    // verify the required parameter 'computeTierId' is set
    if (computeTierId == null) {
      throw new ApiException(400, "Missing the required parameter 'computeTierId' when calling updateComputeTier");
    }
    // verify the required parameter 'computeTierCreation' is set
    if (computeTierCreation == null) {
      throw new ApiException(400, "Missing the required parameter 'computeTierCreation' when calling updateComputeTier");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/computeProviders/beta/computeTiers/{computeTierId}"
        .replace("{computeTierId}", ApiClient.urlEncode(computeTierId.toString()));

    localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));

    localVarRequestBuilder.header("Content-Type", "application/json");
    localVarRequestBuilder.header("Accept", "application/json");

    try {
      byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(computeTierCreation);
      localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
    } catch (IOException e) {
      throw new ApiException(e);
    }
    if (memberVarReadTimeout != null) {
      localVarRequestBuilder.timeout(memberVarReadTimeout);
    }
    if (memberVarInterceptor != null) {
      memberVarInterceptor.accept(localVarRequestBuilder);
    }
    return localVarRequestBuilder;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy