digitalhub 0.13.0b3__py3-none-any.whl → 0.14.0b0__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.
Potentially problematic release.
This version of digitalhub might be problematic. Click here for more details.
- digitalhub/__init__.py +3 -8
- digitalhub/entities/_base/_base/entity.py +0 -11
- digitalhub/entities/_base/entity/builder.py +5 -5
- digitalhub/entities/_base/executable/entity.py +1 -1
- digitalhub/entities/_base/runtime_entity/builder.py +53 -18
- digitalhub/entities/_commons/metrics.py +64 -30
- digitalhub/entities/_commons/utils.py +100 -30
- digitalhub/entities/_processors/base.py +160 -81
- digitalhub/entities/_processors/context.py +424 -224
- digitalhub/entities/_processors/utils.py +77 -33
- digitalhub/entities/artifact/crud.py +20 -4
- digitalhub/entities/artifact/utils.py +29 -14
- digitalhub/entities/dataitem/crud.py +20 -4
- digitalhub/entities/dataitem/table/entity.py +0 -21
- digitalhub/entities/dataitem/utils.py +84 -34
- digitalhub/entities/function/_base/entity.py +1 -1
- digitalhub/entities/function/crud.py +15 -4
- digitalhub/entities/model/_base/entity.py +21 -1
- digitalhub/entities/model/crud.py +21 -5
- digitalhub/entities/model/utils.py +29 -14
- digitalhub/entities/project/_base/entity.py +65 -33
- digitalhub/entities/project/crud.py +8 -1
- digitalhub/entities/run/_base/entity.py +21 -1
- digitalhub/entities/run/crud.py +22 -5
- digitalhub/entities/secret/crud.py +22 -5
- digitalhub/entities/task/crud.py +22 -5
- digitalhub/entities/trigger/crud.py +20 -4
- digitalhub/entities/workflow/_base/entity.py +1 -1
- digitalhub/entities/workflow/crud.py +15 -4
- digitalhub/factory/enums.py +18 -0
- digitalhub/factory/factory.py +136 -57
- digitalhub/factory/utils.py +3 -54
- digitalhub/stores/client/api.py +6 -10
- digitalhub/stores/client/builder.py +3 -3
- digitalhub/stores/client/dhcore/client.py +104 -162
- digitalhub/stores/client/dhcore/configurator.py +92 -289
- digitalhub/stores/client/dhcore/enums.py +0 -16
- digitalhub/stores/client/dhcore/params_builder.py +41 -83
- digitalhub/stores/client/dhcore/utils.py +14 -22
- digitalhub/stores/client/local/client.py +77 -45
- digitalhub/stores/credentials/enums.py +1 -0
- digitalhub/stores/credentials/ini_module.py +0 -16
- digitalhub/stores/data/api.py +1 -1
- digitalhub/stores/data/builder.py +66 -4
- digitalhub/stores/data/local/store.py +0 -103
- digitalhub/stores/data/s3/configurator.py +60 -6
- digitalhub/stores/data/s3/store.py +44 -2
- digitalhub/stores/data/sql/configurator.py +57 -7
- digitalhub/stores/data/sql/store.py +184 -78
- digitalhub/utils/file_utils.py +0 -17
- digitalhub/utils/generic_utils.py +1 -2
- digitalhub/utils/store_utils.py +44 -0
- {digitalhub-0.13.0b3.dist-info → digitalhub-0.14.0b0.dist-info}/METADATA +3 -2
- {digitalhub-0.13.0b3.dist-info → digitalhub-0.14.0b0.dist-info}/RECORD +63 -65
- digitalhub/entities/_commons/types.py +0 -9
- digitalhub/entities/task/_base/utils.py +0 -22
- digitalhub/stores/client/dhcore/models.py +0 -40
- digitalhub/stores/data/s3/utils.py +0 -78
- /digitalhub/entities/{_base/entity/_constructors → _constructors}/__init__.py +0 -0
- /digitalhub/entities/{_base/entity/_constructors → _constructors}/metadata.py +0 -0
- /digitalhub/entities/{_base/entity/_constructors → _constructors}/name.py +0 -0
- /digitalhub/entities/{_base/entity/_constructors → _constructors}/spec.py +0 -0
- /digitalhub/entities/{_base/entity/_constructors → _constructors}/status.py +0 -0
- /digitalhub/entities/{_base/entity/_constructors → _constructors}/uuid.py +0 -0
- {digitalhub-0.13.0b3.dist-info → digitalhub-0.14.0b0.dist-info}/WHEEL +0 -0
- {digitalhub-0.13.0b3.dist-info → digitalhub-0.14.0b0.dist-info}/licenses/AUTHORS +0 -0
- {digitalhub-0.13.0b3.dist-info → digitalhub-0.14.0b0.dist-info}/licenses/LICENSE +0 -0
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
7
7
|
import typing
|
|
8
|
+
from warnings import warn
|
|
8
9
|
|
|
9
10
|
from digitalhub.context.api import delete_context
|
|
10
11
|
from digitalhub.entities._commons.enums import ApiCategories, BackendOperations
|
|
@@ -20,11 +21,12 @@ if typing.TYPE_CHECKING:
|
|
|
20
21
|
|
|
21
22
|
class BaseEntityOperationsProcessor:
|
|
22
23
|
"""
|
|
23
|
-
Processor for
|
|
24
|
+
Processor for base entity operations.
|
|
24
25
|
|
|
25
|
-
This
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
This class handles CRUD operations and other entity management tasks
|
|
27
|
+
for base-level entities (primarily projects). It interacts with the
|
|
28
|
+
client layer to perform backend operations and manages entity lifecycle
|
|
29
|
+
including creation, reading, updating, deletion, and sharing.
|
|
28
30
|
"""
|
|
29
31
|
|
|
30
32
|
##############################
|
|
@@ -39,23 +41,26 @@ class BaseEntityOperationsProcessor:
|
|
|
39
41
|
**kwargs,
|
|
40
42
|
) -> dict:
|
|
41
43
|
"""
|
|
42
|
-
Create
|
|
44
|
+
Create a base entity in the backend.
|
|
45
|
+
|
|
46
|
+
Builds the appropriate API endpoint and sends a create request
|
|
47
|
+
to the backend for base-level entities.
|
|
43
48
|
|
|
44
49
|
Parameters
|
|
45
50
|
----------
|
|
46
51
|
client : Client
|
|
47
|
-
|
|
52
|
+
The client instance to use for the API call.
|
|
48
53
|
entity_type : str
|
|
49
|
-
|
|
54
|
+
The type of entity to create (e.g., 'project').
|
|
50
55
|
entity_dict : dict
|
|
51
|
-
|
|
56
|
+
The entity data dictionary to create.
|
|
52
57
|
**kwargs : dict
|
|
53
|
-
|
|
58
|
+
Additional parameters to pass to the API call.
|
|
54
59
|
|
|
55
60
|
Returns
|
|
56
61
|
-------
|
|
57
62
|
dict
|
|
58
|
-
|
|
63
|
+
The created entity data returned from the backend.
|
|
59
64
|
"""
|
|
60
65
|
api = client.build_api(
|
|
61
66
|
ApiCategories.BASE.value,
|
|
@@ -70,19 +75,25 @@ class BaseEntityOperationsProcessor:
|
|
|
70
75
|
**kwargs,
|
|
71
76
|
) -> Project:
|
|
72
77
|
"""
|
|
73
|
-
Create
|
|
78
|
+
Create a project entity in the backend.
|
|
79
|
+
|
|
80
|
+
Creates a new project either from an existing entity object or
|
|
81
|
+
by building one from the provided parameters. Handles both
|
|
82
|
+
local and remote backend creation.
|
|
74
83
|
|
|
75
84
|
Parameters
|
|
76
85
|
----------
|
|
77
|
-
_entity : Project
|
|
78
|
-
|
|
86
|
+
_entity : Project, optional
|
|
87
|
+
An existing project entity object to create. If None,
|
|
88
|
+
a new entity will be built from kwargs.
|
|
79
89
|
**kwargs : dict
|
|
80
|
-
Parameters
|
|
90
|
+
Parameters for entity creation, including 'local' flag
|
|
91
|
+
and entity-specific parameters.
|
|
81
92
|
|
|
82
93
|
Returns
|
|
83
94
|
-------
|
|
84
95
|
Project
|
|
85
|
-
|
|
96
|
+
The created project entity with backend data populated.
|
|
86
97
|
"""
|
|
87
98
|
if _entity is not None:
|
|
88
99
|
client = _entity._client
|
|
@@ -102,23 +113,26 @@ class BaseEntityOperationsProcessor:
|
|
|
102
113
|
**kwargs,
|
|
103
114
|
) -> dict:
|
|
104
115
|
"""
|
|
105
|
-
Read
|
|
116
|
+
Read a base entity from the backend.
|
|
117
|
+
|
|
118
|
+
Builds the appropriate API endpoint and sends a read request
|
|
119
|
+
to retrieve entity data from the backend.
|
|
106
120
|
|
|
107
121
|
Parameters
|
|
108
122
|
----------
|
|
109
123
|
client : Client
|
|
110
|
-
|
|
124
|
+
The client instance to use for the API call.
|
|
111
125
|
entity_type : str
|
|
112
|
-
|
|
126
|
+
The type of entity to read (e.g., 'project').
|
|
113
127
|
entity_name : str
|
|
114
|
-
|
|
128
|
+
The name identifier of the entity to read.
|
|
115
129
|
**kwargs : dict
|
|
116
|
-
|
|
130
|
+
Additional parameters to pass to the API call.
|
|
117
131
|
|
|
118
132
|
Returns
|
|
119
133
|
-------
|
|
120
134
|
dict
|
|
121
|
-
|
|
135
|
+
The entity data retrieved from the backend.
|
|
122
136
|
"""
|
|
123
137
|
api = client.build_api(
|
|
124
138
|
ApiCategories.BASE.value,
|
|
@@ -135,21 +149,25 @@ class BaseEntityOperationsProcessor:
|
|
|
135
149
|
**kwargs,
|
|
136
150
|
) -> Project:
|
|
137
151
|
"""
|
|
138
|
-
Read
|
|
152
|
+
Read a project entity from the backend.
|
|
153
|
+
|
|
154
|
+
Retrieves project data from the backend and constructs a
|
|
155
|
+
Project entity object with the retrieved data.
|
|
139
156
|
|
|
140
157
|
Parameters
|
|
141
158
|
----------
|
|
142
159
|
entity_type : str
|
|
143
|
-
|
|
160
|
+
The type of entity to read (typically 'project').
|
|
144
161
|
entity_name : str
|
|
145
|
-
|
|
162
|
+
The name identifier of the project to read.
|
|
146
163
|
**kwargs : dict
|
|
147
|
-
|
|
164
|
+
Additional parameters including 'local' flag and
|
|
165
|
+
API call parameters.
|
|
148
166
|
|
|
149
167
|
Returns
|
|
150
168
|
-------
|
|
151
169
|
Project
|
|
152
|
-
|
|
170
|
+
The project entity object populated with backend data.
|
|
153
171
|
"""
|
|
154
172
|
client = get_client(kwargs.pop("local", False))
|
|
155
173
|
obj = self._read_base_entity(client, entity_type, entity_name, **kwargs)
|
|
@@ -162,33 +180,49 @@ class BaseEntityOperationsProcessor:
|
|
|
162
180
|
**kwargs,
|
|
163
181
|
) -> Project:
|
|
164
182
|
"""
|
|
165
|
-
Import
|
|
183
|
+
Import a project entity from a YAML file and create it in the backend.
|
|
184
|
+
|
|
185
|
+
Reads project configuration from a YAML file, creates a new project
|
|
186
|
+
entity in the backend, and imports any related entities defined
|
|
187
|
+
in the file. Raises an error if the project already exists.
|
|
166
188
|
|
|
167
189
|
Parameters
|
|
168
190
|
----------
|
|
169
191
|
file : str
|
|
170
|
-
Path to YAML file.
|
|
192
|
+
Path to the YAML file containing project configuration.
|
|
171
193
|
**kwargs : dict
|
|
172
|
-
Additional
|
|
194
|
+
Additional parameters including 'local' and 'reset_id' flags.
|
|
173
195
|
|
|
174
196
|
Returns
|
|
175
197
|
-------
|
|
176
198
|
Project
|
|
177
|
-
|
|
199
|
+
The imported and created project entity.
|
|
200
|
+
|
|
201
|
+
Raises
|
|
202
|
+
------
|
|
203
|
+
EntityError
|
|
204
|
+
If the project already exists in the backend.
|
|
178
205
|
"""
|
|
179
206
|
client = get_client(kwargs.pop("local", False))
|
|
180
207
|
obj: dict = read_yaml(file)
|
|
181
208
|
obj["status"] = {}
|
|
182
209
|
obj["local"] = client.is_local()
|
|
183
210
|
ent: Project = factory.build_entity_from_dict(obj)
|
|
211
|
+
reset_id = kwargs.pop("reset_id", False)
|
|
184
212
|
|
|
185
213
|
try:
|
|
186
214
|
self._create_base_entity(ent._client, ent.ENTITY_TYPE, ent.to_dict())
|
|
187
215
|
except EntityAlreadyExistsError:
|
|
188
|
-
|
|
216
|
+
msg = f"Entity {ent.name} already exists."
|
|
217
|
+
if reset_id:
|
|
218
|
+
ent._import_entities(obj, reset_id=reset_id)
|
|
219
|
+
warn(f"{msg} Other entities ids have been imported.")
|
|
220
|
+
ent.refresh()
|
|
221
|
+
return ent
|
|
222
|
+
raise EntityError(f"{msg} If you want to update it, use load instead.")
|
|
189
223
|
|
|
190
224
|
# Import related entities
|
|
191
|
-
ent._import_entities(obj)
|
|
225
|
+
ent._import_entities(obj, reset_id=reset_id)
|
|
192
226
|
ent.refresh()
|
|
193
227
|
return ent
|
|
194
228
|
|
|
@@ -198,19 +232,23 @@ class BaseEntityOperationsProcessor:
|
|
|
198
232
|
**kwargs,
|
|
199
233
|
) -> Project:
|
|
200
234
|
"""
|
|
201
|
-
Load
|
|
235
|
+
Load a project entity from a YAML file and update it in the backend.
|
|
236
|
+
|
|
237
|
+
Reads project configuration from a YAML file and updates an existing
|
|
238
|
+
project in the backend. If the project doesn't exist, it creates a
|
|
239
|
+
new one. Also loads any related entities defined in the file.
|
|
202
240
|
|
|
203
241
|
Parameters
|
|
204
242
|
----------
|
|
205
243
|
file : str
|
|
206
|
-
Path to YAML file.
|
|
244
|
+
Path to the YAML file containing project configuration.
|
|
207
245
|
**kwargs : dict
|
|
208
|
-
Additional
|
|
246
|
+
Additional parameters including 'local' flag.
|
|
209
247
|
|
|
210
248
|
Returns
|
|
211
249
|
-------
|
|
212
250
|
Project
|
|
213
|
-
|
|
251
|
+
The loaded and updated project entity.
|
|
214
252
|
"""
|
|
215
253
|
client = get_client(kwargs.pop("local", False))
|
|
216
254
|
obj: dict = read_yaml(file)
|
|
@@ -234,21 +272,25 @@ class BaseEntityOperationsProcessor:
|
|
|
234
272
|
**kwargs,
|
|
235
273
|
) -> list[dict]:
|
|
236
274
|
"""
|
|
237
|
-
List
|
|
275
|
+
List base entities from the backend.
|
|
276
|
+
|
|
277
|
+
Builds the appropriate API endpoint and sends a list request
|
|
278
|
+
to retrieve multiple entities from the backend.
|
|
238
279
|
|
|
239
280
|
Parameters
|
|
240
281
|
----------
|
|
241
282
|
client : Client
|
|
242
|
-
|
|
283
|
+
The client instance to use for the API call.
|
|
243
284
|
entity_type : str
|
|
244
|
-
|
|
285
|
+
The type of entities to list (e.g., 'project').
|
|
245
286
|
**kwargs : dict
|
|
246
|
-
|
|
287
|
+
Additional parameters to pass to the API call for filtering
|
|
288
|
+
or pagination.
|
|
247
289
|
|
|
248
290
|
Returns
|
|
249
291
|
-------
|
|
250
292
|
list[dict]
|
|
251
|
-
List of
|
|
293
|
+
List of entity data dictionaries from the backend.
|
|
252
294
|
"""
|
|
253
295
|
api = client.build_api(
|
|
254
296
|
ApiCategories.BASE.value,
|
|
@@ -263,19 +305,23 @@ class BaseEntityOperationsProcessor:
|
|
|
263
305
|
**kwargs,
|
|
264
306
|
) -> list[Project]:
|
|
265
307
|
"""
|
|
266
|
-
List
|
|
308
|
+
List project entities from the backend.
|
|
309
|
+
|
|
310
|
+
Retrieves a list of projects from the backend and converts
|
|
311
|
+
them to Project entity objects.
|
|
267
312
|
|
|
268
313
|
Parameters
|
|
269
314
|
----------
|
|
270
315
|
entity_type : str
|
|
271
|
-
|
|
316
|
+
The type of entities to list (typically 'project').
|
|
272
317
|
**kwargs : dict
|
|
273
|
-
|
|
318
|
+
Additional parameters including 'local' flag and
|
|
319
|
+
API call parameters for filtering or pagination.
|
|
274
320
|
|
|
275
321
|
Returns
|
|
276
322
|
-------
|
|
277
323
|
list[Project]
|
|
278
|
-
List of objects.
|
|
324
|
+
List of project entity objects.
|
|
279
325
|
"""
|
|
280
326
|
client = get_client(kwargs.pop("local", False))
|
|
281
327
|
objs = self._list_base_entities(client, entity_type, **kwargs)
|
|
@@ -295,25 +341,28 @@ class BaseEntityOperationsProcessor:
|
|
|
295
341
|
**kwargs,
|
|
296
342
|
) -> dict:
|
|
297
343
|
"""
|
|
298
|
-
Update
|
|
344
|
+
Update a base entity in the backend.
|
|
345
|
+
|
|
346
|
+
Builds the appropriate API endpoint and sends an update request
|
|
347
|
+
to modify an existing entity in the backend.
|
|
299
348
|
|
|
300
349
|
Parameters
|
|
301
350
|
----------
|
|
302
351
|
client : Client
|
|
303
|
-
|
|
352
|
+
The client instance to use for the API call.
|
|
304
353
|
entity_type : str
|
|
305
|
-
|
|
354
|
+
The type of entity to update (e.g., 'project').
|
|
306
355
|
entity_name : str
|
|
307
|
-
|
|
356
|
+
The name identifier of the entity to update.
|
|
308
357
|
entity_dict : dict
|
|
309
|
-
|
|
358
|
+
The updated entity data dictionary.
|
|
310
359
|
**kwargs : dict
|
|
311
|
-
|
|
360
|
+
Additional parameters to pass to the API call.
|
|
312
361
|
|
|
313
362
|
Returns
|
|
314
363
|
-------
|
|
315
364
|
dict
|
|
316
|
-
|
|
365
|
+
The updated entity data returned from the backend.
|
|
317
366
|
"""
|
|
318
367
|
api = client.build_api(
|
|
319
368
|
ApiCategories.BASE.value,
|
|
@@ -331,23 +380,27 @@ class BaseEntityOperationsProcessor:
|
|
|
331
380
|
**kwargs,
|
|
332
381
|
) -> Project:
|
|
333
382
|
"""
|
|
334
|
-
Update
|
|
383
|
+
Update a project entity in the backend.
|
|
384
|
+
|
|
385
|
+
Updates an existing project with new data and returns the
|
|
386
|
+
updated Project entity object.
|
|
335
387
|
|
|
336
388
|
Parameters
|
|
337
389
|
----------
|
|
338
390
|
entity_type : str
|
|
339
|
-
|
|
391
|
+
The type of entity to update (typically 'project').
|
|
340
392
|
entity_name : str
|
|
341
|
-
|
|
393
|
+
The name identifier of the project to update.
|
|
342
394
|
entity_dict : dict
|
|
343
|
-
|
|
395
|
+
The updated project data dictionary.
|
|
344
396
|
**kwargs : dict
|
|
345
|
-
|
|
397
|
+
Additional parameters including 'local' flag and
|
|
398
|
+
API call parameters.
|
|
346
399
|
|
|
347
400
|
Returns
|
|
348
401
|
-------
|
|
349
402
|
Project
|
|
350
|
-
|
|
403
|
+
The updated project entity object.
|
|
351
404
|
"""
|
|
352
405
|
client = get_client(kwargs.pop("local", False))
|
|
353
406
|
obj = self._update_base_entity(client, entity_type, entity_name, entity_dict, **kwargs)
|
|
@@ -362,23 +415,27 @@ class BaseEntityOperationsProcessor:
|
|
|
362
415
|
**kwargs,
|
|
363
416
|
) -> dict:
|
|
364
417
|
"""
|
|
365
|
-
Delete
|
|
418
|
+
Delete a base entity from the backend.
|
|
419
|
+
|
|
420
|
+
Builds the appropriate API endpoint and parameters, then sends
|
|
421
|
+
a delete request to remove the entity from the backend.
|
|
366
422
|
|
|
367
423
|
Parameters
|
|
368
424
|
----------
|
|
369
425
|
client : Client
|
|
370
|
-
|
|
426
|
+
The client instance to use for the API call.
|
|
371
427
|
entity_type : str
|
|
372
|
-
|
|
428
|
+
The type of entity to delete (e.g., 'project').
|
|
373
429
|
entity_name : str
|
|
374
|
-
|
|
430
|
+
The name identifier of the entity to delete.
|
|
375
431
|
**kwargs : dict
|
|
376
|
-
|
|
432
|
+
Additional parameters to pass to the API call, such as
|
|
433
|
+
cascade deletion options.
|
|
377
434
|
|
|
378
435
|
Returns
|
|
379
436
|
-------
|
|
380
437
|
dict
|
|
381
|
-
Response from backend.
|
|
438
|
+
Response data from the backend delete operation.
|
|
382
439
|
"""
|
|
383
440
|
kwargs = client.build_parameters(
|
|
384
441
|
ApiCategories.BASE.value,
|
|
@@ -400,21 +457,25 @@ class BaseEntityOperationsProcessor:
|
|
|
400
457
|
**kwargs,
|
|
401
458
|
) -> dict:
|
|
402
459
|
"""
|
|
403
|
-
Delete
|
|
460
|
+
Delete a project entity from the backend.
|
|
461
|
+
|
|
462
|
+
Deletes a project from the backend and optionally cleans up
|
|
463
|
+
the associated context. Handles both local and remote backends.
|
|
404
464
|
|
|
405
465
|
Parameters
|
|
406
466
|
----------
|
|
407
467
|
entity_type : str
|
|
408
|
-
|
|
468
|
+
The type of entity to delete (typically 'project').
|
|
409
469
|
entity_name : str
|
|
410
|
-
|
|
470
|
+
The name identifier of the project to delete.
|
|
411
471
|
**kwargs : dict
|
|
412
|
-
|
|
472
|
+
Additional parameters including 'local' flag, 'clean_context'
|
|
473
|
+
flag (default True), and API call parameters.
|
|
413
474
|
|
|
414
475
|
Returns
|
|
415
476
|
-------
|
|
416
477
|
dict
|
|
417
|
-
Response from backend.
|
|
478
|
+
Response data from the backend delete operation.
|
|
418
479
|
"""
|
|
419
480
|
if kwargs.pop("clean_context", True):
|
|
420
481
|
delete_context(entity_name)
|
|
@@ -436,19 +497,22 @@ class BaseEntityOperationsProcessor:
|
|
|
436
497
|
entity_id: str,
|
|
437
498
|
) -> str:
|
|
438
499
|
"""
|
|
439
|
-
Build
|
|
500
|
+
Build a storage key for a base entity.
|
|
501
|
+
|
|
502
|
+
Creates a standardized key string that can be used to identify
|
|
503
|
+
and store the entity in various contexts.
|
|
440
504
|
|
|
441
505
|
Parameters
|
|
442
506
|
----------
|
|
443
507
|
client : Client
|
|
444
|
-
|
|
508
|
+
The client instance to use for key building.
|
|
445
509
|
entity_id : str
|
|
446
|
-
|
|
510
|
+
The unique identifier of the entity.
|
|
447
511
|
|
|
448
512
|
Returns
|
|
449
513
|
-------
|
|
450
514
|
str
|
|
451
|
-
|
|
515
|
+
The constructed entity key string.
|
|
452
516
|
"""
|
|
453
517
|
return client.build_key(ApiCategories.BASE.value, entity_id)
|
|
454
518
|
|
|
@@ -458,19 +522,22 @@ class BaseEntityOperationsProcessor:
|
|
|
458
522
|
**kwargs,
|
|
459
523
|
) -> str:
|
|
460
524
|
"""
|
|
461
|
-
Build
|
|
525
|
+
Build a storage key for a project entity.
|
|
526
|
+
|
|
527
|
+
Creates a standardized key string for project identification
|
|
528
|
+
and storage, handling both local and remote client contexts.
|
|
462
529
|
|
|
463
530
|
Parameters
|
|
464
531
|
----------
|
|
465
532
|
entity_id : str
|
|
466
|
-
|
|
533
|
+
The unique identifier of the project entity.
|
|
467
534
|
**kwargs : dict
|
|
468
|
-
|
|
535
|
+
Additional parameters including 'local' flag.
|
|
469
536
|
|
|
470
537
|
Returns
|
|
471
538
|
-------
|
|
472
539
|
str
|
|
473
|
-
|
|
540
|
+
The constructed project entity key string.
|
|
474
541
|
"""
|
|
475
542
|
client = get_client(kwargs.pop("local", False))
|
|
476
543
|
return self._build_base_entity_key(client, entity_id)
|
|
@@ -482,20 +549,32 @@ class BaseEntityOperationsProcessor:
|
|
|
482
549
|
**kwargs,
|
|
483
550
|
) -> None:
|
|
484
551
|
"""
|
|
485
|
-
Share
|
|
552
|
+
Share or unshare a project entity with a user.
|
|
553
|
+
|
|
554
|
+
Manages project access permissions by sharing the project with
|
|
555
|
+
a specified user or removing user access. Handles both sharing
|
|
556
|
+
and unsharing operations based on the 'unshare' parameter.
|
|
486
557
|
|
|
487
558
|
Parameters
|
|
488
559
|
----------
|
|
489
560
|
entity_type : str
|
|
490
|
-
|
|
561
|
+
The type of entity to share (typically 'project').
|
|
491
562
|
entity_name : str
|
|
492
|
-
|
|
563
|
+
The name identifier of the project to share.
|
|
493
564
|
**kwargs : dict
|
|
494
|
-
|
|
565
|
+
Additional parameters including:
|
|
566
|
+
- 'user': username to share with/unshare from
|
|
567
|
+
- 'unshare': boolean flag for unsharing (default False)
|
|
568
|
+
- 'local': boolean flag for local backend
|
|
495
569
|
|
|
496
570
|
Returns
|
|
497
571
|
-------
|
|
498
572
|
None
|
|
573
|
+
|
|
574
|
+
Raises
|
|
575
|
+
------
|
|
576
|
+
ValueError
|
|
577
|
+
If trying to unshare from a user who doesn't have access.
|
|
499
578
|
"""
|
|
500
579
|
client = get_client(kwargs.pop("local", False))
|
|
501
580
|
api = client.build_api(
|