kelvin-python-api-client 0.0.1__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 (43) hide show
  1. kelvin/api/client/__init__.py +15 -0
  2. kelvin/api/client/api/app_manager.py +646 -0
  3. kelvin/api/client/api/app_registry.py +342 -0
  4. kelvin/api/client/api/asset.py +1012 -0
  5. kelvin/api/client/api/asset_insights.py +67 -0
  6. kelvin/api/client/api/bridge.py +306 -0
  7. kelvin/api/client/api/control_change.py +398 -0
  8. kelvin/api/client/api/data_tag.py +499 -0
  9. kelvin/api/client/api/datastreams.py +1021 -0
  10. kelvin/api/client/api/filestorage.py +234 -0
  11. kelvin/api/client/api/instance.py +559 -0
  12. kelvin/api/client/api/orchestration.py +717 -0
  13. kelvin/api/client/api/parameters.py +417 -0
  14. kelvin/api/client/api/recommendation.py +804 -0
  15. kelvin/api/client/api/secret.py +173 -0
  16. kelvin/api/client/api/thread.py +435 -0
  17. kelvin/api/client/api/timeseries.py +273 -0
  18. kelvin/api/client/api/user.py +382 -0
  19. kelvin/api/client/api/workload.py +437 -0
  20. kelvin/api/client/base_client.py +924 -0
  21. kelvin/api/client/base_model.py +187 -0
  22. kelvin/api/client/client.py +181 -0
  23. kelvin/api/client/config.py +709 -0
  24. kelvin/api/client/data_model.py +523 -0
  25. kelvin/api/client/dataframe_conversion.py +172 -0
  26. kelvin/api/client/deeplist.py +285 -0
  27. kelvin/api/client/error.py +77 -0
  28. kelvin/api/client/model/__init__.py +3 -0
  29. kelvin/api/client/model/enum.py +82 -0
  30. kelvin/api/client/model/pagination.py +61 -0
  31. kelvin/api/client/model/requests.py +3352 -0
  32. kelvin/api/client/model/response.py +68 -0
  33. kelvin/api/client/model/responses.py +4799 -0
  34. kelvin/api/client/model/type.py +2025 -0
  35. kelvin/api/client/py.typed +0 -0
  36. kelvin/api/client/retry.py +88 -0
  37. kelvin/api/client/serialize.py +222 -0
  38. kelvin/api/client/utils.py +316 -0
  39. kelvin/api/client/version.py +16 -0
  40. kelvin_python_api_client-0.0.1.dist-info/METADATA +75 -0
  41. kelvin_python_api_client-0.0.1.dist-info/RECORD +43 -0
  42. kelvin_python_api_client-0.0.1.dist-info/WHEEL +5 -0
  43. kelvin_python_api_client-0.0.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,173 @@
1
+ """
2
+ Kelvin API Client.
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ from typing import Any, List, Mapping, Optional, Sequence, Union
8
+
9
+ from typing_extensions import Literal
10
+
11
+ from kelvin.api.client.data_model import DataModelBase
12
+
13
+ from ..model import requests, responses
14
+
15
+
16
+ class Secret(DataModelBase):
17
+ @classmethod
18
+ def create_secret(
19
+ cls,
20
+ data: Optional[Union[requests.SecretCreate, Mapping[str, Any]]] = None,
21
+ _dry_run: bool = False,
22
+ _client: Any = None,
23
+ **kwargs: Any,
24
+ ) -> responses.SecretCreate:
25
+ """
26
+ Create a new Secret.
27
+
28
+ Once this is created you can not change or see the value itself from Kelvin API. Retrieval of the value can only be done through an App.
29
+
30
+ **Permission Required:** `kelvin.permission.secret.create`.
31
+
32
+ ``createSecret``: ``POST`` ``/api/v4/secrets/create``
33
+
34
+ Parameters
35
+ ----------
36
+ data: requests.SecretCreate, optional
37
+ **kwargs:
38
+ Extra parameters for requests.SecretCreate
39
+ - create_secret: dict
40
+
41
+ """
42
+
43
+ from ..model import responses
44
+
45
+ result = cls._make_request(
46
+ _client,
47
+ "post",
48
+ "/api/v4/secrets/create",
49
+ {},
50
+ {},
51
+ {},
52
+ {},
53
+ data,
54
+ "requests.SecretCreate",
55
+ False,
56
+ {"201": responses.SecretCreate, "400": None, "401": None, "409": None},
57
+ False,
58
+ _dry_run,
59
+ kwargs,
60
+ )
61
+ return result
62
+
63
+ @classmethod
64
+ def list_secrets(
65
+ cls,
66
+ search: Optional[Sequence[str]] = None,
67
+ pagination_type: Optional[Literal["limits", "cursor", "stream"]] = None,
68
+ page_size: Optional[int] = 10000,
69
+ page: Optional[int] = None,
70
+ next: Optional[str] = None,
71
+ previous: Optional[str] = None,
72
+ direction: Optional[Literal["asc", "desc"]] = None,
73
+ sort_by: Optional[Sequence[str]] = None,
74
+ fetch: bool = True,
75
+ _dry_run: bool = False,
76
+ _client: Any = None,
77
+ ) -> Union[List[responses.SecretItem], responses.SecretsListPaginatedResponseCursor]:
78
+ """
79
+ Returns a list of Secrets. The actual Secret itself can not be retrieved here and is only available from an App.
80
+
81
+ **Permission Required:** `kelvin.permission.secret.read`.
82
+
83
+ ``listSecrets``: ``GET`` ``/api/v4/secrets/list``
84
+
85
+ Parameters
86
+ ----------
87
+ search : :obj:`Sequence[str]`
88
+ Search and filter on the list based on the key `name`. The search is
89
+ case sensitive but will find partial matches anywhere in the `name`.
90
+ pagination_type : :obj:`Literal['limits', 'cursor', 'stream']`
91
+ Method of pagination to use for return results where `total_items` is
92
+ greater than `page_size`. `cursor` and `limits` will return one `page`
93
+ of results, `stream` will return all results. ('limits', 'cursor',
94
+ 'stream')
95
+ page_size : :obj:`int`
96
+ Number of objects to be returned in each page. Page size can range
97
+ between 1 and 1000 objects.
98
+ page : :obj:`int`
99
+ An integer for the wanted page of results. Used only with
100
+ `pagination_type` set as `limits`.
101
+ next : :obj:`str`
102
+ An alphanumeric string bookmark to indicate where to start for the
103
+ next page. Used only with `pagination_type` set as `cursor`.
104
+ previous : :obj:`str`
105
+ An alphanumeric string bookmark to indicate where to end for the
106
+ previous page. Used only with `pagination_type` set as `cursor`.
107
+ direction : :obj:`Literal['asc', 'desc']`
108
+ Sorting order according to the `sort_by` parameter. ('asc', 'desc')
109
+ sort_by : :obj:`Sequence[str]`
110
+
111
+ """
112
+
113
+ from ..model import responses
114
+
115
+ result = cls._make_request(
116
+ _client,
117
+ "get",
118
+ "/api/v4/secrets/list",
119
+ {},
120
+ {
121
+ "search": search,
122
+ "pagination_type": pagination_type,
123
+ "page_size": page_size,
124
+ "page": page,
125
+ "next": next,
126
+ "previous": previous,
127
+ "direction": direction,
128
+ "sort_by": sort_by,
129
+ },
130
+ {},
131
+ {},
132
+ None,
133
+ None,
134
+ False,
135
+ {"200": responses.SecretsListPaginatedResponseCursor, "400": None, "401": None},
136
+ False,
137
+ _dry_run,
138
+ )
139
+ return result.fetch("/api/v4/secrets/list", "GET") if fetch and not _dry_run else result
140
+
141
+ @classmethod
142
+ def delete_secret(cls, secret_name: str, _dry_run: bool = False, _client: Any = None) -> None:
143
+ """
144
+ Permanently delete a Secret. This cannot be undone once the API request has been submitted.
145
+
146
+ **Permission Required:** `kelvin.permission.secret.delete`.
147
+
148
+ ``deleteSecret``: ``POST`` ``/api/v4/secrets/{secret_name}/delete``
149
+
150
+ Parameters
151
+ ----------
152
+ secret_name : :obj:`str`, optional
153
+ Secret key `name` to delete. The string can only contain lowercase
154
+ alphanumeric characters and `.`, `_` or `-` characters.
155
+
156
+ """
157
+
158
+ result = cls._make_request(
159
+ _client,
160
+ "post",
161
+ "/api/v4/secrets/{secret_name}/delete",
162
+ {"secret_name": secret_name},
163
+ {},
164
+ {},
165
+ {},
166
+ None,
167
+ None,
168
+ False,
169
+ {"200": None, "400": None, "401": None, "404": None},
170
+ False,
171
+ _dry_run,
172
+ )
173
+ return result
@@ -0,0 +1,435 @@
1
+ """
2
+ Kelvin API Client.
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ from typing import Any, Mapping, Optional, Union
8
+
9
+ from typing_extensions import Literal
10
+
11
+ from kelvin.api.client.data_model import DataModelBase
12
+
13
+ from ..model import requests, responses
14
+
15
+
16
+ class Thread(DataModelBase):
17
+ @classmethod
18
+ def create_thread(
19
+ cls,
20
+ data: Optional[Union[requests.ThreadCreate, Mapping[str, Any]]] = None,
21
+ _dry_run: bool = False,
22
+ _client: Any = None,
23
+ **kwargs: Any,
24
+ ) -> responses.ThreadCreate:
25
+ """
26
+ Create Thread
27
+
28
+ **Permission Required:** `kelvin.permission.thread.create`.
29
+
30
+ ``createThread``: ``POST`` ``/api/v4/threads/create``
31
+
32
+ Parameters
33
+ ----------
34
+ data: requests.ThreadCreate, optional
35
+ **kwargs:
36
+ Extra parameters for requests.ThreadCreate
37
+ - create_thread: dict
38
+
39
+ """
40
+
41
+ from ..model import responses
42
+
43
+ result = cls._make_request(
44
+ _client,
45
+ "post",
46
+ "/api/v4/threads/create",
47
+ {},
48
+ {},
49
+ {},
50
+ {},
51
+ data,
52
+ "requests.ThreadCreate",
53
+ False,
54
+ {"201": responses.ThreadCreate, "400": None, "401": None},
55
+ False,
56
+ _dry_run,
57
+ kwargs,
58
+ )
59
+ return result
60
+
61
+ @classmethod
62
+ def list_threads(
63
+ cls,
64
+ type: Optional[str] = None,
65
+ related_to: Optional[str] = None,
66
+ user_id: Optional[str] = None,
67
+ _dry_run: bool = False,
68
+ _client: Any = None,
69
+ ) -> responses.ThreadsList:
70
+ """
71
+ List Threads
72
+
73
+ **Pagination Sortable Columns:** `thread.id`
74
+
75
+ **Permission Required:** `kelvin.permission.thread.read`.
76
+
77
+ ``listThreads``: ``GET`` ``/api/v4/threads/list``
78
+
79
+ Parameters
80
+ ----------
81
+ type : :obj:`str`
82
+ Filter threads by type
83
+ related_to : :obj:`str`
84
+ Filter threads by related_to
85
+ user_id : :obj:`str`
86
+ Filter threads by user_id
87
+
88
+ """
89
+
90
+ from ..model import responses
91
+
92
+ result = cls._make_request(
93
+ _client,
94
+ "get",
95
+ "/api/v4/threads/list",
96
+ {},
97
+ {"type": type, "related_to": related_to, "user_id": user_id},
98
+ {},
99
+ {},
100
+ None,
101
+ None,
102
+ False,
103
+ {"200": responses.ThreadsList, "400": None, "401": None},
104
+ False,
105
+ _dry_run,
106
+ )
107
+ return result
108
+
109
+ @classmethod
110
+ def delete_thread(cls, thread_id: str, _dry_run: bool = False, _client: Any = None) -> None:
111
+ """
112
+ Delete Thread
113
+
114
+ **Permission Required:** `kelvin.permission.thread.delete`.
115
+
116
+ ``deleteThread``: ``POST`` ``/api/v4/threads/{thread_id}/delete``
117
+
118
+ Parameters
119
+ ----------
120
+ thread_id : :obj:`str`, optional
121
+ Thread ID
122
+
123
+ """
124
+
125
+ result = cls._make_request(
126
+ _client,
127
+ "post",
128
+ "/api/v4/threads/{thread_id}/delete",
129
+ {"thread_id": thread_id},
130
+ {},
131
+ {},
132
+ {},
133
+ None,
134
+ None,
135
+ False,
136
+ {"200": None, "400": None, "403": None},
137
+ False,
138
+ _dry_run,
139
+ )
140
+ return result
141
+
142
+ @classmethod
143
+ def update_thread_follow(
144
+ cls, thread_id: str, follow: Optional[bool] = None, _dry_run: bool = False, _client: Any = None
145
+ ) -> responses.ThreadFollowUpdate:
146
+ """
147
+ Update Thread Follow
148
+
149
+ **Permission Required:** `kelvin.permission.thread.read`.
150
+
151
+ ``updateThreadFollow``: ``POST`` ``/api/v4/threads/{thread_id}/follow/update``
152
+
153
+ Parameters
154
+ ----------
155
+ thread_id : :obj:`str`, optional
156
+ Thread ID
157
+ follow : :obj:`bool`
158
+ Set user follow value to true or false
159
+
160
+ """
161
+
162
+ from ..model import responses
163
+
164
+ result = cls._make_request(
165
+ _client,
166
+ "post",
167
+ "/api/v4/threads/{thread_id}/follow/update",
168
+ {"thread_id": thread_id},
169
+ {"follow": follow},
170
+ {},
171
+ {},
172
+ None,
173
+ None,
174
+ False,
175
+ {"200": responses.ThreadFollowUpdate, "404": None},
176
+ False,
177
+ _dry_run,
178
+ )
179
+ return result
180
+
181
+ @classmethod
182
+ def get_thread(cls, thread_id: str, _dry_run: bool = False, _client: Any = None) -> responses.ThreadGet:
183
+ """
184
+ Get Thread
185
+
186
+ **Permission Required:** `kelvin.permission.thread.read`.
187
+
188
+ ``getThread``: ``GET`` ``/api/v4/threads/{thread_id}/get``
189
+
190
+ Parameters
191
+ ----------
192
+ thread_id : :obj:`str`, optional
193
+ Thread ID
194
+
195
+ """
196
+
197
+ from ..model import responses
198
+
199
+ result = cls._make_request(
200
+ _client,
201
+ "get",
202
+ "/api/v4/threads/{thread_id}/get",
203
+ {"thread_id": thread_id},
204
+ {},
205
+ {},
206
+ {},
207
+ None,
208
+ None,
209
+ False,
210
+ {"200": responses.ThreadGet, "404": None},
211
+ False,
212
+ _dry_run,
213
+ )
214
+ return result
215
+
216
+ @classmethod
217
+ def create_thread_reply(
218
+ cls,
219
+ thread_id: str,
220
+ reply_id: Optional[str] = None,
221
+ data: Optional[Union[requests.ThreadReplyCreate, Mapping[str, Any]]] = None,
222
+ _dry_run: bool = False,
223
+ _client: Any = None,
224
+ **kwargs: Any,
225
+ ) -> responses.ThreadReplyCreate:
226
+ """
227
+ Create Thread Reply
228
+
229
+ **Permission Required:** `kelvin.permission.thread.create`.
230
+
231
+ ``createThreadReply``: ``POST`` ``/api/v4/threads/{thread_id}/replies/create``
232
+
233
+ Parameters
234
+ ----------
235
+ thread_id : :obj:`str`, optional
236
+ Thread ID
237
+ reply_id : :obj:`str`
238
+ Reply ID
239
+ data: requests.ThreadReplyCreate, optional
240
+ **kwargs:
241
+ Extra parameters for requests.ThreadReplyCreate
242
+ - create_thread_reply: dict
243
+
244
+ """
245
+
246
+ from ..model import responses
247
+
248
+ result = cls._make_request(
249
+ _client,
250
+ "post",
251
+ "/api/v4/threads/{thread_id}/replies/create",
252
+ {"thread_id": thread_id},
253
+ {"reply_id": reply_id},
254
+ {},
255
+ {},
256
+ data,
257
+ "requests.ThreadReplyCreate",
258
+ False,
259
+ {"200": responses.ThreadReplyCreate, "400": None, "401": None},
260
+ False,
261
+ _dry_run,
262
+ kwargs,
263
+ )
264
+ return result
265
+
266
+ @classmethod
267
+ def delete_thread_reply(cls, thread_id: str, reply_id: str, _dry_run: bool = False, _client: Any = None) -> str:
268
+ """
269
+ Delete Thread Reply
270
+
271
+ **Permission Required:** `kelvin.permission.thread.delete`.
272
+
273
+ ``deleteThreadReply``: ``POST`` ``/api/v4/threads/{thread_id}/replies/{reply_id}/delete``
274
+
275
+ Parameters
276
+ ----------
277
+ thread_id : :obj:`str`, optional
278
+ Thread ID
279
+ reply_id : :obj:`str`, optional
280
+ Reply ID
281
+
282
+ """
283
+
284
+ result = cls._make_request(
285
+ _client,
286
+ "post",
287
+ "/api/v4/threads/{thread_id}/replies/{reply_id}/delete",
288
+ {"thread_id": thread_id, "reply_id": reply_id},
289
+ {},
290
+ {},
291
+ {},
292
+ None,
293
+ None,
294
+ False,
295
+ {"200": str, "400": None, "401": None},
296
+ False,
297
+ _dry_run,
298
+ )
299
+ return result
300
+
301
+ @classmethod
302
+ def update_thread_reply(
303
+ cls,
304
+ thread_id: str,
305
+ reply_id: str,
306
+ data: Optional[Union[requests.ThreadReplyUpdate, Mapping[str, Any]]] = None,
307
+ _dry_run: bool = False,
308
+ _client: Any = None,
309
+ **kwargs: Any,
310
+ ) -> responses.ThreadReplyUpdate:
311
+ """
312
+ Update Thread Reply
313
+
314
+ **Permission Required:** `kelvin.permission.thread.update`.
315
+
316
+ ``updateThreadReply``: ``POST`` ``/api/v4/threads/{thread_id}/replies/{reply_id}/update``
317
+
318
+ Parameters
319
+ ----------
320
+ thread_id : :obj:`str`, optional
321
+ Thread ID
322
+ reply_id : :obj:`str`, optional
323
+ Reply ID
324
+ data: requests.ThreadReplyUpdate, optional
325
+ **kwargs:
326
+ Extra parameters for requests.ThreadReplyUpdate
327
+ - update_thread_reply: dict
328
+
329
+ """
330
+
331
+ from ..model import responses
332
+
333
+ result = cls._make_request(
334
+ _client,
335
+ "post",
336
+ "/api/v4/threads/{thread_id}/replies/{reply_id}/update",
337
+ {"thread_id": thread_id, "reply_id": reply_id},
338
+ {},
339
+ {},
340
+ {},
341
+ data,
342
+ "requests.ThreadReplyUpdate",
343
+ False,
344
+ {"200": responses.ThreadReplyUpdate, "400": None, "401": None},
345
+ False,
346
+ _dry_run,
347
+ kwargs,
348
+ )
349
+ return result
350
+
351
+ @classmethod
352
+ def update_thread_seen(
353
+ cls, thread_id: str, seen: Optional[bool] = None, _dry_run: bool = False, _client: Any = None
354
+ ) -> responses.ThreadSeenUpdate:
355
+ """
356
+ Update Thread Seen
357
+
358
+ **Permission Required:** `kelvin.permission.thread.read`.
359
+
360
+ ``updateThreadSeen``: ``POST`` ``/api/v4/threads/{thread_id}/seen/update``
361
+
362
+ Parameters
363
+ ----------
364
+ thread_id : :obj:`str`, optional
365
+ Thread ID
366
+ seen : :obj:`bool`
367
+ Set user seen value to true or false
368
+
369
+ """
370
+
371
+ from ..model import responses
372
+
373
+ result = cls._make_request(
374
+ _client,
375
+ "post",
376
+ "/api/v4/threads/{thread_id}/seen/update",
377
+ {"thread_id": thread_id},
378
+ {"seen": seen},
379
+ {},
380
+ {},
381
+ None,
382
+ None,
383
+ False,
384
+ {"200": responses.ThreadSeenUpdate, "404": None},
385
+ False,
386
+ _dry_run,
387
+ )
388
+ return result
389
+
390
+ @classmethod
391
+ def update_thread(
392
+ cls,
393
+ thread_id: str,
394
+ data: Optional[Union[requests.ThreadUpdate, Mapping[str, Any]]] = None,
395
+ _dry_run: bool = False,
396
+ _client: Any = None,
397
+ **kwargs: Any,
398
+ ) -> responses.ThreadUpdate:
399
+ """
400
+ Update Thread
401
+
402
+ **Permission Required:** `kelvin.permission.thread.update`.
403
+
404
+ ``updateThread``: ``POST`` ``/api/v4/threads/{thread_id}/update``
405
+
406
+ Parameters
407
+ ----------
408
+ thread_id : :obj:`str`, optional
409
+ Thread ID
410
+ data: requests.ThreadUpdate, optional
411
+ **kwargs:
412
+ Extra parameters for requests.ThreadUpdate
413
+ - update_thread: dict
414
+
415
+ """
416
+
417
+ from ..model import responses
418
+
419
+ result = cls._make_request(
420
+ _client,
421
+ "post",
422
+ "/api/v4/threads/{thread_id}/update",
423
+ {"thread_id": thread_id},
424
+ {},
425
+ {},
426
+ {},
427
+ data,
428
+ "requests.ThreadUpdate",
429
+ False,
430
+ {"200": responses.ThreadUpdate, "400": None, "401": None},
431
+ False,
432
+ _dry_run,
433
+ kwargs,
434
+ )
435
+ return result