moru 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.
- moru/__init__.py +174 -0
- moru/api/__init__.py +164 -0
- moru/api/client/__init__.py +8 -0
- moru/api/client/api/__init__.py +1 -0
- moru/api/client/api/sandboxes/__init__.py +1 -0
- moru/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py +161 -0
- moru/api/client/api/sandboxes/get_sandboxes.py +176 -0
- moru/api/client/api/sandboxes/get_sandboxes_metrics.py +173 -0
- moru/api/client/api/sandboxes/get_sandboxes_sandbox_id.py +163 -0
- moru/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py +199 -0
- moru/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py +212 -0
- moru/api/client/api/sandboxes/get_v2_sandboxes.py +230 -0
- moru/api/client/api/sandboxes/post_sandboxes.py +172 -0
- moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py +193 -0
- moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_pause.py +165 -0
- moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py +181 -0
- moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_resume.py +189 -0
- moru/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py +193 -0
- moru/api/client/api/templates/__init__.py +1 -0
- moru/api/client/api/templates/delete_templates_template_id.py +157 -0
- moru/api/client/api/templates/get_templates.py +172 -0
- moru/api/client/api/templates/get_templates_template_id.py +195 -0
- moru/api/client/api/templates/get_templates_template_id_builds_build_id_status.py +217 -0
- moru/api/client/api/templates/get_templates_template_id_files_hash.py +180 -0
- moru/api/client/api/templates/patch_templates_template_id.py +183 -0
- moru/api/client/api/templates/post_templates.py +172 -0
- moru/api/client/api/templates/post_templates_template_id.py +181 -0
- moru/api/client/api/templates/post_templates_template_id_builds_build_id.py +170 -0
- moru/api/client/api/templates/post_v2_templates.py +172 -0
- moru/api/client/api/templates/post_v3_templates.py +172 -0
- moru/api/client/api/templates/post_v_2_templates_template_id_builds_build_id.py +192 -0
- moru/api/client/client.py +286 -0
- moru/api/client/errors.py +16 -0
- moru/api/client/models/__init__.py +123 -0
- moru/api/client/models/aws_registry.py +85 -0
- moru/api/client/models/aws_registry_type.py +8 -0
- moru/api/client/models/build_log_entry.py +89 -0
- moru/api/client/models/build_status_reason.py +95 -0
- moru/api/client/models/connect_sandbox.py +59 -0
- moru/api/client/models/created_access_token.py +100 -0
- moru/api/client/models/created_team_api_key.py +166 -0
- moru/api/client/models/disk_metrics.py +91 -0
- moru/api/client/models/error.py +67 -0
- moru/api/client/models/gcp_registry.py +69 -0
- moru/api/client/models/gcp_registry_type.py +8 -0
- moru/api/client/models/general_registry.py +77 -0
- moru/api/client/models/general_registry_type.py +8 -0
- moru/api/client/models/identifier_masking_details.py +83 -0
- moru/api/client/models/listed_sandbox.py +154 -0
- moru/api/client/models/log_level.py +11 -0
- moru/api/client/models/max_team_metric.py +78 -0
- moru/api/client/models/mcp_type_0.py +44 -0
- moru/api/client/models/new_access_token.py +59 -0
- moru/api/client/models/new_sandbox.py +172 -0
- moru/api/client/models/new_team_api_key.py +59 -0
- moru/api/client/models/node.py +155 -0
- moru/api/client/models/node_detail.py +165 -0
- moru/api/client/models/node_metrics.py +122 -0
- moru/api/client/models/node_status.py +11 -0
- moru/api/client/models/node_status_change.py +79 -0
- moru/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py +59 -0
- moru/api/client/models/post_sandboxes_sandbox_id_timeout_body.py +59 -0
- moru/api/client/models/resumed_sandbox.py +68 -0
- moru/api/client/models/sandbox.py +145 -0
- moru/api/client/models/sandbox_detail.py +183 -0
- moru/api/client/models/sandbox_log.py +70 -0
- moru/api/client/models/sandbox_log_entry.py +93 -0
- moru/api/client/models/sandbox_log_entry_fields.py +44 -0
- moru/api/client/models/sandbox_logs.py +91 -0
- moru/api/client/models/sandbox_metric.py +118 -0
- moru/api/client/models/sandbox_network_config.py +92 -0
- moru/api/client/models/sandbox_state.py +9 -0
- moru/api/client/models/sandboxes_with_metrics.py +59 -0
- moru/api/client/models/team.py +83 -0
- moru/api/client/models/team_api_key.py +158 -0
- moru/api/client/models/team_metric.py +86 -0
- moru/api/client/models/team_user.py +68 -0
- moru/api/client/models/template.py +217 -0
- moru/api/client/models/template_build.py +139 -0
- moru/api/client/models/template_build_file_upload.py +70 -0
- moru/api/client/models/template_build_info.py +126 -0
- moru/api/client/models/template_build_request.py +115 -0
- moru/api/client/models/template_build_request_v2.py +88 -0
- moru/api/client/models/template_build_request_v3.py +88 -0
- moru/api/client/models/template_build_start_v2.py +184 -0
- moru/api/client/models/template_build_status.py +11 -0
- moru/api/client/models/template_legacy.py +207 -0
- moru/api/client/models/template_request_response_v3.py +83 -0
- moru/api/client/models/template_step.py +91 -0
- moru/api/client/models/template_update_request.py +59 -0
- moru/api/client/models/template_with_builds.py +148 -0
- moru/api/client/models/update_team_api_key.py +59 -0
- moru/api/client/py.typed +1 -0
- moru/api/client/types.py +54 -0
- moru/api/client_async/__init__.py +50 -0
- moru/api/client_sync/__init__.py +52 -0
- moru/api/metadata.py +14 -0
- moru/connection_config.py +217 -0
- moru/envd/api.py +59 -0
- moru/envd/filesystem/filesystem_connect.py +193 -0
- moru/envd/filesystem/filesystem_pb2.py +76 -0
- moru/envd/filesystem/filesystem_pb2.pyi +233 -0
- moru/envd/process/process_connect.py +155 -0
- moru/envd/process/process_pb2.py +92 -0
- moru/envd/process/process_pb2.pyi +304 -0
- moru/envd/rpc.py +61 -0
- moru/envd/versions.py +6 -0
- moru/exceptions.py +95 -0
- moru/sandbox/commands/command_handle.py +69 -0
- moru/sandbox/commands/main.py +39 -0
- moru/sandbox/filesystem/filesystem.py +94 -0
- moru/sandbox/filesystem/watch_handle.py +60 -0
- moru/sandbox/main.py +210 -0
- moru/sandbox/mcp.py +1120 -0
- moru/sandbox/network.py +8 -0
- moru/sandbox/sandbox_api.py +210 -0
- moru/sandbox/signature.py +45 -0
- moru/sandbox/utils.py +34 -0
- moru/sandbox_async/commands/command.py +336 -0
- moru/sandbox_async/commands/command_handle.py +196 -0
- moru/sandbox_async/commands/pty.py +240 -0
- moru/sandbox_async/filesystem/filesystem.py +531 -0
- moru/sandbox_async/filesystem/watch_handle.py +62 -0
- moru/sandbox_async/main.py +734 -0
- moru/sandbox_async/paginator.py +69 -0
- moru/sandbox_async/sandbox_api.py +325 -0
- moru/sandbox_async/utils.py +7 -0
- moru/sandbox_sync/commands/command.py +328 -0
- moru/sandbox_sync/commands/command_handle.py +150 -0
- moru/sandbox_sync/commands/pty.py +230 -0
- moru/sandbox_sync/filesystem/filesystem.py +518 -0
- moru/sandbox_sync/filesystem/watch_handle.py +69 -0
- moru/sandbox_sync/main.py +726 -0
- moru/sandbox_sync/paginator.py +69 -0
- moru/sandbox_sync/sandbox_api.py +308 -0
- moru/template/consts.py +30 -0
- moru/template/dockerfile_parser.py +275 -0
- moru/template/logger.py +232 -0
- moru/template/main.py +1360 -0
- moru/template/readycmd.py +138 -0
- moru/template/types.py +105 -0
- moru/template/utils.py +320 -0
- moru/template_async/build_api.py +202 -0
- moru/template_async/main.py +366 -0
- moru/template_sync/build_api.py +199 -0
- moru/template_sync/main.py +371 -0
- moru-0.1.0.dist-info/METADATA +63 -0
- moru-0.1.0.dist-info/RECORD +152 -0
- moru-0.1.0.dist-info/WHEEL +4 -0
- moru-0.1.0.dist-info/licenses/LICENSE +9 -0
- moru_connect/__init__.py +1 -0
- moru_connect/client.py +493 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.error import Error
|
|
9
|
+
from ...models.resumed_sandbox import ResumedSandbox
|
|
10
|
+
from ...models.sandbox import Sandbox
|
|
11
|
+
from ...types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
sandbox_id: str,
|
|
16
|
+
*,
|
|
17
|
+
body: ResumedSandbox,
|
|
18
|
+
) -> dict[str, Any]:
|
|
19
|
+
headers: dict[str, Any] = {}
|
|
20
|
+
|
|
21
|
+
_kwargs: dict[str, Any] = {
|
|
22
|
+
"method": "post",
|
|
23
|
+
"url": f"/sandboxes/{sandbox_id}/resume",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
_kwargs["json"] = body.to_dict()
|
|
27
|
+
|
|
28
|
+
headers["Content-Type"] = "application/json"
|
|
29
|
+
|
|
30
|
+
_kwargs["headers"] = headers
|
|
31
|
+
return _kwargs
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _parse_response(
|
|
35
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
36
|
+
) -> Optional[Union[Error, Sandbox]]:
|
|
37
|
+
if response.status_code == 201:
|
|
38
|
+
response_201 = Sandbox.from_dict(response.json())
|
|
39
|
+
|
|
40
|
+
return response_201
|
|
41
|
+
if response.status_code == 401:
|
|
42
|
+
response_401 = Error.from_dict(response.json())
|
|
43
|
+
|
|
44
|
+
return response_401
|
|
45
|
+
if response.status_code == 404:
|
|
46
|
+
response_404 = Error.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
return response_404
|
|
49
|
+
if response.status_code == 409:
|
|
50
|
+
response_409 = Error.from_dict(response.json())
|
|
51
|
+
|
|
52
|
+
return response_409
|
|
53
|
+
if response.status_code == 500:
|
|
54
|
+
response_500 = Error.from_dict(response.json())
|
|
55
|
+
|
|
56
|
+
return response_500
|
|
57
|
+
if client.raise_on_unexpected_status:
|
|
58
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
59
|
+
else:
|
|
60
|
+
return None
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _build_response(
|
|
64
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
65
|
+
) -> Response[Union[Error, Sandbox]]:
|
|
66
|
+
return Response(
|
|
67
|
+
status_code=HTTPStatus(response.status_code),
|
|
68
|
+
content=response.content,
|
|
69
|
+
headers=response.headers,
|
|
70
|
+
parsed=_parse_response(client=client, response=response),
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def sync_detailed(
|
|
75
|
+
sandbox_id: str,
|
|
76
|
+
*,
|
|
77
|
+
client: AuthenticatedClient,
|
|
78
|
+
body: ResumedSandbox,
|
|
79
|
+
) -> Response[Union[Error, Sandbox]]:
|
|
80
|
+
"""Resume the sandbox
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
sandbox_id (str):
|
|
84
|
+
body (ResumedSandbox):
|
|
85
|
+
|
|
86
|
+
Raises:
|
|
87
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
88
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
Response[Union[Error, Sandbox]]
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
kwargs = _get_kwargs(
|
|
95
|
+
sandbox_id=sandbox_id,
|
|
96
|
+
body=body,
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
response = client.get_httpx_client().request(
|
|
100
|
+
**kwargs,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
return _build_response(client=client, response=response)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def sync(
|
|
107
|
+
sandbox_id: str,
|
|
108
|
+
*,
|
|
109
|
+
client: AuthenticatedClient,
|
|
110
|
+
body: ResumedSandbox,
|
|
111
|
+
) -> Optional[Union[Error, Sandbox]]:
|
|
112
|
+
"""Resume the sandbox
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
sandbox_id (str):
|
|
116
|
+
body (ResumedSandbox):
|
|
117
|
+
|
|
118
|
+
Raises:
|
|
119
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
120
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
Union[Error, Sandbox]
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
return sync_detailed(
|
|
127
|
+
sandbox_id=sandbox_id,
|
|
128
|
+
client=client,
|
|
129
|
+
body=body,
|
|
130
|
+
).parsed
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
async def asyncio_detailed(
|
|
134
|
+
sandbox_id: str,
|
|
135
|
+
*,
|
|
136
|
+
client: AuthenticatedClient,
|
|
137
|
+
body: ResumedSandbox,
|
|
138
|
+
) -> Response[Union[Error, Sandbox]]:
|
|
139
|
+
"""Resume the sandbox
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
sandbox_id (str):
|
|
143
|
+
body (ResumedSandbox):
|
|
144
|
+
|
|
145
|
+
Raises:
|
|
146
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
147
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
Response[Union[Error, Sandbox]]
|
|
151
|
+
"""
|
|
152
|
+
|
|
153
|
+
kwargs = _get_kwargs(
|
|
154
|
+
sandbox_id=sandbox_id,
|
|
155
|
+
body=body,
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
159
|
+
|
|
160
|
+
return _build_response(client=client, response=response)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
async def asyncio(
|
|
164
|
+
sandbox_id: str,
|
|
165
|
+
*,
|
|
166
|
+
client: AuthenticatedClient,
|
|
167
|
+
body: ResumedSandbox,
|
|
168
|
+
) -> Optional[Union[Error, Sandbox]]:
|
|
169
|
+
"""Resume the sandbox
|
|
170
|
+
|
|
171
|
+
Args:
|
|
172
|
+
sandbox_id (str):
|
|
173
|
+
body (ResumedSandbox):
|
|
174
|
+
|
|
175
|
+
Raises:
|
|
176
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
177
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
178
|
+
|
|
179
|
+
Returns:
|
|
180
|
+
Union[Error, Sandbox]
|
|
181
|
+
"""
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
await asyncio_detailed(
|
|
185
|
+
sandbox_id=sandbox_id,
|
|
186
|
+
client=client,
|
|
187
|
+
body=body,
|
|
188
|
+
)
|
|
189
|
+
).parsed
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union, cast
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.error import Error
|
|
9
|
+
from ...models.post_sandboxes_sandbox_id_timeout_body import (
|
|
10
|
+
PostSandboxesSandboxIDTimeoutBody,
|
|
11
|
+
)
|
|
12
|
+
from ...types import Response
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
sandbox_id: str,
|
|
17
|
+
*,
|
|
18
|
+
body: PostSandboxesSandboxIDTimeoutBody,
|
|
19
|
+
) -> dict[str, Any]:
|
|
20
|
+
headers: dict[str, Any] = {}
|
|
21
|
+
|
|
22
|
+
_kwargs: dict[str, Any] = {
|
|
23
|
+
"method": "post",
|
|
24
|
+
"url": f"/sandboxes/{sandbox_id}/timeout",
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
_kwargs["json"] = body.to_dict()
|
|
28
|
+
|
|
29
|
+
headers["Content-Type"] = "application/json"
|
|
30
|
+
|
|
31
|
+
_kwargs["headers"] = headers
|
|
32
|
+
return _kwargs
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _parse_response(
|
|
36
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
37
|
+
) -> Optional[Union[Any, Error]]:
|
|
38
|
+
if response.status_code == 204:
|
|
39
|
+
response_204 = cast(Any, None)
|
|
40
|
+
return response_204
|
|
41
|
+
if response.status_code == 401:
|
|
42
|
+
response_401 = Error.from_dict(response.json())
|
|
43
|
+
|
|
44
|
+
return response_401
|
|
45
|
+
if response.status_code == 404:
|
|
46
|
+
response_404 = Error.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
return response_404
|
|
49
|
+
if response.status_code == 500:
|
|
50
|
+
response_500 = Error.from_dict(response.json())
|
|
51
|
+
|
|
52
|
+
return response_500
|
|
53
|
+
if client.raise_on_unexpected_status:
|
|
54
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
55
|
+
else:
|
|
56
|
+
return None
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _build_response(
|
|
60
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
61
|
+
) -> Response[Union[Any, Error]]:
|
|
62
|
+
return Response(
|
|
63
|
+
status_code=HTTPStatus(response.status_code),
|
|
64
|
+
content=response.content,
|
|
65
|
+
headers=response.headers,
|
|
66
|
+
parsed=_parse_response(client=client, response=response),
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def sync_detailed(
|
|
71
|
+
sandbox_id: str,
|
|
72
|
+
*,
|
|
73
|
+
client: AuthenticatedClient,
|
|
74
|
+
body: PostSandboxesSandboxIDTimeoutBody,
|
|
75
|
+
) -> Response[Union[Any, Error]]:
|
|
76
|
+
"""Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request.
|
|
77
|
+
Calling this method multiple times overwrites the TTL, each time using the current timestamp as the
|
|
78
|
+
starting point to measure the timeout duration.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
sandbox_id (str):
|
|
82
|
+
body (PostSandboxesSandboxIDTimeoutBody):
|
|
83
|
+
|
|
84
|
+
Raises:
|
|
85
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
86
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
87
|
+
|
|
88
|
+
Returns:
|
|
89
|
+
Response[Union[Any, Error]]
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
kwargs = _get_kwargs(
|
|
93
|
+
sandbox_id=sandbox_id,
|
|
94
|
+
body=body,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
response = client.get_httpx_client().request(
|
|
98
|
+
**kwargs,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
return _build_response(client=client, response=response)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def sync(
|
|
105
|
+
sandbox_id: str,
|
|
106
|
+
*,
|
|
107
|
+
client: AuthenticatedClient,
|
|
108
|
+
body: PostSandboxesSandboxIDTimeoutBody,
|
|
109
|
+
) -> Optional[Union[Any, Error]]:
|
|
110
|
+
"""Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request.
|
|
111
|
+
Calling this method multiple times overwrites the TTL, each time using the current timestamp as the
|
|
112
|
+
starting point to measure the timeout duration.
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
sandbox_id (str):
|
|
116
|
+
body (PostSandboxesSandboxIDTimeoutBody):
|
|
117
|
+
|
|
118
|
+
Raises:
|
|
119
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
120
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
Union[Any, Error]
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
return sync_detailed(
|
|
127
|
+
sandbox_id=sandbox_id,
|
|
128
|
+
client=client,
|
|
129
|
+
body=body,
|
|
130
|
+
).parsed
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
async def asyncio_detailed(
|
|
134
|
+
sandbox_id: str,
|
|
135
|
+
*,
|
|
136
|
+
client: AuthenticatedClient,
|
|
137
|
+
body: PostSandboxesSandboxIDTimeoutBody,
|
|
138
|
+
) -> Response[Union[Any, Error]]:
|
|
139
|
+
"""Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request.
|
|
140
|
+
Calling this method multiple times overwrites the TTL, each time using the current timestamp as the
|
|
141
|
+
starting point to measure the timeout duration.
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
sandbox_id (str):
|
|
145
|
+
body (PostSandboxesSandboxIDTimeoutBody):
|
|
146
|
+
|
|
147
|
+
Raises:
|
|
148
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
149
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
150
|
+
|
|
151
|
+
Returns:
|
|
152
|
+
Response[Union[Any, Error]]
|
|
153
|
+
"""
|
|
154
|
+
|
|
155
|
+
kwargs = _get_kwargs(
|
|
156
|
+
sandbox_id=sandbox_id,
|
|
157
|
+
body=body,
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
161
|
+
|
|
162
|
+
return _build_response(client=client, response=response)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
async def asyncio(
|
|
166
|
+
sandbox_id: str,
|
|
167
|
+
*,
|
|
168
|
+
client: AuthenticatedClient,
|
|
169
|
+
body: PostSandboxesSandboxIDTimeoutBody,
|
|
170
|
+
) -> Optional[Union[Any, Error]]:
|
|
171
|
+
"""Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request.
|
|
172
|
+
Calling this method multiple times overwrites the TTL, each time using the current timestamp as the
|
|
173
|
+
starting point to measure the timeout duration.
|
|
174
|
+
|
|
175
|
+
Args:
|
|
176
|
+
sandbox_id (str):
|
|
177
|
+
body (PostSandboxesSandboxIDTimeoutBody):
|
|
178
|
+
|
|
179
|
+
Raises:
|
|
180
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
181
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
182
|
+
|
|
183
|
+
Returns:
|
|
184
|
+
Union[Any, Error]
|
|
185
|
+
"""
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
await asyncio_detailed(
|
|
189
|
+
sandbox_id=sandbox_id,
|
|
190
|
+
client=client,
|
|
191
|
+
body=body,
|
|
192
|
+
)
|
|
193
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union, cast
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.error import Error
|
|
9
|
+
from ...types import Response
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_kwargs(
|
|
13
|
+
template_id: str,
|
|
14
|
+
) -> dict[str, Any]:
|
|
15
|
+
_kwargs: dict[str, Any] = {
|
|
16
|
+
"method": "delete",
|
|
17
|
+
"url": f"/templates/{template_id}",
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return _kwargs
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _parse_response(
|
|
24
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
25
|
+
) -> Optional[Union[Any, Error]]:
|
|
26
|
+
if response.status_code == 204:
|
|
27
|
+
response_204 = cast(Any, None)
|
|
28
|
+
return response_204
|
|
29
|
+
if response.status_code == 401:
|
|
30
|
+
response_401 = Error.from_dict(response.json())
|
|
31
|
+
|
|
32
|
+
return response_401
|
|
33
|
+
if response.status_code == 500:
|
|
34
|
+
response_500 = Error.from_dict(response.json())
|
|
35
|
+
|
|
36
|
+
return response_500
|
|
37
|
+
if client.raise_on_unexpected_status:
|
|
38
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
39
|
+
else:
|
|
40
|
+
return None
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _build_response(
|
|
44
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
45
|
+
) -> Response[Union[Any, Error]]:
|
|
46
|
+
return Response(
|
|
47
|
+
status_code=HTTPStatus(response.status_code),
|
|
48
|
+
content=response.content,
|
|
49
|
+
headers=response.headers,
|
|
50
|
+
parsed=_parse_response(client=client, response=response),
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def sync_detailed(
|
|
55
|
+
template_id: str,
|
|
56
|
+
*,
|
|
57
|
+
client: AuthenticatedClient,
|
|
58
|
+
) -> Response[Union[Any, Error]]:
|
|
59
|
+
"""Delete a template
|
|
60
|
+
|
|
61
|
+
Args:
|
|
62
|
+
template_id (str):
|
|
63
|
+
|
|
64
|
+
Raises:
|
|
65
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
66
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
Response[Union[Any, Error]]
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
kwargs = _get_kwargs(
|
|
73
|
+
template_id=template_id,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
response = client.get_httpx_client().request(
|
|
77
|
+
**kwargs,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
return _build_response(client=client, response=response)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def sync(
|
|
84
|
+
template_id: str,
|
|
85
|
+
*,
|
|
86
|
+
client: AuthenticatedClient,
|
|
87
|
+
) -> Optional[Union[Any, Error]]:
|
|
88
|
+
"""Delete a template
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
template_id (str):
|
|
92
|
+
|
|
93
|
+
Raises:
|
|
94
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
95
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
96
|
+
|
|
97
|
+
Returns:
|
|
98
|
+
Union[Any, Error]
|
|
99
|
+
"""
|
|
100
|
+
|
|
101
|
+
return sync_detailed(
|
|
102
|
+
template_id=template_id,
|
|
103
|
+
client=client,
|
|
104
|
+
).parsed
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
async def asyncio_detailed(
|
|
108
|
+
template_id: str,
|
|
109
|
+
*,
|
|
110
|
+
client: AuthenticatedClient,
|
|
111
|
+
) -> Response[Union[Any, Error]]:
|
|
112
|
+
"""Delete a template
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
template_id (str):
|
|
116
|
+
|
|
117
|
+
Raises:
|
|
118
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
119
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
120
|
+
|
|
121
|
+
Returns:
|
|
122
|
+
Response[Union[Any, Error]]
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
kwargs = _get_kwargs(
|
|
126
|
+
template_id=template_id,
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
130
|
+
|
|
131
|
+
return _build_response(client=client, response=response)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
async def asyncio(
|
|
135
|
+
template_id: str,
|
|
136
|
+
*,
|
|
137
|
+
client: AuthenticatedClient,
|
|
138
|
+
) -> Optional[Union[Any, Error]]:
|
|
139
|
+
"""Delete a template
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
template_id (str):
|
|
143
|
+
|
|
144
|
+
Raises:
|
|
145
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
146
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
147
|
+
|
|
148
|
+
Returns:
|
|
149
|
+
Union[Any, Error]
|
|
150
|
+
"""
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
await asyncio_detailed(
|
|
154
|
+
template_id=template_id,
|
|
155
|
+
client=client,
|
|
156
|
+
)
|
|
157
|
+
).parsed
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.error import Error
|
|
9
|
+
from ...models.template import Template
|
|
10
|
+
from ...types import UNSET, Response, Unset
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
*,
|
|
15
|
+
team_id: Union[Unset, str] = UNSET,
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
|
+
params: dict[str, Any] = {}
|
|
18
|
+
|
|
19
|
+
params["teamID"] = team_id
|
|
20
|
+
|
|
21
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
22
|
+
|
|
23
|
+
_kwargs: dict[str, Any] = {
|
|
24
|
+
"method": "get",
|
|
25
|
+
"url": "/templates",
|
|
26
|
+
"params": params,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return _kwargs
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _parse_response(
|
|
33
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
34
|
+
) -> Optional[Union[Error, list["Template"]]]:
|
|
35
|
+
if response.status_code == 200:
|
|
36
|
+
response_200 = []
|
|
37
|
+
_response_200 = response.json()
|
|
38
|
+
for response_200_item_data in _response_200:
|
|
39
|
+
response_200_item = Template.from_dict(response_200_item_data)
|
|
40
|
+
|
|
41
|
+
response_200.append(response_200_item)
|
|
42
|
+
|
|
43
|
+
return response_200
|
|
44
|
+
if response.status_code == 401:
|
|
45
|
+
response_401 = Error.from_dict(response.json())
|
|
46
|
+
|
|
47
|
+
return response_401
|
|
48
|
+
if response.status_code == 500:
|
|
49
|
+
response_500 = Error.from_dict(response.json())
|
|
50
|
+
|
|
51
|
+
return response_500
|
|
52
|
+
if client.raise_on_unexpected_status:
|
|
53
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
54
|
+
else:
|
|
55
|
+
return None
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _build_response(
|
|
59
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
60
|
+
) -> Response[Union[Error, list["Template"]]]:
|
|
61
|
+
return Response(
|
|
62
|
+
status_code=HTTPStatus(response.status_code),
|
|
63
|
+
content=response.content,
|
|
64
|
+
headers=response.headers,
|
|
65
|
+
parsed=_parse_response(client=client, response=response),
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def sync_detailed(
|
|
70
|
+
*,
|
|
71
|
+
client: AuthenticatedClient,
|
|
72
|
+
team_id: Union[Unset, str] = UNSET,
|
|
73
|
+
) -> Response[Union[Error, list["Template"]]]:
|
|
74
|
+
"""List all templates
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
team_id (Union[Unset, str]): Identifier of the team
|
|
78
|
+
|
|
79
|
+
Raises:
|
|
80
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
81
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
Response[Union[Error, list['Template']]]
|
|
85
|
+
"""
|
|
86
|
+
|
|
87
|
+
kwargs = _get_kwargs(
|
|
88
|
+
team_id=team_id,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
response = client.get_httpx_client().request(
|
|
92
|
+
**kwargs,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
return _build_response(client=client, response=response)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def sync(
|
|
99
|
+
*,
|
|
100
|
+
client: AuthenticatedClient,
|
|
101
|
+
team_id: Union[Unset, str] = UNSET,
|
|
102
|
+
) -> Optional[Union[Error, list["Template"]]]:
|
|
103
|
+
"""List all templates
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
team_id (Union[Unset, str]): Identifier of the team
|
|
107
|
+
|
|
108
|
+
Raises:
|
|
109
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
110
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
111
|
+
|
|
112
|
+
Returns:
|
|
113
|
+
Union[Error, list['Template']]
|
|
114
|
+
"""
|
|
115
|
+
|
|
116
|
+
return sync_detailed(
|
|
117
|
+
client=client,
|
|
118
|
+
team_id=team_id,
|
|
119
|
+
).parsed
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
async def asyncio_detailed(
|
|
123
|
+
*,
|
|
124
|
+
client: AuthenticatedClient,
|
|
125
|
+
team_id: Union[Unset, str] = UNSET,
|
|
126
|
+
) -> Response[Union[Error, list["Template"]]]:
|
|
127
|
+
"""List all templates
|
|
128
|
+
|
|
129
|
+
Args:
|
|
130
|
+
team_id (Union[Unset, str]): Identifier of the team
|
|
131
|
+
|
|
132
|
+
Raises:
|
|
133
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
134
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
135
|
+
|
|
136
|
+
Returns:
|
|
137
|
+
Response[Union[Error, list['Template']]]
|
|
138
|
+
"""
|
|
139
|
+
|
|
140
|
+
kwargs = _get_kwargs(
|
|
141
|
+
team_id=team_id,
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
145
|
+
|
|
146
|
+
return _build_response(client=client, response=response)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
async def asyncio(
|
|
150
|
+
*,
|
|
151
|
+
client: AuthenticatedClient,
|
|
152
|
+
team_id: Union[Unset, str] = UNSET,
|
|
153
|
+
) -> Optional[Union[Error, list["Template"]]]:
|
|
154
|
+
"""List all templates
|
|
155
|
+
|
|
156
|
+
Args:
|
|
157
|
+
team_id (Union[Unset, str]): Identifier of the team
|
|
158
|
+
|
|
159
|
+
Raises:
|
|
160
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
161
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
Union[Error, list['Template']]
|
|
165
|
+
"""
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
await asyncio_detailed(
|
|
169
|
+
client=client,
|
|
170
|
+
team_id=team_id,
|
|
171
|
+
)
|
|
172
|
+
).parsed
|