<?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;

/**
 * Rule to apply.
 *
 * 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\RestrictRollout $restrict_rollouts
     *           Rollout restrictions.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce();
        parent::__construct($data);
    }

    /**
     * Rollout restrictions.
     *
     * Generated from protobuf field <code>.google.cloud.deploy.v1.RestrictRollout restrict_rollouts = 1;</code>
     * @return \Google\Cloud\Deploy\V1\RestrictRollout|null
     */
    public function getRestrictRollouts()
    {
        return $this->readOneof(1);
    }

    public function hasRestrictRollouts()
    {
        return $this->hasOneof(1);
    }

    /**
     * Rollout restrictions.
     *
     * Generated from protobuf field <code>.google.cloud.deploy.v1.RestrictRollout restrict_rollouts = 1;</code>
     * @param \Google\Cloud\Deploy\V1\RestrictRollout $var
     * @return $this
     */
    public function setRestrictRollouts($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\RestrictRollout::class);
        $this->writeOneof(1, $var);

        return $this;
    }

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

}

