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

com.dominodatalab.pub.model.NewJobV1 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.model;

import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import com.dominodatalab.pub.model.ComputeClusterConfigV1;
import com.dominodatalab.pub.model.GitRefV1;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;


import com.dominodatalab.pub.invoker.ApiClient;
/**
 * NewJobV1
 */
@JsonPropertyOrder({
  NewJobV1.JSON_PROPERTY_COMMIT_ID,
  NewJobV1.JSON_PROPERTY_COMPUTE_CLUSTER,
  NewJobV1.JSON_PROPERTY_ENVIRONMENT_ID,
  NewJobV1.JSON_PROPERTY_ENVIRONMENT_REVISION_SPEC,
  NewJobV1.JSON_PROPERTY_EXTERNAL_VOLUME_MOUNT_IDS,
  NewJobV1.JSON_PROPERTY_HARDWARE_TIER,
  NewJobV1.JSON_PROPERTY_MAIN_REPO_GIT_REF,
  NewJobV1.JSON_PROPERTY_PROJECT_ID,
  NewJobV1.JSON_PROPERTY_RUN_COMMAND,
  NewJobV1.JSON_PROPERTY_SNAPSHOT_DATASETS_ON_COMPLETION,
  NewJobV1.JSON_PROPERTY_TITLE
})
@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 NewJobV1 {
  public static final String JSON_PROPERTY_COMMIT_ID = "commitId";
  private String commitId;

  public static final String JSON_PROPERTY_COMPUTE_CLUSTER = "computeCluster";
  private ComputeClusterConfigV1 computeCluster;

  public static final String JSON_PROPERTY_ENVIRONMENT_ID = "environmentId";
  private String environmentId;

  public static final String JSON_PROPERTY_ENVIRONMENT_REVISION_SPEC = "environmentRevisionSpec";
  private String environmentRevisionSpec;

  public static final String JSON_PROPERTY_EXTERNAL_VOLUME_MOUNT_IDS = "externalVolumeMountIds";
  private List externalVolumeMountIds = new ArrayList<>();

  public static final String JSON_PROPERTY_HARDWARE_TIER = "hardwareTier";
  private String hardwareTier;

  public static final String JSON_PROPERTY_MAIN_REPO_GIT_REF = "mainRepoGitRef";
  private GitRefV1 mainRepoGitRef;

  public static final String JSON_PROPERTY_PROJECT_ID = "projectId";
  private String projectId;

  public static final String JSON_PROPERTY_RUN_COMMAND = "runCommand";
  private String runCommand;

  public static final String JSON_PROPERTY_SNAPSHOT_DATASETS_ON_COMPLETION = "snapshotDatasetsOnCompletion";
  private Boolean snapshotDatasetsOnCompletion;

  public static final String JSON_PROPERTY_TITLE = "title";
  private String title;

  public NewJobV1() { 
  }

  public NewJobV1 commitId(String commitId) {
    this.commitId = commitId;
    return this;
  }

  /**
   * Git commitId to start job from. Defaults to head commitId for the project.
   * @return commitId
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_COMMIT_ID)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public String getCommitId() {
    return commitId;
  }


  @JsonProperty(JSON_PROPERTY_COMMIT_ID)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setCommitId(String commitId) {
    this.commitId = commitId;
  }


  public NewJobV1 computeCluster(ComputeClusterConfigV1 computeCluster) {
    this.computeCluster = computeCluster;
    return this;
  }

  /**
   * Get computeCluster
   * @return computeCluster
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_COMPUTE_CLUSTER)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public ComputeClusterConfigV1 getComputeCluster() {
    return computeCluster;
  }


  @JsonProperty(JSON_PROPERTY_COMPUTE_CLUSTER)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setComputeCluster(ComputeClusterConfigV1 computeCluster) {
    this.computeCluster = computeCluster;
  }


  public NewJobV1 environmentId(String environmentId) {
    this.environmentId = environmentId;
    return this;
  }

  /**
   * Id of environment to use when creating job. Defaults to project default environment.
   * @return environmentId
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_ENVIRONMENT_ID)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public String getEnvironmentId() {
    return environmentId;
  }


  @JsonProperty(JSON_PROPERTY_ENVIRONMENT_ID)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setEnvironmentId(String environmentId) {
    this.environmentId = environmentId;
  }


  public NewJobV1 environmentRevisionSpec(String environmentRevisionSpec) {
    this.environmentRevisionSpec = environmentRevisionSpec;
    return this;
  }

  /**
   * Specification describing which environment revision to use. Defaults to \"ActiveRevision\"
   * @return environmentRevisionSpec
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_ENVIRONMENT_REVISION_SPEC)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public String getEnvironmentRevisionSpec() {
    return environmentRevisionSpec;
  }


  @JsonProperty(JSON_PROPERTY_ENVIRONMENT_REVISION_SPEC)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setEnvironmentRevisionSpec(String environmentRevisionSpec) {
    this.environmentRevisionSpec = environmentRevisionSpec;
  }


  public NewJobV1 externalVolumeMountIds(List externalVolumeMountIds) {
    this.externalVolumeMountIds = externalVolumeMountIds;
    return this;
  }

  public NewJobV1 addExternalVolumeMountIdsItem(String externalVolumeMountIdsItem) {
    if (this.externalVolumeMountIds == null) {
      this.externalVolumeMountIds = new ArrayList<>();
    }
    this.externalVolumeMountIds.add(externalVolumeMountIdsItem);
    return this;
  }

  /**
   * Id's of external volumes to be mounted on this job.
   * @return externalVolumeMountIds
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_EXTERNAL_VOLUME_MOUNT_IDS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public List getExternalVolumeMountIds() {
    return externalVolumeMountIds;
  }


  @JsonProperty(JSON_PROPERTY_EXTERNAL_VOLUME_MOUNT_IDS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setExternalVolumeMountIds(List externalVolumeMountIds) {
    this.externalVolumeMountIds = externalVolumeMountIds;
  }


  public NewJobV1 hardwareTier(String hardwareTier) {
    this.hardwareTier = hardwareTier;
    return this;
  }

  /**
   * Hardware tier to use for this job. Defaults to project default hardware tier.
   * @return hardwareTier
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_HARDWARE_TIER)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public String getHardwareTier() {
    return hardwareTier;
  }


  @JsonProperty(JSON_PROPERTY_HARDWARE_TIER)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setHardwareTier(String hardwareTier) {
    this.hardwareTier = hardwareTier;
  }


  public NewJobV1 mainRepoGitRef(GitRefV1 mainRepoGitRef) {
    this.mainRepoGitRef = mainRepoGitRef;
    return this;
  }

  /**
   * Get mainRepoGitRef
   * @return mainRepoGitRef
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_MAIN_REPO_GIT_REF)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public GitRefV1 getMainRepoGitRef() {
    return mainRepoGitRef;
  }


  @JsonProperty(JSON_PROPERTY_MAIN_REPO_GIT_REF)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setMainRepoGitRef(GitRefV1 mainRepoGitRef) {
    this.mainRepoGitRef = mainRepoGitRef;
  }


  public NewJobV1 projectId(String projectId) {
    this.projectId = projectId;
    return this;
  }

  /**
   * Id of project to create job in.
   * @return projectId
   */
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_PROJECT_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public String getProjectId() {
    return projectId;
  }


  @JsonProperty(JSON_PROPERTY_PROJECT_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setProjectId(String projectId) {
    this.projectId = projectId;
  }


  public NewJobV1 runCommand(String runCommand) {
    this.runCommand = runCommand;
    return this;
  }

  /**
   * Command for job to run
   * @return runCommand
   */
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_RUN_COMMAND)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public String getRunCommand() {
    return runCommand;
  }


  @JsonProperty(JSON_PROPERTY_RUN_COMMAND)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setRunCommand(String runCommand) {
    this.runCommand = runCommand;
  }


  public NewJobV1 snapshotDatasetsOnCompletion(Boolean snapshotDatasetsOnCompletion) {
    this.snapshotDatasetsOnCompletion = snapshotDatasetsOnCompletion;
    return this;
  }

  /**
   * Whether to snapshot datasets mounted on the Job when the Job completes.
   * @return snapshotDatasetsOnCompletion
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_SNAPSHOT_DATASETS_ON_COMPLETION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public Boolean getSnapshotDatasetsOnCompletion() {
    return snapshotDatasetsOnCompletion;
  }


  @JsonProperty(JSON_PROPERTY_SNAPSHOT_DATASETS_ON_COMPLETION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setSnapshotDatasetsOnCompletion(Boolean snapshotDatasetsOnCompletion) {
    this.snapshotDatasetsOnCompletion = snapshotDatasetsOnCompletion;
  }


  public NewJobV1 title(String title) {
    this.title = title;
    return this;
  }

  /**
   * Name of job to start
   * @return title
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_TITLE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public String getTitle() {
    return title;
  }


  @JsonProperty(JSON_PROPERTY_TITLE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setTitle(String title) {
    this.title = title;
  }


  /**
   * Return true if this NewJobV1 object is equal to o.
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    NewJobV1 newJobV1 = (NewJobV1) o;
    return Objects.equals(this.commitId, newJobV1.commitId) &&
        Objects.equals(this.computeCluster, newJobV1.computeCluster) &&
        Objects.equals(this.environmentId, newJobV1.environmentId) &&
        Objects.equals(this.environmentRevisionSpec, newJobV1.environmentRevisionSpec) &&
        Objects.equals(this.externalVolumeMountIds, newJobV1.externalVolumeMountIds) &&
        Objects.equals(this.hardwareTier, newJobV1.hardwareTier) &&
        Objects.equals(this.mainRepoGitRef, newJobV1.mainRepoGitRef) &&
        Objects.equals(this.projectId, newJobV1.projectId) &&
        Objects.equals(this.runCommand, newJobV1.runCommand) &&
        Objects.equals(this.snapshotDatasetsOnCompletion, newJobV1.snapshotDatasetsOnCompletion) &&
        Objects.equals(this.title, newJobV1.title);
  }

  @Override
  public int hashCode() {
    return Objects.hash(commitId, computeCluster, environmentId, environmentRevisionSpec, externalVolumeMountIds, hardwareTier, mainRepoGitRef, projectId, runCommand, snapshotDatasetsOnCompletion, title);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class NewJobV1 {\n");
    sb.append("    commitId: ").append(toIndentedString(commitId)).append("\n");
    sb.append("    computeCluster: ").append(toIndentedString(computeCluster)).append("\n");
    sb.append("    environmentId: ").append(toIndentedString(environmentId)).append("\n");
    sb.append("    environmentRevisionSpec: ").append(toIndentedString(environmentRevisionSpec)).append("\n");
    sb.append("    externalVolumeMountIds: ").append(toIndentedString(externalVolumeMountIds)).append("\n");
    sb.append("    hardwareTier: ").append(toIndentedString(hardwareTier)).append("\n");
    sb.append("    mainRepoGitRef: ").append(toIndentedString(mainRepoGitRef)).append("\n");
    sb.append("    projectId: ").append(toIndentedString(projectId)).append("\n");
    sb.append("    runCommand: ").append(toIndentedString(runCommand)).append("\n");
    sb.append("    snapshotDatasetsOnCompletion: ").append(toIndentedString(snapshotDatasetsOnCompletion)).append("\n");
    sb.append("    title: ").append(toIndentedString(title)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

  /**
   * Convert the instance into URL query string.
   *
   * @return URL query string
   */
  public String toUrlQueryString() {
    return toUrlQueryString(null);
  }

  /**
   * Convert the instance into URL query string.
   *
   * @param prefix prefix of the query string
   * @return URL query string
   */
  public String toUrlQueryString(String prefix) {
    String suffix = "";
    String containerSuffix = "";
    String containerPrefix = "";
    if (prefix == null) {
      // style=form, explode=true, e.g. /pet?name=cat&type=manx
      prefix = "";
    } else {
      // deepObject style e.g. /pet?id[name]=cat&id[type]=manx
      prefix = prefix + "[";
      suffix = "]";
      containerSuffix = "]";
      containerPrefix = "[";
    }

    StringJoiner joiner = new StringJoiner("&");

    // add `commitId` to the URL query string
    if (getCommitId() != null) {
      joiner.add(String.format("%scommitId%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getCommitId()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `computeCluster` to the URL query string
    if (getComputeCluster() != null) {
      joiner.add(getComputeCluster().toUrlQueryString(prefix + "computeCluster" + suffix));
    }

    // add `environmentId` to the URL query string
    if (getEnvironmentId() != null) {
      joiner.add(String.format("%senvironmentId%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getEnvironmentId()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `environmentRevisionSpec` to the URL query string
    if (getEnvironmentRevisionSpec() != null) {
      joiner.add(String.format("%senvironmentRevisionSpec%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getEnvironmentRevisionSpec()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `externalVolumeMountIds` to the URL query string
    if (getExternalVolumeMountIds() != null) {
      for (int i = 0; i < getExternalVolumeMountIds().size(); i++) {
        joiner.add(String.format("%sexternalVolumeMountIds%s%s=%s", prefix, suffix,
            "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
            URLEncoder.encode(ApiClient.valueToString(getExternalVolumeMountIds().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
      }
    }

    // add `hardwareTier` to the URL query string
    if (getHardwareTier() != null) {
      joiner.add(String.format("%shardwareTier%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getHardwareTier()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `mainRepoGitRef` to the URL query string
    if (getMainRepoGitRef() != null) {
      joiner.add(getMainRepoGitRef().toUrlQueryString(prefix + "mainRepoGitRef" + suffix));
    }

    // add `projectId` to the URL query string
    if (getProjectId() != null) {
      joiner.add(String.format("%sprojectId%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getProjectId()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `runCommand` to the URL query string
    if (getRunCommand() != null) {
      joiner.add(String.format("%srunCommand%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getRunCommand()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `snapshotDatasetsOnCompletion` to the URL query string
    if (getSnapshotDatasetsOnCompletion() != null) {
      joiner.add(String.format("%ssnapshotDatasetsOnCompletion%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getSnapshotDatasetsOnCompletion()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `title` to the URL query string
    if (getTitle() != null) {
      joiner.add(String.format("%stitle%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getTitle()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    return joiner.toString();
  }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy