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

com.dominodatalab.api.rest.EnvironmentsApi Maven / Gradle / Ivy

/*
 * Domino Data Lab API v4
 * This API is going to provide access to all the Domino functions available in the user interface. To authenticate your requests, include your API Key (which you can find on your account page) with the header X-Domino-Api-Key. 
 *
 * The version of the OpenAPI document: 4.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.api.rest;

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

import com.dominodatalab.api.model.DominoApiErrorResponse;
import com.dominodatalab.api.model.DominoEnvironmentsApiEnvironmentDetails;
import com.dominodatalab.api.model.DominoEnvironmentsApiEnvironmentPermissionsResult;
import com.dominodatalab.api.model.DominoEnvironmentsApiEnvironmentProjectUsageSummariesSet;
import com.dominodatalab.api.model.DominoEnvironmentsApiEnvironmentWorkspaceToolDefinition;
import com.dominodatalab.api.model.DominoEnvironmentsApiPaginatedRevisionData;
import com.dominodatalab.api.model.DominoEnvironmentsApiSetDeployDefaultEnvRequest;
import com.dominodatalab.api.model.DominoEnvironmentsApiSetRestrictedEnvRevisionRequest;

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 = "2023-10-17T15:20:46.682098100-04:00[America/New_York]")
public class EnvironmentsApi {
  private final HttpClient memberVarHttpClient;
  private final ObjectMapper memberVarObjectMapper;
  private final String memberVarBaseUri;
  private final Consumer memberVarInterceptor;
  private final Duration memberVarReadTimeout;
  private final Consumer> memberVarResponseInterceptor;
  private final Consumer> memberVarAsyncResponseInterceptor;

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

  public EnvironmentsApi(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);
  }

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

  /**
   * Get the list of available Workspace tools for the given Environment
   * 
   * @param environmentId ID of the Environment (required)
   * @return List<DominoEnvironmentsApiEnvironmentWorkspaceToolDefinition>
   * @throws ApiException if fails to make API call
   */
  public List getAvailableToolsForEnvironment(String environmentId) throws ApiException {
    ApiResponse> localVarResponse = getAvailableToolsForEnvironmentWithHttpInfo(environmentId);
    return localVarResponse.getData();
  }

  /**
   * Get the list of available Workspace tools for the given Environment
   * 
   * @param environmentId ID of the Environment (required)
   * @return ApiResponse<List<DominoEnvironmentsApiEnvironmentWorkspaceToolDefinition>>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse> getAvailableToolsForEnvironmentWithHttpInfo(String environmentId) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getAvailableToolsForEnvironmentRequestBuilder(environmentId);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getAvailableToolsForEnvironment", 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);
    }
  }

  private HttpRequest.Builder getAvailableToolsForEnvironmentRequestBuilder(String environmentId) throws ApiException {
    // verify the required parameter 'environmentId' is set
    if (environmentId == null) {
      throw new ApiException(400, "Missing the required parameter 'environmentId' when calling getAvailableToolsForEnvironment");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/environments/{environmentId}/availableTools"
        .replace("{environmentId}", ApiClient.urlEncode(environmentId.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;
  }
  /**
   * Get environment revision summaries
   * 
   * @param environmentId ID of the Environment (required)
   * @param page page number, indexed from 0 (required)
   * @param pageSize page size (required)
   * @return DominoEnvironmentsApiPaginatedRevisionData
   * @throws ApiException if fails to make API call
   */
  public DominoEnvironmentsApiPaginatedRevisionData getBuiltEnvironmentRevisions(String environmentId, Integer page, Integer pageSize) throws ApiException {
    ApiResponse localVarResponse = getBuiltEnvironmentRevisionsWithHttpInfo(environmentId, page, pageSize);
    return localVarResponse.getData();
  }

  /**
   * Get environment revision summaries
   * 
   * @param environmentId ID of the Environment (required)
   * @param page page number, indexed from 0 (required)
   * @param pageSize page size (required)
   * @return ApiResponse<DominoEnvironmentsApiPaginatedRevisionData>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getBuiltEnvironmentRevisionsWithHttpInfo(String environmentId, Integer page, Integer pageSize) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getBuiltEnvironmentRevisionsRequestBuilder(environmentId, page, pageSize);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getBuiltEnvironmentRevisions", 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);
    }
  }

  private HttpRequest.Builder getBuiltEnvironmentRevisionsRequestBuilder(String environmentId, Integer page, Integer pageSize) throws ApiException {
    // verify the required parameter 'environmentId' is set
    if (environmentId == null) {
      throw new ApiException(400, "Missing the required parameter 'environmentId' when calling getBuiltEnvironmentRevisions");
    }
    // verify the required parameter 'page' is set
    if (page == null) {
      throw new ApiException(400, "Missing the required parameter 'page' when calling getBuiltEnvironmentRevisions");
    }
    // verify the required parameter 'pageSize' is set
    if (pageSize == null) {
      throw new ApiException(400, "Missing the required parameter 'pageSize' when calling getBuiltEnvironmentRevisions");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/environments/{environmentId}/page/{page}/pageSize/{pageSize}/revisions"
        .replace("{environmentId}", ApiClient.urlEncode(environmentId.toString()))
        .replace("{page}", ApiClient.urlEncode(page.toString()))
        .replace("{pageSize}", ApiClient.urlEncode(pageSize.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;
  }
  /**
   * retrieves the current user's Environments
   * 
   * @param isRestricted Whether to only get restricted environments or not (optional)
   * @return List<DominoEnvironmentsApiEnvironmentDetails>
   * @throws ApiException if fails to make API call
   */
  public List getCurrentUserEnvironments(Boolean isRestricted) throws ApiException {
    ApiResponse> localVarResponse = getCurrentUserEnvironmentsWithHttpInfo(isRestricted);
    return localVarResponse.getData();
  }

  /**
   * retrieves the current user's Environments
   * 
   * @param isRestricted Whether to only get restricted environments or not (optional)
   * @return ApiResponse<List<DominoEnvironmentsApiEnvironmentDetails>>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse> getCurrentUserEnvironmentsWithHttpInfo(Boolean isRestricted) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getCurrentUserEnvironmentsRequestBuilder(isRestricted);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getCurrentUserEnvironments", 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);
    }
  }

  private HttpRequest.Builder getCurrentUserEnvironmentsRequestBuilder(Boolean isRestricted) throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/environments/self";

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

    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 default environment
   * 
   * @return DominoEnvironmentsApiEnvironmentDetails
   * @throws ApiException if fails to make API call
   */
  public DominoEnvironmentsApiEnvironmentDetails getDefaultEnvironment() throws ApiException {
    ApiResponse localVarResponse = getDefaultEnvironmentWithHttpInfo();
    return localVarResponse.getData();
  }

  /**
   * Get default environment
   * 
   * @return ApiResponse<DominoEnvironmentsApiEnvironmentDetails>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getDefaultEnvironmentWithHttpInfo() throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getDefaultEnvironmentRequestBuilder();
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getDefaultEnvironment", 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);
    }
  }

  private HttpRequest.Builder getDefaultEnvironmentRequestBuilder() throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/environments/defaultEnvironment";

    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;
  }
  /**
   * retrieves an Environment by id
   * 
   * @param environmentId Id of the environment (required)
   * @return DominoEnvironmentsApiEnvironmentDetails
   * @throws ApiException if fails to make API call
   */
  public DominoEnvironmentsApiEnvironmentDetails getEnvironmentById(String environmentId) throws ApiException {
    ApiResponse localVarResponse = getEnvironmentByIdWithHttpInfo(environmentId);
    return localVarResponse.getData();
  }

  /**
   * retrieves an Environment by id
   * 
   * @param environmentId Id of the environment (required)
   * @return ApiResponse<DominoEnvironmentsApiEnvironmentDetails>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getEnvironmentByIdWithHttpInfo(String environmentId) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getEnvironmentByIdRequestBuilder(environmentId);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getEnvironmentById", 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);
    }
  }

  private HttpRequest.Builder getEnvironmentByIdRequestBuilder(String environmentId) throws ApiException {
    // verify the required parameter 'environmentId' is set
    if (environmentId == null) {
      throw new ApiException(400, "Missing the required parameter 'environmentId' when calling getEnvironmentById");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/environments/{environmentId}"
        .replace("{environmentId}", ApiClient.urlEncode(environmentId.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;
  }
  /**
   * Get permissions for environments for the requesting user
   * 
   * @return DominoEnvironmentsApiEnvironmentPermissionsResult
   * @throws ApiException if fails to make API call
   */
  public DominoEnvironmentsApiEnvironmentPermissionsResult getEnvironmentPermissions() throws ApiException {
    ApiResponse localVarResponse = getEnvironmentPermissionsWithHttpInfo();
    return localVarResponse.getData();
  }

  /**
   * Get permissions for environments for the requesting user
   * 
   * @return ApiResponse<DominoEnvironmentsApiEnvironmentPermissionsResult>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getEnvironmentPermissionsWithHttpInfo() throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getEnvironmentPermissionsRequestBuilder();
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getEnvironmentPermissions", 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);
    }
  }

  private HttpRequest.Builder getEnvironmentPermissionsRequestBuilder() throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/environments/permissions/all";

    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 project usage summaries for an environment
   * 
   * @param environmentId ID of the Environment (required)
   * @param pageNumber page number, indexed from 0 (required)
   * @param pageSize requested page size (required)
   * @return DominoEnvironmentsApiEnvironmentProjectUsageSummariesSet
   * @throws ApiException if fails to make API call
   */
  public DominoEnvironmentsApiEnvironmentProjectUsageSummariesSet getProjectSummariesByEnvironment(String environmentId, Integer pageNumber, Integer pageSize) throws ApiException {
    ApiResponse localVarResponse = getProjectSummariesByEnvironmentWithHttpInfo(environmentId, pageNumber, pageSize);
    return localVarResponse.getData();
  }

  /**
   * Get project usage summaries for an environment
   * 
   * @param environmentId ID of the Environment (required)
   * @param pageNumber page number, indexed from 0 (required)
   * @param pageSize requested page size (required)
   * @return ApiResponse<DominoEnvironmentsApiEnvironmentProjectUsageSummariesSet>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getProjectSummariesByEnvironmentWithHttpInfo(String environmentId, Integer pageNumber, Integer pageSize) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getProjectSummariesByEnvironmentRequestBuilder(environmentId, pageNumber, pageSize);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getProjectSummariesByEnvironment", 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);
    }
  }

  private HttpRequest.Builder getProjectSummariesByEnvironmentRequestBuilder(String environmentId, Integer pageNumber, Integer pageSize) throws ApiException {
    // verify the required parameter 'environmentId' is set
    if (environmentId == null) {
      throw new ApiException(400, "Missing the required parameter 'environmentId' when calling getProjectSummariesByEnvironment");
    }
    // verify the required parameter 'pageNumber' is set
    if (pageNumber == null) {
      throw new ApiException(400, "Missing the required parameter 'pageNumber' when calling getProjectSummariesByEnvironment");
    }
    // verify the required parameter 'pageSize' is set
    if (pageSize == null) {
      throw new ApiException(400, "Missing the required parameter 'pageSize' when calling getProjectSummariesByEnvironment");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/environments/{environmentId}/projectUsageSummaries/page/{pageNumber}/pageSize/{pageSize}"
        .replace("{environmentId}", ApiClient.urlEncode(environmentId.toString()))
        .replace("{pageNumber}", ApiClient.urlEncode(pageNumber.toString()))
        .replace("{pageSize}", ApiClient.urlEncode(pageSize.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;
  }
  /**
   * Set default environment
   * 
   * @param dominoEnvironmentsApiSetDeployDefaultEnvRequest The ID of the environment to set as the deployment default (required)
   * @throws ApiException if fails to make API call
   */
  public void setDefaultEnvironment(DominoEnvironmentsApiSetDeployDefaultEnvRequest dominoEnvironmentsApiSetDeployDefaultEnvRequest) throws ApiException {
    setDefaultEnvironmentWithHttpInfo(dominoEnvironmentsApiSetDeployDefaultEnvRequest);
  }

  /**
   * Set default environment
   * 
   * @param dominoEnvironmentsApiSetDeployDefaultEnvRequest The ID of the environment to set as the deployment default (required)
   * @return ApiResponse<Void>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse setDefaultEnvironmentWithHttpInfo(DominoEnvironmentsApiSetDeployDefaultEnvRequest dominoEnvironmentsApiSetDeployDefaultEnvRequest) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = setDefaultEnvironmentRequestBuilder(dominoEnvironmentsApiSetDeployDefaultEnvRequest);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("setDefaultEnvironment", 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);
    }
  }

  private HttpRequest.Builder setDefaultEnvironmentRequestBuilder(DominoEnvironmentsApiSetDeployDefaultEnvRequest dominoEnvironmentsApiSetDeployDefaultEnvRequest) throws ApiException {
    // verify the required parameter 'dominoEnvironmentsApiSetDeployDefaultEnvRequest' is set
    if (dominoEnvironmentsApiSetDeployDefaultEnvRequest == null) {
      throw new ApiException(400, "Missing the required parameter 'dominoEnvironmentsApiSetDeployDefaultEnvRequest' when calling setDefaultEnvironment");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/environments/setDefaultEnvironment";

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

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

    try {
      byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(dominoEnvironmentsApiSetDeployDefaultEnvRequest);
      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;
  }
  /**
   * Update isRestricted for environments if user has EnvironmentClassifier role
   * 
   * @param environmentId Domino id of the environment (required)
   * @param environmentRevisionId Domino id of the environment revision (required)
   * @param dominoEnvironmentsApiSetRestrictedEnvRevisionRequest  (required)
   * @throws ApiException if fails to make API call
   */
  public void updateEnvironmentRevisionIsRestricted(String environmentId, String environmentRevisionId, DominoEnvironmentsApiSetRestrictedEnvRevisionRequest dominoEnvironmentsApiSetRestrictedEnvRevisionRequest) throws ApiException {
    updateEnvironmentRevisionIsRestrictedWithHttpInfo(environmentId, environmentRevisionId, dominoEnvironmentsApiSetRestrictedEnvRevisionRequest);
  }

  /**
   * Update isRestricted for environments if user has EnvironmentClassifier role
   * 
   * @param environmentId Domino id of the environment (required)
   * @param environmentRevisionId Domino id of the environment revision (required)
   * @param dominoEnvironmentsApiSetRestrictedEnvRevisionRequest  (required)
   * @return ApiResponse<Void>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse updateEnvironmentRevisionIsRestrictedWithHttpInfo(String environmentId, String environmentRevisionId, DominoEnvironmentsApiSetRestrictedEnvRevisionRequest dominoEnvironmentsApiSetRestrictedEnvRevisionRequest) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = updateEnvironmentRevisionIsRestrictedRequestBuilder(environmentId, environmentRevisionId, dominoEnvironmentsApiSetRestrictedEnvRevisionRequest);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("updateEnvironmentRevisionIsRestricted", 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);
    }
  }

  private HttpRequest.Builder updateEnvironmentRevisionIsRestrictedRequestBuilder(String environmentId, String environmentRevisionId, DominoEnvironmentsApiSetRestrictedEnvRevisionRequest dominoEnvironmentsApiSetRestrictedEnvRevisionRequest) throws ApiException {
    // verify the required parameter 'environmentId' is set
    if (environmentId == null) {
      throw new ApiException(400, "Missing the required parameter 'environmentId' when calling updateEnvironmentRevisionIsRestricted");
    }
    // verify the required parameter 'environmentRevisionId' is set
    if (environmentRevisionId == null) {
      throw new ApiException(400, "Missing the required parameter 'environmentRevisionId' when calling updateEnvironmentRevisionIsRestricted");
    }
    // verify the required parameter 'dominoEnvironmentsApiSetRestrictedEnvRevisionRequest' is set
    if (dominoEnvironmentsApiSetRestrictedEnvRevisionRequest == null) {
      throw new ApiException(400, "Missing the required parameter 'dominoEnvironmentsApiSetRestrictedEnvRevisionRequest' when calling updateEnvironmentRevisionIsRestricted");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/environments/{environmentId}/environmentRevision/{environmentRevisionId}"
        .replace("{environmentId}", ApiClient.urlEncode(environmentId.toString()))
        .replace("{environmentRevisionId}", ApiClient.urlEncode(environmentRevisionId.toString()));

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

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

    try {
      byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(dominoEnvironmentsApiSetRestrictedEnvRevisionRequest);
      localVarRequestBuilder.method("PATCH", 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