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

namespace Google\Cloud\Compute\V1\Scheduling;

use UnexpectedValueException;

/**
 * Specifies the termination action for the instance.
 *
 * Protobuf type <code>google.cloud.compute.v1.Scheduling.InstanceTerminationAction</code>
 */
class InstanceTerminationAction
{
    /**
     * A value indicating that the enum field is not set.
     *
     * Generated from protobuf enum <code>UNDEFINED_INSTANCE_TERMINATION_ACTION = 0;</code>
     */
    const UNDEFINED_INSTANCE_TERMINATION_ACTION = 0;
    /**
     * Delete the VM.
     *
     * Generated from protobuf enum <code>DELETE = 402225579;</code>
     */
    const DELETE = 402225579;
    /**
     * Default value. This value is unused.
     *
     * Generated from protobuf enum <code>INSTANCE_TERMINATION_ACTION_UNSPECIFIED = 92954803;</code>
     */
    const INSTANCE_TERMINATION_ACTION_UNSPECIFIED = 92954803;
    /**
     * Stop the VM without storing in-memory content. default action.
     *
     * Generated from protobuf enum <code>STOP = 2555906;</code>
     */
    const STOP = 2555906;

    private static $valueToName = [
        self::UNDEFINED_INSTANCE_TERMINATION_ACTION => 'UNDEFINED_INSTANCE_TERMINATION_ACTION',
        self::DELETE => 'DELETE',
        self::INSTANCE_TERMINATION_ACTION_UNSPECIFIED => 'INSTANCE_TERMINATION_ACTION_UNSPECIFIED',
        self::STOP => 'STOP',
    ];

    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);
    }
}


