/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.batch.v1.model;

/**
 * Runnable describes instructions for executing a specific script or container as part of a Task.
 *
 * <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Batch API. For a detailed explanation see:
 * <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
 * </p>
 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class Runnable extends com.google.api.client.json.GenericJson {

  /**
   * By default, after a Runnable fails, no further Runnable are executed. This flag indicates that
   * this Runnable must be run even if the Task has already failed. This is useful for Runnables
   * that copy output files off of the VM or for debugging. The always_run flag does not override
   * the Task's overall max_run_duration. If the max_run_duration has expired then no further
   * Runnables will execute, not even always_run Runnables.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Boolean alwaysRun;

  /**
   * This flag allows a Runnable to continue running in the background while the Task executes
   * subsequent Runnables. This is useful to provide services to other Runnables (or to provide
   * debugging support tools like SSH servers).
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Boolean background;

  /**
   * Barrier runnable.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private Barrier barrier;

  /**
   * Container runnable.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private Container container;

  /**
   * Environment variables for this Runnable (overrides variables set for the whole Task or
   * TaskGroup).
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private Environment environment;

  /**
   * Normally, a non-zero exit status causes the Task to fail. This flag allows execution of other
   * Runnables to continue instead.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Boolean ignoreExitStatus;

  /**
   * Labels for this Runnable.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.Map<String, java.lang.String> labels;

  /**
   * Script runnable.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private Script script;

  /**
   * Timeout for this Runnable.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private String timeout;

  /**
   * By default, after a Runnable fails, no further Runnable are executed. This flag indicates that
   * this Runnable must be run even if the Task has already failed. This is useful for Runnables
   * that copy output files off of the VM or for debugging. The always_run flag does not override
   * the Task's overall max_run_duration. If the max_run_duration has expired then no further
   * Runnables will execute, not even always_run Runnables.
   * @return value or {@code null} for none
   */
  public java.lang.Boolean getAlwaysRun() {
    return alwaysRun;
  }

  /**
   * By default, after a Runnable fails, no further Runnable are executed. This flag indicates that
   * this Runnable must be run even if the Task has already failed. This is useful for Runnables
   * that copy output files off of the VM or for debugging. The always_run flag does not override
   * the Task's overall max_run_duration. If the max_run_duration has expired then no further
   * Runnables will execute, not even always_run Runnables.
   * @param alwaysRun alwaysRun or {@code null} for none
   */
  public Runnable setAlwaysRun(java.lang.Boolean alwaysRun) {
    this.alwaysRun = alwaysRun;
    return this;
  }

  /**
   * This flag allows a Runnable to continue running in the background while the Task executes
   * subsequent Runnables. This is useful to provide services to other Runnables (or to provide
   * debugging support tools like SSH servers).
   * @return value or {@code null} for none
   */
  public java.lang.Boolean getBackground() {
    return background;
  }

  /**
   * This flag allows a Runnable to continue running in the background while the Task executes
   * subsequent Runnables. This is useful to provide services to other Runnables (or to provide
   * debugging support tools like SSH servers).
   * @param background background or {@code null} for none
   */
  public Runnable setBackground(java.lang.Boolean background) {
    this.background = background;
    return this;
  }

  /**
   * Barrier runnable.
   * @return value or {@code null} for none
   */
  public Barrier getBarrier() {
    return barrier;
  }

  /**
   * Barrier runnable.
   * @param barrier barrier or {@code null} for none
   */
  public Runnable setBarrier(Barrier barrier) {
    this.barrier = barrier;
    return this;
  }

  /**
   * Container runnable.
   * @return value or {@code null} for none
   */
  public Container getContainer() {
    return container;
  }

  /**
   * Container runnable.
   * @param container container or {@code null} for none
   */
  public Runnable setContainer(Container container) {
    this.container = container;
    return this;
  }

  /**
   * Environment variables for this Runnable (overrides variables set for the whole Task or
   * TaskGroup).
   * @return value or {@code null} for none
   */
  public Environment getEnvironment() {
    return environment;
  }

  /**
   * Environment variables for this Runnable (overrides variables set for the whole Task or
   * TaskGroup).
   * @param environment environment or {@code null} for none
   */
  public Runnable setEnvironment(Environment environment) {
    this.environment = environment;
    return this;
  }

  /**
   * Normally, a non-zero exit status causes the Task to fail. This flag allows execution of other
   * Runnables to continue instead.
   * @return value or {@code null} for none
   */
  public java.lang.Boolean getIgnoreExitStatus() {
    return ignoreExitStatus;
  }

  /**
   * Normally, a non-zero exit status causes the Task to fail. This flag allows execution of other
   * Runnables to continue instead.
   * @param ignoreExitStatus ignoreExitStatus or {@code null} for none
   */
  public Runnable setIgnoreExitStatus(java.lang.Boolean ignoreExitStatus) {
    this.ignoreExitStatus = ignoreExitStatus;
    return this;
  }

  /**
   * Labels for this Runnable.
   * @return value or {@code null} for none
   */
  public java.util.Map<String, java.lang.String> getLabels() {
    return labels;
  }

  /**
   * Labels for this Runnable.
   * @param labels labels or {@code null} for none
   */
  public Runnable setLabels(java.util.Map<String, java.lang.String> labels) {
    this.labels = labels;
    return this;
  }

  /**
   * Script runnable.
   * @return value or {@code null} for none
   */
  public Script getScript() {
    return script;
  }

  /**
   * Script runnable.
   * @param script script or {@code null} for none
   */
  public Runnable setScript(Script script) {
    this.script = script;
    return this;
  }

  /**
   * Timeout for this Runnable.
   * @return value or {@code null} for none
   */
  public String getTimeout() {
    return timeout;
  }

  /**
   * Timeout for this Runnable.
   * @param timeout timeout or {@code null} for none
   */
  public Runnable setTimeout(String timeout) {
    this.timeout = timeout;
    return this;
  }

  @Override
  public Runnable set(String fieldName, Object value) {
    return (Runnable) super.set(fieldName, value);
  }

  @Override
  public Runnable clone() {
    return (Runnable) super.clone();
  }

}
