/*
 * 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.run.v2.model;

/**
 * TaskTemplate describes the data a task should have when created from a template.
 *
 * <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 Cloud Run Admin 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 GoogleCloudRunV2TaskTemplate extends com.google.api.client.json.GenericJson {

  /**
   * Holds the single container that defines the unit of execution for this task.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<GoogleCloudRunV2Container> containers;

  static {
    // hack to force ProGuard to consider GoogleCloudRunV2Container used, since otherwise it would be stripped out
    // see https://github.com/google/google-api-java-client/issues/543
    com.google.api.client.util.Data.nullOf(GoogleCloudRunV2Container.class);
  }

  /**
   * A reference to a customer managed encryption key (CMEK) to use to encrypt this container image.
   * For more information, go to https://cloud.google.com/run/docs/securing/using-cmek
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String encryptionKey;

  /**
   * The execution environment being used to host this Task.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String executionEnvironment;

  /**
   * Number of retries allowed per Task, before marking this Task failed.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Integer maxRetries;

  /**
   * Email address of the IAM service account associated with the Task of a Job. The service account
   * represents the identity of the running task, and determines what permissions the task has. If
   * not provided, the task will use the project's default service account.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String serviceAccount;

  /**
   * Max allowed time duration the Task may be active before the system will actively try to mark it
   * failed and kill associated containers. This applies per attempt of a task, meaning each retry
   * can run for the full timeout.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private String timeout;

  /**
   * A list of Volumes to make available to containers.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<GoogleCloudRunV2Volume> volumes;

  /**
   * VPC Access configuration to use for this Task. For more information, visit
   * https://cloud.google.com/run/docs/configuring/connecting-vpc.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private GoogleCloudRunV2VpcAccess vpcAccess;

  /**
   * Holds the single container that defines the unit of execution for this task.
   * @return value or {@code null} for none
   */
  public java.util.List<GoogleCloudRunV2Container> getContainers() {
    return containers;
  }

  /**
   * Holds the single container that defines the unit of execution for this task.
   * @param containers containers or {@code null} for none
   */
  public GoogleCloudRunV2TaskTemplate setContainers(java.util.List<GoogleCloudRunV2Container> containers) {
    this.containers = containers;
    return this;
  }

  /**
   * A reference to a customer managed encryption key (CMEK) to use to encrypt this container image.
   * For more information, go to https://cloud.google.com/run/docs/securing/using-cmek
   * @return value or {@code null} for none
   */
  public java.lang.String getEncryptionKey() {
    return encryptionKey;
  }

  /**
   * A reference to a customer managed encryption key (CMEK) to use to encrypt this container image.
   * For more information, go to https://cloud.google.com/run/docs/securing/using-cmek
   * @param encryptionKey encryptionKey or {@code null} for none
   */
  public GoogleCloudRunV2TaskTemplate setEncryptionKey(java.lang.String encryptionKey) {
    this.encryptionKey = encryptionKey;
    return this;
  }

  /**
   * The execution environment being used to host this Task.
   * @return value or {@code null} for none
   */
  public java.lang.String getExecutionEnvironment() {
    return executionEnvironment;
  }

  /**
   * The execution environment being used to host this Task.
   * @param executionEnvironment executionEnvironment or {@code null} for none
   */
  public GoogleCloudRunV2TaskTemplate setExecutionEnvironment(java.lang.String executionEnvironment) {
    this.executionEnvironment = executionEnvironment;
    return this;
  }

  /**
   * Number of retries allowed per Task, before marking this Task failed.
   * @return value or {@code null} for none
   */
  public java.lang.Integer getMaxRetries() {
    return maxRetries;
  }

  /**
   * Number of retries allowed per Task, before marking this Task failed.
   * @param maxRetries maxRetries or {@code null} for none
   */
  public GoogleCloudRunV2TaskTemplate setMaxRetries(java.lang.Integer maxRetries) {
    this.maxRetries = maxRetries;
    return this;
  }

  /**
   * Email address of the IAM service account associated with the Task of a Job. The service account
   * represents the identity of the running task, and determines what permissions the task has. If
   * not provided, the task will use the project's default service account.
   * @return value or {@code null} for none
   */
  public java.lang.String getServiceAccount() {
    return serviceAccount;
  }

  /**
   * Email address of the IAM service account associated with the Task of a Job. The service account
   * represents the identity of the running task, and determines what permissions the task has. If
   * not provided, the task will use the project's default service account.
   * @param serviceAccount serviceAccount or {@code null} for none
   */
  public GoogleCloudRunV2TaskTemplate setServiceAccount(java.lang.String serviceAccount) {
    this.serviceAccount = serviceAccount;
    return this;
  }

  /**
   * Max allowed time duration the Task may be active before the system will actively try to mark it
   * failed and kill associated containers. This applies per attempt of a task, meaning each retry
   * can run for the full timeout.
   * @return value or {@code null} for none
   */
  public String getTimeout() {
    return timeout;
  }

  /**
   * Max allowed time duration the Task may be active before the system will actively try to mark it
   * failed and kill associated containers. This applies per attempt of a task, meaning each retry
   * can run for the full timeout.
   * @param timeout timeout or {@code null} for none
   */
  public GoogleCloudRunV2TaskTemplate setTimeout(String timeout) {
    this.timeout = timeout;
    return this;
  }

  /**
   * A list of Volumes to make available to containers.
   * @return value or {@code null} for none
   */
  public java.util.List<GoogleCloudRunV2Volume> getVolumes() {
    return volumes;
  }

  /**
   * A list of Volumes to make available to containers.
   * @param volumes volumes or {@code null} for none
   */
  public GoogleCloudRunV2TaskTemplate setVolumes(java.util.List<GoogleCloudRunV2Volume> volumes) {
    this.volumes = volumes;
    return this;
  }

  /**
   * VPC Access configuration to use for this Task. For more information, visit
   * https://cloud.google.com/run/docs/configuring/connecting-vpc.
   * @return value or {@code null} for none
   */
  public GoogleCloudRunV2VpcAccess getVpcAccess() {
    return vpcAccess;
  }

  /**
   * VPC Access configuration to use for this Task. For more information, visit
   * https://cloud.google.com/run/docs/configuring/connecting-vpc.
   * @param vpcAccess vpcAccess or {@code null} for none
   */
  public GoogleCloudRunV2TaskTemplate setVpcAccess(GoogleCloudRunV2VpcAccess vpcAccess) {
    this.vpcAccess = vpcAccess;
    return this;
  }

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

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

}
