/*
 * 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;

/**
 * Probe describes a health check to be performed against a container to determine whether it is
 * alive or ready to receive traffic.
 *
 * <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 GoogleCloudRunV2Probe extends com.google.api.client.json.GenericJson {

  /**
   * Minimum consecutive failures for the probe to be considered failed after having succeeded.
   * Defaults to 3. Minimum value is 1.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Integer failureThreshold;

  /**
   * GRPC specifies an action involving a gRPC port. Exactly one of httpGet, tcpSocket, or grpc must
   * be specified.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private GoogleCloudRunV2GRPCAction grpc;

  /**
   * HTTPGet specifies the http request to perform. Exactly one of httpGet, tcpSocket, or grpc must
   * be specified.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private GoogleCloudRunV2HTTPGetAction httpGet;

  /**
   * Number of seconds after the container has started before the probe is initiated. Defaults to 0
   * seconds. Minimum value is 0. Maximum value for liveness probe is 3600. Maximum value for
   * startup probe is 240.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Integer initialDelaySeconds;

  /**
   * How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. Maximum
   * value for liveness probe is 3600. Maximum value for startup probe is 240. Must be greater or
   * equal than timeout_seconds.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Integer periodSeconds;

  /**
   * TCPSocket specifies an action involving a TCP port. Exactly one of httpGet, tcpSocket, or grpc
   * must be specified.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private GoogleCloudRunV2TCPSocketAction tcpSocket;

  /**
   * Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1.
   * Maximum value is 3600. Must be smaller than period_seconds.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Integer timeoutSeconds;

  /**
   * Minimum consecutive failures for the probe to be considered failed after having succeeded.
   * Defaults to 3. Minimum value is 1.
   * @return value or {@code null} for none
   */
  public java.lang.Integer getFailureThreshold() {
    return failureThreshold;
  }

  /**
   * Minimum consecutive failures for the probe to be considered failed after having succeeded.
   * Defaults to 3. Minimum value is 1.
   * @param failureThreshold failureThreshold or {@code null} for none
   */
  public GoogleCloudRunV2Probe setFailureThreshold(java.lang.Integer failureThreshold) {
    this.failureThreshold = failureThreshold;
    return this;
  }

  /**
   * GRPC specifies an action involving a gRPC port. Exactly one of httpGet, tcpSocket, or grpc must
   * be specified.
   * @return value or {@code null} for none
   */
  public GoogleCloudRunV2GRPCAction getGrpc() {
    return grpc;
  }

  /**
   * GRPC specifies an action involving a gRPC port. Exactly one of httpGet, tcpSocket, or grpc must
   * be specified.
   * @param grpc grpc or {@code null} for none
   */
  public GoogleCloudRunV2Probe setGrpc(GoogleCloudRunV2GRPCAction grpc) {
    this.grpc = grpc;
    return this;
  }

  /**
   * HTTPGet specifies the http request to perform. Exactly one of httpGet, tcpSocket, or grpc must
   * be specified.
   * @return value or {@code null} for none
   */
  public GoogleCloudRunV2HTTPGetAction getHttpGet() {
    return httpGet;
  }

  /**
   * HTTPGet specifies the http request to perform. Exactly one of httpGet, tcpSocket, or grpc must
   * be specified.
   * @param httpGet httpGet or {@code null} for none
   */
  public GoogleCloudRunV2Probe setHttpGet(GoogleCloudRunV2HTTPGetAction httpGet) {
    this.httpGet = httpGet;
    return this;
  }

  /**
   * Number of seconds after the container has started before the probe is initiated. Defaults to 0
   * seconds. Minimum value is 0. Maximum value for liveness probe is 3600. Maximum value for
   * startup probe is 240.
   * @return value or {@code null} for none
   */
  public java.lang.Integer getInitialDelaySeconds() {
    return initialDelaySeconds;
  }

  /**
   * Number of seconds after the container has started before the probe is initiated. Defaults to 0
   * seconds. Minimum value is 0. Maximum value for liveness probe is 3600. Maximum value for
   * startup probe is 240.
   * @param initialDelaySeconds initialDelaySeconds or {@code null} for none
   */
  public GoogleCloudRunV2Probe setInitialDelaySeconds(java.lang.Integer initialDelaySeconds) {
    this.initialDelaySeconds = initialDelaySeconds;
    return this;
  }

  /**
   * How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. Maximum
   * value for liveness probe is 3600. Maximum value for startup probe is 240. Must be greater or
   * equal than timeout_seconds.
   * @return value or {@code null} for none
   */
  public java.lang.Integer getPeriodSeconds() {
    return periodSeconds;
  }

  /**
   * How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. Maximum
   * value for liveness probe is 3600. Maximum value for startup probe is 240. Must be greater or
   * equal than timeout_seconds.
   * @param periodSeconds periodSeconds or {@code null} for none
   */
  public GoogleCloudRunV2Probe setPeriodSeconds(java.lang.Integer periodSeconds) {
    this.periodSeconds = periodSeconds;
    return this;
  }

  /**
   * TCPSocket specifies an action involving a TCP port. Exactly one of httpGet, tcpSocket, or grpc
   * must be specified.
   * @return value or {@code null} for none
   */
  public GoogleCloudRunV2TCPSocketAction getTcpSocket() {
    return tcpSocket;
  }

  /**
   * TCPSocket specifies an action involving a TCP port. Exactly one of httpGet, tcpSocket, or grpc
   * must be specified.
   * @param tcpSocket tcpSocket or {@code null} for none
   */
  public GoogleCloudRunV2Probe setTcpSocket(GoogleCloudRunV2TCPSocketAction tcpSocket) {
    this.tcpSocket = tcpSocket;
    return this;
  }

  /**
   * Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1.
   * Maximum value is 3600. Must be smaller than period_seconds.
   * @return value or {@code null} for none
   */
  public java.lang.Integer getTimeoutSeconds() {
    return timeoutSeconds;
  }

  /**
   * Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1.
   * Maximum value is 3600. Must be smaller than period_seconds.
   * @param timeoutSeconds timeoutSeconds or {@code null} for none
   */
  public GoogleCloudRunV2Probe setTimeoutSeconds(java.lang.Integer timeoutSeconds) {
    this.timeoutSeconds = timeoutSeconds;
    return this;
  }

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

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

}
