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

namespace Google\Cloud\PolicyTroubleshooter\V1;

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

/**
 * Details about how a specific IAM [Policy][google.iam.v1.Policy] contributed
 * to the access check.
 *
 * Generated from protobuf message <code>google.cloud.policytroubleshooter.v1.ExplainedPolicy</code>
 */
class ExplainedPolicy extends \Google\Protobuf\Internal\Message
{
    /**
     * Indicates whether _this policy_ provides the specified permission to the
     * specified member for the specified resource.
     * This field does _not_ indicate whether the member actually has the
     * permission for the resource. There might be another policy that overrides
     * this policy. To determine whether the member actually has the permission,
     * use the `access` field in the
     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
     *
     * Generated from protobuf field <code>.google.cloud.policytroubleshooter.v1.AccessState access = 1;</code>
     */
    private $access = 0;
    /**
     * The full resource name that identifies the resource. For example,
     * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
     * If the sender of the request does not have access to the policy, this field
     * is omitted.
     * For examples of full resource names for Google Cloud services, see
     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
     *
     * Generated from protobuf field <code>string full_resource_name = 2;</code>
     */
    private $full_resource_name = '';
    /**
     * The IAM policy attached to the resource.
     * If the sender of the request does not have access to the policy, this field
     * is empty.
     *
     * Generated from protobuf field <code>.google.iam.v1.Policy policy = 3;</code>
     */
    private $policy = null;
    /**
     * Details about how each binding in the policy affects the member's ability,
     * or inability, to use the permission for the resource.
     * If the sender of the request does not have access to the policy, this field
     * is omitted.
     *
     * Generated from protobuf field <code>repeated .google.cloud.policytroubleshooter.v1.BindingExplanation binding_explanations = 4;</code>
     */
    private $binding_explanations;
    /**
     * The relevance of this policy to the overall determination in the
     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
     * If the sender of the request does not have access to the policy, this field
     * is omitted.
     *
     * Generated from protobuf field <code>.google.cloud.policytroubleshooter.v1.HeuristicRelevance relevance = 5;</code>
     */
    private $relevance = 0;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $access
     *           Indicates whether _this policy_ provides the specified permission to the
     *           specified member for the specified resource.
     *           This field does _not_ indicate whether the member actually has the
     *           permission for the resource. There might be another policy that overrides
     *           this policy. To determine whether the member actually has the permission,
     *           use the `access` field in the
     *           [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
     *     @type string $full_resource_name
     *           The full resource name that identifies the resource. For example,
     *           `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
     *           If the sender of the request does not have access to the policy, this field
     *           is omitted.
     *           For examples of full resource names for Google Cloud services, see
     *           https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
     *     @type \Google\Cloud\Iam\V1\Policy $policy
     *           The IAM policy attached to the resource.
     *           If the sender of the request does not have access to the policy, this field
     *           is empty.
     *     @type array<\Google\Cloud\PolicyTroubleshooter\V1\BindingExplanation>|\Google\Protobuf\Internal\RepeatedField $binding_explanations
     *           Details about how each binding in the policy affects the member's ability,
     *           or inability, to use the permission for the resource.
     *           If the sender of the request does not have access to the policy, this field
     *           is omitted.
     *     @type int $relevance
     *           The relevance of this policy to the overall determination in the
     *           [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
     *           If the sender of the request does not have access to the policy, this field
     *           is omitted.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Policytroubleshooter\V1\Explanations::initOnce();
        parent::__construct($data);
    }

    /**
     * Indicates whether _this policy_ provides the specified permission to the
     * specified member for the specified resource.
     * This field does _not_ indicate whether the member actually has the
     * permission for the resource. There might be another policy that overrides
     * this policy. To determine whether the member actually has the permission,
     * use the `access` field in the
     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
     *
     * Generated from protobuf field <code>.google.cloud.policytroubleshooter.v1.AccessState access = 1;</code>
     * @return int
     */
    public function getAccess()
    {
        return $this->access;
    }

    /**
     * Indicates whether _this policy_ provides the specified permission to the
     * specified member for the specified resource.
     * This field does _not_ indicate whether the member actually has the
     * permission for the resource. There might be another policy that overrides
     * this policy. To determine whether the member actually has the permission,
     * use the `access` field in the
     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
     *
     * Generated from protobuf field <code>.google.cloud.policytroubleshooter.v1.AccessState access = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setAccess($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\PolicyTroubleshooter\V1\AccessState::class);
        $this->access = $var;

        return $this;
    }

    /**
     * The full resource name that identifies the resource. For example,
     * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
     * If the sender of the request does not have access to the policy, this field
     * is omitted.
     * For examples of full resource names for Google Cloud services, see
     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
     *
     * Generated from protobuf field <code>string full_resource_name = 2;</code>
     * @return string
     */
    public function getFullResourceName()
    {
        return $this->full_resource_name;
    }

    /**
     * The full resource name that identifies the resource. For example,
     * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
     * If the sender of the request does not have access to the policy, this field
     * is omitted.
     * For examples of full resource names for Google Cloud services, see
     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
     *
     * Generated from protobuf field <code>string full_resource_name = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setFullResourceName($var)
    {
        GPBUtil::checkString($var, True);
        $this->full_resource_name = $var;

        return $this;
    }

    /**
     * The IAM policy attached to the resource.
     * If the sender of the request does not have access to the policy, this field
     * is empty.
     *
     * Generated from protobuf field <code>.google.iam.v1.Policy policy = 3;</code>
     * @return \Google\Cloud\Iam\V1\Policy|null
     */
    public function getPolicy()
    {
        return $this->policy;
    }

    public function hasPolicy()
    {
        return isset($this->policy);
    }

    public function clearPolicy()
    {
        unset($this->policy);
    }

    /**
     * The IAM policy attached to the resource.
     * If the sender of the request does not have access to the policy, this field
     * is empty.
     *
     * Generated from protobuf field <code>.google.iam.v1.Policy policy = 3;</code>
     * @param \Google\Cloud\Iam\V1\Policy $var
     * @return $this
     */
    public function setPolicy($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Iam\V1\Policy::class);
        $this->policy = $var;

        return $this;
    }

    /**
     * Details about how each binding in the policy affects the member's ability,
     * or inability, to use the permission for the resource.
     * If the sender of the request does not have access to the policy, this field
     * is omitted.
     *
     * Generated from protobuf field <code>repeated .google.cloud.policytroubleshooter.v1.BindingExplanation binding_explanations = 4;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getBindingExplanations()
    {
        return $this->binding_explanations;
    }

    /**
     * Details about how each binding in the policy affects the member's ability,
     * or inability, to use the permission for the resource.
     * If the sender of the request does not have access to the policy, this field
     * is omitted.
     *
     * Generated from protobuf field <code>repeated .google.cloud.policytroubleshooter.v1.BindingExplanation binding_explanations = 4;</code>
     * @param array<\Google\Cloud\PolicyTroubleshooter\V1\BindingExplanation>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setBindingExplanations($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PolicyTroubleshooter\V1\BindingExplanation::class);
        $this->binding_explanations = $arr;

        return $this;
    }

    /**
     * The relevance of this policy to the overall determination in the
     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
     * If the sender of the request does not have access to the policy, this field
     * is omitted.
     *
     * Generated from protobuf field <code>.google.cloud.policytroubleshooter.v1.HeuristicRelevance relevance = 5;</code>
     * @return int
     */
    public function getRelevance()
    {
        return $this->relevance;
    }

    /**
     * The relevance of this policy to the overall determination in the
     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
     * If the sender of the request does not have access to the policy, this field
     * is omitted.
     *
     * Generated from protobuf field <code>.google.cloud.policytroubleshooter.v1.HeuristicRelevance relevance = 5;</code>
     * @param int $var
     * @return $this
     */
    public function setRelevance($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\PolicyTroubleshooter\V1\HeuristicRelevance::class);
        $this->relevance = $var;

        return $this;
    }

}

