<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/run/v2/k8s.min.proto

namespace Google\Cloud\Run\V2;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * Probe describes a health check to be performed against a container to
 * determine whether it is alive or ready to receive traffic.
 *
 * Generated from protobuf message <code>google.cloud.run.v2.Probe</code>
 */
class Probe extends \Google\Protobuf\Internal\Message
{
    /**
     * 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.
     * More info:
     * https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
     *
     * Generated from protobuf field <code>int32 initial_delay_seconds = 1;</code>
     */
    private $initial_delay_seconds = 0;
    /**
     * 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.
     * More info:
     * https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
     *
     * Generated from protobuf field <code>int32 timeout_seconds = 2;</code>
     */
    private $timeout_seconds = 0;
    /**
     * 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.
     *
     * Generated from protobuf field <code>int32 period_seconds = 3;</code>
     */
    private $period_seconds = 0;
    /**
     * Minimum consecutive failures for the probe to be considered failed after
     * having succeeded. Defaults to 3. Minimum value is 1.
     *
     * Generated from protobuf field <code>int32 failure_threshold = 4;</code>
     */
    private $failure_threshold = 0;
    protected $probe_type;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $initial_delay_seconds
     *           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.
     *           More info:
     *           https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
     *     @type int $timeout_seconds
     *           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.
     *           More info:
     *           https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
     *     @type int $period_seconds
     *           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.
     *     @type int $failure_threshold
     *           Minimum consecutive failures for the probe to be considered failed after
     *           having succeeded. Defaults to 3. Minimum value is 1.
     *     @type \Google\Cloud\Run\V2\HTTPGetAction $http_get
     *           HTTPGet specifies the http request to perform.
     *           Exactly one of httpGet, tcpSocket, or grpc must be specified.
     *     @type \Google\Cloud\Run\V2\TCPSocketAction $tcp_socket
     *           TCPSocket specifies an action involving a TCP port.
     *           Exactly one of httpGet, tcpSocket, or grpc must be specified.
     *     @type \Google\Cloud\Run\V2\GRPCAction $grpc
     *           GRPC specifies an action involving a gRPC port.
     *           Exactly one of httpGet, tcpSocket, or grpc must be specified.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Run\V2\K8SMin::initOnce();
        parent::__construct($data);
    }

    /**
     * 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.
     * More info:
     * https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
     *
     * Generated from protobuf field <code>int32 initial_delay_seconds = 1;</code>
     * @return int
     */
    public function getInitialDelaySeconds()
    {
        return $this->initial_delay_seconds;
    }

    /**
     * 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.
     * More info:
     * https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
     *
     * Generated from protobuf field <code>int32 initial_delay_seconds = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setInitialDelaySeconds($var)
    {
        GPBUtil::checkInt32($var);
        $this->initial_delay_seconds = $var;

        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.
     * More info:
     * https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
     *
     * Generated from protobuf field <code>int32 timeout_seconds = 2;</code>
     * @return int
     */
    public function getTimeoutSeconds()
    {
        return $this->timeout_seconds;
    }

    /**
     * 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.
     * More info:
     * https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
     *
     * Generated from protobuf field <code>int32 timeout_seconds = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setTimeoutSeconds($var)
    {
        GPBUtil::checkInt32($var);
        $this->timeout_seconds = $var;

        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.
     *
     * Generated from protobuf field <code>int32 period_seconds = 3;</code>
     * @return int
     */
    public function getPeriodSeconds()
    {
        return $this->period_seconds;
    }

    /**
     * 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.
     *
     * Generated from protobuf field <code>int32 period_seconds = 3;</code>
     * @param int $var
     * @return $this
     */
    public function setPeriodSeconds($var)
    {
        GPBUtil::checkInt32($var);
        $this->period_seconds = $var;

        return $this;
    }

    /**
     * Minimum consecutive failures for the probe to be considered failed after
     * having succeeded. Defaults to 3. Minimum value is 1.
     *
     * Generated from protobuf field <code>int32 failure_threshold = 4;</code>
     * @return int
     */
    public function getFailureThreshold()
    {
        return $this->failure_threshold;
    }

    /**
     * Minimum consecutive failures for the probe to be considered failed after
     * having succeeded. Defaults to 3. Minimum value is 1.
     *
     * Generated from protobuf field <code>int32 failure_threshold = 4;</code>
     * @param int $var
     * @return $this
     */
    public function setFailureThreshold($var)
    {
        GPBUtil::checkInt32($var);
        $this->failure_threshold = $var;

        return $this;
    }

    /**
     * HTTPGet specifies the http request to perform.
     * Exactly one of httpGet, tcpSocket, or grpc must be specified.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.HTTPGetAction http_get = 5;</code>
     * @return \Google\Cloud\Run\V2\HTTPGetAction|null
     */
    public function getHttpGet()
    {
        return $this->readOneof(5);
    }

    public function hasHttpGet()
    {
        return $this->hasOneof(5);
    }

    /**
     * HTTPGet specifies the http request to perform.
     * Exactly one of httpGet, tcpSocket, or grpc must be specified.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.HTTPGetAction http_get = 5;</code>
     * @param \Google\Cloud\Run\V2\HTTPGetAction $var
     * @return $this
     */
    public function setHttpGet($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Run\V2\HTTPGetAction::class);
        $this->writeOneof(5, $var);

        return $this;
    }

    /**
     * TCPSocket specifies an action involving a TCP port.
     * Exactly one of httpGet, tcpSocket, or grpc must be specified.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.TCPSocketAction tcp_socket = 6;</code>
     * @return \Google\Cloud\Run\V2\TCPSocketAction|null
     */
    public function getTcpSocket()
    {
        return $this->readOneof(6);
    }

    public function hasTcpSocket()
    {
        return $this->hasOneof(6);
    }

    /**
     * TCPSocket specifies an action involving a TCP port.
     * Exactly one of httpGet, tcpSocket, or grpc must be specified.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.TCPSocketAction tcp_socket = 6;</code>
     * @param \Google\Cloud\Run\V2\TCPSocketAction $var
     * @return $this
     */
    public function setTcpSocket($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Run\V2\TCPSocketAction::class);
        $this->writeOneof(6, $var);

        return $this;
    }

    /**
     * GRPC specifies an action involving a gRPC port.
     * Exactly one of httpGet, tcpSocket, or grpc must be specified.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.GRPCAction grpc = 7;</code>
     * @return \Google\Cloud\Run\V2\GRPCAction|null
     */
    public function getGrpc()
    {
        return $this->readOneof(7);
    }

    public function hasGrpc()
    {
        return $this->hasOneof(7);
    }

    /**
     * GRPC specifies an action involving a gRPC port.
     * Exactly one of httpGet, tcpSocket, or grpc must be specified.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.GRPCAction grpc = 7;</code>
     * @param \Google\Cloud\Run\V2\GRPCAction $var
     * @return $this
     */
    public function setGrpc($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Run\V2\GRPCAction::class);
        $this->writeOneof(7, $var);

        return $this;
    }

    /**
     * @return string
     */
    public function getProbeType()
    {
        return $this->whichOneof("probe_type");
    }

}

