<?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;

/**
 *
 * Generated from protobuf message <code>google.cloud.compute.v1.InstanceGroupManagerVersion</code>
 */
class InstanceGroupManagerVersion extends \Google\Protobuf\Internal\Message
{
    /**
     * The URL of the instance template that is specified for this managed instance group. The group uses this template to create new instances in the managed instance group until the `targetSize` for this version is reached. The templates for existing instances in the group do not change unless you run recreateInstances, run applyUpdatesToInstances, or set the group's updatePolicy.type to PROACTIVE; in those cases, existing instances are updated until the `targetSize` for this version is reached.
     *
     * Generated from protobuf field <code>string instance_template = 40812772;</code>
     */
    private $instance_template = '';
    /**
     * Name of the version. Unique among all versions in the scope of this managed instance group.
     *
     * Generated from protobuf field <code>string name = 3373707;</code>
     */
    private $name = '';
    /**
     * Specifies the intended number of instances to be created from the instanceTemplate. The final number of instances created from the template will be equal to:
     * - If expressed as a fixed number, the minimum of either targetSize.fixed or instanceGroupManager.targetSize is used.
     * - if expressed as a percent, the targetSize would be (targetSize.percent/100 * InstanceGroupManager.targetSize) If there is a remainder, the number is rounded up.  If unset, this version will update any remaining instances not updated by another version. Read Starting a canary update for more information.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.FixedOrPercent target_size = 62880239;</code>
     */
    private $target_size = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $instance_template
     *           The URL of the instance template that is specified for this managed instance group. The group uses this template to create new instances in the managed instance group until the `targetSize` for this version is reached. The templates for existing instances in the group do not change unless you run recreateInstances, run applyUpdatesToInstances, or set the group's updatePolicy.type to PROACTIVE; in those cases, existing instances are updated until the `targetSize` for this version is reached.
     *     @type string $name
     *           Name of the version. Unique among all versions in the scope of this managed instance group.
     *     @type \Google\Cloud\Compute\V1\FixedOrPercent $target_size
     *           Specifies the intended number of instances to be created from the instanceTemplate. The final number of instances created from the template will be equal to:
     *           - If expressed as a fixed number, the minimum of either targetSize.fixed or instanceGroupManager.targetSize is used.
     *           - if expressed as a percent, the targetSize would be (targetSize.percent/100 * InstanceGroupManager.targetSize) If there is a remainder, the number is rounded up.  If unset, this version will update any remaining instances not updated by another version. Read Starting a canary update for more information.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce();
        parent::__construct($data);
    }

    /**
     * The URL of the instance template that is specified for this managed instance group. The group uses this template to create new instances in the managed instance group until the `targetSize` for this version is reached. The templates for existing instances in the group do not change unless you run recreateInstances, run applyUpdatesToInstances, or set the group's updatePolicy.type to PROACTIVE; in those cases, existing instances are updated until the `targetSize` for this version is reached.
     *
     * Generated from protobuf field <code>string instance_template = 40812772;</code>
     * @return string
     */
    public function getInstanceTemplate()
    {
        return $this->instance_template;
    }

    /**
     * The URL of the instance template that is specified for this managed instance group. The group uses this template to create new instances in the managed instance group until the `targetSize` for this version is reached. The templates for existing instances in the group do not change unless you run recreateInstances, run applyUpdatesToInstances, or set the group's updatePolicy.type to PROACTIVE; in those cases, existing instances are updated until the `targetSize` for this version is reached.
     *
     * Generated from protobuf field <code>string instance_template = 40812772;</code>
     * @param string $var
     * @return $this
     */
    public function setInstanceTemplate($var)
    {
        GPBUtil::checkString($var, True);
        $this->instance_template = $var;

        return $this;
    }

    /**
     * Name of the version. Unique among all versions in the scope of this managed instance group.
     *
     * Generated from protobuf field <code>string name = 3373707;</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Name of the version. Unique among all versions in the scope of this managed instance group.
     *
     * Generated from protobuf field <code>string name = 3373707;</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Specifies the intended number of instances to be created from the instanceTemplate. The final number of instances created from the template will be equal to:
     * - If expressed as a fixed number, the minimum of either targetSize.fixed or instanceGroupManager.targetSize is used.
     * - if expressed as a percent, the targetSize would be (targetSize.percent/100 * InstanceGroupManager.targetSize) If there is a remainder, the number is rounded up.  If unset, this version will update any remaining instances not updated by another version. Read Starting a canary update for more information.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.FixedOrPercent target_size = 62880239;</code>
     * @return \Google\Cloud\Compute\V1\FixedOrPercent
     */
    public function getTargetSize()
    {
        return isset($this->target_size) ? $this->target_size : null;
    }

    public function hasTargetSize()
    {
        return isset($this->target_size);
    }

    public function clearTargetSize()
    {
        unset($this->target_size);
    }

    /**
     * Specifies the intended number of instances to be created from the instanceTemplate. The final number of instances created from the template will be equal to:
     * - If expressed as a fixed number, the minimum of either targetSize.fixed or instanceGroupManager.targetSize is used.
     * - if expressed as a percent, the targetSize would be (targetSize.percent/100 * InstanceGroupManager.targetSize) If there is a remainder, the number is rounded up.  If unset, this version will update any remaining instances not updated by another version. Read Starting a canary update for more information.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.FixedOrPercent target_size = 62880239;</code>
     * @param \Google\Cloud\Compute\V1\FixedOrPercent $var
     * @return $this
     */
    public function setTargetSize($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\FixedOrPercent::class);
        $this->target_size = $var;

        return $this;
    }

}

