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

/**
 * A Managed Instance resource.
 *
 * Generated from protobuf message <code>google.cloud.compute.v1.ManagedInstance</code>
 */
class ManagedInstance extends \Google\Protobuf\Internal\Message
{
    /**
     * [Output Only] The current action that the managed instance group has scheduled for the instance. Possible values:
     * - NONE The instance is running, and the managed instance group does not have any scheduled actions for this instance.
     * - CREATING The managed instance group is creating this instance. If the group fails to create this instance, it will try again until it is successful.
     * - CREATING_WITHOUT_RETRIES The managed instance group is attempting to create this instance only once. If the group fails to create this instance, it does not try again and the group's targetSize value is decreased instead.
     * - RECREATING The managed instance group is recreating this instance.
     * - DELETING The managed instance group is permanently deleting this instance.
     * - ABANDONING The managed instance group is abandoning this instance. The instance will be removed from the instance group and from any target pools that are associated with this group.
     * - RESTARTING The managed instance group is restarting the instance.
     * - REFRESHING The managed instance group is applying configuration changes to the instance without stopping it. For example, the group can update the target pool list for an instance without stopping that instance.
     * - VERIFYING The managed instance group has created the instance and it is in the process of being verified.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.ManagedInstance.CurrentAction current_action = 178475964;</code>
     */
    private $current_action = 0;
    /**
     * [Output only] The unique identifier for this resource. This field is empty when instance does not exist.
     *
     * Generated from protobuf field <code>string id = 3355;</code>
     */
    private $id = '';
    /**
     * [Output Only] The URL of the instance. The URL can exist even if the instance has not yet been created.
     *
     * Generated from protobuf field <code>string instance = 18257045;</code>
     */
    private $instance = '';
    /**
     * [Output Only] Health state of the instance per health-check.
     *
     * Generated from protobuf field <code>repeated .google.cloud.compute.v1.ManagedInstanceInstanceHealth instance_health = 114231622;</code>
     */
    private $instance_health;
    /**
     * [Output Only] The status of the instance. This field is empty when the instance does not exist.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.ManagedInstance.InstanceStatus instance_status = 174577372;</code>
     */
    private $instance_status = 0;
    /**
     * [Output Only] Information about the last attempt to create or delete the instance.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.ManagedInstanceLastAttempt last_attempt = 166336036;</code>
     */
    private $last_attempt = null;
    /**
     * [Output Only] Preserved state applied from per-instance config for this instance.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.PreservedState preserved_state_from_config = 98661858;</code>
     */
    private $preserved_state_from_config = null;
    /**
     * [Output Only] Preserved state generated based on stateful policy for this instance.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.PreservedState preserved_state_from_policy = 202348498;</code>
     */
    private $preserved_state_from_policy = null;
    /**
     * [Output Only] Intended version of this instance.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.ManagedInstanceVersion version = 83172568;</code>
     */
    private $version = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $current_action
     *           [Output Only] The current action that the managed instance group has scheduled for the instance. Possible values:
     *           - NONE The instance is running, and the managed instance group does not have any scheduled actions for this instance.
     *           - CREATING The managed instance group is creating this instance. If the group fails to create this instance, it will try again until it is successful.
     *           - CREATING_WITHOUT_RETRIES The managed instance group is attempting to create this instance only once. If the group fails to create this instance, it does not try again and the group's targetSize value is decreased instead.
     *           - RECREATING The managed instance group is recreating this instance.
     *           - DELETING The managed instance group is permanently deleting this instance.
     *           - ABANDONING The managed instance group is abandoning this instance. The instance will be removed from the instance group and from any target pools that are associated with this group.
     *           - RESTARTING The managed instance group is restarting the instance.
     *           - REFRESHING The managed instance group is applying configuration changes to the instance without stopping it. For example, the group can update the target pool list for an instance without stopping that instance.
     *           - VERIFYING The managed instance group has created the instance and it is in the process of being verified.
     *     @type string $id
     *           [Output only] The unique identifier for this resource. This field is empty when instance does not exist.
     *     @type string $instance
     *           [Output Only] The URL of the instance. The URL can exist even if the instance has not yet been created.
     *     @type \Google\Cloud\Compute\V1\ManagedInstanceInstanceHealth[]|\Google\Protobuf\Internal\RepeatedField $instance_health
     *           [Output Only] Health state of the instance per health-check.
     *     @type int $instance_status
     *           [Output Only] The status of the instance. This field is empty when the instance does not exist.
     *     @type \Google\Cloud\Compute\V1\ManagedInstanceLastAttempt $last_attempt
     *           [Output Only] Information about the last attempt to create or delete the instance.
     *     @type \Google\Cloud\Compute\V1\PreservedState $preserved_state_from_config
     *           [Output Only] Preserved state applied from per-instance config for this instance.
     *     @type \Google\Cloud\Compute\V1\PreservedState $preserved_state_from_policy
     *           [Output Only] Preserved state generated based on stateful policy for this instance.
     *     @type \Google\Cloud\Compute\V1\ManagedInstanceVersion $version
     *           [Output Only] Intended version of this instance.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce();
        parent::__construct($data);
    }

    /**
     * [Output Only] The current action that the managed instance group has scheduled for the instance. Possible values:
     * - NONE The instance is running, and the managed instance group does not have any scheduled actions for this instance.
     * - CREATING The managed instance group is creating this instance. If the group fails to create this instance, it will try again until it is successful.
     * - CREATING_WITHOUT_RETRIES The managed instance group is attempting to create this instance only once. If the group fails to create this instance, it does not try again and the group's targetSize value is decreased instead.
     * - RECREATING The managed instance group is recreating this instance.
     * - DELETING The managed instance group is permanently deleting this instance.
     * - ABANDONING The managed instance group is abandoning this instance. The instance will be removed from the instance group and from any target pools that are associated with this group.
     * - RESTARTING The managed instance group is restarting the instance.
     * - REFRESHING The managed instance group is applying configuration changes to the instance without stopping it. For example, the group can update the target pool list for an instance without stopping that instance.
     * - VERIFYING The managed instance group has created the instance and it is in the process of being verified.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.ManagedInstance.CurrentAction current_action = 178475964;</code>
     * @return int
     */
    public function getCurrentAction()
    {
        return $this->current_action;
    }

    /**
     * [Output Only] The current action that the managed instance group has scheduled for the instance. Possible values:
     * - NONE The instance is running, and the managed instance group does not have any scheduled actions for this instance.
     * - CREATING The managed instance group is creating this instance. If the group fails to create this instance, it will try again until it is successful.
     * - CREATING_WITHOUT_RETRIES The managed instance group is attempting to create this instance only once. If the group fails to create this instance, it does not try again and the group's targetSize value is decreased instead.
     * - RECREATING The managed instance group is recreating this instance.
     * - DELETING The managed instance group is permanently deleting this instance.
     * - ABANDONING The managed instance group is abandoning this instance. The instance will be removed from the instance group and from any target pools that are associated with this group.
     * - RESTARTING The managed instance group is restarting the instance.
     * - REFRESHING The managed instance group is applying configuration changes to the instance without stopping it. For example, the group can update the target pool list for an instance without stopping that instance.
     * - VERIFYING The managed instance group has created the instance and it is in the process of being verified.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.ManagedInstance.CurrentAction current_action = 178475964;</code>
     * @param int $var
     * @return $this
     */
    public function setCurrentAction($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Compute\V1\ManagedInstance\CurrentAction::class);
        $this->current_action = $var;

        return $this;
    }

    /**
     * [Output only] The unique identifier for this resource. This field is empty when instance does not exist.
     *
     * Generated from protobuf field <code>string id = 3355;</code>
     * @return string
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * [Output only] The unique identifier for this resource. This field is empty when instance does not exist.
     *
     * Generated from protobuf field <code>string id = 3355;</code>
     * @param string $var
     * @return $this
     */
    public function setId($var)
    {
        GPBUtil::checkString($var, True);
        $this->id = $var;

        return $this;
    }

    /**
     * [Output Only] The URL of the instance. The URL can exist even if the instance has not yet been created.
     *
     * Generated from protobuf field <code>string instance = 18257045;</code>
     * @return string
     */
    public function getInstance()
    {
        return $this->instance;
    }

    /**
     * [Output Only] The URL of the instance. The URL can exist even if the instance has not yet been created.
     *
     * Generated from protobuf field <code>string instance = 18257045;</code>
     * @param string $var
     * @return $this
     */
    public function setInstance($var)
    {
        GPBUtil::checkString($var, True);
        $this->instance = $var;

        return $this;
    }

    /**
     * [Output Only] Health state of the instance per health-check.
     *
     * Generated from protobuf field <code>repeated .google.cloud.compute.v1.ManagedInstanceInstanceHealth instance_health = 114231622;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getInstanceHealth()
    {
        return $this->instance_health;
    }

    /**
     * [Output Only] Health state of the instance per health-check.
     *
     * Generated from protobuf field <code>repeated .google.cloud.compute.v1.ManagedInstanceInstanceHealth instance_health = 114231622;</code>
     * @param \Google\Cloud\Compute\V1\ManagedInstanceInstanceHealth[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setInstanceHealth($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Compute\V1\ManagedInstanceInstanceHealth::class);
        $this->instance_health = $arr;

        return $this;
    }

    /**
     * [Output Only] The status of the instance. This field is empty when the instance does not exist.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.ManagedInstance.InstanceStatus instance_status = 174577372;</code>
     * @return int
     */
    public function getInstanceStatus()
    {
        return $this->instance_status;
    }

    /**
     * [Output Only] The status of the instance. This field is empty when the instance does not exist.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.ManagedInstance.InstanceStatus instance_status = 174577372;</code>
     * @param int $var
     * @return $this
     */
    public function setInstanceStatus($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Compute\V1\ManagedInstance\InstanceStatus::class);
        $this->instance_status = $var;

        return $this;
    }

    /**
     * [Output Only] Information about the last attempt to create or delete the instance.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.ManagedInstanceLastAttempt last_attempt = 166336036;</code>
     * @return \Google\Cloud\Compute\V1\ManagedInstanceLastAttempt
     */
    public function getLastAttempt()
    {
        return isset($this->last_attempt) ? $this->last_attempt : null;
    }

    public function hasLastAttempt()
    {
        return isset($this->last_attempt);
    }

    public function clearLastAttempt()
    {
        unset($this->last_attempt);
    }

    /**
     * [Output Only] Information about the last attempt to create or delete the instance.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.ManagedInstanceLastAttempt last_attempt = 166336036;</code>
     * @param \Google\Cloud\Compute\V1\ManagedInstanceLastAttempt $var
     * @return $this
     */
    public function setLastAttempt($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\ManagedInstanceLastAttempt::class);
        $this->last_attempt = $var;

        return $this;
    }

    /**
     * [Output Only] Preserved state applied from per-instance config for this instance.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.PreservedState preserved_state_from_config = 98661858;</code>
     * @return \Google\Cloud\Compute\V1\PreservedState
     */
    public function getPreservedStateFromConfig()
    {
        return isset($this->preserved_state_from_config) ? $this->preserved_state_from_config : null;
    }

    public function hasPreservedStateFromConfig()
    {
        return isset($this->preserved_state_from_config);
    }

    public function clearPreservedStateFromConfig()
    {
        unset($this->preserved_state_from_config);
    }

    /**
     * [Output Only] Preserved state applied from per-instance config for this instance.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.PreservedState preserved_state_from_config = 98661858;</code>
     * @param \Google\Cloud\Compute\V1\PreservedState $var
     * @return $this
     */
    public function setPreservedStateFromConfig($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\PreservedState::class);
        $this->preserved_state_from_config = $var;

        return $this;
    }

    /**
     * [Output Only] Preserved state generated based on stateful policy for this instance.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.PreservedState preserved_state_from_policy = 202348498;</code>
     * @return \Google\Cloud\Compute\V1\PreservedState
     */
    public function getPreservedStateFromPolicy()
    {
        return isset($this->preserved_state_from_policy) ? $this->preserved_state_from_policy : null;
    }

    public function hasPreservedStateFromPolicy()
    {
        return isset($this->preserved_state_from_policy);
    }

    public function clearPreservedStateFromPolicy()
    {
        unset($this->preserved_state_from_policy);
    }

    /**
     * [Output Only] Preserved state generated based on stateful policy for this instance.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.PreservedState preserved_state_from_policy = 202348498;</code>
     * @param \Google\Cloud\Compute\V1\PreservedState $var
     * @return $this
     */
    public function setPreservedStateFromPolicy($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\PreservedState::class);
        $this->preserved_state_from_policy = $var;

        return $this;
    }

    /**
     * [Output Only] Intended version of this instance.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.ManagedInstanceVersion version = 83172568;</code>
     * @return \Google\Cloud\Compute\V1\ManagedInstanceVersion
     */
    public function getVersion()
    {
        return isset($this->version) ? $this->version : null;
    }

    public function hasVersion()
    {
        return isset($this->version);
    }

    public function clearVersion()
    {
        unset($this->version);
    }

    /**
     * [Output Only] Intended version of this instance.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.ManagedInstanceVersion version = 83172568;</code>
     * @param \Google\Cloud\Compute\V1\ManagedInstanceVersion $var
     * @return $this
     */
    public function setVersion($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\ManagedInstanceVersion::class);
        $this->version = $var;

        return $this;
    }

}

