<?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 custom metrics (see [Custom
 * metrics]
 * (https://cloud.google.com//dataproc/docs/guides/dataproc-metrics#custom_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;
    /**
     * Monitoring agent metrics. If this source is enabled,
     * Dataproc enables the monitoring agent in Compute Engine,
     * and collects 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;
    /**
     * flink metric source
     *
     * Generated from protobuf enum <code>FLINK = 8;</code>
     */
    const FLINK = 8;

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

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


