# This file was auto-generated by Fern from our API Definition.

from ..core.pydantic_utilities import UniversalBaseModel
import pydantic
import typing
from .api_operation_policy import ApiOperationPolicy
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class ApiPolicy(UniversalBaseModel):
    """
    What actions a principal can take on the Vectara platform.
    """

    name: str = pydantic.Field()
    """
    The name of the API role.
    """

    allowed_operations: typing.Dict[str, ApiOperationPolicy] = pydantic.Field()
    """
    Operations that are allowed by the API role. Each operation may only allow
    certain resources that are described by a resource path to resource value
    map. If the value is null, then the operation is allowed on any resource.
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
