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

namespace Google\Cloud\Asset\V1\AnalyzerOrgPolicy;

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

/**
 * This rule message is a customized version of the one defined in the
 * Organization Policy system. In addition to the fields defined in the
 * original organization policy, it contains additional field(s) under
 * specific circumstances to support analysis results.
 *
 * Generated from protobuf message <code>google.cloud.asset.v1.AnalyzerOrgPolicy.Rule</code>
 */
class Rule extends \Google\Protobuf\Internal\Message
{
    /**
     * The evaluating condition for this rule.
     *
     * Generated from protobuf field <code>.google.type.Expr condition = 7;</code>
     */
    private $condition = null;
    /**
     * The condition evaluation result for this rule.
     * Only populated if it meets all the following criteria:
     * * There is a
     * [condition][google.cloud.asset.v1.AnalyzerOrgPolicy.Rule.condition]
     * defined for this rule.
     * * This rule is within
     *   [AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.consolidated_policy][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.consolidated_policy],
     *   or
     *   [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.consolidated_policy][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.consolidated_policy]
     *   when the
     *   [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset]
     *   has
     *   [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.governed_resource][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.governed_resource].
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.ConditionEvaluation condition_evaluation = 8;</code>
     */
    private $condition_evaluation = null;
    protected $kind;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Asset\V1\AnalyzerOrgPolicy\Rule\StringValues $values
     *           List of values to be used for this policy rule. This field can be set
     *           only in policies for list constraints.
     *     @type bool $allow_all
     *           Setting this to true means that all values are allowed. This field can
     *           be set only in Policies for list constraints.
     *     @type bool $deny_all
     *           Setting this to true means that all values are denied. This field can
     *           be set only in Policies for list constraints.
     *     @type bool $enforce
     *           If `true`, then the `Policy` is enforced. If `false`, then any
     *           configuration is acceptable.
     *           This field can be set only in Policies for boolean constraints.
     *     @type \Google\Type\Expr $condition
     *           The evaluating condition for this rule.
     *     @type \Google\Cloud\Asset\V1\ConditionEvaluation $condition_evaluation
     *           The condition evaluation result for this rule.
     *           Only populated if it meets all the following criteria:
     *           * There is a
     *           [condition][google.cloud.asset.v1.AnalyzerOrgPolicy.Rule.condition]
     *           defined for this rule.
     *           * This rule is within
     *             [AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.consolidated_policy][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.consolidated_policy],
     *             or
     *             [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.consolidated_policy][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.consolidated_policy]
     *             when the
     *             [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset]
     *             has
     *             [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.governed_resource][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.governed_resource].
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Asset\V1\AssetService::initOnce();
        parent::__construct($data);
    }

    /**
     * List of values to be used for this policy rule. This field can be set
     * only in policies for list constraints.
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.AnalyzerOrgPolicy.Rule.StringValues values = 3;</code>
     * @return \Google\Cloud\Asset\V1\AnalyzerOrgPolicy\Rule\StringValues|null
     */
    public function getValues()
    {
        return $this->readOneof(3);
    }

    public function hasValues()
    {
        return $this->hasOneof(3);
    }

    /**
     * List of values to be used for this policy rule. This field can be set
     * only in policies for list constraints.
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.AnalyzerOrgPolicy.Rule.StringValues values = 3;</code>
     * @param \Google\Cloud\Asset\V1\AnalyzerOrgPolicy\Rule\StringValues $var
     * @return $this
     */
    public function setValues($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1\AnalyzerOrgPolicy\Rule\StringValues::class);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * Setting this to true means that all values are allowed. This field can
     * be set only in Policies for list constraints.
     *
     * Generated from protobuf field <code>bool allow_all = 4;</code>
     * @return bool
     */
    public function getAllowAll()
    {
        return $this->readOneof(4);
    }

    public function hasAllowAll()
    {
        return $this->hasOneof(4);
    }

    /**
     * Setting this to true means that all values are allowed. This field can
     * be set only in Policies for list constraints.
     *
     * Generated from protobuf field <code>bool allow_all = 4;</code>
     * @param bool $var
     * @return $this
     */
    public function setAllowAll($var)
    {
        GPBUtil::checkBool($var);
        $this->writeOneof(4, $var);

        return $this;
    }

    /**
     * Setting this to true means that all values are denied. This field can
     * be set only in Policies for list constraints.
     *
     * Generated from protobuf field <code>bool deny_all = 5;</code>
     * @return bool
     */
    public function getDenyAll()
    {
        return $this->readOneof(5);
    }

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

    /**
     * Setting this to true means that all values are denied. This field can
     * be set only in Policies for list constraints.
     *
     * Generated from protobuf field <code>bool deny_all = 5;</code>
     * @param bool $var
     * @return $this
     */
    public function setDenyAll($var)
    {
        GPBUtil::checkBool($var);
        $this->writeOneof(5, $var);

        return $this;
    }

    /**
     * If `true`, then the `Policy` is enforced. If `false`, then any
     * configuration is acceptable.
     * This field can be set only in Policies for boolean constraints.
     *
     * Generated from protobuf field <code>bool enforce = 6;</code>
     * @return bool
     */
    public function getEnforce()
    {
        return $this->readOneof(6);
    }

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

    /**
     * If `true`, then the `Policy` is enforced. If `false`, then any
     * configuration is acceptable.
     * This field can be set only in Policies for boolean constraints.
     *
     * Generated from protobuf field <code>bool enforce = 6;</code>
     * @param bool $var
     * @return $this
     */
    public function setEnforce($var)
    {
        GPBUtil::checkBool($var);
        $this->writeOneof(6, $var);

        return $this;
    }

    /**
     * The evaluating condition for this rule.
     *
     * Generated from protobuf field <code>.google.type.Expr condition = 7;</code>
     * @return \Google\Type\Expr|null
     */
    public function getCondition()
    {
        return $this->condition;
    }

    public function hasCondition()
    {
        return isset($this->condition);
    }

    public function clearCondition()
    {
        unset($this->condition);
    }

    /**
     * The evaluating condition for this rule.
     *
     * Generated from protobuf field <code>.google.type.Expr condition = 7;</code>
     * @param \Google\Type\Expr $var
     * @return $this
     */
    public function setCondition($var)
    {
        GPBUtil::checkMessage($var, \Google\Type\Expr::class);
        $this->condition = $var;

        return $this;
    }

    /**
     * The condition evaluation result for this rule.
     * Only populated if it meets all the following criteria:
     * * There is a
     * [condition][google.cloud.asset.v1.AnalyzerOrgPolicy.Rule.condition]
     * defined for this rule.
     * * This rule is within
     *   [AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.consolidated_policy][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.consolidated_policy],
     *   or
     *   [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.consolidated_policy][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.consolidated_policy]
     *   when the
     *   [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset]
     *   has
     *   [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.governed_resource][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.governed_resource].
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.ConditionEvaluation condition_evaluation = 8;</code>
     * @return \Google\Cloud\Asset\V1\ConditionEvaluation|null
     */
    public function getConditionEvaluation()
    {
        return $this->condition_evaluation;
    }

    public function hasConditionEvaluation()
    {
        return isset($this->condition_evaluation);
    }

    public function clearConditionEvaluation()
    {
        unset($this->condition_evaluation);
    }

    /**
     * The condition evaluation result for this rule.
     * Only populated if it meets all the following criteria:
     * * There is a
     * [condition][google.cloud.asset.v1.AnalyzerOrgPolicy.Rule.condition]
     * defined for this rule.
     * * This rule is within
     *   [AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.consolidated_policy][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.consolidated_policy],
     *   or
     *   [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.consolidated_policy][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.consolidated_policy]
     *   when the
     *   [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset]
     *   has
     *   [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.governed_resource][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.governed_resource].
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.ConditionEvaluation condition_evaluation = 8;</code>
     * @param \Google\Cloud\Asset\V1\ConditionEvaluation $var
     * @return $this
     */
    public function setConditionEvaluation($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1\ConditionEvaluation::class);
        $this->condition_evaluation = $var;

        return $this;
    }

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

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Rule::class, \Google\Cloud\Asset\V1\AnalyzerOrgPolicy_Rule::class);

