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

namespace Google\Cloud\Run\V2\RunJobRequest;

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

/**
 * RunJob Overrides that contains Execution fields to be overridden.
 *
 * Generated from protobuf message <code>google.cloud.run.v2.RunJobRequest.Overrides</code>
 */
class Overrides extends \Google\Protobuf\Internal\Message
{
    /**
     * Per container override specification.
     *
     * Generated from protobuf field <code>repeated .google.cloud.run.v2.RunJobRequest.Overrides.ContainerOverride container_overrides = 1;</code>
     */
    private $container_overrides;
    /**
     * Optional. The desired number of tasks the execution should run. Will
     * replace existing task_count value.
     *
     * Generated from protobuf field <code>int32 task_count = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $task_count = 0;
    /**
     * Duration in seconds the task may be active before the system will
     * actively try to mark it failed and kill associated containers. Will
     * replace existing timeout_seconds value.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration timeout = 4;</code>
     */
    private $timeout = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type array<\Google\Cloud\Run\V2\RunJobRequest\Overrides\ContainerOverride>|\Google\Protobuf\Internal\RepeatedField $container_overrides
     *           Per container override specification.
     *     @type int $task_count
     *           Optional. The desired number of tasks the execution should run. Will
     *           replace existing task_count value.
     *     @type \Google\Protobuf\Duration $timeout
     *           Duration in seconds the task may be active before the system will
     *           actively try to mark it failed and kill associated containers. Will
     *           replace existing timeout_seconds value.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Run\V2\Job::initOnce();
        parent::__construct($data);
    }

    /**
     * Per container override specification.
     *
     * Generated from protobuf field <code>repeated .google.cloud.run.v2.RunJobRequest.Overrides.ContainerOverride container_overrides = 1;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getContainerOverrides()
    {
        return $this->container_overrides;
    }

    /**
     * Per container override specification.
     *
     * Generated from protobuf field <code>repeated .google.cloud.run.v2.RunJobRequest.Overrides.ContainerOverride container_overrides = 1;</code>
     * @param array<\Google\Cloud\Run\V2\RunJobRequest\Overrides\ContainerOverride>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setContainerOverrides($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Run\V2\RunJobRequest\Overrides\ContainerOverride::class);
        $this->container_overrides = $arr;

        return $this;
    }

    /**
     * Optional. The desired number of tasks the execution should run. Will
     * replace existing task_count value.
     *
     * Generated from protobuf field <code>int32 task_count = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return int
     */
    public function getTaskCount()
    {
        return $this->task_count;
    }

    /**
     * Optional. The desired number of tasks the execution should run. Will
     * replace existing task_count value.
     *
     * Generated from protobuf field <code>int32 task_count = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param int $var
     * @return $this
     */
    public function setTaskCount($var)
    {
        GPBUtil::checkInt32($var);
        $this->task_count = $var;

        return $this;
    }

    /**
     * Duration in seconds the task may be active before the system will
     * actively try to mark it failed and kill associated containers. Will
     * replace existing timeout_seconds value.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration timeout = 4;</code>
     * @return \Google\Protobuf\Duration|null
     */
    public function getTimeout()
    {
        return $this->timeout;
    }

    public function hasTimeout()
    {
        return isset($this->timeout);
    }

    public function clearTimeout()
    {
        unset($this->timeout);
    }

    /**
     * Duration in seconds the task may be active before the system will
     * actively try to mark it failed and kill associated containers. Will
     * replace existing timeout_seconds value.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration timeout = 4;</code>
     * @param \Google\Protobuf\Duration $var
     * @return $this
     */
    public function setTimeout($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class);
        $this->timeout = $var;

        return $this;
    }

}


