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

namespace Google\Cloud\Dataproc\V1;

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

/**
 * A request to create an autoscaling policy.
 *
 * Generated from protobuf message <code>google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest</code>
 */
class CreateAutoscalingPolicyRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The "resource name" of the region or location, as described
     * in https://cloud.google.com/apis/design/resource_names.
     * * For `projects.regions.autoscalingPolicies.create`, the resource name
     *   of the region has the following format:
     *   `projects/{project_id}/regions/{region}`
     * * For `projects.locations.autoscalingPolicies.create`, the resource name
     *   of the location has the following format:
     *   `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 = '';
    /**
     * Required. The autoscaling policy to create.
     *
     * Generated from protobuf field <code>.google.cloud.dataproc.v1.AutoscalingPolicy policy = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $policy = null;

    /**
     * @param string                                      $parent Required. The "resource name" of the region or location, as described
     *                                                            in https://cloud.google.com/apis/design/resource_names.
     *
     *                                                            * For `projects.regions.autoscalingPolicies.create`, the resource name
     *                                                            of the region has the following format:
     *                                                            `projects/{project_id}/regions/{region}`
     *
     *                                                            * For `projects.locations.autoscalingPolicies.create`, the resource name
     *                                                            of the location has the following format:
     *                                                            `projects/{project_id}/locations/{location}`
     *                                                            Please see {@see AutoscalingPolicyServiceClient::regionName()} for help formatting this field.
     * @param \Google\Cloud\Dataproc\V1\AutoscalingPolicy $policy Required. The autoscaling policy to create.
     *
     * @return \Google\Cloud\Dataproc\V1\CreateAutoscalingPolicyRequest
     *
     * @experimental
     */
    public static function build(string $parent, \Google\Cloud\Dataproc\V1\AutoscalingPolicy $policy): self
    {
        return (new self())
            ->setParent($parent)
            ->setPolicy($policy);
    }

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $parent
     *           Required. The "resource name" of the region or location, as described
     *           in https://cloud.google.com/apis/design/resource_names.
     *           * For `projects.regions.autoscalingPolicies.create`, the resource name
     *             of the region has the following format:
     *             `projects/{project_id}/regions/{region}`
     *           * For `projects.locations.autoscalingPolicies.create`, the resource name
     *             of the location has the following format:
     *             `projects/{project_id}/locations/{location}`
     *     @type \Google\Cloud\Dataproc\V1\AutoscalingPolicy $policy
     *           Required. The autoscaling policy to create.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Dataproc\V1\AutoscalingPolicies::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The "resource name" of the region or location, as described
     * in https://cloud.google.com/apis/design/resource_names.
     * * For `projects.regions.autoscalingPolicies.create`, the resource name
     *   of the region has the following format:
     *   `projects/{project_id}/regions/{region}`
     * * For `projects.locations.autoscalingPolicies.create`, the resource name
     *   of the location has the following format:
     *   `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. The "resource name" of the region or location, as described
     * in https://cloud.google.com/apis/design/resource_names.
     * * For `projects.regions.autoscalingPolicies.create`, the resource name
     *   of the region has the following format:
     *   `projects/{project_id}/regions/{region}`
     * * For `projects.locations.autoscalingPolicies.create`, the resource name
     *   of the location has the following format:
     *   `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;
    }

    /**
     * Required. The autoscaling policy to create.
     *
     * Generated from protobuf field <code>.google.cloud.dataproc.v1.AutoscalingPolicy policy = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Cloud\Dataproc\V1\AutoscalingPolicy|null
     */
    public function getPolicy()
    {
        return $this->policy;
    }

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

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

    /**
     * Required. The autoscaling policy to create.
     *
     * Generated from protobuf field <code>.google.cloud.dataproc.v1.AutoscalingPolicy policy = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Cloud\Dataproc\V1\AutoscalingPolicy $var
     * @return $this
     */
    public function setPolicy($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\AutoscalingPolicy::class);
        $this->policy = $var;

        return $this;
    }

}

