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

namespace Google\Cloud\Run\V2;

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

/**
 * Request message for updating a service.
 *
 * Generated from protobuf message <code>google.cloud.run.v2.UpdateServiceRequest</code>
 */
class UpdateServiceRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Optional. The list of fields to be updated.
     *
     * Generated from protobuf field <code>.google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $update_mask = null;
    /**
     * Required. The Service to be updated.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.Service service = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $service = null;
    /**
     * Indicates that the request should be validated and default values
     * populated, without persisting the request or updating any resources.
     *
     * Generated from protobuf field <code>bool validate_only = 3;</code>
     */
    protected $validate_only = false;
    /**
     * Optional. If set to true, and if the Service does not exist, it will create
     * a new one. The caller must have 'run.services.create' permissions if this
     * is set to true and the Service does not exist.
     *
     * Generated from protobuf field <code>bool allow_missing = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $allow_missing = false;

    /**
     * @param \Google\Cloud\Run\V2\Service $service Required. The Service to be updated.
     *
     * @return \Google\Cloud\Run\V2\UpdateServiceRequest
     *
     * @experimental
     */
    public static function build(\Google\Cloud\Run\V2\Service $service): self
    {
        return (new self())
            ->setService($service);
    }

    /**
     * @param \Google\Cloud\Run\V2\Service $service    Required. The Service to be updated.
     * @param \Google\Protobuf\FieldMask   $updateMask Optional. The list of fields to be updated.
     *
     * @return \Google\Cloud\Run\V2\UpdateServiceRequest
     *
     * @experimental
     */
    public static function buildFromServiceUpdateMask(\Google\Cloud\Run\V2\Service $service, \Google\Protobuf\FieldMask $updateMask): self
    {
        return (new self())
            ->setService($service)
            ->setUpdateMask($updateMask);
    }

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Protobuf\FieldMask $update_mask
     *           Optional. The list of fields to be updated.
     *     @type \Google\Cloud\Run\V2\Service $service
     *           Required. The Service to be updated.
     *     @type bool $validate_only
     *           Indicates that the request should be validated and default values
     *           populated, without persisting the request or updating any resources.
     *     @type bool $allow_missing
     *           Optional. If set to true, and if the Service does not exist, it will create
     *           a new one. The caller must have 'run.services.create' permissions if this
     *           is set to true and the Service does not exist.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Run\V2\Service::initOnce();
        parent::__construct($data);
    }

    /**
     * Optional. The list of fields to be updated.
     *
     * Generated from protobuf field <code>.google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Protobuf\FieldMask|null
     */
    public function getUpdateMask()
    {
        return $this->update_mask;
    }

    public function hasUpdateMask()
    {
        return isset($this->update_mask);
    }

    public function clearUpdateMask()
    {
        unset($this->update_mask);
    }

    /**
     * Optional. The list of fields to be updated.
     *
     * Generated from protobuf field <code>.google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Protobuf\FieldMask $var
     * @return $this
     */
    public function setUpdateMask($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class);
        $this->update_mask = $var;

        return $this;
    }

    /**
     * Required. The Service to be updated.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.Service service = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Cloud\Run\V2\Service|null
     */
    public function getService()
    {
        return $this->service;
    }

    public function hasService()
    {
        return isset($this->service);
    }

    public function clearService()
    {
        unset($this->service);
    }

    /**
     * Required. The Service to be updated.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.Service service = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Cloud\Run\V2\Service $var
     * @return $this
     */
    public function setService($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Run\V2\Service::class);
        $this->service = $var;

        return $this;
    }

    /**
     * Indicates that the request should be validated and default values
     * populated, without persisting the request or updating any resources.
     *
     * Generated from protobuf field <code>bool validate_only = 3;</code>
     * @return bool
     */
    public function getValidateOnly()
    {
        return $this->validate_only;
    }

    /**
     * Indicates that the request should be validated and default values
     * populated, without persisting the request or updating any resources.
     *
     * Generated from protobuf field <code>bool validate_only = 3;</code>
     * @param bool $var
     * @return $this
     */
    public function setValidateOnly($var)
    {
        GPBUtil::checkBool($var);
        $this->validate_only = $var;

        return $this;
    }

    /**
     * Optional. If set to true, and if the Service does not exist, it will create
     * a new one. The caller must have 'run.services.create' permissions if this
     * is set to true and the Service does not exist.
     *
     * Generated from protobuf field <code>bool allow_missing = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return bool
     */
    public function getAllowMissing()
    {
        return $this->allow_missing;
    }

    /**
     * Optional. If set to true, and if the Service does not exist, it will create
     * a new one. The caller must have 'run.services.create' permissions if this
     * is set to true and the Service does not exist.
     *
     * Generated from protobuf field <code>bool allow_missing = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param bool $var
     * @return $this
     */
    public function setAllowMissing($var)
    {
        GPBUtil::checkBool($var);
        $this->allow_missing = $var;

        return $this;
    }

}

