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

namespace Google\Cloud\Redis\V1\Instance;

use UnexpectedValueException;

/**
 * Available connection modes.
 *
 * Protobuf type <code>google.cloud.redis.v1.Instance.ConnectMode</code>
 */
class ConnectMode
{
    /**
     * Not set.
     *
     * Generated from protobuf enum <code>CONNECT_MODE_UNSPECIFIED = 0;</code>
     */
    const CONNECT_MODE_UNSPECIFIED = 0;
    /**
     * Connect via directly peering with memorystore redis hosted service.
     *
     * Generated from protobuf enum <code>DIRECT_PEERING = 1;</code>
     */
    const DIRECT_PEERING = 1;
    /**
     * Connect with google via private service access and share connection
     * across google managed services.
     *
     * Generated from protobuf enum <code>PRIVATE_SERVICE_ACCESS = 2;</code>
     */
    const PRIVATE_SERVICE_ACCESS = 2;

    private static $valueToName = [
        self::CONNECT_MODE_UNSPECIFIED => 'CONNECT_MODE_UNSPECIFIED',
        self::DIRECT_PEERING => 'DIRECT_PEERING',
        self::PRIVATE_SERVICE_ACCESS => 'PRIVATE_SERVICE_ACCESS',
    ];

    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(ConnectMode::class, \Google\Cloud\Redis\V1\Instance_ConnectMode::class);

