Source code for rasenmaeher_api.web.api.healthcheck.schema

"""Healthcheck response schemas"""
from typing import Dict

from pydantic import BaseModel, Field, Extra


[docs] class BasicHealthCheckResponse(BaseModel): """Basic healthcheck, basically are we running at all..."""
[docs] healthcheck: str = Field(description="Should contain 'success'")
[docs] dns: str = Field(description="Contains the FQDN of this instance")
[docs] deployment: str = Field(description="Contains the deployment name of this instance (host part of the FQDN)")
[docs] version: str = Field(description="Version number of the API package")
[docs] class Config: # pylint: disable=too-few-public-methods """Example values for schema"""
[docs] extra = Extra.forbid
[docs] schema_extra = { "examples": [ { "healthcheck": "success", "dns": "sleepy-sloth.pvarki.fi", "deployment": "sleepy-sloth", "version": "1.0.0", } ] }
[docs] class AllProductsHealthCheckResponse(BaseModel): """Check status of all products in manifest"""
[docs] all_ok: bool = Field(description="Is everything ok ?")
[docs] products: Dict[str, bool] = Field(description="Status for each product")
[docs] class Config: # pylint: disable=too-few-public-methods """Example values for schema"""
[docs] extra = Extra.forbid
[docs] schema_extra = { "examples": [ { "all_ok": True, "products": { "tak": True, }, }, { "all_ok": False, "products": { "tak": True, "other": False, }, }, ] }