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,195 @@
|
|
|
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_with_builds import TemplateWithBuilds
|
|
10
|
+
from ...types import UNSET, Response, Unset
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
template_id: str,
|
|
15
|
+
*,
|
|
16
|
+
next_token: Union[Unset, str] = UNSET,
|
|
17
|
+
limit: Union[Unset, int] = 100,
|
|
18
|
+
) -> dict[str, Any]:
|
|
19
|
+
params: dict[str, Any] = {}
|
|
20
|
+
|
|
21
|
+
params["nextToken"] = next_token
|
|
22
|
+
|
|
23
|
+
params["limit"] = limit
|
|
24
|
+
|
|
25
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
26
|
+
|
|
27
|
+
_kwargs: dict[str, Any] = {
|
|
28
|
+
"method": "get",
|
|
29
|
+
"url": f"/templates/{template_id}",
|
|
30
|
+
"params": params,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return _kwargs
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _parse_response(
|
|
37
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
38
|
+
) -> Optional[Union[Error, TemplateWithBuilds]]:
|
|
39
|
+
if response.status_code == 200:
|
|
40
|
+
response_200 = TemplateWithBuilds.from_dict(response.json())
|
|
41
|
+
|
|
42
|
+
return response_200
|
|
43
|
+
if response.status_code == 401:
|
|
44
|
+
response_401 = Error.from_dict(response.json())
|
|
45
|
+
|
|
46
|
+
return response_401
|
|
47
|
+
if response.status_code == 500:
|
|
48
|
+
response_500 = Error.from_dict(response.json())
|
|
49
|
+
|
|
50
|
+
return response_500
|
|
51
|
+
if client.raise_on_unexpected_status:
|
|
52
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
53
|
+
else:
|
|
54
|
+
return None
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _build_response(
|
|
58
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
59
|
+
) -> Response[Union[Error, TemplateWithBuilds]]:
|
|
60
|
+
return Response(
|
|
61
|
+
status_code=HTTPStatus(response.status_code),
|
|
62
|
+
content=response.content,
|
|
63
|
+
headers=response.headers,
|
|
64
|
+
parsed=_parse_response(client=client, response=response),
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def sync_detailed(
|
|
69
|
+
template_id: str,
|
|
70
|
+
*,
|
|
71
|
+
client: AuthenticatedClient,
|
|
72
|
+
next_token: Union[Unset, str] = UNSET,
|
|
73
|
+
limit: Union[Unset, int] = 100,
|
|
74
|
+
) -> Response[Union[Error, TemplateWithBuilds]]:
|
|
75
|
+
"""List all builds for a template
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
template_id (str):
|
|
79
|
+
next_token (Union[Unset, str]):
|
|
80
|
+
limit (Union[Unset, int]): Default: 100.
|
|
81
|
+
|
|
82
|
+
Raises:
|
|
83
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
84
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
Response[Union[Error, TemplateWithBuilds]]
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
kwargs = _get_kwargs(
|
|
91
|
+
template_id=template_id,
|
|
92
|
+
next_token=next_token,
|
|
93
|
+
limit=limit,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
response = client.get_httpx_client().request(
|
|
97
|
+
**kwargs,
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
return _build_response(client=client, response=response)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def sync(
|
|
104
|
+
template_id: str,
|
|
105
|
+
*,
|
|
106
|
+
client: AuthenticatedClient,
|
|
107
|
+
next_token: Union[Unset, str] = UNSET,
|
|
108
|
+
limit: Union[Unset, int] = 100,
|
|
109
|
+
) -> Optional[Union[Error, TemplateWithBuilds]]:
|
|
110
|
+
"""List all builds for a template
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
template_id (str):
|
|
114
|
+
next_token (Union[Unset, str]):
|
|
115
|
+
limit (Union[Unset, int]): Default: 100.
|
|
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
|
+
Union[Error, TemplateWithBuilds]
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
return sync_detailed(
|
|
126
|
+
template_id=template_id,
|
|
127
|
+
client=client,
|
|
128
|
+
next_token=next_token,
|
|
129
|
+
limit=limit,
|
|
130
|
+
).parsed
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
async def asyncio_detailed(
|
|
134
|
+
template_id: str,
|
|
135
|
+
*,
|
|
136
|
+
client: AuthenticatedClient,
|
|
137
|
+
next_token: Union[Unset, str] = UNSET,
|
|
138
|
+
limit: Union[Unset, int] = 100,
|
|
139
|
+
) -> Response[Union[Error, TemplateWithBuilds]]:
|
|
140
|
+
"""List all builds for a template
|
|
141
|
+
|
|
142
|
+
Args:
|
|
143
|
+
template_id (str):
|
|
144
|
+
next_token (Union[Unset, str]):
|
|
145
|
+
limit (Union[Unset, int]): Default: 100.
|
|
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[Error, TemplateWithBuilds]]
|
|
153
|
+
"""
|
|
154
|
+
|
|
155
|
+
kwargs = _get_kwargs(
|
|
156
|
+
template_id=template_id,
|
|
157
|
+
next_token=next_token,
|
|
158
|
+
limit=limit,
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
162
|
+
|
|
163
|
+
return _build_response(client=client, response=response)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
async def asyncio(
|
|
167
|
+
template_id: str,
|
|
168
|
+
*,
|
|
169
|
+
client: AuthenticatedClient,
|
|
170
|
+
next_token: Union[Unset, str] = UNSET,
|
|
171
|
+
limit: Union[Unset, int] = 100,
|
|
172
|
+
) -> Optional[Union[Error, TemplateWithBuilds]]:
|
|
173
|
+
"""List all builds for a template
|
|
174
|
+
|
|
175
|
+
Args:
|
|
176
|
+
template_id (str):
|
|
177
|
+
next_token (Union[Unset, str]):
|
|
178
|
+
limit (Union[Unset, int]): Default: 100.
|
|
179
|
+
|
|
180
|
+
Raises:
|
|
181
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
182
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
183
|
+
|
|
184
|
+
Returns:
|
|
185
|
+
Union[Error, TemplateWithBuilds]
|
|
186
|
+
"""
|
|
187
|
+
|
|
188
|
+
return (
|
|
189
|
+
await asyncio_detailed(
|
|
190
|
+
template_id=template_id,
|
|
191
|
+
client=client,
|
|
192
|
+
next_token=next_token,
|
|
193
|
+
limit=limit,
|
|
194
|
+
)
|
|
195
|
+
).parsed
|
|
@@ -0,0 +1,217 @@
|
|
|
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.log_level import LogLevel
|
|
10
|
+
from ...models.template_build_info import TemplateBuildInfo
|
|
11
|
+
from ...types import UNSET, Response, Unset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
template_id: str,
|
|
16
|
+
build_id: str,
|
|
17
|
+
*,
|
|
18
|
+
logs_offset: Union[Unset, int] = 0,
|
|
19
|
+
level: Union[Unset, LogLevel] = UNSET,
|
|
20
|
+
) -> dict[str, Any]:
|
|
21
|
+
params: dict[str, Any] = {}
|
|
22
|
+
|
|
23
|
+
params["logsOffset"] = logs_offset
|
|
24
|
+
|
|
25
|
+
json_level: Union[Unset, str] = UNSET
|
|
26
|
+
if not isinstance(level, Unset):
|
|
27
|
+
json_level = level.value
|
|
28
|
+
|
|
29
|
+
params["level"] = json_level
|
|
30
|
+
|
|
31
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
32
|
+
|
|
33
|
+
_kwargs: dict[str, Any] = {
|
|
34
|
+
"method": "get",
|
|
35
|
+
"url": f"/templates/{template_id}/builds/{build_id}/status",
|
|
36
|
+
"params": params,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return _kwargs
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _parse_response(
|
|
43
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
44
|
+
) -> Optional[Union[Error, TemplateBuildInfo]]:
|
|
45
|
+
if response.status_code == 200:
|
|
46
|
+
response_200 = TemplateBuildInfo.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
return response_200
|
|
49
|
+
if response.status_code == 401:
|
|
50
|
+
response_401 = Error.from_dict(response.json())
|
|
51
|
+
|
|
52
|
+
return response_401
|
|
53
|
+
if response.status_code == 404:
|
|
54
|
+
response_404 = Error.from_dict(response.json())
|
|
55
|
+
|
|
56
|
+
return response_404
|
|
57
|
+
if response.status_code == 500:
|
|
58
|
+
response_500 = Error.from_dict(response.json())
|
|
59
|
+
|
|
60
|
+
return response_500
|
|
61
|
+
if client.raise_on_unexpected_status:
|
|
62
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
63
|
+
else:
|
|
64
|
+
return None
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _build_response(
|
|
68
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
69
|
+
) -> Response[Union[Error, TemplateBuildInfo]]:
|
|
70
|
+
return Response(
|
|
71
|
+
status_code=HTTPStatus(response.status_code),
|
|
72
|
+
content=response.content,
|
|
73
|
+
headers=response.headers,
|
|
74
|
+
parsed=_parse_response(client=client, response=response),
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def sync_detailed(
|
|
79
|
+
template_id: str,
|
|
80
|
+
build_id: str,
|
|
81
|
+
*,
|
|
82
|
+
client: AuthenticatedClient,
|
|
83
|
+
logs_offset: Union[Unset, int] = 0,
|
|
84
|
+
level: Union[Unset, LogLevel] = UNSET,
|
|
85
|
+
) -> Response[Union[Error, TemplateBuildInfo]]:
|
|
86
|
+
"""Get template build info
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
template_id (str):
|
|
90
|
+
build_id (str):
|
|
91
|
+
logs_offset (Union[Unset, int]): Default: 0.
|
|
92
|
+
level (Union[Unset, LogLevel]): State of the sandbox
|
|
93
|
+
|
|
94
|
+
Raises:
|
|
95
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
96
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
Response[Union[Error, TemplateBuildInfo]]
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
kwargs = _get_kwargs(
|
|
103
|
+
template_id=template_id,
|
|
104
|
+
build_id=build_id,
|
|
105
|
+
logs_offset=logs_offset,
|
|
106
|
+
level=level,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
response = client.get_httpx_client().request(
|
|
110
|
+
**kwargs,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
return _build_response(client=client, response=response)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def sync(
|
|
117
|
+
template_id: str,
|
|
118
|
+
build_id: str,
|
|
119
|
+
*,
|
|
120
|
+
client: AuthenticatedClient,
|
|
121
|
+
logs_offset: Union[Unset, int] = 0,
|
|
122
|
+
level: Union[Unset, LogLevel] = UNSET,
|
|
123
|
+
) -> Optional[Union[Error, TemplateBuildInfo]]:
|
|
124
|
+
"""Get template build info
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
template_id (str):
|
|
128
|
+
build_id (str):
|
|
129
|
+
logs_offset (Union[Unset, int]): Default: 0.
|
|
130
|
+
level (Union[Unset, LogLevel]): State of the sandbox
|
|
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
|
+
Union[Error, TemplateBuildInfo]
|
|
138
|
+
"""
|
|
139
|
+
|
|
140
|
+
return sync_detailed(
|
|
141
|
+
template_id=template_id,
|
|
142
|
+
build_id=build_id,
|
|
143
|
+
client=client,
|
|
144
|
+
logs_offset=logs_offset,
|
|
145
|
+
level=level,
|
|
146
|
+
).parsed
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
async def asyncio_detailed(
|
|
150
|
+
template_id: str,
|
|
151
|
+
build_id: str,
|
|
152
|
+
*,
|
|
153
|
+
client: AuthenticatedClient,
|
|
154
|
+
logs_offset: Union[Unset, int] = 0,
|
|
155
|
+
level: Union[Unset, LogLevel] = UNSET,
|
|
156
|
+
) -> Response[Union[Error, TemplateBuildInfo]]:
|
|
157
|
+
"""Get template build info
|
|
158
|
+
|
|
159
|
+
Args:
|
|
160
|
+
template_id (str):
|
|
161
|
+
build_id (str):
|
|
162
|
+
logs_offset (Union[Unset, int]): Default: 0.
|
|
163
|
+
level (Union[Unset, LogLevel]): State of the sandbox
|
|
164
|
+
|
|
165
|
+
Raises:
|
|
166
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
167
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
168
|
+
|
|
169
|
+
Returns:
|
|
170
|
+
Response[Union[Error, TemplateBuildInfo]]
|
|
171
|
+
"""
|
|
172
|
+
|
|
173
|
+
kwargs = _get_kwargs(
|
|
174
|
+
template_id=template_id,
|
|
175
|
+
build_id=build_id,
|
|
176
|
+
logs_offset=logs_offset,
|
|
177
|
+
level=level,
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
181
|
+
|
|
182
|
+
return _build_response(client=client, response=response)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
async def asyncio(
|
|
186
|
+
template_id: str,
|
|
187
|
+
build_id: str,
|
|
188
|
+
*,
|
|
189
|
+
client: AuthenticatedClient,
|
|
190
|
+
logs_offset: Union[Unset, int] = 0,
|
|
191
|
+
level: Union[Unset, LogLevel] = UNSET,
|
|
192
|
+
) -> Optional[Union[Error, TemplateBuildInfo]]:
|
|
193
|
+
"""Get template build info
|
|
194
|
+
|
|
195
|
+
Args:
|
|
196
|
+
template_id (str):
|
|
197
|
+
build_id (str):
|
|
198
|
+
logs_offset (Union[Unset, int]): Default: 0.
|
|
199
|
+
level (Union[Unset, LogLevel]): State of the sandbox
|
|
200
|
+
|
|
201
|
+
Raises:
|
|
202
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
203
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
204
|
+
|
|
205
|
+
Returns:
|
|
206
|
+
Union[Error, TemplateBuildInfo]
|
|
207
|
+
"""
|
|
208
|
+
|
|
209
|
+
return (
|
|
210
|
+
await asyncio_detailed(
|
|
211
|
+
template_id=template_id,
|
|
212
|
+
build_id=build_id,
|
|
213
|
+
client=client,
|
|
214
|
+
logs_offset=logs_offset,
|
|
215
|
+
level=level,
|
|
216
|
+
)
|
|
217
|
+
).parsed
|
|
@@ -0,0 +1,180 @@
|
|
|
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_build_file_upload import TemplateBuildFileUpload
|
|
10
|
+
from ...types import Response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
template_id: str,
|
|
15
|
+
hash_: str,
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
|
+
_kwargs: dict[str, Any] = {
|
|
18
|
+
"method": "get",
|
|
19
|
+
"url": f"/templates/{template_id}/files/{hash_}",
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return _kwargs
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _parse_response(
|
|
26
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
27
|
+
) -> Optional[Union[Error, TemplateBuildFileUpload]]:
|
|
28
|
+
if response.status_code == 201:
|
|
29
|
+
response_201 = TemplateBuildFileUpload.from_dict(response.json())
|
|
30
|
+
|
|
31
|
+
return response_201
|
|
32
|
+
if response.status_code == 400:
|
|
33
|
+
response_400 = Error.from_dict(response.json())
|
|
34
|
+
|
|
35
|
+
return response_400
|
|
36
|
+
if response.status_code == 401:
|
|
37
|
+
response_401 = Error.from_dict(response.json())
|
|
38
|
+
|
|
39
|
+
return response_401
|
|
40
|
+
if response.status_code == 404:
|
|
41
|
+
response_404 = Error.from_dict(response.json())
|
|
42
|
+
|
|
43
|
+
return response_404
|
|
44
|
+
if response.status_code == 500:
|
|
45
|
+
response_500 = Error.from_dict(response.json())
|
|
46
|
+
|
|
47
|
+
return response_500
|
|
48
|
+
if client.raise_on_unexpected_status:
|
|
49
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
50
|
+
else:
|
|
51
|
+
return None
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _build_response(
|
|
55
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
56
|
+
) -> Response[Union[Error, TemplateBuildFileUpload]]:
|
|
57
|
+
return Response(
|
|
58
|
+
status_code=HTTPStatus(response.status_code),
|
|
59
|
+
content=response.content,
|
|
60
|
+
headers=response.headers,
|
|
61
|
+
parsed=_parse_response(client=client, response=response),
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def sync_detailed(
|
|
66
|
+
template_id: str,
|
|
67
|
+
hash_: str,
|
|
68
|
+
*,
|
|
69
|
+
client: AuthenticatedClient,
|
|
70
|
+
) -> Response[Union[Error, TemplateBuildFileUpload]]:
|
|
71
|
+
"""Get an upload link for a tar file containing build layer files
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
template_id (str):
|
|
75
|
+
hash_ (str): Hash of the files
|
|
76
|
+
|
|
77
|
+
Raises:
|
|
78
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
79
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
Response[Union[Error, TemplateBuildFileUpload]]
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
kwargs = _get_kwargs(
|
|
86
|
+
template_id=template_id,
|
|
87
|
+
hash_=hash_,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
response = client.get_httpx_client().request(
|
|
91
|
+
**kwargs,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
return _build_response(client=client, response=response)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def sync(
|
|
98
|
+
template_id: str,
|
|
99
|
+
hash_: str,
|
|
100
|
+
*,
|
|
101
|
+
client: AuthenticatedClient,
|
|
102
|
+
) -> Optional[Union[Error, TemplateBuildFileUpload]]:
|
|
103
|
+
"""Get an upload link for a tar file containing build layer files
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
template_id (str):
|
|
107
|
+
hash_ (str): Hash of the files
|
|
108
|
+
|
|
109
|
+
Raises:
|
|
110
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
111
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
112
|
+
|
|
113
|
+
Returns:
|
|
114
|
+
Union[Error, TemplateBuildFileUpload]
|
|
115
|
+
"""
|
|
116
|
+
|
|
117
|
+
return sync_detailed(
|
|
118
|
+
template_id=template_id,
|
|
119
|
+
hash_=hash_,
|
|
120
|
+
client=client,
|
|
121
|
+
).parsed
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
async def asyncio_detailed(
|
|
125
|
+
template_id: str,
|
|
126
|
+
hash_: str,
|
|
127
|
+
*,
|
|
128
|
+
client: AuthenticatedClient,
|
|
129
|
+
) -> Response[Union[Error, TemplateBuildFileUpload]]:
|
|
130
|
+
"""Get an upload link for a tar file containing build layer files
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
template_id (str):
|
|
134
|
+
hash_ (str): Hash of the files
|
|
135
|
+
|
|
136
|
+
Raises:
|
|
137
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
138
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
139
|
+
|
|
140
|
+
Returns:
|
|
141
|
+
Response[Union[Error, TemplateBuildFileUpload]]
|
|
142
|
+
"""
|
|
143
|
+
|
|
144
|
+
kwargs = _get_kwargs(
|
|
145
|
+
template_id=template_id,
|
|
146
|
+
hash_=hash_,
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
150
|
+
|
|
151
|
+
return _build_response(client=client, response=response)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
async def asyncio(
|
|
155
|
+
template_id: str,
|
|
156
|
+
hash_: str,
|
|
157
|
+
*,
|
|
158
|
+
client: AuthenticatedClient,
|
|
159
|
+
) -> Optional[Union[Error, TemplateBuildFileUpload]]:
|
|
160
|
+
"""Get an upload link for a tar file containing build layer files
|
|
161
|
+
|
|
162
|
+
Args:
|
|
163
|
+
template_id (str):
|
|
164
|
+
hash_ (str): Hash of the files
|
|
165
|
+
|
|
166
|
+
Raises:
|
|
167
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
168
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
169
|
+
|
|
170
|
+
Returns:
|
|
171
|
+
Union[Error, TemplateBuildFileUpload]
|
|
172
|
+
"""
|
|
173
|
+
|
|
174
|
+
return (
|
|
175
|
+
await asyncio_detailed(
|
|
176
|
+
template_id=template_id,
|
|
177
|
+
hash_=hash_,
|
|
178
|
+
client=client,
|
|
179
|
+
)
|
|
180
|
+
).parsed
|