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

namespace Google\Cloud\OrgPolicy\V2;

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

/**
 * The request sent to the [CreatePolicyRequest]
 * [google.cloud.orgpolicy.v2.OrgPolicy.CreatePolicy] method.
 *
 * Generated from protobuf message <code>google.cloud.orgpolicy.v2.CreatePolicyRequest</code>
 */
class CreatePolicyRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The Cloud resource that will parent the new Policy. Must be in one of the
     * following forms:
     * * `projects/{project_number}`
     * * `projects/{project_id}`
     * * `folders/{folder_id}`
     * * `organizations/{organization_id}`
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     */
    private $parent = '';
    /**
     * Required. `Policy` to create.
     *
     * Generated from protobuf field <code>.google.cloud.orgpolicy.v2.Policy policy = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $policy = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $parent
     *           Required. The Cloud resource that will parent the new Policy. Must be in one of the
     *           following forms:
     *           * `projects/{project_number}`
     *           * `projects/{project_id}`
     *           * `folders/{folder_id}`
     *           * `organizations/{organization_id}`
     *     @type \Google\Cloud\OrgPolicy\V2\Policy $policy
     *           Required. `Policy` to create.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Orgpolicy\V2\Orgpolicy::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The Cloud resource that will parent the new Policy. Must be in one of the
     * following forms:
     * * `projects/{project_number}`
     * * `projects/{project_id}`
     * * `folders/{folder_id}`
     * * `organizations/{organization_id}`
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getParent()
    {
        return $this->parent;
    }

    /**
     * Required. The Cloud resource that will parent the new Policy. Must be in one of the
     * following forms:
     * * `projects/{project_number}`
     * * `projects/{project_id}`
     * * `folders/{folder_id}`
     * * `organizations/{organization_id}`
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setParent($var)
    {
        GPBUtil::checkString($var, True);
        $this->parent = $var;

        return $this;
    }

    /**
     * Required. `Policy` to create.
     *
     * Generated from protobuf field <code>.google.cloud.orgpolicy.v2.Policy policy = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Cloud\OrgPolicy\V2\Policy|null
     */
    public function getPolicy()
    {
        return isset($this->policy) ? $this->policy : null;
    }

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

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

    /**
     * Required. `Policy` to create.
     *
     * Generated from protobuf field <code>.google.cloud.orgpolicy.v2.Policy policy = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Cloud\OrgPolicy\V2\Policy $var
     * @return $this
     */
    public function setPolicy($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\OrgPolicy\V2\Policy::class);
        $this->policy = $var;

        return $this;
    }

}

