<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/deploy/v1/cloud_deploy.proto

namespace Google\Cloud\Deploy\V1;

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

/**
 * Deploy Policy rule.
 *
 * Generated from protobuf message <code>google.cloud.deploy.v1.PolicyRule</code>
 */
class PolicyRule extends \Google\Protobuf\Internal\Message
{
    protected $rule;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Deploy\V1\RolloutRestriction $rollout_restriction
     *           Optional. Rollout restrictions.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce();
        parent::__construct($data);
    }

    /**
     * Optional. Rollout restrictions.
     *
     * Generated from protobuf field <code>.google.cloud.deploy.v1.RolloutRestriction rollout_restriction = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Cloud\Deploy\V1\RolloutRestriction|null
     */
    public function getRolloutRestriction()
    {
        return $this->readOneof(2);
    }

    public function hasRolloutRestriction()
    {
        return $this->hasOneof(2);
    }

    /**
     * Optional. Rollout restrictions.
     *
     * Generated from protobuf field <code>.google.cloud.deploy.v1.RolloutRestriction rollout_restriction = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Cloud\Deploy\V1\RolloutRestriction $var
     * @return $this
     */
    public function setRolloutRestriction($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\RolloutRestriction::class);
        $this->writeOneof(2, $var);

        return $this;
    }

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

}

