otdf-python 0.4.1__py3-none-any.whl → 0.4.3__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.
Files changed (61) hide show
  1. otdf_python/autoconfigure_utils.py +0 -2
  2. otdf_python/cli.py +50 -21
  3. otdf_python/collection_store.py +0 -1
  4. otdf_python/ecdh.py +0 -6
  5. otdf_python/kas_allowlist.py +182 -0
  6. otdf_python/kas_client.py +44 -2
  7. otdf_python/kas_connect_rpc_client.py +59 -19
  8. otdf_python/nanotdf.py +4 -14
  9. otdf_python/nanotdf_ecdsa_struct.py +0 -2
  10. otdf_python/nanotdf_type.py +1 -1
  11. otdf_python/sdk.py +31 -15
  12. otdf_python/sdk_builder.py +88 -8
  13. otdf_python/tdf.py +2 -2
  14. {otdf_python-0.4.1.dist-info → otdf_python-0.4.3.dist-info}/METADATA +3 -2
  15. {otdf_python-0.4.1.dist-info → otdf_python-0.4.3.dist-info}/RECORD +46 -36
  16. otdf_python_proto/__init__.py +2 -6
  17. otdf_python_proto/authorization/__init__.py +10 -0
  18. otdf_python_proto/authorization/authorization_connect.py +250 -0
  19. otdf_python_proto/authorization/v2/authorization_connect.py +315 -0
  20. otdf_python_proto/entityresolution/__init__.py +10 -0
  21. otdf_python_proto/entityresolution/entity_resolution_connect.py +185 -0
  22. otdf_python_proto/entityresolution/v2/entity_resolution_connect.py +185 -0
  23. otdf_python_proto/kas/__init__.py +2 -2
  24. otdf_python_proto/kas/kas_connect.py +259 -0
  25. otdf_python_proto/policy/actions/__init__.py +11 -0
  26. otdf_python_proto/policy/actions/actions_connect.py +380 -0
  27. otdf_python_proto/policy/attributes/__init__.py +11 -0
  28. otdf_python_proto/policy/attributes/attributes_connect.py +1310 -0
  29. otdf_python_proto/policy/kasregistry/__init__.py +11 -0
  30. otdf_python_proto/policy/kasregistry/key_access_server_registry_connect.py +912 -0
  31. otdf_python_proto/policy/keymanagement/__init__.py +11 -0
  32. otdf_python_proto/policy/keymanagement/key_management_connect.py +380 -0
  33. otdf_python_proto/policy/namespaces/__init__.py +11 -0
  34. otdf_python_proto/policy/namespaces/namespaces_connect.py +648 -0
  35. otdf_python_proto/policy/registeredresources/__init__.py +11 -0
  36. otdf_python_proto/policy/registeredresources/registered_resources_connect.py +770 -0
  37. otdf_python_proto/policy/resourcemapping/__init__.py +11 -0
  38. otdf_python_proto/policy/resourcemapping/resource_mapping_connect.py +790 -0
  39. otdf_python_proto/policy/subjectmapping/__init__.py +11 -0
  40. otdf_python_proto/policy/subjectmapping/subject_mapping_connect.py +851 -0
  41. otdf_python_proto/policy/unsafe/__init__.py +11 -0
  42. otdf_python_proto/policy/unsafe/unsafe_connect.py +705 -0
  43. otdf_python_proto/wellknownconfiguration/__init__.py +10 -0
  44. otdf_python_proto/wellknownconfiguration/wellknown_configuration_connect.py +124 -0
  45. otdf_python_proto/authorization/authorization_pb2_connect.py +0 -191
  46. otdf_python_proto/authorization/v2/authorization_pb2_connect.py +0 -233
  47. otdf_python_proto/entityresolution/entity_resolution_pb2_connect.py +0 -149
  48. otdf_python_proto/entityresolution/v2/entity_resolution_pb2_connect.py +0 -149
  49. otdf_python_proto/kas/kas_pb2_connect.py +0 -192
  50. otdf_python_proto/policy/actions/actions_pb2_connect.py +0 -275
  51. otdf_python_proto/policy/attributes/attributes_pb2_connect.py +0 -863
  52. otdf_python_proto/policy/kasregistry/key_access_server_registry_pb2_connect.py +0 -611
  53. otdf_python_proto/policy/keymanagement/key_management_pb2_connect.py +0 -275
  54. otdf_python_proto/policy/namespaces/namespaces_pb2_connect.py +0 -443
  55. otdf_python_proto/policy/registeredresources/registered_resources_pb2_connect.py +0 -527
  56. otdf_python_proto/policy/resourcemapping/resource_mapping_pb2_connect.py +0 -527
  57. otdf_python_proto/policy/subjectmapping/subject_mapping_pb2_connect.py +0 -569
  58. otdf_python_proto/policy/unsafe/unsafe_pb2_connect.py +0 -485
  59. otdf_python_proto/wellknownconfiguration/wellknown_configuration_pb2_connect.py +0 -107
  60. {otdf_python-0.4.1.dist-info → otdf_python-0.4.3.dist-info}/WHEEL +0 -0
  61. {otdf_python-0.4.1.dist-info → otdf_python-0.4.3.dist-info}/licenses/LICENSE +0 -0
@@ -1,275 +0,0 @@
1
- # Generated Connect client code
2
-
3
- from __future__ import annotations
4
- from collections.abc import AsyncIterator
5
- from collections.abc import Iterator
6
- from collections.abc import Iterable
7
- import aiohttp
8
- import urllib3
9
- import typing
10
- import sys
11
-
12
- from connectrpc.client_async import AsyncConnectClient
13
- from connectrpc.client_sync import ConnectClient
14
- from connectrpc.client_protocol import ConnectProtocol
15
- from connectrpc.client_connect import ConnectProtocolError
16
- from connectrpc.headers import HeaderInput
17
- from connectrpc.server import ClientRequest
18
- from connectrpc.server import ClientStream
19
- from connectrpc.server import ServerResponse
20
- from connectrpc.server import ServerStream
21
- from connectrpc.server_sync import ConnectWSGI
22
- from connectrpc.streams import StreamInput
23
- from connectrpc.streams import AsyncStreamOutput
24
- from connectrpc.streams import StreamOutput
25
- from connectrpc.unary import UnaryOutput
26
- from connectrpc.unary import ClientStreamingOutput
27
-
28
- if typing.TYPE_CHECKING:
29
- # wsgiref.types was added in Python 3.11.
30
- if sys.version_info >= (3, 11):
31
- from wsgiref.types import WSGIApplication
32
- else:
33
- from _typeshed.wsgi import WSGIApplication
34
-
35
- import policy.actions.actions_pb2
36
-
37
- class ActionServiceClient:
38
- def __init__(
39
- self,
40
- base_url: str,
41
- http_client: urllib3.PoolManager | None = None,
42
- protocol: ConnectProtocol = ConnectProtocol.CONNECT_PROTOBUF,
43
- ):
44
- self.base_url = base_url
45
- self._connect_client = ConnectClient(http_client, protocol)
46
- def call_get_action(
47
- self, req: policy.actions.actions_pb2.GetActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
48
- ) -> UnaryOutput[policy.actions.actions_pb2.GetActionResponse]:
49
- """Low-level method to call GetAction, granting access to errors and metadata"""
50
- url = self.base_url + "/policy.actions.ActionService/GetAction"
51
- return self._connect_client.call_unary(url, req, policy.actions.actions_pb2.GetActionResponse,extra_headers, timeout_seconds)
52
-
53
-
54
- def get_action(
55
- self, req: policy.actions.actions_pb2.GetActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
56
- ) -> policy.actions.actions_pb2.GetActionResponse:
57
- response = self.call_get_action(req, extra_headers, timeout_seconds)
58
- err = response.error()
59
- if err is not None:
60
- raise err
61
- msg = response.message()
62
- if msg is None:
63
- raise ConnectProtocolError('missing response message')
64
- return msg
65
-
66
- def call_list_actions(
67
- self, req: policy.actions.actions_pb2.ListActionsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
68
- ) -> UnaryOutput[policy.actions.actions_pb2.ListActionsResponse]:
69
- """Low-level method to call ListActions, granting access to errors and metadata"""
70
- url = self.base_url + "/policy.actions.ActionService/ListActions"
71
- return self._connect_client.call_unary(url, req, policy.actions.actions_pb2.ListActionsResponse,extra_headers, timeout_seconds)
72
-
73
-
74
- def list_actions(
75
- self, req: policy.actions.actions_pb2.ListActionsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
76
- ) -> policy.actions.actions_pb2.ListActionsResponse:
77
- response = self.call_list_actions(req, extra_headers, timeout_seconds)
78
- err = response.error()
79
- if err is not None:
80
- raise err
81
- msg = response.message()
82
- if msg is None:
83
- raise ConnectProtocolError('missing response message')
84
- return msg
85
-
86
- def call_create_action(
87
- self, req: policy.actions.actions_pb2.CreateActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
88
- ) -> UnaryOutput[policy.actions.actions_pb2.CreateActionResponse]:
89
- """Low-level method to call CreateAction, granting access to errors and metadata"""
90
- url = self.base_url + "/policy.actions.ActionService/CreateAction"
91
- return self._connect_client.call_unary(url, req, policy.actions.actions_pb2.CreateActionResponse,extra_headers, timeout_seconds)
92
-
93
-
94
- def create_action(
95
- self, req: policy.actions.actions_pb2.CreateActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
96
- ) -> policy.actions.actions_pb2.CreateActionResponse:
97
- response = self.call_create_action(req, extra_headers, timeout_seconds)
98
- err = response.error()
99
- if err is not None:
100
- raise err
101
- msg = response.message()
102
- if msg is None:
103
- raise ConnectProtocolError('missing response message')
104
- return msg
105
-
106
- def call_update_action(
107
- self, req: policy.actions.actions_pb2.UpdateActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
108
- ) -> UnaryOutput[policy.actions.actions_pb2.UpdateActionResponse]:
109
- """Low-level method to call UpdateAction, granting access to errors and metadata"""
110
- url = self.base_url + "/policy.actions.ActionService/UpdateAction"
111
- return self._connect_client.call_unary(url, req, policy.actions.actions_pb2.UpdateActionResponse,extra_headers, timeout_seconds)
112
-
113
-
114
- def update_action(
115
- self, req: policy.actions.actions_pb2.UpdateActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
116
- ) -> policy.actions.actions_pb2.UpdateActionResponse:
117
- response = self.call_update_action(req, extra_headers, timeout_seconds)
118
- err = response.error()
119
- if err is not None:
120
- raise err
121
- msg = response.message()
122
- if msg is None:
123
- raise ConnectProtocolError('missing response message')
124
- return msg
125
-
126
- def call_delete_action(
127
- self, req: policy.actions.actions_pb2.DeleteActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
128
- ) -> UnaryOutput[policy.actions.actions_pb2.DeleteActionResponse]:
129
- """Low-level method to call DeleteAction, granting access to errors and metadata"""
130
- url = self.base_url + "/policy.actions.ActionService/DeleteAction"
131
- return self._connect_client.call_unary(url, req, policy.actions.actions_pb2.DeleteActionResponse,extra_headers, timeout_seconds)
132
-
133
-
134
- def delete_action(
135
- self, req: policy.actions.actions_pb2.DeleteActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
136
- ) -> policy.actions.actions_pb2.DeleteActionResponse:
137
- response = self.call_delete_action(req, extra_headers, timeout_seconds)
138
- err = response.error()
139
- if err is not None:
140
- raise err
141
- msg = response.message()
142
- if msg is None:
143
- raise ConnectProtocolError('missing response message')
144
- return msg
145
-
146
-
147
- class AsyncActionServiceClient:
148
- def __init__(
149
- self,
150
- base_url: str,
151
- http_client: aiohttp.ClientSession,
152
- protocol: ConnectProtocol = ConnectProtocol.CONNECT_PROTOBUF,
153
- ):
154
- self.base_url = base_url
155
- self._connect_client = AsyncConnectClient(http_client, protocol)
156
-
157
- async def call_get_action(
158
- self, req: policy.actions.actions_pb2.GetActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
159
- ) -> UnaryOutput[policy.actions.actions_pb2.GetActionResponse]:
160
- """Low-level method to call GetAction, granting access to errors and metadata"""
161
- url = self.base_url + "/policy.actions.ActionService/GetAction"
162
- return await self._connect_client.call_unary(url, req, policy.actions.actions_pb2.GetActionResponse,extra_headers, timeout_seconds)
163
-
164
- async def get_action(
165
- self, req: policy.actions.actions_pb2.GetActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
166
- ) -> policy.actions.actions_pb2.GetActionResponse:
167
- response = await self.call_get_action(req, extra_headers, timeout_seconds)
168
- err = response.error()
169
- if err is not None:
170
- raise err
171
- msg = response.message()
172
- if msg is None:
173
- raise ConnectProtocolError('missing response message')
174
- return msg
175
-
176
- async def call_list_actions(
177
- self, req: policy.actions.actions_pb2.ListActionsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
178
- ) -> UnaryOutput[policy.actions.actions_pb2.ListActionsResponse]:
179
- """Low-level method to call ListActions, granting access to errors and metadata"""
180
- url = self.base_url + "/policy.actions.ActionService/ListActions"
181
- return await self._connect_client.call_unary(url, req, policy.actions.actions_pb2.ListActionsResponse,extra_headers, timeout_seconds)
182
-
183
- async def list_actions(
184
- self, req: policy.actions.actions_pb2.ListActionsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
185
- ) -> policy.actions.actions_pb2.ListActionsResponse:
186
- response = await self.call_list_actions(req, extra_headers, timeout_seconds)
187
- err = response.error()
188
- if err is not None:
189
- raise err
190
- msg = response.message()
191
- if msg is None:
192
- raise ConnectProtocolError('missing response message')
193
- return msg
194
-
195
- async def call_create_action(
196
- self, req: policy.actions.actions_pb2.CreateActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
197
- ) -> UnaryOutput[policy.actions.actions_pb2.CreateActionResponse]:
198
- """Low-level method to call CreateAction, granting access to errors and metadata"""
199
- url = self.base_url + "/policy.actions.ActionService/CreateAction"
200
- return await self._connect_client.call_unary(url, req, policy.actions.actions_pb2.CreateActionResponse,extra_headers, timeout_seconds)
201
-
202
- async def create_action(
203
- self, req: policy.actions.actions_pb2.CreateActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
204
- ) -> policy.actions.actions_pb2.CreateActionResponse:
205
- response = await self.call_create_action(req, extra_headers, timeout_seconds)
206
- err = response.error()
207
- if err is not None:
208
- raise err
209
- msg = response.message()
210
- if msg is None:
211
- raise ConnectProtocolError('missing response message')
212
- return msg
213
-
214
- async def call_update_action(
215
- self, req: policy.actions.actions_pb2.UpdateActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
216
- ) -> UnaryOutput[policy.actions.actions_pb2.UpdateActionResponse]:
217
- """Low-level method to call UpdateAction, granting access to errors and metadata"""
218
- url = self.base_url + "/policy.actions.ActionService/UpdateAction"
219
- return await self._connect_client.call_unary(url, req, policy.actions.actions_pb2.UpdateActionResponse,extra_headers, timeout_seconds)
220
-
221
- async def update_action(
222
- self, req: policy.actions.actions_pb2.UpdateActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
223
- ) -> policy.actions.actions_pb2.UpdateActionResponse:
224
- response = await self.call_update_action(req, extra_headers, timeout_seconds)
225
- err = response.error()
226
- if err is not None:
227
- raise err
228
- msg = response.message()
229
- if msg is None:
230
- raise ConnectProtocolError('missing response message')
231
- return msg
232
-
233
- async def call_delete_action(
234
- self, req: policy.actions.actions_pb2.DeleteActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
235
- ) -> UnaryOutput[policy.actions.actions_pb2.DeleteActionResponse]:
236
- """Low-level method to call DeleteAction, granting access to errors and metadata"""
237
- url = self.base_url + "/policy.actions.ActionService/DeleteAction"
238
- return await self._connect_client.call_unary(url, req, policy.actions.actions_pb2.DeleteActionResponse,extra_headers, timeout_seconds)
239
-
240
- async def delete_action(
241
- self, req: policy.actions.actions_pb2.DeleteActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
242
- ) -> policy.actions.actions_pb2.DeleteActionResponse:
243
- response = await self.call_delete_action(req, extra_headers, timeout_seconds)
244
- err = response.error()
245
- if err is not None:
246
- raise err
247
- msg = response.message()
248
- if msg is None:
249
- raise ConnectProtocolError('missing response message')
250
- return msg
251
-
252
-
253
- @typing.runtime_checkable
254
- class ActionServiceProtocol(typing.Protocol):
255
- def get_action(self, req: ClientRequest[policy.actions.actions_pb2.GetActionRequest]) -> ServerResponse[policy.actions.actions_pb2.GetActionResponse]:
256
- ...
257
- def list_actions(self, req: ClientRequest[policy.actions.actions_pb2.ListActionsRequest]) -> ServerResponse[policy.actions.actions_pb2.ListActionsResponse]:
258
- ...
259
- def create_action(self, req: ClientRequest[policy.actions.actions_pb2.CreateActionRequest]) -> ServerResponse[policy.actions.actions_pb2.CreateActionResponse]:
260
- ...
261
- def update_action(self, req: ClientRequest[policy.actions.actions_pb2.UpdateActionRequest]) -> ServerResponse[policy.actions.actions_pb2.UpdateActionResponse]:
262
- ...
263
- def delete_action(self, req: ClientRequest[policy.actions.actions_pb2.DeleteActionRequest]) -> ServerResponse[policy.actions.actions_pb2.DeleteActionResponse]:
264
- ...
265
-
266
- ACTION_SERVICE_PATH_PREFIX = "/policy.actions.ActionService"
267
-
268
- def wsgi_action_service(implementation: ActionServiceProtocol) -> WSGIApplication:
269
- app = ConnectWSGI()
270
- app.register_unary_rpc("/policy.actions.ActionService/GetAction", implementation.get_action, policy.actions.actions_pb2.GetActionRequest)
271
- app.register_unary_rpc("/policy.actions.ActionService/ListActions", implementation.list_actions, policy.actions.actions_pb2.ListActionsRequest)
272
- app.register_unary_rpc("/policy.actions.ActionService/CreateAction", implementation.create_action, policy.actions.actions_pb2.CreateActionRequest)
273
- app.register_unary_rpc("/policy.actions.ActionService/UpdateAction", implementation.update_action, policy.actions.actions_pb2.UpdateActionRequest)
274
- app.register_unary_rpc("/policy.actions.ActionService/DeleteAction", implementation.delete_action, policy.actions.actions_pb2.DeleteActionRequest)
275
- return app