<?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 `CreatePolicy`.
 *
 * Generated from protobuf message <code>google.iam.v2.CreatePolicyRequest</code>
 */
class CreatePolicyRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The resource that the policy is attached to, along with the kind of policy
     * to create. Format: `policies/{attachment_point}/denypolicies`
     * The attachment point is identified by its URL-encoded full resource name,
     * which means that the forward-slash character, `/`, must be written as
     * `%2F`. For example,
     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
     * For organizations and folders, use the numeric ID in the full resource
     * name. For projects, you can use the alphanumeric or the numeric ID.
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $parent = '';
    /**
     * Required. The policy to create.
     *
     * Generated from protobuf field <code>.google.iam.v2.Policy policy = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $policy = null;
    /**
     * The ID to use for this policy, which will become the final component of
     * the policy's resource name. The ID must contain 3 to 63 characters. It can
     * contain lowercase letters and numbers, as well as dashes (`-`) and periods
     * (`.`). The first character must be a lowercase letter.
     *
     * Generated from protobuf field <code>string policy_id = 3;</code>
     */
    private $policy_id = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $parent
     *           Required. The resource that the policy is attached to, along with the kind of policy
     *           to create. Format: `policies/{attachment_point}/denypolicies`
     *           The attachment point is identified by its URL-encoded full resource name,
     *           which means that the forward-slash character, `/`, must be written as
     *           `%2F`. For example,
     *           `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
     *           For organizations and folders, use the numeric ID in the full resource
     *           name. For projects, you can use the alphanumeric or the numeric ID.
     *     @type \Google\Cloud\Iam\V2\Policy $policy
     *           Required. The policy to create.
     *     @type string $policy_id
     *           The ID to use for this policy, which will become the final component of
     *           the policy's resource name. The ID must contain 3 to 63 characters. It can
     *           contain lowercase letters and numbers, as well as dashes (`-`) and periods
     *           (`.`). The first character must be a lowercase letter.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Iam\V2\Policy::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The resource that the policy is attached to, along with the kind of policy
     * to create. Format: `policies/{attachment_point}/denypolicies`
     * The attachment point is identified by its URL-encoded full resource name,
     * which means that the forward-slash character, `/`, must be written as
     * `%2F`. For example,
     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
     * For organizations and folders, use the numeric ID in the full resource
     * name. For projects, you can use the alphanumeric or the numeric ID.
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getParent()
    {
        return $this->parent;
    }

    /**
     * Required. The resource that the policy is attached to, along with the kind of policy
     * to create. Format: `policies/{attachment_point}/denypolicies`
     * The attachment point is identified by its URL-encoded full resource name,
     * which means that the forward-slash character, `/`, must be written as
     * `%2F`. For example,
     * `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
     * For organizations and folders, use the numeric ID in the full resource
     * name. For projects, you can use the alphanumeric or the numeric ID.
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setParent($var)
    {
        GPBUtil::checkString($var, True);
        $this->parent = $var;

        return $this;
    }

    /**
     * Required. The policy to create.
     *
     * Generated from protobuf field <code>.google.iam.v2.Policy policy = 2 [(.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 create.
     *
     * Generated from protobuf field <code>.google.iam.v2.Policy policy = 2 [(.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;
    }

    /**
     * The ID to use for this policy, which will become the final component of
     * the policy's resource name. The ID must contain 3 to 63 characters. It can
     * contain lowercase letters and numbers, as well as dashes (`-`) and periods
     * (`.`). The first character must be a lowercase letter.
     *
     * Generated from protobuf field <code>string policy_id = 3;</code>
     * @return string
     */
    public function getPolicyId()
    {
        return $this->policy_id;
    }

    /**
     * The ID to use for this policy, which will become the final component of
     * the policy's resource name. The ID must contain 3 to 63 characters. It can
     * contain lowercase letters and numbers, as well as dashes (`-`) and periods
     * (`.`). The first character must be a lowercase letter.
     *
     * Generated from protobuf field <code>string policy_id = 3;</code>
     * @param string $var
     * @return $this
     */
    public function setPolicyId($var)
    {
        GPBUtil::checkString($var, True);
        $this->policy_id = $var;

        return $this;
    }

}

