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

namespace Google\Cloud\Dataproc\V1\Metric;

use UnexpectedValueException;

/**
 * Protobuf type <code>google.cloud.dataproc.v1.Metric.MetricSource</code>
 */
class MetricSource
{
    /**
     * Unspecified metric source
     *
     * Generated from protobuf enum <code>METRIC_SOURCE_UNSPECIFIED = 0;</code>
     */
    const METRIC_SOURCE_UNSPECIFIED = 0;
    /**
     * Default monitoring agent metrics. If this source is enabled,
     * Dataproc enables the monitoring agent in Compute Engine, and collects
     * default monitoring agent metrics, which are published with an
     * agent.googleapis.com prefix.
     *
     * Generated from protobuf enum <code>MONITORING_AGENT_DEFAULTS = 1;</code>
     */
    const MONITORING_AGENT_DEFAULTS = 1;
    /**
     * HDFS metric source
     *
     * Generated from protobuf enum <code>HDFS = 2;</code>
     */
    const HDFS = 2;
    /**
     * SPARK metric source
     *
     * Generated from protobuf enum <code>SPARK = 3;</code>
     */
    const SPARK = 3;
    /**
     * YARN metric source
     *
     * Generated from protobuf enum <code>YARN = 4;</code>
     */
    const YARN = 4;
    /**
     * Spark History Server metric source
     *
     * Generated from protobuf enum <code>SPARK_HISTORY_SERVER = 5;</code>
     */
    const SPARK_HISTORY_SERVER = 5;
    /**
     * Hiveserver2 metric source
     *
     * Generated from protobuf enum <code>HIVESERVER2 = 6;</code>
     */
    const HIVESERVER2 = 6;

    private static $valueToName = [
        self::METRIC_SOURCE_UNSPECIFIED => 'METRIC_SOURCE_UNSPECIFIED',
        self::MONITORING_AGENT_DEFAULTS => 'MONITORING_AGENT_DEFAULTS',
        self::HDFS => 'HDFS',
        self::SPARK => 'SPARK',
        self::YARN => 'YARN',
        self::SPARK_HISTORY_SERVER => 'SPARK_HISTORY_SERVER',
        self::HIVESERVER2 => 'HIVESERVER2',
    ];

    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(MetricSource::class, \Google\Cloud\Dataproc\V1\Metric_MetricSource::class);

