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

1# Code generated by openapi-python-client from hush-hush/api/openapi.yaml; DO NOT EDIT. 

2 

3from __future__ import annotations 

4 

5from collections.abc import Mapping 

6from typing import Any, Literal, TypeVar, cast 

7 

8from attrs import define as _attrs_define 

9from attrs import field as _attrs_field 

10 

11from ..types import UNSET, Unset 

12 

13T = TypeVar("T", bound="Health") 

14 

15 

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 """ 

32 

33 status: Literal["ok"] 

34 version: str 

35 environment: str | Unset = UNSET 

36 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 

37 

38 def to_dict(self) -> dict[str, Any]: 

39 status = self.status 

40 

41 version = self.version 

42 

43 environment = self.environment 

44 

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 

55 

56 return field_dict 

57 

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}'") 

64 

65 version = d.pop("version") 

66 

67 environment = d.pop("environment", UNSET) 

68 

69 health = cls( 

70 status=status, 

71 version=version, 

72 environment=environment, 

73 ) 

74 

75 health.additional_properties = d 

76 return health 

77 

78 @property 

79 def additional_keys(self) -> list[str]: 

80 return list(self.additional_properties.keys()) 

81 

82 def __getitem__(self, key: str) -> Any: 

83 return self.additional_properties[key] 

84 

85 def __setitem__(self, key: str, value: Any) -> None: 

86 self.additional_properties[key] = value 

87 

88 def __delitem__(self, key: str) -> None: 

89 del self.additional_properties[key] 

90 

91 def __contains__(self, key: str) -> bool: 

92 return key in self.additional_properties