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

com.hpe.caf.services.job.api.generated.model.NewJob Maven / Gradle / Ivy

The newest version!
package com.hpe.caf.services.job.api.generated.model;

import com.fasterxml.jackson.annotation.JsonTypeName;
import com.hpe.caf.services.job.api.generated.model.WorkerAction;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonTypeName;

/**
 * Exactly one of task and job should be specified.
 **/

@JsonTypeName("newJob")
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", date = "2024-10-23T20:35:51.516502756Z[Etc/UTC]")
public class NewJob   {
  private String name;
  private String description;
  private String externalData;
  private WorkerAction task;
  private String type;
  private com.fasterxml.jackson.databind.JsonNode parameters;
  private List prerequisiteJobIds;
  private Integer delay = 0;
  private Map labels = new HashMap<>();

  /**
   * The name of the job
   **/
  public NewJob name(String name) {
    this.name = name;
    return this;
  }

  
  @JsonProperty("name")
  public String getName() {
    return name;
  }

  @JsonProperty("name")
  public void setName(String name) {
    this.name = name;
  }

  /**
   * The description of the job
   **/
  public NewJob description(String description) {
    this.description = description;
    return this;
  }

  
  @JsonProperty("description")
  public String getDescription() {
    return description;
  }

  @JsonProperty("description")
  public void setDescription(String description) {
    this.description = description;
  }

  /**
   * DEPRECATED - Replaced by labels. External data can be associated with the job for use by other components. 
   **/
  public NewJob externalData(String externalData) {
    this.externalData = externalData;
    return this;
  }

  
  @JsonProperty("externalData")
  public String getExternalData() {
    return externalData;
  }

  @JsonProperty("externalData")
  public void setExternalData(String externalData) {
    this.externalData = externalData;
  }

  /**
   **/
  public NewJob task(WorkerAction task) {
    this.task = task;
    return this;
  }

  
  @JsonProperty("task")
  public WorkerAction getTask() {
    return task;
  }

  @JsonProperty("task")
  public void setTask(WorkerAction task) {
    this.task = task;
  }

  /**
   * Execute the job using a specific job type configured on the service.
   **/
  public NewJob type(String type) {
    this.type = type;
    return this;
  }

  
  @JsonProperty("type")
  public String getType() {
    return type;
  }

  @JsonProperty("type")
  public void setType(String type) {
    this.type = type;
  }

  /**
   * Input to the selected job type.
   **/
  public NewJob parameters(com.fasterxml.jackson.databind.JsonNode parameters) {
    this.parameters = parameters;
    return this;
  }

  
  @JsonProperty("parameters")
  public com.fasterxml.jackson.databind.JsonNode getParameters() {
    return parameters;
  }

  @JsonProperty("parameters")
  public void setParameters(com.fasterxml.jackson.databind.JsonNode parameters) {
    this.parameters = parameters;
  }

  /**
   * List of job identifiers that must be complete prior to the start of this job.
   **/
  public NewJob prerequisiteJobIds(List prerequisiteJobIds) {
    this.prerequisiteJobIds = prerequisiteJobIds;
    return this;
  }

  
  @JsonProperty("prerequisiteJobIds")
  public List getPrerequisiteJobIds() {
    return prerequisiteJobIds;
  }

  @JsonProperty("prerequisiteJobIds")
  public void setPrerequisiteJobIds(List prerequisiteJobIds) {
    this.prerequisiteJobIds = prerequisiteJobIds;
  }

  public NewJob addPrerequisiteJobIdsItem(String prerequisiteJobIdsItem) {
    if (this.prerequisiteJobIds == null) {
      this.prerequisiteJobIds = new ArrayList<>();
    }

    this.prerequisiteJobIds.add(prerequisiteJobIdsItem);
    return this;
  }

  public NewJob removePrerequisiteJobIdsItem(String prerequisiteJobIdsItem) {
    if (prerequisiteJobIdsItem != null && this.prerequisiteJobIds != null) {
      this.prerequisiteJobIds.remove(prerequisiteJobIdsItem);
    }

    return this;
  }
  /**
   * The time in seconds after the prerequisite job identifiers have completed before this job is eligible for running.
   **/
  public NewJob delay(Integer delay) {
    this.delay = delay;
    return this;
  }

  
  @JsonProperty("delay")
  public Integer getDelay() {
    return delay;
  }

  @JsonProperty("delay")
  public void setDelay(Integer delay) {
    this.delay = delay;
  }

  /**
   * A map of meta data associated with this job. Note that the keys can only include alphanumeric, '_', '-' and ':' characters 
   **/
  public NewJob labels(Map labels) {
    this.labels = labels;
    return this;
  }

  
  @JsonProperty("labels")
  public Map getLabels() {
    return labels;
  }

  @JsonProperty("labels")
  public void setLabels(Map labels) {
    this.labels = labels;
  }

  public NewJob putLabelsItem(String key, String labelsItem) {
    if (this.labels == null) {
      this.labels = new HashMap<>();
    }

    this.labels.put(key, labelsItem);
    return this;
  }

  public NewJob removeLabelsItem(String labelsItem) {
    if (labelsItem != null && this.labels != null) {
      this.labels.remove(labelsItem);
    }

    return this;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    NewJob newJob = (NewJob) o;
    return Objects.equals(this.name, newJob.name) &&
        Objects.equals(this.description, newJob.description) &&
        Objects.equals(this.externalData, newJob.externalData) &&
        Objects.equals(this.task, newJob.task) &&
        Objects.equals(this.type, newJob.type) &&
        Objects.equals(this.parameters, newJob.parameters) &&
        Objects.equals(this.prerequisiteJobIds, newJob.prerequisiteJobIds) &&
        Objects.equals(this.delay, newJob.delay) &&
        Objects.equals(this.labels, newJob.labels);
  }

  @Override
  public int hashCode() {
    return Objects.hash(name, description, externalData, task, type, parameters, prerequisiteJobIds, delay, labels);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class NewJob {\n");
    
    sb.append("    name: ").append(toIndentedString(name)).append("\n");
    sb.append("    description: ").append(toIndentedString(description)).append("\n");
    sb.append("    externalData: ").append(toIndentedString(externalData)).append("\n");
    sb.append("    task: ").append(toIndentedString(task)).append("\n");
    sb.append("    type: ").append(toIndentedString(type)).append("\n");
    sb.append("    parameters: ").append(toIndentedString(parameters)).append("\n");
    sb.append("    prerequisiteJobIds: ").append(toIndentedString(prerequisiteJobIds)).append("\n");
    sb.append("    delay: ").append(toIndentedString(delay)).append("\n");
    sb.append("    labels: ").append(toIndentedString(labels)).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    ");
  }


}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy