<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/iam/v2/policy.proto

namespace Google\Cloud\Iam\V2;

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

/**
 * Request message for `UpdatePolicy`.
 *
 * Generated from protobuf message <code>google.iam.v2.UpdatePolicyRequest</code>
 */
class UpdatePolicyRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The policy to update.
     * To prevent conflicting updates, the `etag` value must match the value that
     * is stored in IAM. If the `etag` values do not match, the request fails with
     * a `409` error code and `ABORTED` status.
     *
     * Generated from protobuf field <code>.google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $policy = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Iam\V2\Policy $policy
     *           Required. The policy to update.
     *           To prevent conflicting updates, the `etag` value must match the value that
     *           is stored in IAM. If the `etag` values do not match, the request fails with
     *           a `409` error code and `ABORTED` status.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Iam\V2\Policy::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The policy to update.
     * To prevent conflicting updates, the `etag` value must match the value that
     * is stored in IAM. If the `etag` values do not match, the request fails with
     * a `409` error code and `ABORTED` status.
     *
     * Generated from protobuf field <code>.google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Cloud\Iam\V2\Policy|null
     */
    public function getPolicy()
    {
        return $this->policy;
    }

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

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

    /**
     * Required. The policy to update.
     * To prevent conflicting updates, the `etag` value must match the value that
     * is stored in IAM. If the `etag` values do not match, the request fails with
     * a `409` error code and `ABORTED` status.
     *
     * Generated from protobuf field <code>.google.iam.v2.Policy policy = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Cloud\Iam\V2\Policy $var
     * @return $this
     */
    public function setPolicy($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Iam\V2\Policy::class);
        $this->policy = $var;

        return $this;
    }

}

