dominus-sdk-python 6.2.0__py3-none-any.whl → 6.3.0__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.
- dominus/__init__.py +15 -1
- dominus/errors.py +41 -1
- dominus/namespaces/stash.py +160 -0
- {dominus_sdk_python-6.2.0.dist-info → dominus_sdk_python-6.3.0.dist-info}/METADATA +1 -1
- {dominus_sdk_python-6.2.0.dist-info → dominus_sdk_python-6.3.0.dist-info}/RECORD +7 -7
- {dominus_sdk_python-6.2.0.dist-info → dominus_sdk_python-6.3.0.dist-info}/WHEEL +0 -0
- {dominus_sdk_python-6.2.0.dist-info → dominus_sdk_python-6.3.0.dist-info}/top_level.txt +0 -0
dominus/__init__.py
CHANGED
|
@@ -160,12 +160,19 @@ from .errors import (
|
|
|
160
160
|
ValidationError,
|
|
161
161
|
ConflictError,
|
|
162
162
|
ServiceError,
|
|
163
|
+
StashBookmarkArtifactNotFound,
|
|
164
|
+
StashBookmarkInvalidVersionRef,
|
|
165
|
+
StashBookmarkDuplicateName,
|
|
166
|
+
StashBookmarkUpstreamRejected,
|
|
167
|
+
StashWatchInvalidWebhookUrl,
|
|
168
|
+
StashWatchUpstreamRejected,
|
|
169
|
+
StashWatchNotFound,
|
|
163
170
|
SecureTableError,
|
|
164
171
|
ConnectionError as DominusConnectionError,
|
|
165
172
|
TimeoutError as DominusTimeoutError,
|
|
166
173
|
)
|
|
167
174
|
|
|
168
|
-
__version__ = "6.
|
|
175
|
+
__version__ = "6.3.0"
|
|
169
176
|
__all__ = [
|
|
170
177
|
# Main SDK instance
|
|
171
178
|
"dominus",
|
|
@@ -250,6 +257,13 @@ __all__ = [
|
|
|
250
257
|
"ValidationError",
|
|
251
258
|
"ConflictError",
|
|
252
259
|
"ServiceError",
|
|
260
|
+
"StashBookmarkArtifactNotFound",
|
|
261
|
+
"StashBookmarkInvalidVersionRef",
|
|
262
|
+
"StashBookmarkDuplicateName",
|
|
263
|
+
"StashBookmarkUpstreamRejected",
|
|
264
|
+
"StashWatchInvalidWebhookUrl",
|
|
265
|
+
"StashWatchUpstreamRejected",
|
|
266
|
+
"StashWatchNotFound",
|
|
253
267
|
"SecureTableError",
|
|
254
268
|
"DominusConnectionError",
|
|
255
269
|
"DominusTimeoutError",
|
dominus/errors.py
CHANGED
|
@@ -205,6 +205,34 @@ class ServiceError(DominusError):
|
|
|
205
205
|
super().__init__(message, status_code, details, endpoint)
|
|
206
206
|
|
|
207
207
|
|
|
208
|
+
class StashBookmarkArtifactNotFound(NotFoundError):
|
|
209
|
+
"""Raised when a stash artifact bookmark target cannot be found."""
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
class StashBookmarkInvalidVersionRef(ValidationError):
|
|
213
|
+
"""Raised when a stash artifact bookmark version_ref is invalid."""
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
class StashBookmarkDuplicateName(ConflictError):
|
|
217
|
+
"""Raised when a stash artifact bookmark name is already in use."""
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
class StashBookmarkUpstreamRejected(ServiceError):
|
|
221
|
+
"""Raised when the artifact backend rejects a stash bookmark operation."""
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
class StashWatchInvalidWebhookUrl(ValidationError):
|
|
225
|
+
"""Raised when a stash artifact watcher webhook_url is invalid."""
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
class StashWatchUpstreamRejected(ServiceError):
|
|
229
|
+
"""Raised when the artifact backend rejects a stash watch operation."""
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
class StashWatchNotFound(NotFoundError):
|
|
233
|
+
"""Raised when a stash artifact watcher cannot be found."""
|
|
234
|
+
|
|
235
|
+
|
|
208
236
|
class ConnectionError(DominusError):
|
|
209
237
|
"""Raised when connection to the backend fails."""
|
|
210
238
|
|
|
@@ -244,6 +272,17 @@ class SecureTableError(DominusError):
|
|
|
244
272
|
super().__init__(message, status_code, details, endpoint)
|
|
245
273
|
|
|
246
274
|
|
|
275
|
+
STASH_ERROR_CLASSES = {
|
|
276
|
+
"stash.bookmark.artifact_not_found": StashBookmarkArtifactNotFound,
|
|
277
|
+
"stash.bookmark.invalid_version_ref": StashBookmarkInvalidVersionRef,
|
|
278
|
+
"stash.bookmark.duplicate_name": StashBookmarkDuplicateName,
|
|
279
|
+
"stash.bookmark.upstream_rejected": StashBookmarkUpstreamRejected,
|
|
280
|
+
"stash.watch.invalid_webhook_url": StashWatchInvalidWebhookUrl,
|
|
281
|
+
"stash.watch.upstream_rejected": StashWatchUpstreamRejected,
|
|
282
|
+
"stash.watch.not_found": StashWatchNotFound,
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
|
|
247
286
|
def raise_for_status(
|
|
248
287
|
status_code: int,
|
|
249
288
|
message: str,
|
|
@@ -262,6 +301,7 @@ def raise_for_status(
|
|
|
262
301
|
Raises:
|
|
263
302
|
Appropriate DominusError subclass
|
|
264
303
|
"""
|
|
304
|
+
code = _first_string((details or {}).get("code"))
|
|
265
305
|
error_classes = {
|
|
266
306
|
400: ValidationError,
|
|
267
307
|
401: AuthenticationError,
|
|
@@ -274,5 +314,5 @@ def raise_for_status(
|
|
|
274
314
|
504: TimeoutError,
|
|
275
315
|
}
|
|
276
316
|
|
|
277
|
-
error_class = error_classes.get(status_code, DominusError)
|
|
317
|
+
error_class = STASH_ERROR_CLASSES.get(code) or error_classes.get(status_code, DominusError)
|
|
278
318
|
raise error_class(message, status_code, details, endpoint)
|
dominus/namespaces/stash.py
CHANGED
|
@@ -6,10 +6,18 @@ stores items in each project's ``stash.*`` schema and transparently falls
|
|
|
6
6
|
back to a designated shared project on read.
|
|
7
7
|
"""
|
|
8
8
|
from typing import Any, Dict, List, Optional, TYPE_CHECKING
|
|
9
|
+
from urllib.parse import urlencode
|
|
9
10
|
|
|
10
11
|
if TYPE_CHECKING:
|
|
11
12
|
from ..start import Dominus
|
|
12
13
|
|
|
14
|
+
BookmarkRef = Dict[str, Any]
|
|
15
|
+
WatcherRef = Dict[str, Any]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _facade_query(*, env: str, kind: str, scope: str, key: str) -> str:
|
|
19
|
+
return urlencode({"env": env, "kind": kind, "scope": scope, "key": key})
|
|
20
|
+
|
|
13
21
|
|
|
14
22
|
class StashNamespace:
|
|
15
23
|
"""
|
|
@@ -273,3 +281,155 @@ class StashNamespace:
|
|
|
273
281
|
body=body,
|
|
274
282
|
use_gateway=True,
|
|
275
283
|
)
|
|
284
|
+
|
|
285
|
+
async def bookmark(
|
|
286
|
+
self,
|
|
287
|
+
*,
|
|
288
|
+
env: str,
|
|
289
|
+
kind: str,
|
|
290
|
+
scope: str,
|
|
291
|
+
key: str,
|
|
292
|
+
name: str,
|
|
293
|
+
version_ref: str,
|
|
294
|
+
timeout: float = 30.0,
|
|
295
|
+
) -> BookmarkRef:
|
|
296
|
+
"""Create or update a named bookmark for a stash artifact facade item."""
|
|
297
|
+
return await self._client._request(
|
|
298
|
+
endpoint="/svc/stash/bookmark",
|
|
299
|
+
method="POST",
|
|
300
|
+
body={
|
|
301
|
+
"env": env,
|
|
302
|
+
"kind": kind,
|
|
303
|
+
"scope": scope,
|
|
304
|
+
"key": key,
|
|
305
|
+
"name": name,
|
|
306
|
+
"version_ref": version_ref,
|
|
307
|
+
},
|
|
308
|
+
use_gateway=True,
|
|
309
|
+
timeout=timeout,
|
|
310
|
+
)
|
|
311
|
+
|
|
312
|
+
async def unbookmark(
|
|
313
|
+
self,
|
|
314
|
+
*,
|
|
315
|
+
env: str,
|
|
316
|
+
kind: str,
|
|
317
|
+
scope: str,
|
|
318
|
+
key: str,
|
|
319
|
+
name: str,
|
|
320
|
+
timeout: float = 30.0,
|
|
321
|
+
) -> None:
|
|
322
|
+
"""Remove a named bookmark from a stash artifact facade item."""
|
|
323
|
+
await self._client._request(
|
|
324
|
+
endpoint="/svc/stash/unbookmark",
|
|
325
|
+
method="POST",
|
|
326
|
+
body={
|
|
327
|
+
"env": env,
|
|
328
|
+
"kind": kind,
|
|
329
|
+
"scope": scope,
|
|
330
|
+
"key": key,
|
|
331
|
+
"name": name,
|
|
332
|
+
},
|
|
333
|
+
use_gateway=True,
|
|
334
|
+
timeout=timeout,
|
|
335
|
+
)
|
|
336
|
+
return None
|
|
337
|
+
|
|
338
|
+
async def watch(
|
|
339
|
+
self,
|
|
340
|
+
*,
|
|
341
|
+
env: str,
|
|
342
|
+
kind: str,
|
|
343
|
+
scope: str,
|
|
344
|
+
key: str,
|
|
345
|
+
watcher_name: str,
|
|
346
|
+
webhook_url: str,
|
|
347
|
+
timeout: float = 30.0,
|
|
348
|
+
) -> WatcherRef:
|
|
349
|
+
"""Create or update a webhook watcher for a stash artifact facade item."""
|
|
350
|
+
return await self._client._request(
|
|
351
|
+
endpoint="/svc/stash/watch",
|
|
352
|
+
method="POST",
|
|
353
|
+
body={
|
|
354
|
+
"env": env,
|
|
355
|
+
"kind": kind,
|
|
356
|
+
"scope": scope,
|
|
357
|
+
"key": key,
|
|
358
|
+
"watcher_name": watcher_name,
|
|
359
|
+
"webhook_url": webhook_url,
|
|
360
|
+
},
|
|
361
|
+
use_gateway=True,
|
|
362
|
+
timeout=timeout,
|
|
363
|
+
)
|
|
364
|
+
|
|
365
|
+
async def unwatch(
|
|
366
|
+
self,
|
|
367
|
+
*,
|
|
368
|
+
env: str,
|
|
369
|
+
kind: str,
|
|
370
|
+
scope: str,
|
|
371
|
+
key: str,
|
|
372
|
+
watcher_name: str,
|
|
373
|
+
timeout: float = 30.0,
|
|
374
|
+
) -> None:
|
|
375
|
+
"""Remove a webhook watcher from a stash artifact facade item."""
|
|
376
|
+
await self._client._request(
|
|
377
|
+
endpoint="/svc/stash/unwatch",
|
|
378
|
+
method="POST",
|
|
379
|
+
body={
|
|
380
|
+
"env": env,
|
|
381
|
+
"kind": kind,
|
|
382
|
+
"scope": scope,
|
|
383
|
+
"key": key,
|
|
384
|
+
"watcher_name": watcher_name,
|
|
385
|
+
},
|
|
386
|
+
use_gateway=True,
|
|
387
|
+
timeout=timeout,
|
|
388
|
+
)
|
|
389
|
+
return None
|
|
390
|
+
|
|
391
|
+
async def list_bookmarks(
|
|
392
|
+
self,
|
|
393
|
+
*,
|
|
394
|
+
env: str,
|
|
395
|
+
kind: str,
|
|
396
|
+
scope: str,
|
|
397
|
+
key: str,
|
|
398
|
+
timeout: float = 30.0,
|
|
399
|
+
) -> List[BookmarkRef]:
|
|
400
|
+
"""List bookmark refs for a stash artifact facade item."""
|
|
401
|
+
result = await self._client._request(
|
|
402
|
+
endpoint=f"/svc/stash/bookmark/list?{_facade_query(env=env, kind=kind, scope=scope, key=key)}",
|
|
403
|
+
method="GET",
|
|
404
|
+
use_gateway=True,
|
|
405
|
+
timeout=timeout,
|
|
406
|
+
)
|
|
407
|
+
if isinstance(result, list):
|
|
408
|
+
return result
|
|
409
|
+
if isinstance(result, dict):
|
|
410
|
+
bookmarks = result.get("bookmarks")
|
|
411
|
+
return bookmarks if isinstance(bookmarks, list) else []
|
|
412
|
+
return []
|
|
413
|
+
|
|
414
|
+
async def list_watchers(
|
|
415
|
+
self,
|
|
416
|
+
*,
|
|
417
|
+
env: str,
|
|
418
|
+
kind: str,
|
|
419
|
+
scope: str,
|
|
420
|
+
key: str,
|
|
421
|
+
timeout: float = 30.0,
|
|
422
|
+
) -> List[WatcherRef]:
|
|
423
|
+
"""List watcher refs for a stash artifact facade item."""
|
|
424
|
+
result = await self._client._request(
|
|
425
|
+
endpoint=f"/svc/stash/watch/list?{_facade_query(env=env, kind=kind, scope=scope, key=key)}",
|
|
426
|
+
method="GET",
|
|
427
|
+
use_gateway=True,
|
|
428
|
+
timeout=timeout,
|
|
429
|
+
)
|
|
430
|
+
if isinstance(result, list):
|
|
431
|
+
return result
|
|
432
|
+
if isinstance(result, dict):
|
|
433
|
+
watchers = result.get("watchers")
|
|
434
|
+
return watchers if isinstance(watchers, list) else []
|
|
435
|
+
return []
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
dominus/__init__.py,sha256=
|
|
2
|
-
dominus/errors.py,sha256=
|
|
1
|
+
dominus/__init__.py,sha256=ufIz_THCMp-6QD7Q9ptReUaM8OItGXsRGAsZuKcSbI8,7584
|
|
2
|
+
dominus/errors.py,sha256=mni7otKhnwMUle99hkBOgLt2AeDCaAnqydaYsqWKWwM,9994
|
|
3
3
|
dominus/start.py,sha256=ofvuNx6aNRijs3qRBI9r2UOzw2LV59ncZP8BoIOj2UU,50385
|
|
4
4
|
dominus/config/__init__.py,sha256=nvLLNh4dM_MCqcfF3XFS2NnVn44q0RYHEfAPP-2G5To,434
|
|
5
5
|
dominus/config/endpoints.py,sha256=IFioVY3jQ5Mqy65L6rNbEXyPUfYTaXRQkfyGdKv33A8,4140
|
|
@@ -36,12 +36,12 @@ dominus/namespaces/recipes.py,sha256=vBe09bnqP4p9DCoYll3yXk81PPGyBj0thw746wyV8AI
|
|
|
36
36
|
dominus/namespaces/redis.py,sha256=1joYhewLGdN4-OCYJu5rvhsF5yORUUfVtBrgjzLKAzs,19337
|
|
37
37
|
dominus/namespaces/secrets.py,sha256=od8AKgENwW6U-kVfIX3DSphXKeJA6XC-SxbGqsxhhUk,6253
|
|
38
38
|
dominus/namespaces/secure.py,sha256=9idGY5R6k7b-JM1SAF_1Gt-YV5OempyxFBflgLJieLo,7168
|
|
39
|
-
dominus/namespaces/stash.py,sha256=
|
|
39
|
+
dominus/namespaces/stash.py,sha256=Gos3OjWD45ODgKAlSz0X5zUOvIN9yivlNTPkqvU69EE,14418
|
|
40
40
|
dominus/namespaces/sync.py,sha256=mGwMNwc_iWoKgS94n1staPdsKBHNvliMG7omokl7Qmk,2198
|
|
41
41
|
dominus/namespaces/warden.py,sha256=ebbCeBJJwK9uALEj2aDbvWJ5HTlOXOpXJOwzokH1cso,1139
|
|
42
42
|
dominus/namespaces/workflow.py,sha256=_PF7-9HtkCWhSAvBAq4g-e_43eTb7KjPHAKWmToHvBo,48474
|
|
43
43
|
dominus/services/__init__.py,sha256=LQl5sx6DHhX1xCN3MRoUgffxqwm3Mfm525hijyFods8,43
|
|
44
|
-
dominus_sdk_python-6.
|
|
45
|
-
dominus_sdk_python-6.
|
|
46
|
-
dominus_sdk_python-6.
|
|
47
|
-
dominus_sdk_python-6.
|
|
44
|
+
dominus_sdk_python-6.3.0.dist-info/METADATA,sha256=NAkxpwSdhyrbZVI5br3Lf0MZzZWpoUGztmkWHkax4Us,9852
|
|
45
|
+
dominus_sdk_python-6.3.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
46
|
+
dominus_sdk_python-6.3.0.dist-info/top_level.txt,sha256=515zxMIbX0DpheRbjvNqKIt_AFqdFjX41jtyp_SqLf4,8
|
|
47
|
+
dominus_sdk_python-6.3.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|