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

namespace Google\Identity\AccessContextManager\V1\ServicePerimeterConfig;

use UnexpectedValueException;

/**
 * Specifies the types of identities that are allowed access in either
 * [IngressFrom]
 * [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressFrom]
 * or [EgressFrom]
 * [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressFrom]
 * rules.
 *
 * Protobuf type <code>google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IdentityType</code>
 */
class IdentityType
{
    /**
     * No blanket identity group specified.
     *
     * Generated from protobuf enum <code>IDENTITY_TYPE_UNSPECIFIED = 0;</code>
     */
    const IDENTITY_TYPE_UNSPECIFIED = 0;
    /**
     * Authorize access from all identities outside the perimeter.
     *
     * Generated from protobuf enum <code>ANY_IDENTITY = 1;</code>
     */
    const ANY_IDENTITY = 1;
    /**
     * Authorize access from all human users outside the perimeter.
     *
     * Generated from protobuf enum <code>ANY_USER_ACCOUNT = 2;</code>
     */
    const ANY_USER_ACCOUNT = 2;
    /**
     * Authorize access from all service accounts outside the perimeter.
     *
     * Generated from protobuf enum <code>ANY_SERVICE_ACCOUNT = 3;</code>
     */
    const ANY_SERVICE_ACCOUNT = 3;

    private static $valueToName = [
        self::IDENTITY_TYPE_UNSPECIFIED => 'IDENTITY_TYPE_UNSPECIFIED',
        self::ANY_IDENTITY => 'ANY_IDENTITY',
        self::ANY_USER_ACCOUNT => 'ANY_USER_ACCOUNT',
        self::ANY_SERVICE_ACCOUNT => 'ANY_SERVICE_ACCOUNT',
    ];

    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(IdentityType::class, \Google\Identity\AccessContextManager\V1\ServicePerimeterConfig_IdentityType::class);

