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

namespace Google\Cloud\Dataproc\V1;

use UnexpectedValueException;

/**
 * Actions in response to failure of a resource associated with a cluster.
 *
 * Protobuf type <code>google.cloud.dataproc.v1.FailureAction</code>
 */
class FailureAction
{
    /**
     * When FailureAction is unspecified, failure action defaults to NO_ACTION.
     *
     * Generated from protobuf enum <code>FAILURE_ACTION_UNSPECIFIED = 0;</code>
     */
    const FAILURE_ACTION_UNSPECIFIED = 0;
    /**
     * Take no action on failure to create a cluster resource. NO_ACTION is the
     * default.
     *
     * Generated from protobuf enum <code>NO_ACTION = 1;</code>
     */
    const NO_ACTION = 1;
    /**
     * Delete the failed cluster resource.
     *
     * Generated from protobuf enum <code>DELETE = 2;</code>
     */
    const DELETE = 2;

    private static $valueToName = [
        self::FAILURE_ACTION_UNSPECIFIED => 'FAILURE_ACTION_UNSPECIFIED',
        self::NO_ACTION => 'NO_ACTION',
        self::DELETE => 'DELETE',
    ];

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

