Coverage for src/hush_hush/_generated/models/health.py: 49%
45 statements
« prev ^ index » next coverage.py v7.16.0, created at 2026-10-16 16:01 +0000
« prev ^ index » next coverage.py v7.16.0, created at 2026-10-16 16:01 +0000
1# Code generated by openapi-python-client from hush-hush/api/openapi.yaml; DO NOT EDIT.
3from __future__ import annotations
5from collections.abc import Mapping
6from typing import Any, Literal, TypeVar, cast
8from attrs import define as _attrs_define
9from attrs import field as _attrs_field
11from ..types import UNSET, Unset
13T = TypeVar("T", bound="Health")
16@_attrs_define
17class Health:
18 """
19 Attributes:
20 status (Literal['ok']):
21 version (str): The running server's own version, as goreleaser stamped it -
22 "dev" for a plain `go build`. The web UI's footer links this
23 to the changelog page rather than hardcoding a version that
24 would drift from what's actually running.
25 environment (str | Unset): The operator's own short label for this instance, from the
26 `INSTANCE_LABEL` setting - for example `prod / homelab`. The
27 web UI's top bar shows it so an operator can tell instances
28 apart. Omitted when no label is set. This endpoint is
29 unauthenticated, so the label is public: never put anything
30 sensitive in it.
31 """
33 status: Literal["ok"]
34 version: str
35 environment: str | Unset = UNSET
36 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
38 def to_dict(self) -> dict[str, Any]:
39 status = self.status
41 version = self.version
43 environment = self.environment
45 field_dict: dict[str, Any] = {}
46 field_dict.update(self.additional_properties)
47 field_dict.update(
48 {
49 "status": status,
50 "version": version,
51 }
52 )
53 if environment is not UNSET:
54 field_dict["environment"] = environment
56 return field_dict
58 @classmethod
59 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
60 d = dict(src_dict)
61 status = cast(Literal["ok"], d.pop("status"))
62 if status != "ok":
63 raise ValueError(f"status must match const 'ok', got '{status}'")
65 version = d.pop("version")
67 environment = d.pop("environment", UNSET)
69 health = cls(
70 status=status,
71 version=version,
72 environment=environment,
73 )
75 health.additional_properties = d
76 return health
78 @property
79 def additional_keys(self) -> list[str]:
80 return list(self.additional_properties.keys())
82 def __getitem__(self, key: str) -> Any:
83 return self.additional_properties[key]
85 def __setitem__(self, key: str, value: Any) -> None:
86 self.additional_properties[key] = value
88 def __delitem__(self, key: str) -> None:
89 del self.additional_properties[key]
91 def __contains__(self, key: str) -> bool:
92 return key in self.additional_properties