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

namespace Google\Cloud\Compute\V1\BackendService;

use UnexpectedValueException;

/**
 * The protocol this BackendService uses to communicate with backends. Possible values are HTTP, HTTPS, HTTP2, TCP, SSL, UDP or GRPC. depending on the chosen load balancer or Traffic Director configuration. Refer to the documentation for the load balancers or for Traffic Director for more information. Must be set to GRPC when the backend service is referenced by a URL map that is bound to target gRPC proxy.
 *
 * Protobuf type <code>google.cloud.compute.v1.BackendService.Protocol</code>
 */
class Protocol
{
    /**
     * A value indicating that the enum field is not set.
     *
     * Generated from protobuf enum <code>UNDEFINED_PROTOCOL = 0;</code>
     */
    const UNDEFINED_PROTOCOL = 0;
    /**
     * gRPC (available for Traffic Director).
     *
     * Generated from protobuf enum <code>GRPC = 2196510;</code>
     */
    const GRPC = 2196510;
    /**
     * Generated from protobuf enum <code>HTTP = 2228360;</code>
     */
    const HTTP = 2228360;
    /**
     * HTTP/2 with SSL.
     *
     * Generated from protobuf enum <code>HTTP2 = 69079210;</code>
     */
    const HTTP2 = 69079210;
    /**
     * Generated from protobuf enum <code>HTTPS = 69079243;</code>
     */
    const HTTPS = 69079243;
    /**
     * TCP proxying with SSL.
     *
     * Generated from protobuf enum <code>SSL = 82412;</code>
     */
    const SSL = 82412;
    /**
     * TCP proxying or TCP pass-through.
     *
     * Generated from protobuf enum <code>TCP = 82881;</code>
     */
    const TCP = 82881;
    /**
     * UDP.
     *
     * Generated from protobuf enum <code>UDP = 83873;</code>
     */
    const UDP = 83873;
    /**
     * If a Backend Service has UNSPECIFIED as its protocol, it can be used with any L3/L4 Forwarding Rules.
     *
     * Generated from protobuf enum <code>UNSPECIFIED = 526786327;</code>
     */
    const UNSPECIFIED = 526786327;

    private static $valueToName = [
        self::UNDEFINED_PROTOCOL => 'UNDEFINED_PROTOCOL',
        self::GRPC => 'GRPC',
        self::HTTP => 'HTTP',
        self::HTTP2 => 'HTTP2',
        self::HTTPS => 'HTTPS',
        self::SSL => 'SSL',
        self::TCP => 'TCP',
        self::UDP => 'UDP',
        self::UNSPECIFIED => 'UNSPECIFIED',
    ];

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


