digitalhub 0.14.0b2__py3-none-any.whl → 0.14.0b4__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/context/builder.py +0 -4
- digitalhub/context/context.py +12 -8
- digitalhub/entities/_base/_base/entity.py +0 -4
- digitalhub/entities/_base/context/entity.py +1 -1
- digitalhub/entities/_base/entity/entity.py +0 -8
- digitalhub/entities/_base/executable/entity.py +161 -79
- digitalhub/entities/_base/material/entity.py +7 -23
- digitalhub/entities/_base/material/utils.py +28 -0
- digitalhub/entities/_base/unversioned/entity.py +1 -1
- digitalhub/entities/_base/versioned/entity.py +1 -1
- digitalhub/entities/_commons/enums.py +0 -31
- digitalhub/entities/_constructors/_resources.py +151 -0
- digitalhub/entities/_constructors/name.py +18 -0
- digitalhub/entities/_processors/base/__init__.py +3 -0
- digitalhub/entities/_processors/{base.py → base/crud.py} +7 -227
- digitalhub/entities/_processors/base/import_export.py +122 -0
- digitalhub/entities/_processors/base/processor.py +302 -0
- digitalhub/entities/_processors/base/special_ops.py +108 -0
- digitalhub/entities/_processors/context/__init__.py +3 -0
- digitalhub/entities/_processors/context/crud.py +654 -0
- digitalhub/entities/_processors/context/import_export.py +242 -0
- digitalhub/entities/_processors/context/material.py +123 -0
- digitalhub/entities/_processors/context/processor.py +400 -0
- digitalhub/entities/_processors/context/special_ops.py +476 -0
- digitalhub/entities/_processors/processors.py +12 -0
- digitalhub/entities/_processors/utils.py +2 -1
- digitalhub/entities/artifact/crud.py +45 -41
- digitalhub/entities/dataitem/crud.py +45 -37
- digitalhub/entities/dataitem/table/entity.py +5 -6
- digitalhub/entities/function/crud.py +47 -43
- digitalhub/entities/model/_base/entity.py +3 -23
- digitalhub/entities/model/crud.py +45 -39
- digitalhub/entities/project/_base/entity.py +45 -134
- digitalhub/entities/project/crud.py +13 -42
- digitalhub/entities/run/_base/builder.py +0 -4
- digitalhub/entities/run/_base/entity.py +4 -60
- digitalhub/entities/run/crud.py +61 -40
- digitalhub/entities/secret/_base/entity.py +1 -5
- digitalhub/entities/secret/crud.py +14 -42
- digitalhub/entities/task/_base/builder.py +0 -4
- digitalhub/entities/task/_base/entity.py +1 -1
- digitalhub/entities/task/crud.py +47 -44
- digitalhub/entities/trigger/_base/entity.py +1 -5
- digitalhub/entities/trigger/crud.py +51 -43
- digitalhub/entities/workflow/crud.py +47 -40
- digitalhub/factory/registry.py +0 -24
- digitalhub/stores/client/_base/enums.py +39 -0
- digitalhub/stores/client/_base/key_builder.py +1 -1
- digitalhub/stores/client/_base/params_builder.py +48 -0
- digitalhub/stores/client/dhcore/api_builder.py +2 -1
- digitalhub/stores/client/dhcore/client.py +67 -73
- digitalhub/stores/client/dhcore/configurator.py +5 -28
- digitalhub/stores/client/dhcore/error_parser.py +0 -4
- digitalhub/stores/client/dhcore/params_builder.py +130 -75
- digitalhub/stores/client/local/api_builder.py +1 -1
- digitalhub/stores/client/local/params_builder.py +18 -41
- digitalhub/stores/credentials/configurator.py +0 -24
- digitalhub/stores/credentials/handler.py +0 -12
- digitalhub/stores/credentials/store.py +0 -4
- digitalhub/stores/data/_base/store.py +0 -16
- digitalhub/stores/data/builder.py +0 -4
- digitalhub/stores/data/remote/store.py +0 -4
- digitalhub/stores/data/s3/configurator.py +0 -8
- digitalhub/stores/data/s3/store.py +8 -17
- digitalhub/stores/data/sql/configurator.py +0 -8
- digitalhub/stores/data/sql/store.py +0 -4
- digitalhub/stores/readers/data/factory.py +0 -8
- digitalhub/stores/readers/data/pandas/reader.py +0 -16
- digitalhub/utils/io_utils.py +0 -4
- {digitalhub-0.14.0b2.dist-info → digitalhub-0.14.0b4.dist-info}/METADATA +1 -1
- {digitalhub-0.14.0b2.dist-info → digitalhub-0.14.0b4.dist-info}/RECORD +74 -62
- digitalhub/entities/_processors/context.py +0 -1499
- {digitalhub-0.14.0b2.dist-info → digitalhub-0.14.0b4.dist-info}/WHEEL +0 -0
- {digitalhub-0.14.0b2.dist-info → digitalhub-0.14.0b4.dist-info}/licenses/AUTHORS +0 -0
- {digitalhub-0.14.0b2.dist-info → digitalhub-0.14.0b4.dist-info}/licenses/LICENSE +0 -0
|
@@ -8,7 +8,7 @@ import typing
|
|
|
8
8
|
|
|
9
9
|
from digitalhub.entities._commons.enums import EntityTypes
|
|
10
10
|
from digitalhub.entities._commons.utils import is_valid_key
|
|
11
|
-
from digitalhub.entities._processors.
|
|
11
|
+
from digitalhub.entities._processors.processors import context_processor
|
|
12
12
|
from digitalhub.utils.exceptions import EntityNotExistsError
|
|
13
13
|
|
|
14
14
|
if typing.TYPE_CHECKING:
|
|
@@ -81,7 +81,6 @@ def get_secret(
|
|
|
81
81
|
identifier: str,
|
|
82
82
|
project: str | None = None,
|
|
83
83
|
entity_id: str | None = None,
|
|
84
|
-
**kwargs,
|
|
85
84
|
) -> Secret:
|
|
86
85
|
"""
|
|
87
86
|
Get object from backend.
|
|
@@ -94,8 +93,6 @@ def get_secret(
|
|
|
94
93
|
Project name.
|
|
95
94
|
entity_id : str
|
|
96
95
|
Entity ID.
|
|
97
|
-
**kwargs : dict
|
|
98
|
-
Parameters to pass to the API call.
|
|
99
96
|
|
|
100
97
|
Returns
|
|
101
98
|
-------
|
|
@@ -105,9 +102,7 @@ def get_secret(
|
|
|
105
102
|
Examples
|
|
106
103
|
--------
|
|
107
104
|
Using entity key:
|
|
108
|
-
>>> obj = get_secret(
|
|
109
|
-
... "store://my-secret-key"
|
|
110
|
-
... )
|
|
105
|
+
>>> obj = get_secret("store://my-secret-key")
|
|
111
106
|
|
|
112
107
|
Using entity name:
|
|
113
108
|
>>> obj = get_secret("my-secret-name"
|
|
@@ -117,25 +112,23 @@ def get_secret(
|
|
|
117
112
|
if not is_valid_key(identifier):
|
|
118
113
|
if project is None:
|
|
119
114
|
raise ValueError("Project must be provided.")
|
|
120
|
-
secrets = list_secrets(project=project
|
|
115
|
+
secrets = list_secrets(project=project)
|
|
121
116
|
for secret in secrets:
|
|
122
117
|
if secret.name == identifier:
|
|
123
118
|
return secret
|
|
124
119
|
else:
|
|
125
120
|
raise EntityNotExistsError(f"Secret {identifier} not found.")
|
|
126
121
|
return context_processor.read_context_entity(
|
|
127
|
-
identifier,
|
|
122
|
+
identifier=identifier,
|
|
128
123
|
entity_type=ENTITY_TYPE,
|
|
129
124
|
project=project,
|
|
130
125
|
entity_id=entity_id,
|
|
131
|
-
**kwargs,
|
|
132
126
|
)
|
|
133
127
|
|
|
134
128
|
|
|
135
129
|
def get_secret_versions(
|
|
136
130
|
identifier: str,
|
|
137
131
|
project: str | None = None,
|
|
138
|
-
**kwargs,
|
|
139
132
|
) -> list[Secret]:
|
|
140
133
|
"""
|
|
141
134
|
Get object versions from backend.
|
|
@@ -146,8 +139,6 @@ def get_secret_versions(
|
|
|
146
139
|
Entity key (store://...) or entity name.
|
|
147
140
|
project : str
|
|
148
141
|
Project name.
|
|
149
|
-
**kwargs : dict
|
|
150
|
-
Parameters to pass to the API call.
|
|
151
142
|
|
|
152
143
|
Returns
|
|
153
144
|
-------
|
|
@@ -157,23 +148,20 @@ def get_secret_versions(
|
|
|
157
148
|
Examples
|
|
158
149
|
--------
|
|
159
150
|
Using entity key:
|
|
160
|
-
>>> objs = get_secret_versions(
|
|
161
|
-
... "store://my-secret-key"
|
|
162
|
-
... )
|
|
151
|
+
>>> objs = get_secret_versions("store://my-secret-key")
|
|
163
152
|
|
|
164
153
|
Using entity name:
|
|
165
154
|
>>> objs = get_secret_versions("my-secret-name",
|
|
166
155
|
>>> project="my-project")
|
|
167
156
|
"""
|
|
168
157
|
return context_processor.read_context_entity_versions(
|
|
169
|
-
identifier,
|
|
158
|
+
identifier=identifier,
|
|
170
159
|
entity_type=ENTITY_TYPE,
|
|
171
160
|
project=project,
|
|
172
|
-
**kwargs,
|
|
173
161
|
)
|
|
174
162
|
|
|
175
163
|
|
|
176
|
-
def list_secrets(project: str
|
|
164
|
+
def list_secrets(project: str) -> list[Secret]:
|
|
177
165
|
"""
|
|
178
166
|
List all latest version objects from backend.
|
|
179
167
|
|
|
@@ -181,8 +169,6 @@ def list_secrets(project: str, **kwargs) -> list[Secret]:
|
|
|
181
169
|
----------
|
|
182
170
|
project : str
|
|
183
171
|
Project name.
|
|
184
|
-
**kwargs : dict
|
|
185
|
-
Parameters to pass to the API call.
|
|
186
172
|
|
|
187
173
|
Returns
|
|
188
174
|
-------
|
|
@@ -191,14 +177,11 @@ def list_secrets(project: str, **kwargs) -> list[Secret]:
|
|
|
191
177
|
|
|
192
178
|
Examples
|
|
193
179
|
--------
|
|
194
|
-
>>> objs = list_secrets(
|
|
195
|
-
... project="my-project"
|
|
196
|
-
... )
|
|
180
|
+
>>> objs = list_secrets(project="my-project")
|
|
197
181
|
"""
|
|
198
182
|
return context_processor.list_context_entities(
|
|
199
183
|
project=project,
|
|
200
184
|
entity_type=ENTITY_TYPE,
|
|
201
|
-
**kwargs,
|
|
202
185
|
)
|
|
203
186
|
|
|
204
187
|
|
|
@@ -229,9 +212,7 @@ def import_secret(
|
|
|
229
212
|
|
|
230
213
|
Examples
|
|
231
214
|
--------
|
|
232
|
-
>>> obj = import_secret(
|
|
233
|
-
... "my-secret.yaml"
|
|
234
|
-
... )
|
|
215
|
+
>>> obj = import_secret("my-secret.yaml")
|
|
235
216
|
"""
|
|
236
217
|
return context_processor.import_context_entity(
|
|
237
218
|
file,
|
|
@@ -257,9 +238,7 @@ def load_secret(file: str) -> Secret:
|
|
|
257
238
|
|
|
258
239
|
Examples
|
|
259
240
|
--------
|
|
260
|
-
>>> obj = load_secret(
|
|
261
|
-
... "my-secret.yaml"
|
|
262
|
-
... )
|
|
241
|
+
>>> obj = load_secret("my-secret.yaml")
|
|
263
242
|
"""
|
|
264
243
|
return context_processor.load_context_entity(file)
|
|
265
244
|
|
|
@@ -280,9 +259,7 @@ def update_secret(entity: Secret) -> Secret:
|
|
|
280
259
|
|
|
281
260
|
Examples
|
|
282
261
|
--------
|
|
283
|
-
>>> obj = update_secret(
|
|
284
|
-
... obj
|
|
285
|
-
... )
|
|
262
|
+
>>> obj = update_secret(obj)
|
|
286
263
|
"""
|
|
287
264
|
return context_processor.update_context_entity(
|
|
288
265
|
project=entity.project,
|
|
@@ -297,7 +274,6 @@ def delete_secret(
|
|
|
297
274
|
project: str | None = None,
|
|
298
275
|
entity_id: str | None = None,
|
|
299
276
|
delete_all_versions: bool = False,
|
|
300
|
-
**kwargs,
|
|
301
277
|
) -> dict:
|
|
302
278
|
"""
|
|
303
279
|
Delete object from backend.
|
|
@@ -311,9 +287,8 @@ def delete_secret(
|
|
|
311
287
|
entity_id : str
|
|
312
288
|
Entity ID.
|
|
313
289
|
delete_all_versions : bool
|
|
314
|
-
Delete all versions of the named entity.
|
|
315
|
-
|
|
316
|
-
Parameters to pass to the API call.
|
|
290
|
+
Delete all versions of the named entity.
|
|
291
|
+
If True, use entity name instead of entity key as identifier.
|
|
317
292
|
|
|
318
293
|
Returns
|
|
319
294
|
-------
|
|
@@ -323,9 +298,7 @@ def delete_secret(
|
|
|
323
298
|
Examples
|
|
324
299
|
--------
|
|
325
300
|
If delete_all_versions is False:
|
|
326
|
-
>>> obj = delete_secret(
|
|
327
|
-
... "store://my-secret-key"
|
|
328
|
-
... )
|
|
301
|
+
>>> obj = delete_secret("store://my-secret-key")
|
|
329
302
|
|
|
330
303
|
Otherwise:
|
|
331
304
|
>>> obj = delete_secret("my-secret-name"
|
|
@@ -338,5 +311,4 @@ def delete_secret(
|
|
|
338
311
|
project=project,
|
|
339
312
|
entity_id=entity_id,
|
|
340
313
|
delete_all_versions=delete_all_versions,
|
|
341
|
-
**kwargs,
|
|
342
314
|
)
|
|
@@ -8,7 +8,7 @@ import typing
|
|
|
8
8
|
|
|
9
9
|
from digitalhub.entities._base.unversioned.entity import UnversionedEntity
|
|
10
10
|
from digitalhub.entities._commons.enums import EntityTypes
|
|
11
|
-
from digitalhub.entities._processors.
|
|
11
|
+
from digitalhub.entities._processors.processors import context_processor
|
|
12
12
|
from digitalhub.factory.entity import entity_factory
|
|
13
13
|
|
|
14
14
|
if typing.TYPE_CHECKING:
|
digitalhub/entities/task/crud.py
CHANGED
|
@@ -7,9 +7,7 @@ from __future__ import annotations
|
|
|
7
7
|
import typing
|
|
8
8
|
|
|
9
9
|
from digitalhub.entities._commons.enums import EntityTypes
|
|
10
|
-
from digitalhub.entities.
|
|
11
|
-
from digitalhub.entities._processors.context import context_processor
|
|
12
|
-
from digitalhub.utils.exceptions import EntityError
|
|
10
|
+
from digitalhub.entities._processors.processors import context_processor
|
|
13
11
|
|
|
14
12
|
if typing.TYPE_CHECKING:
|
|
15
13
|
from digitalhub.entities.task._base.entity import Task
|
|
@@ -72,7 +70,6 @@ def new_task(
|
|
|
72
70
|
def get_task(
|
|
73
71
|
identifier: str,
|
|
74
72
|
project: str | None = None,
|
|
75
|
-
**kwargs,
|
|
76
73
|
) -> Task:
|
|
77
74
|
"""
|
|
78
75
|
Get object from backend.
|
|
@@ -83,8 +80,6 @@ def get_task(
|
|
|
83
80
|
Entity key (store://...) or entity ID.
|
|
84
81
|
project : str
|
|
85
82
|
Project name.
|
|
86
|
-
**kwargs : dict
|
|
87
|
-
Parameters to pass to the API call.
|
|
88
83
|
|
|
89
84
|
Returns
|
|
90
85
|
-------
|
|
@@ -94,23 +89,31 @@ def get_task(
|
|
|
94
89
|
Examples
|
|
95
90
|
--------
|
|
96
91
|
Using entity key:
|
|
97
|
-
>>> obj = get_task(
|
|
98
|
-
... "store://my-task-key"
|
|
99
|
-
... )
|
|
92
|
+
>>> obj = get_task("store://my-task-key")
|
|
100
93
|
|
|
101
94
|
Using entity ID:
|
|
102
95
|
>>> obj = get_task("my-task-id"
|
|
103
96
|
>>> project="my-project")
|
|
104
97
|
"""
|
|
105
98
|
return context_processor.read_unversioned_entity(
|
|
106
|
-
identifier,
|
|
99
|
+
identifier=identifier,
|
|
107
100
|
entity_type=ENTITY_TYPE,
|
|
108
101
|
project=project,
|
|
109
|
-
**kwargs,
|
|
110
102
|
)
|
|
111
103
|
|
|
112
104
|
|
|
113
|
-
def list_tasks(
|
|
105
|
+
def list_tasks(
|
|
106
|
+
project: str,
|
|
107
|
+
q: str | None = None,
|
|
108
|
+
name: str | None = None,
|
|
109
|
+
kind: str | None = None,
|
|
110
|
+
user: str | None = None,
|
|
111
|
+
state: str | None = None,
|
|
112
|
+
created: str | None = None,
|
|
113
|
+
updated: str | None = None,
|
|
114
|
+
function: str | None = None,
|
|
115
|
+
workflow: str | None = None,
|
|
116
|
+
) -> list[Task]:
|
|
114
117
|
"""
|
|
115
118
|
List all latest version objects from backend.
|
|
116
119
|
|
|
@@ -118,8 +121,24 @@ def list_tasks(project: str, **kwargs) -> list[Task]:
|
|
|
118
121
|
----------
|
|
119
122
|
project : str
|
|
120
123
|
Project name.
|
|
121
|
-
|
|
122
|
-
|
|
124
|
+
q : str
|
|
125
|
+
Query string to filter objects.
|
|
126
|
+
name : str
|
|
127
|
+
Object name.
|
|
128
|
+
kind : str
|
|
129
|
+
Kind of the object.
|
|
130
|
+
user : str
|
|
131
|
+
User that created the object.
|
|
132
|
+
state : str
|
|
133
|
+
Object state.
|
|
134
|
+
created : str
|
|
135
|
+
Creation date filter.
|
|
136
|
+
updated : str
|
|
137
|
+
Update date filter.
|
|
138
|
+
function : str
|
|
139
|
+
Function key filter.
|
|
140
|
+
workflow : str
|
|
141
|
+
Workflow key filter.
|
|
123
142
|
|
|
124
143
|
Returns
|
|
125
144
|
-------
|
|
@@ -128,14 +147,20 @@ def list_tasks(project: str, **kwargs) -> list[Task]:
|
|
|
128
147
|
|
|
129
148
|
Examples
|
|
130
149
|
--------
|
|
131
|
-
>>> objs = list_tasks(
|
|
132
|
-
... project="my-project"
|
|
133
|
-
... )
|
|
150
|
+
>>> objs = list_tasks(project="my-project")
|
|
134
151
|
"""
|
|
135
152
|
return context_processor.list_context_entities(
|
|
136
153
|
project=project,
|
|
137
154
|
entity_type=ENTITY_TYPE,
|
|
138
|
-
|
|
155
|
+
q=q,
|
|
156
|
+
name=name,
|
|
157
|
+
kind=kind,
|
|
158
|
+
user=user,
|
|
159
|
+
state=state,
|
|
160
|
+
created=created,
|
|
161
|
+
updated=updated,
|
|
162
|
+
function=function,
|
|
163
|
+
workflow=workflow,
|
|
139
164
|
)
|
|
140
165
|
|
|
141
166
|
|
|
@@ -166,9 +191,7 @@ def import_task(
|
|
|
166
191
|
|
|
167
192
|
Example
|
|
168
193
|
-------
|
|
169
|
-
>>> obj = import_task(
|
|
170
|
-
... "my-task.yaml"
|
|
171
|
-
... )
|
|
194
|
+
>>> obj = import_task("my-task.yaml")
|
|
172
195
|
"""
|
|
173
196
|
return context_processor.import_context_entity(
|
|
174
197
|
file,
|
|
@@ -194,9 +217,7 @@ def load_task(file: str) -> Task:
|
|
|
194
217
|
|
|
195
218
|
Examples
|
|
196
219
|
--------
|
|
197
|
-
>>> obj = load_task(
|
|
198
|
-
... "my-task.yaml"
|
|
199
|
-
... )
|
|
220
|
+
>>> obj = load_task("my-task.yaml")
|
|
200
221
|
"""
|
|
201
222
|
return context_processor.load_context_entity(file)
|
|
202
223
|
|
|
@@ -217,9 +238,7 @@ def update_task(entity: Task) -> Task:
|
|
|
217
238
|
|
|
218
239
|
Examples
|
|
219
240
|
--------
|
|
220
|
-
>>> obj = update_task(
|
|
221
|
-
... obj
|
|
222
|
-
... )
|
|
241
|
+
>>> obj = update_task(obj)
|
|
223
242
|
"""
|
|
224
243
|
return context_processor.update_context_entity(
|
|
225
244
|
project=entity.project,
|
|
@@ -233,9 +252,7 @@ def delete_task(
|
|
|
233
252
|
identifier: str,
|
|
234
253
|
project: str | None = None,
|
|
235
254
|
entity_id: str | None = None,
|
|
236
|
-
delete_all_versions: bool = False,
|
|
237
255
|
cascade: bool = True,
|
|
238
|
-
**kwargs,
|
|
239
256
|
) -> dict:
|
|
240
257
|
"""
|
|
241
258
|
Delete object from backend.
|
|
@@ -248,8 +265,6 @@ def delete_task(
|
|
|
248
265
|
Project name.
|
|
249
266
|
entity_id : str
|
|
250
267
|
Entity ID.
|
|
251
|
-
delete_all_versions : bool
|
|
252
|
-
Delete all versions of the named entity. If True, use entity name instead of entity key as identifier.
|
|
253
268
|
cascade : bool
|
|
254
269
|
Cascade delete.
|
|
255
270
|
**kwargs : dict
|
|
@@ -262,24 +277,12 @@ def delete_task(
|
|
|
262
277
|
|
|
263
278
|
Examples
|
|
264
279
|
--------
|
|
265
|
-
|
|
266
|
-
>>> obj = delete_task(
|
|
267
|
-
... "store://my-task-key"
|
|
268
|
-
... )
|
|
269
|
-
|
|
270
|
-
Otherwise:
|
|
271
|
-
>>> obj = delete_task("task-name",
|
|
272
|
-
>>> project="my-project",
|
|
273
|
-
>>> delete_all_versions=True)
|
|
280
|
+
>>> obj = delete_task("store://my-task-key")
|
|
274
281
|
"""
|
|
275
|
-
if not is_valid_key(identifier):
|
|
276
|
-
raise EntityError("Task has no name. Use key instead.")
|
|
277
282
|
return context_processor.delete_context_entity(
|
|
278
283
|
identifier=identifier,
|
|
279
284
|
entity_type=ENTITY_TYPE,
|
|
280
285
|
project=project,
|
|
281
286
|
entity_id=entity_id,
|
|
282
|
-
delete_all_versions=delete_all_versions,
|
|
283
287
|
cascade=cascade,
|
|
284
|
-
**kwargs,
|
|
285
288
|
)
|
|
@@ -8,7 +8,7 @@ import typing
|
|
|
8
8
|
|
|
9
9
|
from digitalhub.entities._base.versioned.entity import VersionedEntity
|
|
10
10
|
from digitalhub.entities._commons.enums import EntityTypes
|
|
11
|
-
from digitalhub.entities._processors.
|
|
11
|
+
from digitalhub.entities._processors.processors import context_processor
|
|
12
12
|
|
|
13
13
|
if typing.TYPE_CHECKING:
|
|
14
14
|
from digitalhub.entities._base.entity.metadata import Metadata
|
|
@@ -41,9 +41,5 @@ class Trigger(VersionedEntity):
|
|
|
41
41
|
def stop(self) -> None:
|
|
42
42
|
"""
|
|
43
43
|
Stop trigger.
|
|
44
|
-
|
|
45
|
-
Returns
|
|
46
|
-
-------
|
|
47
|
-
None
|
|
48
44
|
"""
|
|
49
45
|
return context_processor.stop_entity(self.project, self.ENTITY_TYPE, self.id)
|
|
@@ -7,7 +7,7 @@ from __future__ import annotations
|
|
|
7
7
|
import typing
|
|
8
8
|
|
|
9
9
|
from digitalhub.entities._commons.enums import EntityTypes
|
|
10
|
-
from digitalhub.entities._processors.
|
|
10
|
+
from digitalhub.entities._processors.processors import context_processor
|
|
11
11
|
|
|
12
12
|
if typing.TYPE_CHECKING:
|
|
13
13
|
from digitalhub.entities.trigger._base.entity import Trigger
|
|
@@ -91,7 +91,6 @@ def get_trigger(
|
|
|
91
91
|
identifier: str,
|
|
92
92
|
project: str | None = None,
|
|
93
93
|
entity_id: str | None = None,
|
|
94
|
-
**kwargs,
|
|
95
94
|
) -> Trigger:
|
|
96
95
|
"""
|
|
97
96
|
Get object from backend.
|
|
@@ -104,8 +103,6 @@ def get_trigger(
|
|
|
104
103
|
Project name.
|
|
105
104
|
entity_id : str
|
|
106
105
|
Entity ID.
|
|
107
|
-
**kwargs : dict
|
|
108
|
-
Parameters to pass to the API call.
|
|
109
106
|
|
|
110
107
|
Returns
|
|
111
108
|
-------
|
|
@@ -115,9 +112,7 @@ def get_trigger(
|
|
|
115
112
|
Examples
|
|
116
113
|
--------
|
|
117
114
|
Using entity key:
|
|
118
|
-
>>> obj = get_trigger(
|
|
119
|
-
... "store://my-trigger-key"
|
|
120
|
-
... )
|
|
115
|
+
>>> obj = get_trigger("store://my-trigger-key")
|
|
121
116
|
|
|
122
117
|
Using entity name:
|
|
123
118
|
>>> obj = get_trigger("my-trigger-name"
|
|
@@ -125,18 +120,16 @@ def get_trigger(
|
|
|
125
120
|
>>> entity_id="my-trigger-id")
|
|
126
121
|
"""
|
|
127
122
|
return context_processor.read_context_entity(
|
|
128
|
-
identifier,
|
|
123
|
+
identifier=identifier,
|
|
129
124
|
entity_type=ENTITY_TYPE,
|
|
130
125
|
project=project,
|
|
131
126
|
entity_id=entity_id,
|
|
132
|
-
**kwargs,
|
|
133
127
|
)
|
|
134
128
|
|
|
135
129
|
|
|
136
130
|
def get_trigger_versions(
|
|
137
131
|
identifier: str,
|
|
138
132
|
project: str | None = None,
|
|
139
|
-
**kwargs,
|
|
140
133
|
) -> list[Trigger]:
|
|
141
134
|
"""
|
|
142
135
|
Get object versions from backend.
|
|
@@ -147,8 +140,6 @@ def get_trigger_versions(
|
|
|
147
140
|
Entity key (store://...) or entity name.
|
|
148
141
|
project : str
|
|
149
142
|
Project name.
|
|
150
|
-
**kwargs : dict
|
|
151
|
-
Parameters to pass to the API call.
|
|
152
143
|
|
|
153
144
|
Returns
|
|
154
145
|
-------
|
|
@@ -158,23 +149,31 @@ def get_trigger_versions(
|
|
|
158
149
|
Examples
|
|
159
150
|
--------
|
|
160
151
|
Using entity key:
|
|
161
|
-
>>> objs = get_trigger_versions(
|
|
162
|
-
... "store://my-trigger-key"
|
|
163
|
-
... )
|
|
152
|
+
>>> objs = get_trigger_versions("store://my-trigger-key")
|
|
164
153
|
|
|
165
154
|
Using entity name:
|
|
166
155
|
>>> objs = get_trigger_versions("my-trigger-name",
|
|
167
156
|
>>> project="my-project")
|
|
168
157
|
"""
|
|
169
158
|
return context_processor.read_context_entity_versions(
|
|
170
|
-
identifier,
|
|
159
|
+
identifier=identifier,
|
|
171
160
|
entity_type=ENTITY_TYPE,
|
|
172
161
|
project=project,
|
|
173
|
-
**kwargs,
|
|
174
162
|
)
|
|
175
163
|
|
|
176
164
|
|
|
177
|
-
def list_triggers(
|
|
165
|
+
def list_triggers(
|
|
166
|
+
project: str,
|
|
167
|
+
q: str | None = None,
|
|
168
|
+
name: str | None = None,
|
|
169
|
+
kind: str | None = None,
|
|
170
|
+
user: str | None = None,
|
|
171
|
+
state: str | None = None,
|
|
172
|
+
created: str | None = None,
|
|
173
|
+
updated: str | None = None,
|
|
174
|
+
version: str | None = None,
|
|
175
|
+
task: str | None = None,
|
|
176
|
+
) -> list[Trigger]:
|
|
178
177
|
"""
|
|
179
178
|
List all latest version objects from backend.
|
|
180
179
|
|
|
@@ -182,8 +181,24 @@ def list_triggers(project: str, **kwargs) -> list[Trigger]:
|
|
|
182
181
|
----------
|
|
183
182
|
project : str
|
|
184
183
|
Project name.
|
|
185
|
-
|
|
186
|
-
|
|
184
|
+
q : str
|
|
185
|
+
Query string to filter objects.
|
|
186
|
+
name : str
|
|
187
|
+
Object name.
|
|
188
|
+
kind : str
|
|
189
|
+
Kind of the object.
|
|
190
|
+
user : str
|
|
191
|
+
User that created the object.
|
|
192
|
+
state : str
|
|
193
|
+
Object state.
|
|
194
|
+
created : str
|
|
195
|
+
Creation date filter.
|
|
196
|
+
updated : str
|
|
197
|
+
Update date filter.
|
|
198
|
+
version : str
|
|
199
|
+
Object version, default is latest.
|
|
200
|
+
task : str
|
|
201
|
+
Task string filter.
|
|
187
202
|
|
|
188
203
|
Returns
|
|
189
204
|
-------
|
|
@@ -192,14 +207,20 @@ def list_triggers(project: str, **kwargs) -> list[Trigger]:
|
|
|
192
207
|
|
|
193
208
|
Examples
|
|
194
209
|
--------
|
|
195
|
-
>>> objs = list_triggers(
|
|
196
|
-
... project="my-project"
|
|
197
|
-
... )
|
|
210
|
+
>>> objs = list_triggers(project="my-project")
|
|
198
211
|
"""
|
|
199
212
|
return context_processor.list_context_entities(
|
|
200
213
|
project=project,
|
|
201
214
|
entity_type=ENTITY_TYPE,
|
|
202
|
-
|
|
215
|
+
q=q,
|
|
216
|
+
name=name,
|
|
217
|
+
kind=kind,
|
|
218
|
+
user=user,
|
|
219
|
+
state=state,
|
|
220
|
+
created=created,
|
|
221
|
+
updated=updated,
|
|
222
|
+
version=version,
|
|
223
|
+
task=task,
|
|
203
224
|
)
|
|
204
225
|
|
|
205
226
|
|
|
@@ -230,9 +251,7 @@ def import_trigger(
|
|
|
230
251
|
|
|
231
252
|
Examples
|
|
232
253
|
--------
|
|
233
|
-
>>> obj = import_trigger(
|
|
234
|
-
... "my-trigger.yaml"
|
|
235
|
-
... )
|
|
254
|
+
>>> obj = import_trigger("my-trigger.yaml")
|
|
236
255
|
"""
|
|
237
256
|
return context_processor.import_context_entity(
|
|
238
257
|
file,
|
|
@@ -258,9 +277,7 @@ def load_trigger(file: str) -> Trigger:
|
|
|
258
277
|
|
|
259
278
|
Examples
|
|
260
279
|
--------
|
|
261
|
-
>>> obj = load_trigger(
|
|
262
|
-
... "my-trigger.yaml"
|
|
263
|
-
... )
|
|
280
|
+
>>> obj = load_trigger("my-trigger.yaml")
|
|
264
281
|
"""
|
|
265
282
|
return context_processor.load_context_entity(file)
|
|
266
283
|
|
|
@@ -281,11 +298,7 @@ def update_trigger(entity: Trigger) -> Trigger:
|
|
|
281
298
|
|
|
282
299
|
Examples
|
|
283
300
|
--------
|
|
284
|
-
>>> obj = (
|
|
285
|
-
... update_trigger(
|
|
286
|
-
... obj
|
|
287
|
-
... )
|
|
288
|
-
... )
|
|
301
|
+
>>> obj = update_trigger(obj)
|
|
289
302
|
"""
|
|
290
303
|
return context_processor.update_context_entity(
|
|
291
304
|
project=entity.project,
|
|
@@ -300,7 +313,6 @@ def delete_trigger(
|
|
|
300
313
|
project: str | None = None,
|
|
301
314
|
entity_id: str | None = None,
|
|
302
315
|
delete_all_versions: bool = False,
|
|
303
|
-
**kwargs,
|
|
304
316
|
) -> dict:
|
|
305
317
|
"""
|
|
306
318
|
Delete object from backend.
|
|
@@ -314,9 +326,8 @@ def delete_trigger(
|
|
|
314
326
|
entity_id : str
|
|
315
327
|
Entity ID.
|
|
316
328
|
delete_all_versions : bool
|
|
317
|
-
Delete all versions of the named entity.
|
|
318
|
-
|
|
319
|
-
Parameters to pass to the API call.
|
|
329
|
+
Delete all versions of the named entity.
|
|
330
|
+
If True, use entity name instead of entity key as identifier.
|
|
320
331
|
|
|
321
332
|
Returns
|
|
322
333
|
-------
|
|
@@ -326,9 +337,7 @@ def delete_trigger(
|
|
|
326
337
|
Examples
|
|
327
338
|
--------
|
|
328
339
|
If delete_all_versions is False:
|
|
329
|
-
>>> obj = delete_trigger(
|
|
330
|
-
... "store://my-trigger-key"
|
|
331
|
-
... )
|
|
340
|
+
>>> obj = delete_trigger("store://my-trigger-key")
|
|
332
341
|
|
|
333
342
|
Otherwise:
|
|
334
343
|
>>> obj = delete_trigger("my-trigger-name"
|
|
@@ -341,5 +350,4 @@ def delete_trigger(
|
|
|
341
350
|
project=project,
|
|
342
351
|
entity_id=entity_id,
|
|
343
352
|
delete_all_versions=delete_all_versions,
|
|
344
|
-
**kwargs,
|
|
345
353
|
)
|