Coverage for src/hush_hush/_generated/models/update_object_request.py: 43%

54 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, 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="UpdateObjectRequest") 

14 

15 

16@_attrs_define 

17class UpdateObjectRequest: 

18 """ 

19 Attributes: 

20 value (str): The new sealed (encrypted) value, base64-encoded. It has to be 

21 a well-formed age file naming at least one recipient; the 

22 service reads only its header, never the payload. At most 1 MiB 

23 once decoded. 

24 used_by (list[str] | Unset): The consumers (repos or hosts) recorded as depending on this 

25 object. Set at creation, and replaceable later via 

26 UpdateObjectRequest's own used_by field - a plain value update 

27 that omits it leaves the list as it was. 

28 A consumer named more than once is recorded once. 

29 tags (list[str] | Unset): Labels for grouping and filtering objects (`GET /objects?tag=`). 

30 Free-form, 1 to 32 characters from `a-z 0-9 . _ / -`, at most 10 

31 per object. Uppercase is converted to lowercase and duplicates are dropped. 

32 Metadata only - never part of the sealed value. A response always 

33 carries the array, empty when the object has none. 

34 keep_readable_copy (bool | Unset): Requests that the owner's own escrowed identity public key be 

35 included as an additional decrypt recipient, alongside whatever 

36 consumer recipients the client already resolved 

37 (specs/secret-objects/spec.md's "Opt-in owner-recipient inclusion 

38 at create time" requirement). Omitting this field (the default) 

39 means the owner is not added as a recipient - this service never 

40 makes ownership imply decrypt access on its own. 

41 

42 This is a client-side sealing instruction, not something this 

43 service enforces or verifies: it never decrypts, and never adds a 

44 recipient to `value` itself - the caller has to add the owner's 

45 public key (`GET /auth/identity`) to its own recipient list before 

46 sealing. A create or update response echoes back exactly what that 

47 same request asked for; it isn't persisted, so a later fetch never 

48 carries this field. 

49 """ 

50 

51 value: str 

52 used_by: list[str] | Unset = UNSET 

53 tags: list[str] | Unset = UNSET 

54 keep_readable_copy: bool | Unset = UNSET 

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

56 

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

58 value = self.value 

59 

60 used_by: list[str] | Unset = UNSET 

61 if not isinstance(self.used_by, Unset): 

62 used_by = self.used_by 

63 

64 tags: list[str] | Unset = UNSET 

65 if not isinstance(self.tags, Unset): 

66 tags = self.tags 

67 

68 keep_readable_copy = self.keep_readable_copy 

69 

70 field_dict: dict[str, Any] = {} 

71 field_dict.update(self.additional_properties) 

72 field_dict.update( 

73 { 

74 "value": value, 

75 } 

76 ) 

77 if used_by is not UNSET: 

78 field_dict["used_by"] = used_by 

79 if tags is not UNSET: 

80 field_dict["tags"] = tags 

81 if keep_readable_copy is not UNSET: 

82 field_dict["keep_readable_copy"] = keep_readable_copy 

83 

84 return field_dict 

85 

86 @classmethod 

87 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 

88 d = dict(src_dict) 

89 value = d.pop("value") 

90 

91 used_by = cast(list[str], d.pop("used_by", UNSET)) 

92 

93 tags = cast(list[str], d.pop("tags", UNSET)) 

94 

95 keep_readable_copy = d.pop("keep_readable_copy", UNSET) 

96 

97 update_object_request = cls( 

98 value=value, 

99 used_by=used_by, 

100 tags=tags, 

101 keep_readable_copy=keep_readable_copy, 

102 ) 

103 

104 update_object_request.additional_properties = d 

105 return update_object_request 

106 

107 @property 

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

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

110 

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

112 return self.additional_properties[key] 

113 

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

115 self.additional_properties[key] = value 

116 

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

118 del self.additional_properties[key] 

119 

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

121 return key in self.additional_properties