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

namespace Google\Cloud\OsConfig\V1\Instance;

use UnexpectedValueException;

/**
 * Patch state of an instance.
 *
 * Protobuf type <code>google.cloud.osconfig.v1.Instance.PatchState</code>
 */
class PatchState
{
    /**
     * Unspecified.
     *
     * Generated from protobuf enum <code>PATCH_STATE_UNSPECIFIED = 0;</code>
     */
    const PATCH_STATE_UNSPECIFIED = 0;
    /**
     * The instance is not yet notified.
     *
     * Generated from protobuf enum <code>PENDING = 1;</code>
     */
    const PENDING = 1;
    /**
     * Instance is inactive and cannot be patched.
     *
     * Generated from protobuf enum <code>INACTIVE = 2;</code>
     */
    const INACTIVE = 2;
    /**
     * The instance is notified that it should be patched.
     *
     * Generated from protobuf enum <code>NOTIFIED = 3;</code>
     */
    const NOTIFIED = 3;
    /**
     * The instance has started the patching process.
     *
     * Generated from protobuf enum <code>STARTED = 4;</code>
     */
    const STARTED = 4;
    /**
     * The instance is downloading patches.
     *
     * Generated from protobuf enum <code>DOWNLOADING_PATCHES = 5;</code>
     */
    const DOWNLOADING_PATCHES = 5;
    /**
     * The instance is applying patches.
     *
     * Generated from protobuf enum <code>APPLYING_PATCHES = 6;</code>
     */
    const APPLYING_PATCHES = 6;
    /**
     * The instance is rebooting.
     *
     * Generated from protobuf enum <code>REBOOTING = 7;</code>
     */
    const REBOOTING = 7;
    /**
     * The instance has completed applying patches.
     *
     * Generated from protobuf enum <code>SUCCEEDED = 8;</code>
     */
    const SUCCEEDED = 8;
    /**
     * The instance has completed applying patches but a reboot is required.
     *
     * Generated from protobuf enum <code>SUCCEEDED_REBOOT_REQUIRED = 9;</code>
     */
    const SUCCEEDED_REBOOT_REQUIRED = 9;
    /**
     * The instance has failed to apply the patch.
     *
     * Generated from protobuf enum <code>FAILED = 10;</code>
     */
    const FAILED = 10;
    /**
     * The instance acked the notification and will start shortly.
     *
     * Generated from protobuf enum <code>ACKED = 11;</code>
     */
    const ACKED = 11;
    /**
     * The instance exceeded the time out while applying the patch.
     *
     * Generated from protobuf enum <code>TIMED_OUT = 12;</code>
     */
    const TIMED_OUT = 12;
    /**
     * The instance is running the pre-patch step.
     *
     * Generated from protobuf enum <code>RUNNING_PRE_PATCH_STEP = 13;</code>
     */
    const RUNNING_PRE_PATCH_STEP = 13;
    /**
     * The instance is running the post-patch step.
     *
     * Generated from protobuf enum <code>RUNNING_POST_PATCH_STEP = 14;</code>
     */
    const RUNNING_POST_PATCH_STEP = 14;
    /**
     * The service could not detect the presence of the agent. Check to ensure
     * that the agent is installed, running, and able to communicate with the
     * service.
     *
     * Generated from protobuf enum <code>NO_AGENT_DETECTED = 15;</code>
     */
    const NO_AGENT_DETECTED = 15;

    private static $valueToName = [
        self::PATCH_STATE_UNSPECIFIED => 'PATCH_STATE_UNSPECIFIED',
        self::PENDING => 'PENDING',
        self::INACTIVE => 'INACTIVE',
        self::NOTIFIED => 'NOTIFIED',
        self::STARTED => 'STARTED',
        self::DOWNLOADING_PATCHES => 'DOWNLOADING_PATCHES',
        self::APPLYING_PATCHES => 'APPLYING_PATCHES',
        self::REBOOTING => 'REBOOTING',
        self::SUCCEEDED => 'SUCCEEDED',
        self::SUCCEEDED_REBOOT_REQUIRED => 'SUCCEEDED_REBOOT_REQUIRED',
        self::FAILED => 'FAILED',
        self::ACKED => 'ACKED',
        self::TIMED_OUT => 'TIMED_OUT',
        self::RUNNING_PRE_PATCH_STEP => 'RUNNING_PRE_PATCH_STEP',
        self::RUNNING_POST_PATCH_STEP => 'RUNNING_POST_PATCH_STEP',
        self::NO_AGENT_DETECTED => 'NO_AGENT_DETECTED',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }


    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(PatchState::class, \Google\Cloud\OsConfig\V1\Instance_PatchState::class);

