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

com.dominodatalab.api.rest.JobsApi 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 java.math.BigDecimal;
import com.dominodatalab.api.model.DominoApiErrorResponse;
import com.dominodatalab.api.model.DominoDatasetrwApiDatasetRwSnapshotDto;
import com.dominodatalab.api.model.DominoJobsInterfaceJob;
import com.dominodatalab.api.model.DominoJobsInterfaceJobResourceUsage;
import com.dominodatalab.api.model.DominoJobsInterfaceJobResourcesStatus;
import com.dominodatalab.api.model.DominoJobsInterfaceJobRuntimeExecutionDetails;
import com.dominodatalab.api.model.DominoJobsInterfaceJobSet;
import com.dominodatalab.api.model.DominoJobsInterfaceJobStatus;
import com.dominodatalab.api.model.DominoJobsInterfaceJobsTimelineSet;
import com.dominodatalab.api.model.DominoJobsWebJobEvents;
import com.dominodatalab.api.model.DominoJobsWebJobOperationRequest;
import com.dominodatalab.api.model.DominoJobsWebJobRestartOperationRequest;
import com.dominodatalab.api.model.DominoJobsWebJobStopOperationRequest;
import com.dominodatalab.api.model.DominoJobsWebStartJobRequest;
import com.dominodatalab.api.model.DominoJobsWebUpdateJobName;
import com.dominodatalab.api.model.StartJob409Response;

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

import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;

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 JobsApi {
  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 JobsApi() {
    this(new ApiClient());
  }

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

  /**
   * Archive a Job
   * 
   * @param dominoJobsWebJobOperationRequest JSON object with information for archiving the Job (required)
   * @return DominoJobsInterfaceJob
   * @throws ApiException if fails to make API call
   */
  public DominoJobsInterfaceJob archiveJob(DominoJobsWebJobOperationRequest dominoJobsWebJobOperationRequest) throws ApiException {
    ApiResponse localVarResponse = archiveJobWithHttpInfo(dominoJobsWebJobOperationRequest);
    return localVarResponse.getData();
  }

  /**
   * Archive a Job
   * 
   * @param dominoJobsWebJobOperationRequest JSON object with information for archiving the Job (required)
   * @return ApiResponse<DominoJobsInterfaceJob>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse archiveJobWithHttpInfo(DominoJobsWebJobOperationRequest dominoJobsWebJobOperationRequest) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = archiveJobRequestBuilder(dominoJobsWebJobOperationRequest);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("archiveJob", 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 archiveJobRequestBuilder(DominoJobsWebJobOperationRequest dominoJobsWebJobOperationRequest) throws ApiException {
    // verify the required parameter 'dominoJobsWebJobOperationRequest' is set
    if (dominoJobsWebJobOperationRequest == null) {
      throw new ApiException(400, "Missing the required parameter 'dominoJobsWebJobOperationRequest' when calling archiveJob");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/jobs/archive";

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

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

    try {
      byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(dominoJobsWebJobOperationRequest);
      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;
  }
  /**
   * Gets host and port for spark web ui reverse proxy
   * 
   * @param jobId ID of the job (required)
   * @param clusterType name of the cluster to connect to (required)
   * @throws ApiException if fails to make API call
   */
  public void getComputeClusterHostAndPort(String jobId, Object clusterType) throws ApiException {
    getComputeClusterHostAndPortWithHttpInfo(jobId, clusterType);
  }

  /**
   * Gets host and port for spark web ui reverse proxy
   * 
   * @param jobId ID of the job (required)
   * @param clusterType name of the cluster to connect to (required)
   * @return ApiResponse<Void>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getComputeClusterHostAndPortWithHttpInfo(String jobId, Object clusterType) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getComputeClusterHostAndPortRequestBuilder(jobId, clusterType);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getComputeClusterHostAndPort", 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 getComputeClusterHostAndPortRequestBuilder(String jobId, Object clusterType) throws ApiException {
    // verify the required parameter 'jobId' is set
    if (jobId == null) {
      throw new ApiException(400, "Missing the required parameter 'jobId' when calling getComputeClusterHostAndPort");
    }
    // verify the required parameter 'clusterType' is set
    if (clusterType == null) {
      throw new ApiException(400, "Missing the required parameter 'clusterType' when calling getComputeClusterHostAndPort");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/jobs/{jobId}/{clusterType}/hostAndPort"
        .replace("{jobId}", ApiClient.urlEncode(jobId.toString()))
        .replace("{clusterType}", ApiClient.urlEncode(clusterType.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 a job
   * 
   * @param jobId  (required)
   * @return DominoJobsInterfaceJob
   * @throws ApiException if fails to make API call
   */
  public DominoJobsInterfaceJob getJob(String jobId) throws ApiException {
    ApiResponse localVarResponse = getJobWithHttpInfo(jobId);
    return localVarResponse.getData();
  }

  /**
   * Gets a job
   * 
   * @param jobId  (required)
   * @return ApiResponse<DominoJobsInterfaceJob>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getJobWithHttpInfo(String jobId) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getJobRequestBuilder(jobId);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getJob", 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 getJobRequestBuilder(String jobId) throws ApiException {
    // verify the required parameter 'jobId' is set
    if (jobId == null) {
      throw new ApiException(400, "Missing the required parameter 'jobId' when calling getJob");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/jobs/{jobId}"
        .replace("{jobId}", ApiClient.urlEncode(jobId.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;
  }
  /**
   * Entities that are pushed via socket updates.
   * 
   * @return DominoJobsWebJobEvents
   * @throws ApiException if fails to make API call
   */
  public DominoJobsWebJobEvents getJobEvents() throws ApiException {
    ApiResponse localVarResponse = getJobEventsWithHttpInfo();
    return localVarResponse.getData();
  }

  /**
   * Entities that are pushed via socket updates.
   * 
   * @return ApiResponse<DominoJobsWebJobEvents>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getJobEventsWithHttpInfo() throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getJobEventsRequestBuilder();
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getJobEvents", 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 getJobEventsRequestBuilder() throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/jobs/events";

    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 possible status for a Job
   * 
   * @return DominoJobsInterfaceJobStatus
   * @throws ApiException if fails to make API call
   */
  public DominoJobsInterfaceJobStatus getJobStatusValues() throws ApiException {
    ApiResponse localVarResponse = getJobStatusValuesWithHttpInfo();
    return localVarResponse.getData();
  }

  /**
   * Get possible status for a Job
   * 
   * @return ApiResponse<DominoJobsInterfaceJobStatus>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getJobStatusValuesWithHttpInfo() throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getJobStatusValuesRequestBuilder();
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getJobStatusValues", 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 getJobStatusValuesRequestBuilder() throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/jobs/getStatus/values";

    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 all Jobs for the given Project
   * 
   * @param projectId Id of the Project (required)
   * @param dominoStatsSortFieldName If orderBy is set to \"dominoStatsField\", then which field of Domino Stats to sort by. Otherwise, this field is ignored (optional)
   * @param pageSize Number of projects to fetch (optional)
   * @param sortBy Order to sort by (optional)
   * @param orderBy Field on which sort has to be applied (optional)
   * @param pageNo Page number to fetch (optional)
   * @param status Status of job to fetch (optional)
   * @param tag Optional Tag filter (optional)
   * @param query Optional search query (optional)
   * @param showArchived If show_archived is true, then jobs that are archived also will be shown. (optional)
   * @return DominoJobsInterfaceJobSet
   * @throws ApiException if fails to make API call
   */
  public DominoJobsInterfaceJobSet getJobs(String projectId, String dominoStatsSortFieldName, BigDecimal pageSize, String sortBy, String orderBy, BigDecimal pageNo, String status, String tag, String query, Boolean showArchived) throws ApiException {
    ApiResponse localVarResponse = getJobsWithHttpInfo(projectId, dominoStatsSortFieldName, pageSize, sortBy, orderBy, pageNo, status, tag, query, showArchived);
    return localVarResponse.getData();
  }

  /**
   * Gets all Jobs for the given Project
   * 
   * @param projectId Id of the Project (required)
   * @param dominoStatsSortFieldName If orderBy is set to \"dominoStatsField\", then which field of Domino Stats to sort by. Otherwise, this field is ignored (optional)
   * @param pageSize Number of projects to fetch (optional)
   * @param sortBy Order to sort by (optional)
   * @param orderBy Field on which sort has to be applied (optional)
   * @param pageNo Page number to fetch (optional)
   * @param status Status of job to fetch (optional)
   * @param tag Optional Tag filter (optional)
   * @param query Optional search query (optional)
   * @param showArchived If show_archived is true, then jobs that are archived also will be shown. (optional)
   * @return ApiResponse<DominoJobsInterfaceJobSet>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getJobsWithHttpInfo(String projectId, String dominoStatsSortFieldName, BigDecimal pageSize, String sortBy, String orderBy, BigDecimal pageNo, String status, String tag, String query, Boolean showArchived) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getJobsRequestBuilder(projectId, dominoStatsSortFieldName, pageSize, sortBy, orderBy, pageNo, status, tag, query, showArchived);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getJobs", 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 getJobsRequestBuilder(String projectId, String dominoStatsSortFieldName, BigDecimal pageSize, String sortBy, String orderBy, BigDecimal pageNo, String status, String tag, String query, Boolean showArchived) throws ApiException {
    // verify the required parameter 'projectId' is set
    if (projectId == null) {
      throw new ApiException(400, "Missing the required parameter 'projectId' when calling getJobs");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/jobs";

    List localVarQueryParams = new ArrayList<>();
    StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
    String localVarQueryParameterBaseName;
    localVarQueryParameterBaseName = "dominoStatsSortFieldName";
    localVarQueryParams.addAll(ApiClient.parameterToPairs("dominoStatsSortFieldName", dominoStatsSortFieldName));
    localVarQueryParameterBaseName = "projectId";
    localVarQueryParams.addAll(ApiClient.parameterToPairs("projectId", projectId));
    localVarQueryParameterBaseName = "page_size";
    localVarQueryParams.addAll(ApiClient.parameterToPairs("page_size", pageSize));
    localVarQueryParameterBaseName = "sort_by";
    localVarQueryParams.addAll(ApiClient.parameterToPairs("sort_by", sortBy));
    localVarQueryParameterBaseName = "order_by";
    localVarQueryParams.addAll(ApiClient.parameterToPairs("order_by", orderBy));
    localVarQueryParameterBaseName = "page_no";
    localVarQueryParams.addAll(ApiClient.parameterToPairs("page_no", pageNo));
    localVarQueryParameterBaseName = "status";
    localVarQueryParams.addAll(ApiClient.parameterToPairs("status", status));
    localVarQueryParameterBaseName = "tag";
    localVarQueryParams.addAll(ApiClient.parameterToPairs("tag", tag));
    localVarQueryParameterBaseName = "query";
    localVarQueryParams.addAll(ApiClient.parameterToPairs("query", query));
    localVarQueryParameterBaseName = "show_archived";
    localVarQueryParams.addAll(ApiClient.parameterToPairs("show_archived", showArchived));

    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;
  }
  /**
   * Gets Jobs timeline for a Project
   * 
   * @param projectId  (required)
   * @param tag Optional Tag filter (optional)
   * @return DominoJobsInterfaceJobsTimelineSet
   * @throws ApiException if fails to make API call
   */
  public DominoJobsInterfaceJobsTimelineSet getJobsTimeline(String projectId, String tag) throws ApiException {
    ApiResponse localVarResponse = getJobsTimelineWithHttpInfo(projectId, tag);
    return localVarResponse.getData();
  }

  /**
   * Gets Jobs timeline for a Project
   * 
   * @param projectId  (required)
   * @param tag Optional Tag filter (optional)
   * @return ApiResponse<DominoJobsInterfaceJobsTimelineSet>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getJobsTimelineWithHttpInfo(String projectId, String tag) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getJobsTimelineRequestBuilder(projectId, tag);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getJobsTimeline", 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 getJobsTimelineRequestBuilder(String projectId, String tag) throws ApiException {
    // verify the required parameter 'projectId' is set
    if (projectId == null) {
      throw new ApiException(400, "Missing the required parameter 'projectId' when calling getJobsTimeline");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/jobs/timeline/project/{projectId}"
        .replace("{projectId}", ApiClient.urlEncode(projectId.toString()));

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

    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 resource usage for a Job
   * 
   * @param jobId  (required)
   * @return List<DominoJobsInterfaceJobResourceUsage>
   * @throws ApiException if fails to make API call
   */
  public List getResourceUsage(String jobId) throws ApiException {
    ApiResponse> localVarResponse = getResourceUsageWithHttpInfo(jobId);
    return localVarResponse.getData();
  }

  /**
   * Get resource usage for a Job
   * 
   * @param jobId  (required)
   * @return ApiResponse<List<DominoJobsInterfaceJobResourceUsage>>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse> getResourceUsageWithHttpInfo(String jobId) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getResourceUsageRequestBuilder(jobId);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getResourceUsage", 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 getResourceUsageRequestBuilder(String jobId) throws ApiException {
    // verify the required parameter 'jobId' is set
    if (jobId == null) {
      throw new ApiException(400, "Missing the required parameter 'jobId' when calling getResourceUsage");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/jobs/jobs/{jobId}/usage"
        .replace("{jobId}", ApiClient.urlEncode(jobId.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 the resource statuses for the running Job
   * 
   * @param jobId  (required)
   * @return DominoJobsInterfaceJobResourcesStatus
   * @throws ApiException if fails to make API call
   */
  public DominoJobsInterfaceJobResourcesStatus getResourcesStatus(String jobId) throws ApiException {
    ApiResponse localVarResponse = getResourcesStatusWithHttpInfo(jobId);
    return localVarResponse.getData();
  }

  /**
   * Gets the resource statuses for the running Job
   * 
   * @param jobId  (required)
   * @return ApiResponse<DominoJobsInterfaceJobResourcesStatus>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getResourcesStatusWithHttpInfo(String jobId) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getResourcesStatusRequestBuilder(jobId);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getResourcesStatus", 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 getResourcesStatusRequestBuilder(String jobId) throws ApiException {
    // verify the required parameter 'jobId' is set
    if (jobId == null) {
      throw new ApiException(400, "Missing the required parameter 'jobId' when calling getResourcesStatus");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/jobs/{jobId}/resourceStatuses"
        .replace("{jobId}", ApiClient.urlEncode(jobId.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 the runtime execution details for a given job
   * 
   * @param jobId  (required)
   * @return DominoJobsInterfaceJobRuntimeExecutionDetails
   * @throws ApiException if fails to make API call
   */
  public DominoJobsInterfaceJobRuntimeExecutionDetails getRuntimeExecutionDetails(String jobId) throws ApiException {
    ApiResponse localVarResponse = getRuntimeExecutionDetailsWithHttpInfo(jobId);
    return localVarResponse.getData();
  }

  /**
   * Get the runtime execution details for a given job
   * 
   * @param jobId  (required)
   * @return ApiResponse<DominoJobsInterfaceJobRuntimeExecutionDetails>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getRuntimeExecutionDetailsWithHttpInfo(String jobId) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getRuntimeExecutionDetailsRequestBuilder(jobId);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getRuntimeExecutionDetails", 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 getRuntimeExecutionDetailsRequestBuilder(String jobId) throws ApiException {
    // verify the required parameter 'jobId' is set
    if (jobId == null) {
      throw new ApiException(400, "Missing the required parameter 'jobId' when calling getRuntimeExecutionDetails");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/jobs/{jobId}/runtimeExecutionDetails"
        .replace("{jobId}", ApiClient.urlEncode(jobId.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 snapshots created by a job
   * 
   * @param jobId  (required)
   * @return List<DominoDatasetrwApiDatasetRwSnapshotDto>
   * @throws ApiException if fails to make API call
   */
  public List getSnapshotsCreatedByJob(String jobId) throws ApiException {
    ApiResponse> localVarResponse = getSnapshotsCreatedByJobWithHttpInfo(jobId);
    return localVarResponse.getData();
  }

  /**
   * Get snapshots created by a job
   * 
   * @param jobId  (required)
   * @return ApiResponse<List<DominoDatasetrwApiDatasetRwSnapshotDto>>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse> getSnapshotsCreatedByJobWithHttpInfo(String jobId) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = getSnapshotsCreatedByJobRequestBuilder(jobId);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("getSnapshotsCreatedByJob", 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 getSnapshotsCreatedByJobRequestBuilder(String jobId) throws ApiException {
    // verify the required parameter 'jobId' is set
    if (jobId == null) {
      throw new ApiException(400, "Missing the required parameter 'jobId' when calling getSnapshotsCreatedByJob");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/jobs/{jobId}/snapshots"
        .replace("{jobId}", ApiClient.urlEncode(jobId.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;
  }
  /**
   * Restart a Job
   * 
   * @param dominoJobsWebJobRestartOperationRequest JSON object with information for restarting the Job (required)
   * @return DominoJobsInterfaceJob
   * @throws ApiException if fails to make API call
   */
  public DominoJobsInterfaceJob restartJob(DominoJobsWebJobRestartOperationRequest dominoJobsWebJobRestartOperationRequest) throws ApiException {
    ApiResponse localVarResponse = restartJobWithHttpInfo(dominoJobsWebJobRestartOperationRequest);
    return localVarResponse.getData();
  }

  /**
   * Restart a Job
   * 
   * @param dominoJobsWebJobRestartOperationRequest JSON object with information for restarting the Job (required)
   * @return ApiResponse<DominoJobsInterfaceJob>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse restartJobWithHttpInfo(DominoJobsWebJobRestartOperationRequest dominoJobsWebJobRestartOperationRequest) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = restartJobRequestBuilder(dominoJobsWebJobRestartOperationRequest);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("restartJob", 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 restartJobRequestBuilder(DominoJobsWebJobRestartOperationRequest dominoJobsWebJobRestartOperationRequest) throws ApiException {
    // verify the required parameter 'dominoJobsWebJobRestartOperationRequest' is set
    if (dominoJobsWebJobRestartOperationRequest == null) {
      throw new ApiException(400, "Missing the required parameter 'dominoJobsWebJobRestartOperationRequest' when calling restartJob");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/jobs/restart";

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

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

    try {
      byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(dominoJobsWebJobRestartOperationRequest);
      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;
  }
  /**
   * Starts a new Job
   * 
   * @param dominoJobsWebStartJobRequest JSON object with information for starting the Job (optional)
   * @return DominoJobsInterfaceJob
   * @throws ApiException if fails to make API call
   */
  public DominoJobsInterfaceJob startJob(DominoJobsWebStartJobRequest dominoJobsWebStartJobRequest) throws ApiException {
    ApiResponse localVarResponse = startJobWithHttpInfo(dominoJobsWebStartJobRequest);
    return localVarResponse.getData();
  }

  /**
   * Starts a new Job
   * 
   * @param dominoJobsWebStartJobRequest JSON object with information for starting the Job (optional)
   * @return ApiResponse<DominoJobsInterfaceJob>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse startJobWithHttpInfo(DominoJobsWebStartJobRequest dominoJobsWebStartJobRequest) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = startJobRequestBuilder(dominoJobsWebStartJobRequest);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("startJob", 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 startJobRequestBuilder(DominoJobsWebStartJobRequest dominoJobsWebStartJobRequest) throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/jobs/start";

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

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

    try {
      byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(dominoJobsWebStartJobRequest);
      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;
  }
  /**
   * Stop a Job
   * 
   * @param dominoJobsWebJobStopOperationRequest JSON object with information for stopping the Job (required)
   * @return DominoJobsInterfaceJob
   * @throws ApiException if fails to make API call
   */
  public DominoJobsInterfaceJob stopJob(DominoJobsWebJobStopOperationRequest dominoJobsWebJobStopOperationRequest) throws ApiException {
    ApiResponse localVarResponse = stopJobWithHttpInfo(dominoJobsWebJobStopOperationRequest);
    return localVarResponse.getData();
  }

  /**
   * Stop a Job
   * 
   * @param dominoJobsWebJobStopOperationRequest JSON object with information for stopping the Job (required)
   * @return ApiResponse<DominoJobsInterfaceJob>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse stopJobWithHttpInfo(DominoJobsWebJobStopOperationRequest dominoJobsWebJobStopOperationRequest) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = stopJobRequestBuilder(dominoJobsWebJobStopOperationRequest);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("stopJob", 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 stopJobRequestBuilder(DominoJobsWebJobStopOperationRequest dominoJobsWebJobStopOperationRequest) throws ApiException {
    // verify the required parameter 'dominoJobsWebJobStopOperationRequest' is set
    if (dominoJobsWebJobStopOperationRequest == null) {
      throw new ApiException(400, "Missing the required parameter 'dominoJobsWebJobStopOperationRequest' when calling stopJob");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/jobs/stop";

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

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

    try {
      byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(dominoJobsWebJobStopOperationRequest);
      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 name for job
   * 
   * @param jobId  (required)
   * @param dominoJobsWebUpdateJobName JSON object with information for new name (required)
   * @return DominoJobsInterfaceJob
   * @throws ApiException if fails to make API call
   */
  public DominoJobsInterfaceJob updateJob(String jobId, DominoJobsWebUpdateJobName dominoJobsWebUpdateJobName) throws ApiException {
    ApiResponse localVarResponse = updateJobWithHttpInfo(jobId, dominoJobsWebUpdateJobName);
    return localVarResponse.getData();
  }

  /**
   * Update name for job
   * 
   * @param jobId  (required)
   * @param dominoJobsWebUpdateJobName JSON object with information for new name (required)
   * @return ApiResponse<DominoJobsInterfaceJob>
   * @throws ApiException if fails to make API call
   */
  public ApiResponse updateJobWithHttpInfo(String jobId, DominoJobsWebUpdateJobName dominoJobsWebUpdateJobName) throws ApiException {
    HttpRequest.Builder localVarRequestBuilder = updateJobRequestBuilder(jobId, dominoJobsWebUpdateJobName);
    try {
      HttpResponse localVarResponse = memberVarHttpClient.send(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofInputStream());
      if (memberVarResponseInterceptor != null) {
        memberVarResponseInterceptor.accept(localVarResponse);
      }
      try {
        if (localVarResponse.statusCode()/ 100 != 2) {
          throw getApiException("updateJob", 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 updateJobRequestBuilder(String jobId, DominoJobsWebUpdateJobName dominoJobsWebUpdateJobName) throws ApiException {
    // verify the required parameter 'jobId' is set
    if (jobId == null) {
      throw new ApiException(400, "Missing the required parameter 'jobId' when calling updateJob");
    }
    // verify the required parameter 'dominoJobsWebUpdateJobName' is set
    if (dominoJobsWebUpdateJobName == null) {
      throw new ApiException(400, "Missing the required parameter 'dominoJobsWebUpdateJobName' when calling updateJob");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/jobs/{jobId}/name"
        .replace("{jobId}", ApiClient.urlEncode(jobId.toString()));

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

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

    try {
      byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(dominoJobsWebUpdateJobName);
      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;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy