blaxel 0.1.9rc37__py3-none-any.whl → 0.1.10__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.
- blaxel/authentication/__init__.py +11 -2
- blaxel/client/api/compute/create_sandbox_preview.py +179 -0
- blaxel/client/api/compute/create_sandbox_preview_token.py +192 -0
- blaxel/client/api/compute/delete_sandbox_preview.py +167 -0
- blaxel/client/api/compute/delete_sandbox_preview_token.py +180 -0
- blaxel/client/api/compute/get_sandbox_preview.py +167 -0
- blaxel/client/api/compute/list_sandbox_preview_tokens.py +172 -0
- blaxel/client/api/compute/list_sandbox_previews.py +159 -0
- blaxel/client/api/compute/update_sandbox_preview.py +192 -0
- blaxel/client/api/integrations/get_integration.py +64 -7
- blaxel/client/api/workspaces/check_workspace_availability.py +165 -0
- blaxel/client/models/__init__.py +32 -2
- blaxel/client/models/check_workspace_availability_body.py +60 -0
- blaxel/client/models/delete_sandbox_preview_token_response_200.py +60 -0
- blaxel/client/models/integration.py +197 -0
- blaxel/client/models/integration_additional_infos.py +45 -0
- blaxel/client/models/integration_endpoint.py +143 -0
- blaxel/client/models/integration_endpoint_token.py +79 -0
- blaxel/client/models/integration_endpoints.py +61 -0
- blaxel/client/models/integration_headers.py +45 -0
- blaxel/client/models/integration_organization.py +88 -0
- blaxel/client/models/integration_query_params.py +45 -0
- blaxel/client/models/metrics.py +9 -0
- blaxel/client/models/preview.py +96 -0
- blaxel/client/models/preview_metadata.py +133 -0
- blaxel/client/models/preview_spec.py +79 -0
- blaxel/client/models/preview_token.py +96 -0
- blaxel/client/models/preview_token_metadata.py +97 -0
- blaxel/client/models/preview_token_spec.py +88 -0
- blaxel/common/autoload.py +1 -0
- blaxel/common/internal.py +5 -5
- blaxel/sandbox/base.py +68 -0
- blaxel/sandbox/client/__init__.py +8 -0
- blaxel/sandbox/client/api/__init__.py +1 -0
- blaxel/sandbox/client/api/filesystem/__init__.py +0 -0
- blaxel/sandbox/client/api/filesystem/delete_filesystem_path.py +184 -0
- blaxel/sandbox/client/api/filesystem/get_filesystem_path.py +184 -0
- blaxel/sandbox/client/api/filesystem/put_filesystem_path.py +189 -0
- blaxel/sandbox/client/api/network/__init__.py +0 -0
- blaxel/sandbox/client/api/network/delete_network_process_pid_monitor.py +169 -0
- blaxel/sandbox/client/api/network/get_network_process_pid_ports.py +169 -0
- blaxel/sandbox/client/api/network/post_network_process_pid_monitor.py +195 -0
- blaxel/sandbox/client/api/process/__init__.py +0 -0
- blaxel/sandbox/client/api/process/delete_process_identifier.py +163 -0
- blaxel/sandbox/client/api/process/delete_process_identifier_kill.py +189 -0
- blaxel/sandbox/client/api/process/get_process.py +135 -0
- blaxel/sandbox/client/api/process/get_process_identifier.py +159 -0
- blaxel/sandbox/client/api/process/get_process_identifier_logs.py +188 -0
- blaxel/sandbox/client/api/process/get_process_identifier_logs_stream.py +190 -0
- blaxel/sandbox/client/api/process/post_process.py +176 -0
- blaxel/sandbox/client/client.py +162 -0
- blaxel/sandbox/client/errors.py +16 -0
- blaxel/sandbox/client/models/__init__.py +41 -0
- blaxel/sandbox/client/models/delete_network_process_pid_monitor_response_200.py +45 -0
- blaxel/sandbox/client/models/directory.py +112 -0
- blaxel/sandbox/client/models/error_response.py +60 -0
- blaxel/sandbox/client/models/file.py +105 -0
- blaxel/sandbox/client/models/file_request.py +78 -0
- blaxel/sandbox/client/models/file_with_content.py +114 -0
- blaxel/sandbox/client/models/get_network_process_pid_ports_response_200.py +45 -0
- blaxel/sandbox/client/models/get_process_identifier_logs_response_200.py +45 -0
- blaxel/sandbox/client/models/get_process_identifier_logs_stream_response_200.py +45 -0
- blaxel/sandbox/client/models/port_monitor_request.py +60 -0
- blaxel/sandbox/client/models/post_network_process_pid_monitor_response_200.py +45 -0
- blaxel/sandbox/client/models/process_kill_request.py +60 -0
- blaxel/sandbox/client/models/process_request.py +118 -0
- blaxel/sandbox/client/models/process_response.py +123 -0
- blaxel/sandbox/client/models/subdirectory.py +60 -0
- blaxel/sandbox/client/models/success_response.py +69 -0
- blaxel/sandbox/client/py.typed +1 -0
- blaxel/sandbox/client/types.py +46 -0
- blaxel/sandbox/filesystem.py +104 -0
- blaxel/sandbox/process.py +57 -0
- blaxel/sandbox/sandbox.py +92 -0
- blaxel/tools/__init__.py +1 -1
- {blaxel-0.1.9rc37.dist-info → blaxel-0.1.10.dist-info}/METADATA +1 -1
- {blaxel-0.1.9rc37.dist-info → blaxel-0.1.10.dist-info}/RECORD +79 -12
- blaxel/client/models/sandboxes.py +0 -129
- {blaxel-0.1.9rc37.dist-info → blaxel-0.1.10.dist-info}/WHEEL +0 -0
- {blaxel-0.1.9rc37.dist-info → blaxel-0.1.10.dist-info}/licenses/LICENSE +0 -0
@@ -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 Client
|
8
|
+
from ...models.delete_sandbox_preview_token_response_200 import DeleteSandboxPreviewTokenResponse200
|
9
|
+
from ...types import Response
|
10
|
+
|
11
|
+
|
12
|
+
def _get_kwargs(
|
13
|
+
sandbox_name: str,
|
14
|
+
preview_name: str,
|
15
|
+
token_name: str,
|
16
|
+
) -> dict[str, Any]:
|
17
|
+
_kwargs: dict[str, Any] = {
|
18
|
+
"method": "delete",
|
19
|
+
"url": f"/sandboxes/{sandbox_name}/previews/{preview_name}/tokens/{token_name}",
|
20
|
+
}
|
21
|
+
|
22
|
+
return _kwargs
|
23
|
+
|
24
|
+
|
25
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[DeleteSandboxPreviewTokenResponse200]:
|
26
|
+
if response.status_code == 200:
|
27
|
+
response_200 = DeleteSandboxPreviewTokenResponse200.from_dict(response.json())
|
28
|
+
|
29
|
+
return response_200
|
30
|
+
if client.raise_on_unexpected_status:
|
31
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
32
|
+
else:
|
33
|
+
return None
|
34
|
+
|
35
|
+
|
36
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[DeleteSandboxPreviewTokenResponse200]:
|
37
|
+
return Response(
|
38
|
+
status_code=HTTPStatus(response.status_code),
|
39
|
+
content=response.content,
|
40
|
+
headers=response.headers,
|
41
|
+
parsed=_parse_response(client=client, response=response),
|
42
|
+
)
|
43
|
+
|
44
|
+
|
45
|
+
def sync_detailed(
|
46
|
+
sandbox_name: str,
|
47
|
+
preview_name: str,
|
48
|
+
token_name: str,
|
49
|
+
*,
|
50
|
+
client: Union[Client],
|
51
|
+
) -> Response[DeleteSandboxPreviewTokenResponse200]:
|
52
|
+
"""Delete token for Sandbox Preview
|
53
|
+
|
54
|
+
Deletes a token for a Sandbox Preview by name.
|
55
|
+
|
56
|
+
Args:
|
57
|
+
sandbox_name (str):
|
58
|
+
preview_name (str):
|
59
|
+
token_name (str):
|
60
|
+
|
61
|
+
Raises:
|
62
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
63
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
64
|
+
|
65
|
+
Returns:
|
66
|
+
Response[DeleteSandboxPreviewTokenResponse200]
|
67
|
+
"""
|
68
|
+
|
69
|
+
kwargs = _get_kwargs(
|
70
|
+
sandbox_name=sandbox_name,
|
71
|
+
preview_name=preview_name,
|
72
|
+
token_name=token_name,
|
73
|
+
)
|
74
|
+
|
75
|
+
response = client.get_httpx_client().request(
|
76
|
+
**kwargs,
|
77
|
+
)
|
78
|
+
|
79
|
+
return _build_response(client=client, response=response)
|
80
|
+
|
81
|
+
|
82
|
+
def sync(
|
83
|
+
sandbox_name: str,
|
84
|
+
preview_name: str,
|
85
|
+
token_name: str,
|
86
|
+
*,
|
87
|
+
client: Union[Client],
|
88
|
+
) -> Optional[DeleteSandboxPreviewTokenResponse200]:
|
89
|
+
"""Delete token for Sandbox Preview
|
90
|
+
|
91
|
+
Deletes a token for a Sandbox Preview by name.
|
92
|
+
|
93
|
+
Args:
|
94
|
+
sandbox_name (str):
|
95
|
+
preview_name (str):
|
96
|
+
token_name (str):
|
97
|
+
|
98
|
+
Raises:
|
99
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
100
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
101
|
+
|
102
|
+
Returns:
|
103
|
+
DeleteSandboxPreviewTokenResponse200
|
104
|
+
"""
|
105
|
+
|
106
|
+
return sync_detailed(
|
107
|
+
sandbox_name=sandbox_name,
|
108
|
+
preview_name=preview_name,
|
109
|
+
token_name=token_name,
|
110
|
+
client=client,
|
111
|
+
).parsed
|
112
|
+
|
113
|
+
|
114
|
+
async def asyncio_detailed(
|
115
|
+
sandbox_name: str,
|
116
|
+
preview_name: str,
|
117
|
+
token_name: str,
|
118
|
+
*,
|
119
|
+
client: Union[Client],
|
120
|
+
) -> Response[DeleteSandboxPreviewTokenResponse200]:
|
121
|
+
"""Delete token for Sandbox Preview
|
122
|
+
|
123
|
+
Deletes a token for a Sandbox Preview by name.
|
124
|
+
|
125
|
+
Args:
|
126
|
+
sandbox_name (str):
|
127
|
+
preview_name (str):
|
128
|
+
token_name (str):
|
129
|
+
|
130
|
+
Raises:
|
131
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
132
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
133
|
+
|
134
|
+
Returns:
|
135
|
+
Response[DeleteSandboxPreviewTokenResponse200]
|
136
|
+
"""
|
137
|
+
|
138
|
+
kwargs = _get_kwargs(
|
139
|
+
sandbox_name=sandbox_name,
|
140
|
+
preview_name=preview_name,
|
141
|
+
token_name=token_name,
|
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
|
+
sandbox_name: str,
|
151
|
+
preview_name: str,
|
152
|
+
token_name: str,
|
153
|
+
*,
|
154
|
+
client: Union[Client],
|
155
|
+
) -> Optional[DeleteSandboxPreviewTokenResponse200]:
|
156
|
+
"""Delete token for Sandbox Preview
|
157
|
+
|
158
|
+
Deletes a token for a Sandbox Preview by name.
|
159
|
+
|
160
|
+
Args:
|
161
|
+
sandbox_name (str):
|
162
|
+
preview_name (str):
|
163
|
+
token_name (str):
|
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
|
+
DeleteSandboxPreviewTokenResponse200
|
171
|
+
"""
|
172
|
+
|
173
|
+
return (
|
174
|
+
await asyncio_detailed(
|
175
|
+
sandbox_name=sandbox_name,
|
176
|
+
preview_name=preview_name,
|
177
|
+
token_name=token_name,
|
178
|
+
client=client,
|
179
|
+
)
|
180
|
+
).parsed
|
@@ -0,0 +1,167 @@
|
|
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 Client
|
8
|
+
from ...models.preview import Preview
|
9
|
+
from ...types import Response
|
10
|
+
|
11
|
+
|
12
|
+
def _get_kwargs(
|
13
|
+
sandbox_name: str,
|
14
|
+
preview_name: str,
|
15
|
+
) -> dict[str, Any]:
|
16
|
+
_kwargs: dict[str, Any] = {
|
17
|
+
"method": "get",
|
18
|
+
"url": f"/sandboxes/{sandbox_name}/previews/{preview_name}",
|
19
|
+
}
|
20
|
+
|
21
|
+
return _kwargs
|
22
|
+
|
23
|
+
|
24
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Preview]:
|
25
|
+
if response.status_code == 200:
|
26
|
+
response_200 = Preview.from_dict(response.json())
|
27
|
+
|
28
|
+
return response_200
|
29
|
+
if client.raise_on_unexpected_status:
|
30
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
31
|
+
else:
|
32
|
+
return None
|
33
|
+
|
34
|
+
|
35
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Preview]:
|
36
|
+
return Response(
|
37
|
+
status_code=HTTPStatus(response.status_code),
|
38
|
+
content=response.content,
|
39
|
+
headers=response.headers,
|
40
|
+
parsed=_parse_response(client=client, response=response),
|
41
|
+
)
|
42
|
+
|
43
|
+
|
44
|
+
def sync_detailed(
|
45
|
+
sandbox_name: str,
|
46
|
+
preview_name: str,
|
47
|
+
*,
|
48
|
+
client: Union[Client],
|
49
|
+
) -> Response[Preview]:
|
50
|
+
"""Get Sandbox Preview
|
51
|
+
|
52
|
+
Returns a Sandbox Preview by name.
|
53
|
+
|
54
|
+
Args:
|
55
|
+
sandbox_name (str):
|
56
|
+
preview_name (str):
|
57
|
+
|
58
|
+
Raises:
|
59
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
60
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
61
|
+
|
62
|
+
Returns:
|
63
|
+
Response[Preview]
|
64
|
+
"""
|
65
|
+
|
66
|
+
kwargs = _get_kwargs(
|
67
|
+
sandbox_name=sandbox_name,
|
68
|
+
preview_name=preview_name,
|
69
|
+
)
|
70
|
+
|
71
|
+
response = client.get_httpx_client().request(
|
72
|
+
**kwargs,
|
73
|
+
)
|
74
|
+
|
75
|
+
return _build_response(client=client, response=response)
|
76
|
+
|
77
|
+
|
78
|
+
def sync(
|
79
|
+
sandbox_name: str,
|
80
|
+
preview_name: str,
|
81
|
+
*,
|
82
|
+
client: Union[Client],
|
83
|
+
) -> Optional[Preview]:
|
84
|
+
"""Get Sandbox Preview
|
85
|
+
|
86
|
+
Returns a Sandbox Preview by name.
|
87
|
+
|
88
|
+
Args:
|
89
|
+
sandbox_name (str):
|
90
|
+
preview_name (str):
|
91
|
+
|
92
|
+
Raises:
|
93
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
94
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
95
|
+
|
96
|
+
Returns:
|
97
|
+
Preview
|
98
|
+
"""
|
99
|
+
|
100
|
+
return sync_detailed(
|
101
|
+
sandbox_name=sandbox_name,
|
102
|
+
preview_name=preview_name,
|
103
|
+
client=client,
|
104
|
+
).parsed
|
105
|
+
|
106
|
+
|
107
|
+
async def asyncio_detailed(
|
108
|
+
sandbox_name: str,
|
109
|
+
preview_name: str,
|
110
|
+
*,
|
111
|
+
client: Union[Client],
|
112
|
+
) -> Response[Preview]:
|
113
|
+
"""Get Sandbox Preview
|
114
|
+
|
115
|
+
Returns a Sandbox Preview by name.
|
116
|
+
|
117
|
+
Args:
|
118
|
+
sandbox_name (str):
|
119
|
+
preview_name (str):
|
120
|
+
|
121
|
+
Raises:
|
122
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
123
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
124
|
+
|
125
|
+
Returns:
|
126
|
+
Response[Preview]
|
127
|
+
"""
|
128
|
+
|
129
|
+
kwargs = _get_kwargs(
|
130
|
+
sandbox_name=sandbox_name,
|
131
|
+
preview_name=preview_name,
|
132
|
+
)
|
133
|
+
|
134
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
135
|
+
|
136
|
+
return _build_response(client=client, response=response)
|
137
|
+
|
138
|
+
|
139
|
+
async def asyncio(
|
140
|
+
sandbox_name: str,
|
141
|
+
preview_name: str,
|
142
|
+
*,
|
143
|
+
client: Union[Client],
|
144
|
+
) -> Optional[Preview]:
|
145
|
+
"""Get Sandbox Preview
|
146
|
+
|
147
|
+
Returns a Sandbox Preview by name.
|
148
|
+
|
149
|
+
Args:
|
150
|
+
sandbox_name (str):
|
151
|
+
preview_name (str):
|
152
|
+
|
153
|
+
Raises:
|
154
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
155
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
156
|
+
|
157
|
+
Returns:
|
158
|
+
Preview
|
159
|
+
"""
|
160
|
+
|
161
|
+
return (
|
162
|
+
await asyncio_detailed(
|
163
|
+
sandbox_name=sandbox_name,
|
164
|
+
preview_name=preview_name,
|
165
|
+
client=client,
|
166
|
+
)
|
167
|
+
).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 Client
|
8
|
+
from ...models.preview_token import PreviewToken
|
9
|
+
from ...types import Response
|
10
|
+
|
11
|
+
|
12
|
+
def _get_kwargs(
|
13
|
+
sandbox_name: str,
|
14
|
+
preview_name: str,
|
15
|
+
) -> dict[str, Any]:
|
16
|
+
_kwargs: dict[str, Any] = {
|
17
|
+
"method": "get",
|
18
|
+
"url": f"/sandboxes/{sandbox_name}/previews/{preview_name}/tokens",
|
19
|
+
}
|
20
|
+
|
21
|
+
return _kwargs
|
22
|
+
|
23
|
+
|
24
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[list["PreviewToken"]]:
|
25
|
+
if response.status_code == 200:
|
26
|
+
response_200 = []
|
27
|
+
_response_200 = response.json()
|
28
|
+
for response_200_item_data in _response_200:
|
29
|
+
response_200_item = PreviewToken.from_dict(response_200_item_data)
|
30
|
+
|
31
|
+
response_200.append(response_200_item)
|
32
|
+
|
33
|
+
return response_200
|
34
|
+
if client.raise_on_unexpected_status:
|
35
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
36
|
+
else:
|
37
|
+
return None
|
38
|
+
|
39
|
+
|
40
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[list["PreviewToken"]]:
|
41
|
+
return Response(
|
42
|
+
status_code=HTTPStatus(response.status_code),
|
43
|
+
content=response.content,
|
44
|
+
headers=response.headers,
|
45
|
+
parsed=_parse_response(client=client, response=response),
|
46
|
+
)
|
47
|
+
|
48
|
+
|
49
|
+
def sync_detailed(
|
50
|
+
sandbox_name: str,
|
51
|
+
preview_name: str,
|
52
|
+
*,
|
53
|
+
client: Union[Client],
|
54
|
+
) -> Response[list["PreviewToken"]]:
|
55
|
+
"""Get tokens for Sandbox Preview
|
56
|
+
|
57
|
+
Gets tokens for a Sandbox Preview.
|
58
|
+
|
59
|
+
Args:
|
60
|
+
sandbox_name (str):
|
61
|
+
preview_name (str):
|
62
|
+
|
63
|
+
Raises:
|
64
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
65
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
66
|
+
|
67
|
+
Returns:
|
68
|
+
Response[list['PreviewToken']]
|
69
|
+
"""
|
70
|
+
|
71
|
+
kwargs = _get_kwargs(
|
72
|
+
sandbox_name=sandbox_name,
|
73
|
+
preview_name=preview_name,
|
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
|
+
sandbox_name: str,
|
85
|
+
preview_name: str,
|
86
|
+
*,
|
87
|
+
client: Union[Client],
|
88
|
+
) -> Optional[list["PreviewToken"]]:
|
89
|
+
"""Get tokens for Sandbox Preview
|
90
|
+
|
91
|
+
Gets tokens for a Sandbox Preview.
|
92
|
+
|
93
|
+
Args:
|
94
|
+
sandbox_name (str):
|
95
|
+
preview_name (str):
|
96
|
+
|
97
|
+
Raises:
|
98
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
99
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
100
|
+
|
101
|
+
Returns:
|
102
|
+
list['PreviewToken']
|
103
|
+
"""
|
104
|
+
|
105
|
+
return sync_detailed(
|
106
|
+
sandbox_name=sandbox_name,
|
107
|
+
preview_name=preview_name,
|
108
|
+
client=client,
|
109
|
+
).parsed
|
110
|
+
|
111
|
+
|
112
|
+
async def asyncio_detailed(
|
113
|
+
sandbox_name: str,
|
114
|
+
preview_name: str,
|
115
|
+
*,
|
116
|
+
client: Union[Client],
|
117
|
+
) -> Response[list["PreviewToken"]]:
|
118
|
+
"""Get tokens for Sandbox Preview
|
119
|
+
|
120
|
+
Gets tokens for a Sandbox Preview.
|
121
|
+
|
122
|
+
Args:
|
123
|
+
sandbox_name (str):
|
124
|
+
preview_name (str):
|
125
|
+
|
126
|
+
Raises:
|
127
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
128
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
129
|
+
|
130
|
+
Returns:
|
131
|
+
Response[list['PreviewToken']]
|
132
|
+
"""
|
133
|
+
|
134
|
+
kwargs = _get_kwargs(
|
135
|
+
sandbox_name=sandbox_name,
|
136
|
+
preview_name=preview_name,
|
137
|
+
)
|
138
|
+
|
139
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
140
|
+
|
141
|
+
return _build_response(client=client, response=response)
|
142
|
+
|
143
|
+
|
144
|
+
async def asyncio(
|
145
|
+
sandbox_name: str,
|
146
|
+
preview_name: str,
|
147
|
+
*,
|
148
|
+
client: Union[Client],
|
149
|
+
) -> Optional[list["PreviewToken"]]:
|
150
|
+
"""Get tokens for Sandbox Preview
|
151
|
+
|
152
|
+
Gets tokens for a Sandbox Preview.
|
153
|
+
|
154
|
+
Args:
|
155
|
+
sandbox_name (str):
|
156
|
+
preview_name (str):
|
157
|
+
|
158
|
+
Raises:
|
159
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
160
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
161
|
+
|
162
|
+
Returns:
|
163
|
+
list['PreviewToken']
|
164
|
+
"""
|
165
|
+
|
166
|
+
return (
|
167
|
+
await asyncio_detailed(
|
168
|
+
sandbox_name=sandbox_name,
|
169
|
+
preview_name=preview_name,
|
170
|
+
client=client,
|
171
|
+
)
|
172
|
+
).parsed
|
@@ -0,0 +1,159 @@
|
|
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 Client
|
8
|
+
from ...models.preview import Preview
|
9
|
+
from ...types import Response
|
10
|
+
|
11
|
+
|
12
|
+
def _get_kwargs(
|
13
|
+
sandbox_name: str,
|
14
|
+
) -> dict[str, Any]:
|
15
|
+
_kwargs: dict[str, Any] = {
|
16
|
+
"method": "get",
|
17
|
+
"url": f"/sandboxes/{sandbox_name}/previews",
|
18
|
+
}
|
19
|
+
|
20
|
+
return _kwargs
|
21
|
+
|
22
|
+
|
23
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[list["Preview"]]:
|
24
|
+
if response.status_code == 200:
|
25
|
+
response_200 = []
|
26
|
+
_response_200 = response.json()
|
27
|
+
for response_200_item_data in _response_200:
|
28
|
+
response_200_item = Preview.from_dict(response_200_item_data)
|
29
|
+
|
30
|
+
response_200.append(response_200_item)
|
31
|
+
|
32
|
+
return response_200
|
33
|
+
if client.raise_on_unexpected_status:
|
34
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
35
|
+
else:
|
36
|
+
return None
|
37
|
+
|
38
|
+
|
39
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[list["Preview"]]:
|
40
|
+
return Response(
|
41
|
+
status_code=HTTPStatus(response.status_code),
|
42
|
+
content=response.content,
|
43
|
+
headers=response.headers,
|
44
|
+
parsed=_parse_response(client=client, response=response),
|
45
|
+
)
|
46
|
+
|
47
|
+
|
48
|
+
def sync_detailed(
|
49
|
+
sandbox_name: str,
|
50
|
+
*,
|
51
|
+
client: Union[Client],
|
52
|
+
) -> Response[list["Preview"]]:
|
53
|
+
"""List Sandboxes
|
54
|
+
|
55
|
+
Returns a list of Sandbox Previews in the workspace.
|
56
|
+
|
57
|
+
Args:
|
58
|
+
sandbox_name (str):
|
59
|
+
|
60
|
+
Raises:
|
61
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
62
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
63
|
+
|
64
|
+
Returns:
|
65
|
+
Response[list['Preview']]
|
66
|
+
"""
|
67
|
+
|
68
|
+
kwargs = _get_kwargs(
|
69
|
+
sandbox_name=sandbox_name,
|
70
|
+
)
|
71
|
+
|
72
|
+
response = client.get_httpx_client().request(
|
73
|
+
**kwargs,
|
74
|
+
)
|
75
|
+
|
76
|
+
return _build_response(client=client, response=response)
|
77
|
+
|
78
|
+
|
79
|
+
def sync(
|
80
|
+
sandbox_name: str,
|
81
|
+
*,
|
82
|
+
client: Union[Client],
|
83
|
+
) -> Optional[list["Preview"]]:
|
84
|
+
"""List Sandboxes
|
85
|
+
|
86
|
+
Returns a list of Sandbox Previews in the workspace.
|
87
|
+
|
88
|
+
Args:
|
89
|
+
sandbox_name (str):
|
90
|
+
|
91
|
+
Raises:
|
92
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
93
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
94
|
+
|
95
|
+
Returns:
|
96
|
+
list['Preview']
|
97
|
+
"""
|
98
|
+
|
99
|
+
return sync_detailed(
|
100
|
+
sandbox_name=sandbox_name,
|
101
|
+
client=client,
|
102
|
+
).parsed
|
103
|
+
|
104
|
+
|
105
|
+
async def asyncio_detailed(
|
106
|
+
sandbox_name: str,
|
107
|
+
*,
|
108
|
+
client: Union[Client],
|
109
|
+
) -> Response[list["Preview"]]:
|
110
|
+
"""List Sandboxes
|
111
|
+
|
112
|
+
Returns a list of Sandbox Previews in the workspace.
|
113
|
+
|
114
|
+
Args:
|
115
|
+
sandbox_name (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[list['Preview']]
|
123
|
+
"""
|
124
|
+
|
125
|
+
kwargs = _get_kwargs(
|
126
|
+
sandbox_name=sandbox_name,
|
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
|
+
sandbox_name: str,
|
136
|
+
*,
|
137
|
+
client: Union[Client],
|
138
|
+
) -> Optional[list["Preview"]]:
|
139
|
+
"""List Sandboxes
|
140
|
+
|
141
|
+
Returns a list of Sandbox Previews in the workspace.
|
142
|
+
|
143
|
+
Args:
|
144
|
+
sandbox_name (str):
|
145
|
+
|
146
|
+
Raises:
|
147
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
148
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
149
|
+
|
150
|
+
Returns:
|
151
|
+
list['Preview']
|
152
|
+
"""
|
153
|
+
|
154
|
+
return (
|
155
|
+
await asyncio_detailed(
|
156
|
+
sandbox_name=sandbox_name,
|
157
|
+
client=client,
|
158
|
+
)
|
159
|
+
).parsed
|