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

namespace Google\Cloud\Kms\V1;

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

/**
 * Request message for
 * [Autokey.CreateKeyHandle][google.cloud.kms.v1.Autokey.CreateKeyHandle].
 *
 * Generated from protobuf message <code>google.cloud.kms.v1.CreateKeyHandleRequest</code>
 */
class CreateKeyHandleRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. Name of the resource project and location to create the
     * [KeyHandle][google.cloud.kms.v1.KeyHandle] in, e.g.
     * `projects/{PROJECT_ID}/locations/{LOCATION}`.
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     */
    protected $parent = '';
    /**
     * Optional. Id of the [KeyHandle][google.cloud.kms.v1.KeyHandle]. Must be
     * unique to the resource project and location. If not provided by the caller,
     * a new UUID is used.
     *
     * Generated from protobuf field <code>string key_handle_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $key_handle_id = '';
    /**
     * Required. [KeyHandle][google.cloud.kms.v1.KeyHandle] to create.
     *
     * Generated from protobuf field <code>.google.cloud.kms.v1.KeyHandle key_handle = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $key_handle = null;

    /**
     * @param string                         $parent      Required. Name of the resource project and location to create the
     *                                                    [KeyHandle][google.cloud.kms.v1.KeyHandle] in, e.g.
     *                                                    `projects/{PROJECT_ID}/locations/{LOCATION}`. Please see
     *                                                    {@see AutokeyClient::locationName()} for help formatting this field.
     * @param \Google\Cloud\Kms\V1\KeyHandle $keyHandle   Required. [KeyHandle][google.cloud.kms.v1.KeyHandle] to create.
     * @param string                         $keyHandleId Optional. Id of the [KeyHandle][google.cloud.kms.v1.KeyHandle]. Must be
     *                                                    unique to the resource project and location. If not provided by the caller,
     *                                                    a new UUID is used.
     *
     * @return \Google\Cloud\Kms\V1\CreateKeyHandleRequest
     *
     * @experimental
     */
    public static function build(string $parent, \Google\Cloud\Kms\V1\KeyHandle $keyHandle, string $keyHandleId): self
    {
        return (new self())
            ->setParent($parent)
            ->setKeyHandle($keyHandle)
            ->setKeyHandleId($keyHandleId);
    }

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $parent
     *           Required. Name of the resource project and location to create the
     *           [KeyHandle][google.cloud.kms.v1.KeyHandle] in, e.g.
     *           `projects/{PROJECT_ID}/locations/{LOCATION}`.
     *     @type string $key_handle_id
     *           Optional. Id of the [KeyHandle][google.cloud.kms.v1.KeyHandle]. Must be
     *           unique to the resource project and location. If not provided by the caller,
     *           a new UUID is used.
     *     @type \Google\Cloud\Kms\V1\KeyHandle $key_handle
     *           Required. [KeyHandle][google.cloud.kms.v1.KeyHandle] to create.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Kms\V1\Autokey::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. Name of the resource project and location to create the
     * [KeyHandle][google.cloud.kms.v1.KeyHandle] in, e.g.
     * `projects/{PROJECT_ID}/locations/{LOCATION}`.
     *
     * 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. Name of the resource project and location to create the
     * [KeyHandle][google.cloud.kms.v1.KeyHandle] in, e.g.
     * `projects/{PROJECT_ID}/locations/{LOCATION}`.
     *
     * 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;
    }

    /**
     * Optional. Id of the [KeyHandle][google.cloud.kms.v1.KeyHandle]. Must be
     * unique to the resource project and location. If not provided by the caller,
     * a new UUID is used.
     *
     * Generated from protobuf field <code>string key_handle_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getKeyHandleId()
    {
        return $this->key_handle_id;
    }

    /**
     * Optional. Id of the [KeyHandle][google.cloud.kms.v1.KeyHandle]. Must be
     * unique to the resource project and location. If not provided by the caller,
     * a new UUID is used.
     *
     * Generated from protobuf field <code>string key_handle_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setKeyHandleId($var)
    {
        GPBUtil::checkString($var, True);
        $this->key_handle_id = $var;

        return $this;
    }

    /**
     * Required. [KeyHandle][google.cloud.kms.v1.KeyHandle] to create.
     *
     * Generated from protobuf field <code>.google.cloud.kms.v1.KeyHandle key_handle = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Cloud\Kms\V1\KeyHandle|null
     */
    public function getKeyHandle()
    {
        return $this->key_handle;
    }

    public function hasKeyHandle()
    {
        return isset($this->key_handle);
    }

    public function clearKeyHandle()
    {
        unset($this->key_handle);
    }

    /**
     * Required. [KeyHandle][google.cloud.kms.v1.KeyHandle] to create.
     *
     * Generated from protobuf field <code>.google.cloud.kms.v1.KeyHandle key_handle = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Cloud\Kms\V1\KeyHandle $var
     * @return $this
     */
    public function setKeyHandle($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Kms\V1\KeyHandle::class);
        $this->key_handle = $var;

        return $this;
    }

}

