qontract-reconcile 0.10.2.dev485__py3-none-any.whl → 0.10.2.dev493__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,111 @@
1
+ """
2
+ Generated by qenerate plugin=pydantic_v2. DO NOT MODIFY MANUALLY!
3
+ """
4
+ from collections.abc import Callable # noqa: F401 # pylint: disable=W0611
5
+ from datetime import datetime # noqa: F401 # pylint: disable=W0611
6
+ from enum import Enum # noqa: F401 # pylint: disable=W0611
7
+ from typing import ( # noqa: F401 # pylint: disable=W0611
8
+ Any,
9
+ Optional,
10
+ Union,
11
+ )
12
+
13
+ from pydantic import ( # noqa: F401 # pylint: disable=W0611
14
+ BaseModel,
15
+ ConfigDict,
16
+ Field,
17
+ Json,
18
+ )
19
+
20
+ from reconcile.gql_definitions.fragments.user import User
21
+
22
+
23
+ DEFINITION = """
24
+ fragment User on User_v1 {
25
+ name
26
+ org_username
27
+ github_username
28
+ pagerduty_username
29
+ tag_on_merge_requests
30
+ }
31
+
32
+ query SlackUsergroupApiClusterUser {
33
+ users: users_v1 {
34
+ ...User
35
+ tag_on_cluster_updates
36
+ tag_on_merge_requests
37
+ roles {
38
+ tag_on_cluster_updates
39
+ access {
40
+ cluster {
41
+ name
42
+ }
43
+ namespace {
44
+ name
45
+ cluster {
46
+ name
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+ """
54
+
55
+
56
+ class ConfiguredBaseModel(BaseModel):
57
+ model_config = ConfigDict(
58
+ extra='forbid'
59
+ )
60
+
61
+
62
+ class ClusterV1(ConfiguredBaseModel):
63
+ name: str = Field(..., alias="name")
64
+
65
+
66
+ class NamespaceV1_ClusterV1(ConfiguredBaseModel):
67
+ name: str = Field(..., alias="name")
68
+
69
+
70
+ class NamespaceV1(ConfiguredBaseModel):
71
+ name: str = Field(..., alias="name")
72
+ cluster: NamespaceV1_ClusterV1 = Field(..., alias="cluster")
73
+
74
+
75
+ class AccessV1(ConfiguredBaseModel):
76
+ cluster: Optional[ClusterV1] = Field(..., alias="cluster")
77
+ namespace: Optional[NamespaceV1] = Field(..., alias="namespace")
78
+
79
+
80
+ class RoleV1(ConfiguredBaseModel):
81
+ tag_on_cluster_updates: Optional[bool] = Field(..., alias="tag_on_cluster_updates")
82
+ access: Optional[list[AccessV1]] = Field(..., alias="access")
83
+
84
+
85
+ class UserV1(User):
86
+ tag_on_cluster_updates: Optional[bool] = Field(..., alias="tag_on_cluster_updates")
87
+ tag_on_merge_requests: Optional[bool] = Field(..., alias="tag_on_merge_requests")
88
+ roles: Optional[list[RoleV1]] = Field(..., alias="roles")
89
+
90
+
91
+ class SlackUsergroupApiClusterUserQueryData(ConfiguredBaseModel):
92
+ users: Optional[list[UserV1]] = Field(..., alias="users")
93
+
94
+
95
+ def query(query_func: Callable, **kwargs: Any) -> SlackUsergroupApiClusterUserQueryData:
96
+ """
97
+ This is a convenience function which queries and parses the data into
98
+ concrete types. It should be compatible with most GQL clients.
99
+ You do not have to use it to consume the generated data classes.
100
+ Alternatively, you can also mime and alternate the behavior
101
+ of this function in the caller.
102
+
103
+ Parameters:
104
+ query_func (Callable): Function which queries your GQL Server
105
+ kwargs: optional arguments that will be passed to the query function
106
+
107
+ Returns:
108
+ SlackUsergroupApiClusterUserQueryData: queried data parsed into generated classes
109
+ """
110
+ raw_data: dict[Any, Any] = query_func(DEFINITION, **kwargs)
111
+ return SlackUsergroupApiClusterUserQueryData(**raw_data)