Source code for smarter.models.platform

"""Models of the platform's own endpoints: ``whoami``, ``version`` and ``status``."""

from typing import Optional

from pydantic import Field

from smarter.core.typing import SmarterJsonObjectType

from .account import Account, User
from .base import SmarterCamelModel, SmarterModel


[docs] class WhoAmI(SmarterModel): """The owner of the api key: the user, their account, and the platform's environment.""" user: User account: Account environment: Optional[str] = Field(None, description="The platform's environment, e.g. local or prod.")
[docs] class ApiVersion(SmarterModel): """The platform's version, and the versions of its main Python packages.""" version: str = Field(..., description="The Smarter platform's semantic version.") python: dict[str, Optional[str]] = Field(default_factory=dict, description="Python package versions, by package.")
[docs] class CliVersion(SmarterModel): """The version of the smarter cli that the platform recommends.""" version: Optional[str] = None
[docs] class PlatformVersion(SmarterModel): """The response of ``version``.""" api: ApiVersion cli: Optional[CliVersion] = None
[docs] class PlatformStatus(SmarterCamelModel): """ The response of ``status``: the state of the platform's infrastructure and compute. The sections' contents depend on how the platform is hosted, so they are JSON objects. """ infrastructures: SmarterJsonObjectType = Field(default_factory=dict) compute: SmarterJsonObjectType = Field(default_factory=dict)
__all__ = ["ApiVersion", "CliVersion", "PlatformStatus", "PlatformVersion", "WhoAmI"]