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

namespace Google\Cloud\Compute\V1;

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

/**
 * Cloud Autoscaler policy.
 *
 * Generated from protobuf message <code>google.cloud.compute.v1.AutoscalingPolicy</code>
 */
class AutoscalingPolicy extends \Google\Protobuf\Internal\Message
{
    /**
     * The number of seconds that the autoscaler waits before it starts collecting information from a new instance. This prevents the autoscaler from collecting information when the instance is initializing, during which the collected usage would not be reliable. The default time autoscaler waits is 60 seconds.
     * Virtual machine initialization times might vary because of numerous factors. We recommend that you test how long an instance may take to initialize. To do this, create an instance and time the startup process.
     *
     * Generated from protobuf field <code>int32 cool_down_period_sec = 107692954;</code>
     */
    private $cool_down_period_sec = 0;
    /**
     * Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.AutoscalingPolicyCpuUtilization cpu_utilization = 112775691;</code>
     */
    private $cpu_utilization = null;
    /**
     * Configuration parameters of autoscaling based on a custom metric.
     *
     * Generated from protobuf field <code>repeated .google.cloud.compute.v1.AutoscalingPolicyCustomMetricUtilization custom_metric_utilizations = 131972850;</code>
     */
    private $custom_metric_utilizations;
    /**
     * Configuration parameters of autoscaling based on load balancer.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.AutoscalingPolicyLoadBalancingUtilization load_balancing_utilization = 161310947;</code>
     */
    private $load_balancing_utilization = null;
    /**
     * The maximum number of instances that the autoscaler can scale out to. This is required when creating or updating an autoscaler. The maximum number of replicas must not be lower than minimal number of replicas.
     *
     * Generated from protobuf field <code>int32 max_num_replicas = 62327375;</code>
     */
    private $max_num_replicas = 0;
    /**
     * The minimum number of replicas that the autoscaler can scale in to. This cannot be less than 0. If not provided, autoscaler chooses a default value depending on maximum number of instances allowed.
     *
     * Generated from protobuf field <code>int32 min_num_replicas = 266894369;</code>
     */
    private $min_num_replicas = 0;
    /**
     * Defines operating mode for this policy.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.AutoscalingPolicy.Mode mode = 3357091;</code>
     */
    private $mode = 0;
    /**
     * Generated from protobuf field <code>.google.cloud.compute.v1.AutoscalingPolicyScaleInControl scale_in_control = 259235416;</code>
     */
    private $scale_in_control = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $cool_down_period_sec
     *           The number of seconds that the autoscaler waits before it starts collecting information from a new instance. This prevents the autoscaler from collecting information when the instance is initializing, during which the collected usage would not be reliable. The default time autoscaler waits is 60 seconds.
     *           Virtual machine initialization times might vary because of numerous factors. We recommend that you test how long an instance may take to initialize. To do this, create an instance and time the startup process.
     *     @type \Google\Cloud\Compute\V1\AutoscalingPolicyCpuUtilization $cpu_utilization
     *           Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group.
     *     @type \Google\Cloud\Compute\V1\AutoscalingPolicyCustomMetricUtilization[]|\Google\Protobuf\Internal\RepeatedField $custom_metric_utilizations
     *           Configuration parameters of autoscaling based on a custom metric.
     *     @type \Google\Cloud\Compute\V1\AutoscalingPolicyLoadBalancingUtilization $load_balancing_utilization
     *           Configuration parameters of autoscaling based on load balancer.
     *     @type int $max_num_replicas
     *           The maximum number of instances that the autoscaler can scale out to. This is required when creating or updating an autoscaler. The maximum number of replicas must not be lower than minimal number of replicas.
     *     @type int $min_num_replicas
     *           The minimum number of replicas that the autoscaler can scale in to. This cannot be less than 0. If not provided, autoscaler chooses a default value depending on maximum number of instances allowed.
     *     @type int $mode
     *           Defines operating mode for this policy.
     *     @type \Google\Cloud\Compute\V1\AutoscalingPolicyScaleInControl $scale_in_control
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce();
        parent::__construct($data);
    }

    /**
     * The number of seconds that the autoscaler waits before it starts collecting information from a new instance. This prevents the autoscaler from collecting information when the instance is initializing, during which the collected usage would not be reliable. The default time autoscaler waits is 60 seconds.
     * Virtual machine initialization times might vary because of numerous factors. We recommend that you test how long an instance may take to initialize. To do this, create an instance and time the startup process.
     *
     * Generated from protobuf field <code>int32 cool_down_period_sec = 107692954;</code>
     * @return int
     */
    public function getCoolDownPeriodSec()
    {
        return $this->cool_down_period_sec;
    }

    /**
     * The number of seconds that the autoscaler waits before it starts collecting information from a new instance. This prevents the autoscaler from collecting information when the instance is initializing, during which the collected usage would not be reliable. The default time autoscaler waits is 60 seconds.
     * Virtual machine initialization times might vary because of numerous factors. We recommend that you test how long an instance may take to initialize. To do this, create an instance and time the startup process.
     *
     * Generated from protobuf field <code>int32 cool_down_period_sec = 107692954;</code>
     * @param int $var
     * @return $this
     */
    public function setCoolDownPeriodSec($var)
    {
        GPBUtil::checkInt32($var);
        $this->cool_down_period_sec = $var;

        return $this;
    }

    /**
     * Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.AutoscalingPolicyCpuUtilization cpu_utilization = 112775691;</code>
     * @return \Google\Cloud\Compute\V1\AutoscalingPolicyCpuUtilization
     */
    public function getCpuUtilization()
    {
        return isset($this->cpu_utilization) ? $this->cpu_utilization : null;
    }

    public function hasCpuUtilization()
    {
        return isset($this->cpu_utilization);
    }

    public function clearCpuUtilization()
    {
        unset($this->cpu_utilization);
    }

    /**
     * Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.AutoscalingPolicyCpuUtilization cpu_utilization = 112775691;</code>
     * @param \Google\Cloud\Compute\V1\AutoscalingPolicyCpuUtilization $var
     * @return $this
     */
    public function setCpuUtilization($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\AutoscalingPolicyCpuUtilization::class);
        $this->cpu_utilization = $var;

        return $this;
    }

    /**
     * Configuration parameters of autoscaling based on a custom metric.
     *
     * Generated from protobuf field <code>repeated .google.cloud.compute.v1.AutoscalingPolicyCustomMetricUtilization custom_metric_utilizations = 131972850;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getCustomMetricUtilizations()
    {
        return $this->custom_metric_utilizations;
    }

    /**
     * Configuration parameters of autoscaling based on a custom metric.
     *
     * Generated from protobuf field <code>repeated .google.cloud.compute.v1.AutoscalingPolicyCustomMetricUtilization custom_metric_utilizations = 131972850;</code>
     * @param \Google\Cloud\Compute\V1\AutoscalingPolicyCustomMetricUtilization[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setCustomMetricUtilizations($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Compute\V1\AutoscalingPolicyCustomMetricUtilization::class);
        $this->custom_metric_utilizations = $arr;

        return $this;
    }

    /**
     * Configuration parameters of autoscaling based on load balancer.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.AutoscalingPolicyLoadBalancingUtilization load_balancing_utilization = 161310947;</code>
     * @return \Google\Cloud\Compute\V1\AutoscalingPolicyLoadBalancingUtilization
     */
    public function getLoadBalancingUtilization()
    {
        return isset($this->load_balancing_utilization) ? $this->load_balancing_utilization : null;
    }

    public function hasLoadBalancingUtilization()
    {
        return isset($this->load_balancing_utilization);
    }

    public function clearLoadBalancingUtilization()
    {
        unset($this->load_balancing_utilization);
    }

    /**
     * Configuration parameters of autoscaling based on load balancer.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.AutoscalingPolicyLoadBalancingUtilization load_balancing_utilization = 161310947;</code>
     * @param \Google\Cloud\Compute\V1\AutoscalingPolicyLoadBalancingUtilization $var
     * @return $this
     */
    public function setLoadBalancingUtilization($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\AutoscalingPolicyLoadBalancingUtilization::class);
        $this->load_balancing_utilization = $var;

        return $this;
    }

    /**
     * The maximum number of instances that the autoscaler can scale out to. This is required when creating or updating an autoscaler. The maximum number of replicas must not be lower than minimal number of replicas.
     *
     * Generated from protobuf field <code>int32 max_num_replicas = 62327375;</code>
     * @return int
     */
    public function getMaxNumReplicas()
    {
        return $this->max_num_replicas;
    }

    /**
     * The maximum number of instances that the autoscaler can scale out to. This is required when creating or updating an autoscaler. The maximum number of replicas must not be lower than minimal number of replicas.
     *
     * Generated from protobuf field <code>int32 max_num_replicas = 62327375;</code>
     * @param int $var
     * @return $this
     */
    public function setMaxNumReplicas($var)
    {
        GPBUtil::checkInt32($var);
        $this->max_num_replicas = $var;

        return $this;
    }

    /**
     * The minimum number of replicas that the autoscaler can scale in to. This cannot be less than 0. If not provided, autoscaler chooses a default value depending on maximum number of instances allowed.
     *
     * Generated from protobuf field <code>int32 min_num_replicas = 266894369;</code>
     * @return int
     */
    public function getMinNumReplicas()
    {
        return $this->min_num_replicas;
    }

    /**
     * The minimum number of replicas that the autoscaler can scale in to. This cannot be less than 0. If not provided, autoscaler chooses a default value depending on maximum number of instances allowed.
     *
     * Generated from protobuf field <code>int32 min_num_replicas = 266894369;</code>
     * @param int $var
     * @return $this
     */
    public function setMinNumReplicas($var)
    {
        GPBUtil::checkInt32($var);
        $this->min_num_replicas = $var;

        return $this;
    }

    /**
     * Defines operating mode for this policy.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.AutoscalingPolicy.Mode mode = 3357091;</code>
     * @return int
     */
    public function getMode()
    {
        return $this->mode;
    }

    /**
     * Defines operating mode for this policy.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.AutoscalingPolicy.Mode mode = 3357091;</code>
     * @param int $var
     * @return $this
     */
    public function setMode($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Compute\V1\AutoscalingPolicy\Mode::class);
        $this->mode = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>.google.cloud.compute.v1.AutoscalingPolicyScaleInControl scale_in_control = 259235416;</code>
     * @return \Google\Cloud\Compute\V1\AutoscalingPolicyScaleInControl
     */
    public function getScaleInControl()
    {
        return isset($this->scale_in_control) ? $this->scale_in_control : null;
    }

    public function hasScaleInControl()
    {
        return isset($this->scale_in_control);
    }

    public function clearScaleInControl()
    {
        unset($this->scale_in_control);
    }

    /**
     * Generated from protobuf field <code>.google.cloud.compute.v1.AutoscalingPolicyScaleInControl scale_in_control = 259235416;</code>
     * @param \Google\Cloud\Compute\V1\AutoscalingPolicyScaleInControl $var
     * @return $this
     */
    public function setScaleInControl($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\AutoscalingPolicyScaleInControl::class);
        $this->scale_in_control = $var;

        return $this;
    }

}

