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

namespace Google\Cloud\Dataproc\V1\DataprocMetricConfig;

use UnexpectedValueException;

/**
 * A source for the collection of Dataproc OSS metrics (see [available OSS
 * metrics]
 * (https://cloud.google.com//dataproc/docs/guides/monitoring#available_oss_metrics)).
 *
 * Protobuf type <code>google.cloud.dataproc.v1.DataprocMetricConfig.MetricSource</code>
 */
class MetricSource
{
    /**
     * Required 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;
    /**
     * hivemetastore metric source
     *
     * Generated from protobuf enum <code>HIVEMETASTORE = 7;</code>
     */
    const HIVEMETASTORE = 7;

    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',
        self::HIVEMETASTORE => 'HIVEMETASTORE',
    ];

    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\DataprocMetricConfig_MetricSource::class);

