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,234 @@
1
+ """
2
+ Kelvin API Client.
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ from typing import Any, Dict, Iterator, List, 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, type
14
+
15
+
16
+ class Filestorage(DataModelBase):
17
+ @classmethod
18
+ def list_files(
19
+ cls,
20
+ pagination_type: Optional[Literal["limits", "cursor", "stream"]] = None,
21
+ page_size: Optional[int] = 10000,
22
+ page: Optional[int] = None,
23
+ next: Optional[str] = None,
24
+ previous: Optional[str] = None,
25
+ direction: Optional[Literal["asc", "desc"]] = None,
26
+ data: Optional[Union[requests.FilesList, Mapping[str, Any]]] = None,
27
+ fetch: bool = True,
28
+ _dry_run: bool = False,
29
+ _client: Any = None,
30
+ **kwargs: Any,
31
+ ) -> Union[List[type.FileStorage], responses.FilesListPaginatedCursor]:
32
+ """
33
+ List the files currently present in the filestorage
34
+
35
+ **Permission Required:** `kelvin.permission.filestorage.read`.
36
+
37
+ ``listFiles``: ``POST`` ``/api/v4/filestorage/list``
38
+
39
+ Parameters
40
+ ----------
41
+ pagination_type : :obj:`Literal['limits', 'cursor', 'stream']`
42
+ Method of pagination to use for return results where `total_items` is
43
+ greater than `page_size`. `cursor` and `limits` will return one `page`
44
+ of results, `stream` will return all results. ('limits', 'cursor',
45
+ 'stream')
46
+ page_size : :obj:`int`
47
+ Number of objects to be returned in each page. Page size can range
48
+ between 1 and 1000 objects.
49
+ page : :obj:`int`
50
+ An integer for the wanted page of results. Used only with
51
+ `pagination_type` set as `limits`.
52
+ next : :obj:`str`
53
+ An alphanumeric string bookmark to indicate where to start for the
54
+ next page. Used only with `pagination_type` set as `cursor`.
55
+ previous : :obj:`str`
56
+ An alphanumeric string bookmark to indicate where to end for the
57
+ previous page. Used only with `pagination_type` set as `cursor`.
58
+ direction : :obj:`Literal['asc', 'desc']`
59
+ Sorting order according to the `sort_by` parameter. ('asc', 'desc')
60
+ data: requests.FilesList, optional
61
+ **kwargs:
62
+ Extra parameters for requests.FilesList
63
+ - list_files: dict
64
+
65
+ """
66
+
67
+ from ..model import responses
68
+
69
+ result = cls._make_request(
70
+ _client,
71
+ "post",
72
+ "/api/v4/filestorage/list",
73
+ {},
74
+ {
75
+ "pagination_type": pagination_type,
76
+ "page_size": page_size,
77
+ "page": page,
78
+ "next": next,
79
+ "previous": previous,
80
+ "direction": direction,
81
+ },
82
+ {},
83
+ {},
84
+ data,
85
+ "requests.FilesList",
86
+ False,
87
+ {"200": responses.FilesListPaginatedCursor, "400": None, "401": None},
88
+ False,
89
+ _dry_run,
90
+ kwargs,
91
+ )
92
+ return result.fetch("/api/v4/filestorage/list", "POST", data) if fetch and not _dry_run else result
93
+
94
+ @classmethod
95
+ def upload_file(
96
+ cls,
97
+ file: Optional[str] = None,
98
+ metadata: Optional[Dict[str, Any]] = None,
99
+ _dry_run: bool = False,
100
+ _client: Any = None,
101
+ ) -> responses.FileUpload:
102
+ """
103
+ Upload a file
104
+
105
+ **Permission Required:** `kelvin.permission.filestorage.upload`.
106
+
107
+ ``uploadFile``: ``POST`` ``/api/v4/filestorage/upload``
108
+
109
+ Parameters
110
+ ----------
111
+ file : :obj:`str`
112
+ metadata : :obj:`Dict[str, Any]`
113
+
114
+ """
115
+
116
+ from ..model import responses
117
+
118
+ result = cls._make_request(
119
+ _client,
120
+ "post",
121
+ "/api/v4/filestorage/upload",
122
+ {},
123
+ {},
124
+ {"file": file, "metadata": metadata},
125
+ {},
126
+ None,
127
+ None,
128
+ False,
129
+ {"201": responses.FileUpload, "400": None, "401": None},
130
+ False,
131
+ _dry_run,
132
+ )
133
+ return result
134
+
135
+ @classmethod
136
+ def delete_file(cls, file_id: str, _dry_run: bool = False, _client: Any = None) -> None:
137
+ """
138
+ Deletes the requested file from filestorage
139
+
140
+ **Permission Required:** `kelvin.permission.filestorage.delete`.
141
+
142
+ ``deleteFile``: ``POST`` ``/api/v4/filestorage/{file_id}/delete``
143
+
144
+ Parameters
145
+ ----------
146
+ file_id : :obj:`str`, optional
147
+ UUID of the desired file
148
+
149
+ """
150
+
151
+ result = cls._make_request(
152
+ _client,
153
+ "post",
154
+ "/api/v4/filestorage/{file_id}/delete",
155
+ {"file_id": file_id},
156
+ {},
157
+ {},
158
+ {},
159
+ None,
160
+ None,
161
+ False,
162
+ {"200": None, "400": None, "401": None, "404": None},
163
+ False,
164
+ _dry_run,
165
+ )
166
+ return result
167
+
168
+ @classmethod
169
+ def download_file(cls, file_id: str, _dry_run: bool = False, _client: Any = None) -> Iterator[bytes]:
170
+ """
171
+ Downloads the requested file
172
+
173
+ **Permission Required:** `kelvin.permission.filestorage.read`.
174
+
175
+ ``downloadFile``: ``GET`` ``/api/v4/filestorage/{file_id}/download``
176
+
177
+ Parameters
178
+ ----------
179
+ file_id : :obj:`str`, optional
180
+ UUID of the desired file
181
+
182
+ """
183
+
184
+ result = cls._make_request(
185
+ _client,
186
+ "get",
187
+ "/api/v4/filestorage/{file_id}/download",
188
+ {"file_id": file_id},
189
+ {},
190
+ {},
191
+ {},
192
+ None,
193
+ None,
194
+ False,
195
+ {"200": bytes, "400": None, "401": None, "404": None},
196
+ True,
197
+ _dry_run,
198
+ )
199
+ return result
200
+
201
+ @classmethod
202
+ def get_file(cls, file_id: str, _dry_run: bool = False, _client: Any = None) -> responses.FileGet:
203
+ """
204
+ Fetches the information for a specific file
205
+
206
+ **Permission Required:** `kelvin.permission.filestorage.read`.
207
+
208
+ ``getFile``: ``GET`` ``/api/v4/filestorage/{file_id}/get``
209
+
210
+ Parameters
211
+ ----------
212
+ file_id : :obj:`str`, optional
213
+ UUID of the desired file
214
+
215
+ """
216
+
217
+ from ..model import responses
218
+
219
+ result = cls._make_request(
220
+ _client,
221
+ "get",
222
+ "/api/v4/filestorage/{file_id}/get",
223
+ {"file_id": file_id},
224
+ {},
225
+ {},
226
+ {},
227
+ None,
228
+ None,
229
+ False,
230
+ {"200": responses.FileGet, "400": None, "401": None, "404": None},
231
+ False,
232
+ _dry_run,
233
+ )
234
+ return result