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

namespace Google\Cloud\NetworkSecurity\V1beta1\AuthorizationPolicy;

use UnexpectedValueException;

/**
 * Possible values that define what action to take.
 *
 * Protobuf type <code>google.cloud.networksecurity.v1beta1.AuthorizationPolicy.Action</code>
 */
class Action
{
    /**
     * Default value.
     *
     * Generated from protobuf enum <code>ACTION_UNSPECIFIED = 0;</code>
     */
    const ACTION_UNSPECIFIED = 0;
    /**
     * Grant access.
     *
     * Generated from protobuf enum <code>ALLOW = 1;</code>
     */
    const ALLOW = 1;
    /**
     * Deny access.
     * Deny rules should be avoided unless they are used to provide a default
     * "deny all" fallback.
     *
     * Generated from protobuf enum <code>DENY = 2;</code>
     */
    const DENY = 2;

    private static $valueToName = [
        self::ACTION_UNSPECIFIED => 'ACTION_UNSPECIFIED',
        self::ALLOW => 'ALLOW',
        self::DENY => 'DENY',
    ];

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


