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

namespace Google\Cloud\Asset\V1\BatchGetEffectiveIamPoliciesResponse\EffectiveIamPolicy;

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

/**
 * The IAM policy and its attached resource.
 *
 * Generated from protobuf message <code>google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo</code>
 */
class PolicyInfo extends \Google\Protobuf\Internal\Message
{
    /**
     * The full resource name the
     * [policy][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.policy]
     * is directly attached to.
     *
     * Generated from protobuf field <code>string attached_resource = 1;</code>
     */
    private $attached_resource = '';
    /**
     * The IAM policy that's directly attached to the
     * [attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource].
     *
     * Generated from protobuf field <code>.google.iam.v1.Policy policy = 2;</code>
     */
    private $policy = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $attached_resource
     *           The full resource name the
     *           [policy][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.policy]
     *           is directly attached to.
     *     @type \Google\Cloud\Iam\V1\Policy $policy
     *           The IAM policy that's directly attached to the
     *           [attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource].
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Asset\V1\AssetService::initOnce();
        parent::__construct($data);
    }

    /**
     * The full resource name the
     * [policy][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.policy]
     * is directly attached to.
     *
     * Generated from protobuf field <code>string attached_resource = 1;</code>
     * @return string
     */
    public function getAttachedResource()
    {
        return $this->attached_resource;
    }

    /**
     * The full resource name the
     * [policy][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.policy]
     * is directly attached to.
     *
     * Generated from protobuf field <code>string attached_resource = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setAttachedResource($var)
    {
        GPBUtil::checkString($var, True);
        $this->attached_resource = $var;

        return $this;
    }

    /**
     * The IAM policy that's directly attached to the
     * [attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource].
     *
     * Generated from protobuf field <code>.google.iam.v1.Policy policy = 2;</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 that's directly attached to the
     * [attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource].
     *
     * Generated from protobuf field <code>.google.iam.v1.Policy policy = 2;</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;
    }

}

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

