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

namespace Google\Cloud\Compute\V1\ForwardingRule;

use UnexpectedValueException;

/**
 * The IP protocol to which this rule applies.
 * For protocol forwarding, valid options are TCP, UDP, ESP, AH, SCTP and ICMP.
 * The valid IP protocols are different for different load balancing products:
 * - Internal TCP/UDP Load Balancing: The load balancing scheme is INTERNAL, and one of TCP, UDP or ALL is valid.
 * - Traffic Director: The load balancing scheme is INTERNAL_SELF_MANAGED, and only TCP is valid.
 * - Internal HTTP(S) Load Balancing: The load balancing scheme is INTERNAL_MANAGED, and only TCP is valid.
 * - HTTP(S), SSL Proxy, and TCP Proxy Load Balancing: The load balancing scheme is EXTERNAL and only TCP is valid.
 * - Network Load Balancing: The load balancing scheme is EXTERNAL, and one of TCP or UDP is valid.
 *
 * Protobuf type <code>google.cloud.compute.v1.ForwardingRule.IPProtocol</code>
 */
class IPProtocol
{
    /**
     * A value indicating that the enum field is not set.
     *
     * Generated from protobuf enum <code>UNDEFINED_I_P_PROTOCOL = 0;</code>
     */
    const UNDEFINED_I_P_PROTOCOL = 0;
    /**
     * Generated from protobuf enum <code>AH = 2087;</code>
     */
    const AH = 2087;
    /**
     * Generated from protobuf enum <code>ESP = 68962;</code>
     */
    const ESP = 68962;
    /**
     * Generated from protobuf enum <code>ICMP = 2241597;</code>
     */
    const ICMP = 2241597;
    /**
     * Generated from protobuf enum <code>SCTP = 2539724;</code>
     */
    const SCTP = 2539724;
    /**
     * Generated from protobuf enum <code>TCP = 82881;</code>
     */
    const TCP = 82881;
    /**
     * Generated from protobuf enum <code>UDP = 83873;</code>
     */
    const UDP = 83873;

    private static $valueToName = [
        self::UNDEFINED_I_P_PROTOCOL => 'UNDEFINED_I_P_PROTOCOL',
        self::AH => 'AH',
        self::ESP => 'ESP',
        self::ICMP => 'ICMP',
        self::SCTP => 'SCTP',
        self::TCP => 'TCP',
        self::UDP => 'UDP',
    ];

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


