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

namespace Google\Cloud\Compute\V1\NodeGroup;

use UnexpectedValueException;

/**
 * Specifies how to handle instances when a node in the group undergoes maintenance. Set to one of: DEFAULT, RESTART_IN_PLACE, or MIGRATE_WITHIN_NODE_GROUP. The default value is DEFAULT. For more information, see  Maintenance policies.
 *
 * Protobuf type <code>google.cloud.compute.v1.NodeGroup.MaintenancePolicy</code>
 */
class MaintenancePolicy
{
    /**
     * A value indicating that the enum field is not set.
     *
     * Generated from protobuf enum <code>UNDEFINED_MAINTENANCE_POLICY = 0;</code>
     */
    const UNDEFINED_MAINTENANCE_POLICY = 0;
    /**
     * Generated from protobuf enum <code>DEFAULT = 115302945;</code>
     */
    const PBDEFAULT = 115302945;
    /**
     * Generated from protobuf enum <code>MAINTENANCE_POLICY_UNSPECIFIED = 72964182;</code>
     */
    const MAINTENANCE_POLICY_UNSPECIFIED = 72964182;
    /**
     * Generated from protobuf enum <code>MIGRATE_WITHIN_NODE_GROUP = 153483394;</code>
     */
    const MIGRATE_WITHIN_NODE_GROUP = 153483394;
    /**
     * Generated from protobuf enum <code>RESTART_IN_PLACE = 228647325;</code>
     */
    const RESTART_IN_PLACE = 228647325;

    private static $valueToName = [
        self::UNDEFINED_MAINTENANCE_POLICY => 'UNDEFINED_MAINTENANCE_POLICY',
        self::PBDEFAULT => 'PBDEFAULT',
        self::MAINTENANCE_POLICY_UNSPECIFIED => 'MAINTENANCE_POLICY_UNSPECIFIED',
        self::MIGRATE_WITHIN_NODE_GROUP => 'MIGRATE_WITHIN_NODE_GROUP',
        self::RESTART_IN_PLACE => 'RESTART_IN_PLACE',
    ];

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


