Coverage for src/hush_hush/_generated/models/consumer_entry.py: 51%
43 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, TypeVar
8from attrs import define as _attrs_define
9from attrs import field as _attrs_field
11from ..types import UNSET, Unset
13T = TypeVar("T", bound="ConsumerEntry")
16@_attrs_define
17class ConsumerEntry:
18 """
19 Example:
20 {'name': 'homelab/vps-docker', 'secret_count': 1}
22 Attributes:
23 name (str): A distinct consumer name recorded in some object's used_by list.
24 secret_count (int): How many stored secret objects' used_by list includes this consumer.
25 public_key (str | Unset): The consumer's registered age public key, safe to store and
26 return server-side since it's public - a private key is never
27 sent to or stored by this API. Absent entirely when no key has
28 been registered for this consumer, rather than present as an
29 error or `null`.
30 """
32 name: str
33 secret_count: int
34 public_key: str | Unset = UNSET
35 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
37 def to_dict(self) -> dict[str, Any]:
38 name = self.name
40 secret_count = self.secret_count
42 public_key = self.public_key
44 field_dict: dict[str, Any] = {}
45 field_dict.update(self.additional_properties)
46 field_dict.update(
47 {
48 "name": name,
49 "secret_count": secret_count,
50 }
51 )
52 if public_key is not UNSET:
53 field_dict["public_key"] = public_key
55 return field_dict
57 @classmethod
58 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
59 d = dict(src_dict)
60 name = d.pop("name")
62 secret_count = d.pop("secret_count")
64 public_key = d.pop("public_key", UNSET)
66 consumer_entry = cls(
67 name=name,
68 secret_count=secret_count,
69 public_key=public_key,
70 )
72 consumer_entry.additional_properties = d
73 return consumer_entry
75 @property
76 def additional_keys(self) -> list[str]:
77 return list(self.additional_properties.keys())
79 def __getitem__(self, key: str) -> Any:
80 return self.additional_properties[key]
82 def __setitem__(self, key: str, value: Any) -> None:
83 self.additional_properties[key] = value
85 def __delitem__(self, key: str) -> None:
86 del self.additional_properties[key]
88 def __contains__(self, key: str) -> bool:
89 return key in self.additional_properties