solari-runloop-compat 0.1.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.
- solari_runloop/__init__.py +42 -0
- solari_runloop/_branding.py +10 -0
- solari_runloop/_client.py +107 -0
- solari_runloop/_config.py +57 -0
- solari_runloop/_context.py +91 -0
- solari_runloop/_dockerfile.py +348 -0
- solari_runloop/_exceptions.py +122 -0
- solari_runloop/_gateway.py +1048 -0
- solari_runloop/_guest/solari-run.sh +14 -0
- solari_runloop/_guest/solari_extract.py +101 -0
- solari_runloop/_guest/solari_sizecheck.py +14 -0
- solari_runloop/_loop.py +54 -0
- solari_runloop/_mapping.py +322 -0
- solari_runloop/_models.py +13 -0
- solari_runloop/_resources.py +416 -0
- solari_runloop/_sync.py +76 -0
- solari_runloop/lib/__init__.py +0 -0
- solari_runloop/lib/polling.py +118 -0
- solari_runloop/pagination.py +66 -0
- solari_runloop/sdk.py +594 -0
- solari_runloop/types/__init__.py +17 -0
- solari_runloop/types/blueprint_build_log.py +16 -0
- solari_runloop/types/blueprint_build_logs_list_view.py +16 -0
- solari_runloop/types/blueprint_build_parameters.py +123 -0
- solari_runloop/types/blueprint_view.py +97 -0
- solari_runloop/types/devbox_async_execution_detail_view.py +46 -0
- solari_runloop/types/devbox_execution_detail_view.py +24 -0
- solari_runloop/types/devbox_snapshot_list_view.py +17 -0
- solari_runloop/types/devbox_snapshot_view.py +33 -0
- solari_runloop/types/devbox_view.py +176 -0
- solari_runloop/types/devboxes/__init__.py +0 -0
- solari_runloop/types/devboxes/devbox_logs_list_view.py +39 -0
- solari_runloop/types/secret_view.py +23 -0
- solari_runloop/types/shared/__init__.py +0 -0
- solari_runloop/types/shared/after_idle.py +15 -0
- solari_runloop/types/shared/code_mount_parameters.py +30 -0
- solari_runloop/types/shared/launch_parameters.py +104 -0
- solari_runloop/types/shared/lifecycle_configuration.py +38 -0
- solari_runloop/types/shared/lifecycle_hooks.py +28 -0
- solari_runloop/types/shared/resume_triggers.py +17 -0
- solari_runloop/types/tunnel_view.py +47 -0
- solari_runloop_compat-0.1.0.dist-info/METADATA +47 -0
- solari_runloop_compat-0.1.0.dist-info/RECORD +45 -0
- solari_runloop_compat-0.1.0.dist-info/WHEEL +4 -0
- solari_runloop_compat-0.1.0.dist-info/licenses/NOTICE +25 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"""Runloop's exception hierarchy, same names and attributes where a Solari call can raise them.
|
|
2
|
+
|
|
3
|
+
Solari gateway errors are translated by :func:`solari_runloop._mapping.map_error`; the original
|
|
4
|
+
``{code, error, message, retryable}`` JSON stays available as ``.body``.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from typing import Any, Optional
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"RunloopError",
|
|
13
|
+
"APIError",
|
|
14
|
+
"APIResponseValidationError",
|
|
15
|
+
"APIStatusError",
|
|
16
|
+
"APIConnectionError",
|
|
17
|
+
"APITimeoutError",
|
|
18
|
+
"BadRequestError",
|
|
19
|
+
"AuthenticationError",
|
|
20
|
+
"PermissionDeniedError",
|
|
21
|
+
"NotFoundError",
|
|
22
|
+
"ConflictError",
|
|
23
|
+
"UnprocessableEntityError",
|
|
24
|
+
"RateLimitError",
|
|
25
|
+
"InternalServerError",
|
|
26
|
+
"SolariCompatUnsupported",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class RunloopError(Exception):
|
|
31
|
+
pass
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class APIError(RunloopError):
|
|
35
|
+
message: str
|
|
36
|
+
request: Optional[Any]
|
|
37
|
+
body: Optional[object]
|
|
38
|
+
|
|
39
|
+
def __init__(self, message: str, request: Optional[Any] = None, *, body: Optional[object] = None) -> None:
|
|
40
|
+
super().__init__(message)
|
|
41
|
+
self.message = message
|
|
42
|
+
self.request = request
|
|
43
|
+
self.body = body
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class APIResponseValidationError(APIError):
|
|
47
|
+
def __init__(self, message: Optional[str] = None, *, body: Optional[object] = None, response: Optional[Any] = None) -> None:
|
|
48
|
+
super().__init__(message or "Data returned by API invalid for expected schema.", None, body=body)
|
|
49
|
+
self.response = response
|
|
50
|
+
self.status_code: Optional[int] = getattr(response, "status_code", None)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class APIStatusError(APIError):
|
|
54
|
+
"""A 4xx/5xx from the Solari gateway."""
|
|
55
|
+
|
|
56
|
+
status_code: int
|
|
57
|
+
|
|
58
|
+
def __init__(
|
|
59
|
+
self,
|
|
60
|
+
message: str,
|
|
61
|
+
*,
|
|
62
|
+
status_code: Optional[int] = None,
|
|
63
|
+
body: Optional[object] = None,
|
|
64
|
+
response: Optional[Any] = None,
|
|
65
|
+
) -> None:
|
|
66
|
+
super().__init__(message, None, body=body)
|
|
67
|
+
self.response = response
|
|
68
|
+
if status_code is not None:
|
|
69
|
+
self.status_code = status_code
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class APIConnectionError(APIError):
|
|
73
|
+
def __init__(self, message: str = "Connection error.", request: Optional[Any] = None) -> None:
|
|
74
|
+
super().__init__(message, request, body=None)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class APITimeoutError(APIConnectionError):
|
|
78
|
+
def __init__(self, request: Optional[Any] = None) -> None:
|
|
79
|
+
super().__init__("Request timed out.", request)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class BadRequestError(APIStatusError):
|
|
83
|
+
status_code = 400
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class AuthenticationError(APIStatusError):
|
|
87
|
+
status_code = 401
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class PermissionDeniedError(APIStatusError):
|
|
91
|
+
status_code = 403
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class NotFoundError(APIStatusError):
|
|
95
|
+
status_code = 404
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class ConflictError(APIStatusError):
|
|
99
|
+
status_code = 409
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class UnprocessableEntityError(APIStatusError):
|
|
103
|
+
status_code = 422
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class RateLimitError(APIStatusError):
|
|
107
|
+
status_code = 429
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class InternalServerError(APIStatusError):
|
|
111
|
+
pass
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class SolariCompatUnsupported(APIError):
|
|
115
|
+
"""The Runloop feature has no Solari equivalent yet (see COMPAT.md). Never silently ignored."""
|
|
116
|
+
|
|
117
|
+
def __init__(self, feature: str, hint: str = "") -> None:
|
|
118
|
+
msg = f"{feature} is not supported by the Solari compatibility layer yet."
|
|
119
|
+
if hint:
|
|
120
|
+
msg += f" {hint}"
|
|
121
|
+
super().__init__(msg, None, body=None)
|
|
122
|
+
self.feature = feature
|