blaxel 0.1.9rc36__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/agents/__init__.py +52 -15
- 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 +0 -2
- blaxel/common/internal.py +75 -0
- blaxel/common/settings.py +6 -1
- blaxel/mcp/server.py +2 -1
- 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 +62 -21
- {blaxel-0.1.9rc36.dist-info → blaxel-0.1.10.dist-info}/METADATA +1 -1
- {blaxel-0.1.9rc36.dist-info → blaxel-0.1.10.dist-info}/RECORD +82 -14
- blaxel/client/models/sandboxes.py +0 -129
- {blaxel-0.1.9rc36.dist-info → blaxel-0.1.10.dist-info}/WHEEL +0 -0
- {blaxel-0.1.9rc36.dist-info → blaxel-0.1.10.dist-info}/licenses/LICENSE +0 -0
@@ -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.error_response import ErrorResponse
|
9
|
+
from ...models.process_response import ProcessResponse
|
10
|
+
from ...types import Response
|
11
|
+
|
12
|
+
|
13
|
+
def _get_kwargs(
|
14
|
+
identifier: str,
|
15
|
+
) -> dict[str, Any]:
|
16
|
+
_kwargs: dict[str, Any] = {
|
17
|
+
"method": "get",
|
18
|
+
"url": f"/process/{identifier}",
|
19
|
+
}
|
20
|
+
|
21
|
+
return _kwargs
|
22
|
+
|
23
|
+
|
24
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[ErrorResponse, ProcessResponse]]:
|
25
|
+
if response.status_code == 200:
|
26
|
+
response_200 = ProcessResponse.from_dict(response.json())
|
27
|
+
|
28
|
+
return response_200
|
29
|
+
if response.status_code == 404:
|
30
|
+
response_404 = ErrorResponse.from_dict(response.json())
|
31
|
+
|
32
|
+
return response_404
|
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[Union[ErrorResponse, ProcessResponse]]:
|
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
|
+
identifier: str,
|
50
|
+
*,
|
51
|
+
client: Union[Client],
|
52
|
+
) -> Response[Union[ErrorResponse, ProcessResponse]]:
|
53
|
+
"""Get process by identifier
|
54
|
+
|
55
|
+
Get information about a process by its PID or name
|
56
|
+
|
57
|
+
Args:
|
58
|
+
identifier (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[Union[ErrorResponse, ProcessResponse]]
|
66
|
+
"""
|
67
|
+
|
68
|
+
kwargs = _get_kwargs(
|
69
|
+
identifier=identifier,
|
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
|
+
identifier: str,
|
81
|
+
*,
|
82
|
+
client: Union[Client],
|
83
|
+
) -> Optional[Union[ErrorResponse, ProcessResponse]]:
|
84
|
+
"""Get process by identifier
|
85
|
+
|
86
|
+
Get information about a process by its PID or name
|
87
|
+
|
88
|
+
Args:
|
89
|
+
identifier (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
|
+
Union[ErrorResponse, ProcessResponse]
|
97
|
+
"""
|
98
|
+
|
99
|
+
return sync_detailed(
|
100
|
+
identifier=identifier,
|
101
|
+
client=client,
|
102
|
+
).parsed
|
103
|
+
|
104
|
+
|
105
|
+
async def asyncio_detailed(
|
106
|
+
identifier: str,
|
107
|
+
*,
|
108
|
+
client: Union[Client],
|
109
|
+
) -> Response[Union[ErrorResponse, ProcessResponse]]:
|
110
|
+
"""Get process by identifier
|
111
|
+
|
112
|
+
Get information about a process by its PID or name
|
113
|
+
|
114
|
+
Args:
|
115
|
+
identifier (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[ErrorResponse, ProcessResponse]]
|
123
|
+
"""
|
124
|
+
|
125
|
+
kwargs = _get_kwargs(
|
126
|
+
identifier=identifier,
|
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
|
+
identifier: str,
|
136
|
+
*,
|
137
|
+
client: Union[Client],
|
138
|
+
) -> Optional[Union[ErrorResponse, ProcessResponse]]:
|
139
|
+
"""Get process by identifier
|
140
|
+
|
141
|
+
Get information about a process by its PID or name
|
142
|
+
|
143
|
+
Args:
|
144
|
+
identifier (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
|
+
Union[ErrorResponse, ProcessResponse]
|
152
|
+
"""
|
153
|
+
|
154
|
+
return (
|
155
|
+
await asyncio_detailed(
|
156
|
+
identifier=identifier,
|
157
|
+
client=client,
|
158
|
+
)
|
159
|
+
).parsed
|
@@ -0,0 +1,188 @@
|
|
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.error_response import ErrorResponse
|
9
|
+
from ...models.get_process_identifier_logs_response_200 import GetProcessIdentifierLogsResponse200
|
10
|
+
from ...types import UNSET, Response, Unset
|
11
|
+
|
12
|
+
|
13
|
+
def _get_kwargs(
|
14
|
+
identifier: str,
|
15
|
+
*,
|
16
|
+
stream: Union[Unset, bool] = UNSET,
|
17
|
+
) -> dict[str, Any]:
|
18
|
+
params: dict[str, Any] = {}
|
19
|
+
|
20
|
+
params["stream"] = stream
|
21
|
+
|
22
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
23
|
+
|
24
|
+
_kwargs: dict[str, Any] = {
|
25
|
+
"method": "get",
|
26
|
+
"url": f"/process/{identifier}/logs",
|
27
|
+
"params": params,
|
28
|
+
}
|
29
|
+
|
30
|
+
return _kwargs
|
31
|
+
|
32
|
+
|
33
|
+
def _parse_response(
|
34
|
+
*, client: Client, response: httpx.Response
|
35
|
+
) -> Optional[Union[ErrorResponse, GetProcessIdentifierLogsResponse200]]:
|
36
|
+
if response.status_code == 200:
|
37
|
+
response_200 = GetProcessIdentifierLogsResponse200.from_dict(response.json())
|
38
|
+
|
39
|
+
return response_200
|
40
|
+
if response.status_code == 404:
|
41
|
+
response_404 = ErrorResponse.from_dict(response.json())
|
42
|
+
|
43
|
+
return response_404
|
44
|
+
if response.status_code == 500:
|
45
|
+
response_500 = ErrorResponse.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: Client, response: httpx.Response
|
56
|
+
) -> Response[Union[ErrorResponse, GetProcessIdentifierLogsResponse200]]:
|
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
|
+
identifier: str,
|
67
|
+
*,
|
68
|
+
client: Union[Client],
|
69
|
+
stream: Union[Unset, bool] = UNSET,
|
70
|
+
) -> Response[Union[ErrorResponse, GetProcessIdentifierLogsResponse200]]:
|
71
|
+
"""Get process logs
|
72
|
+
|
73
|
+
Get the stdout and stderr output of a process
|
74
|
+
|
75
|
+
Args:
|
76
|
+
identifier (str):
|
77
|
+
stream (Union[Unset, bool]):
|
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[ErrorResponse, GetProcessIdentifierLogsResponse200]]
|
85
|
+
"""
|
86
|
+
|
87
|
+
kwargs = _get_kwargs(
|
88
|
+
identifier=identifier,
|
89
|
+
stream=stream,
|
90
|
+
)
|
91
|
+
|
92
|
+
response = client.get_httpx_client().request(
|
93
|
+
**kwargs,
|
94
|
+
)
|
95
|
+
|
96
|
+
return _build_response(client=client, response=response)
|
97
|
+
|
98
|
+
|
99
|
+
def sync(
|
100
|
+
identifier: str,
|
101
|
+
*,
|
102
|
+
client: Union[Client],
|
103
|
+
stream: Union[Unset, bool] = UNSET,
|
104
|
+
) -> Optional[Union[ErrorResponse, GetProcessIdentifierLogsResponse200]]:
|
105
|
+
"""Get process logs
|
106
|
+
|
107
|
+
Get the stdout and stderr output of a process
|
108
|
+
|
109
|
+
Args:
|
110
|
+
identifier (str):
|
111
|
+
stream (Union[Unset, bool]):
|
112
|
+
|
113
|
+
Raises:
|
114
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
115
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
116
|
+
|
117
|
+
Returns:
|
118
|
+
Union[ErrorResponse, GetProcessIdentifierLogsResponse200]
|
119
|
+
"""
|
120
|
+
|
121
|
+
return sync_detailed(
|
122
|
+
identifier=identifier,
|
123
|
+
client=client,
|
124
|
+
stream=stream,
|
125
|
+
).parsed
|
126
|
+
|
127
|
+
|
128
|
+
async def asyncio_detailed(
|
129
|
+
identifier: str,
|
130
|
+
*,
|
131
|
+
client: Union[Client],
|
132
|
+
stream: Union[Unset, bool] = UNSET,
|
133
|
+
) -> Response[Union[ErrorResponse, GetProcessIdentifierLogsResponse200]]:
|
134
|
+
"""Get process logs
|
135
|
+
|
136
|
+
Get the stdout and stderr output of a process
|
137
|
+
|
138
|
+
Args:
|
139
|
+
identifier (str):
|
140
|
+
stream (Union[Unset, bool]):
|
141
|
+
|
142
|
+
Raises:
|
143
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
144
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
145
|
+
|
146
|
+
Returns:
|
147
|
+
Response[Union[ErrorResponse, GetProcessIdentifierLogsResponse200]]
|
148
|
+
"""
|
149
|
+
|
150
|
+
kwargs = _get_kwargs(
|
151
|
+
identifier=identifier,
|
152
|
+
stream=stream,
|
153
|
+
)
|
154
|
+
|
155
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
156
|
+
|
157
|
+
return _build_response(client=client, response=response)
|
158
|
+
|
159
|
+
|
160
|
+
async def asyncio(
|
161
|
+
identifier: str,
|
162
|
+
*,
|
163
|
+
client: Union[Client],
|
164
|
+
stream: Union[Unset, bool] = UNSET,
|
165
|
+
) -> Optional[Union[ErrorResponse, GetProcessIdentifierLogsResponse200]]:
|
166
|
+
"""Get process logs
|
167
|
+
|
168
|
+
Get the stdout and stderr output of a process
|
169
|
+
|
170
|
+
Args:
|
171
|
+
identifier (str):
|
172
|
+
stream (Union[Unset, bool]):
|
173
|
+
|
174
|
+
Raises:
|
175
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
176
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
177
|
+
|
178
|
+
Returns:
|
179
|
+
Union[ErrorResponse, GetProcessIdentifierLogsResponse200]
|
180
|
+
"""
|
181
|
+
|
182
|
+
return (
|
183
|
+
await asyncio_detailed(
|
184
|
+
identifier=identifier,
|
185
|
+
client=client,
|
186
|
+
stream=stream,
|
187
|
+
)
|
188
|
+
).parsed
|
@@ -0,0 +1,190 @@
|
|
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.error_response import ErrorResponse
|
9
|
+
from ...models.get_process_identifier_logs_stream_response_200 import (
|
10
|
+
GetProcessIdentifierLogsStreamResponse200,
|
11
|
+
)
|
12
|
+
from ...types import UNSET, Response, Unset
|
13
|
+
|
14
|
+
|
15
|
+
def _get_kwargs(
|
16
|
+
identifier: str,
|
17
|
+
*,
|
18
|
+
stream: Union[Unset, bool] = UNSET,
|
19
|
+
) -> dict[str, Any]:
|
20
|
+
params: dict[str, Any] = {}
|
21
|
+
|
22
|
+
params["stream"] = stream
|
23
|
+
|
24
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
25
|
+
|
26
|
+
_kwargs: dict[str, Any] = {
|
27
|
+
"method": "get",
|
28
|
+
"url": f"/process/{identifier}/logs/stream",
|
29
|
+
"params": params,
|
30
|
+
}
|
31
|
+
|
32
|
+
return _kwargs
|
33
|
+
|
34
|
+
|
35
|
+
def _parse_response(
|
36
|
+
*, client: Client, response: httpx.Response
|
37
|
+
) -> Optional[Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]]:
|
38
|
+
if response.status_code == 200:
|
39
|
+
response_200 = GetProcessIdentifierLogsStreamResponse200.from_dict(response.json())
|
40
|
+
|
41
|
+
return response_200
|
42
|
+
if response.status_code == 404:
|
43
|
+
response_404 = ErrorResponse.from_dict(response.json())
|
44
|
+
|
45
|
+
return response_404
|
46
|
+
if response.status_code == 500:
|
47
|
+
response_500 = ErrorResponse.from_dict(response.json())
|
48
|
+
|
49
|
+
return response_500
|
50
|
+
if client.raise_on_unexpected_status:
|
51
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
52
|
+
else:
|
53
|
+
return None
|
54
|
+
|
55
|
+
|
56
|
+
def _build_response(
|
57
|
+
*, client: Client, response: httpx.Response
|
58
|
+
) -> Response[Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]]:
|
59
|
+
return Response(
|
60
|
+
status_code=HTTPStatus(response.status_code),
|
61
|
+
content=response.content,
|
62
|
+
headers=response.headers,
|
63
|
+
parsed=_parse_response(client=client, response=response),
|
64
|
+
)
|
65
|
+
|
66
|
+
|
67
|
+
def sync_detailed(
|
68
|
+
identifier: str,
|
69
|
+
*,
|
70
|
+
client: Union[Client],
|
71
|
+
stream: Union[Unset, bool] = UNSET,
|
72
|
+
) -> Response[Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]]:
|
73
|
+
"""Get process logs in realtime
|
74
|
+
|
75
|
+
Get the stdout and stderr output of a process in realtime
|
76
|
+
|
77
|
+
Args:
|
78
|
+
identifier (str):
|
79
|
+
stream (Union[Unset, bool]):
|
80
|
+
|
81
|
+
Raises:
|
82
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
83
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
84
|
+
|
85
|
+
Returns:
|
86
|
+
Response[Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]]
|
87
|
+
"""
|
88
|
+
|
89
|
+
kwargs = _get_kwargs(
|
90
|
+
identifier=identifier,
|
91
|
+
stream=stream,
|
92
|
+
)
|
93
|
+
|
94
|
+
response = client.get_httpx_client().request(
|
95
|
+
**kwargs,
|
96
|
+
)
|
97
|
+
|
98
|
+
return _build_response(client=client, response=response)
|
99
|
+
|
100
|
+
|
101
|
+
def sync(
|
102
|
+
identifier: str,
|
103
|
+
*,
|
104
|
+
client: Union[Client],
|
105
|
+
stream: Union[Unset, bool] = UNSET,
|
106
|
+
) -> Optional[Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]]:
|
107
|
+
"""Get process logs in realtime
|
108
|
+
|
109
|
+
Get the stdout and stderr output of a process in realtime
|
110
|
+
|
111
|
+
Args:
|
112
|
+
identifier (str):
|
113
|
+
stream (Union[Unset, bool]):
|
114
|
+
|
115
|
+
Raises:
|
116
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
117
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
118
|
+
|
119
|
+
Returns:
|
120
|
+
Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]
|
121
|
+
"""
|
122
|
+
|
123
|
+
return sync_detailed(
|
124
|
+
identifier=identifier,
|
125
|
+
client=client,
|
126
|
+
stream=stream,
|
127
|
+
).parsed
|
128
|
+
|
129
|
+
|
130
|
+
async def asyncio_detailed(
|
131
|
+
identifier: str,
|
132
|
+
*,
|
133
|
+
client: Union[Client],
|
134
|
+
stream: Union[Unset, bool] = UNSET,
|
135
|
+
) -> Response[Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]]:
|
136
|
+
"""Get process logs in realtime
|
137
|
+
|
138
|
+
Get the stdout and stderr output of a process in realtime
|
139
|
+
|
140
|
+
Args:
|
141
|
+
identifier (str):
|
142
|
+
stream (Union[Unset, bool]):
|
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
|
+
Response[Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]]
|
150
|
+
"""
|
151
|
+
|
152
|
+
kwargs = _get_kwargs(
|
153
|
+
identifier=identifier,
|
154
|
+
stream=stream,
|
155
|
+
)
|
156
|
+
|
157
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
158
|
+
|
159
|
+
return _build_response(client=client, response=response)
|
160
|
+
|
161
|
+
|
162
|
+
async def asyncio(
|
163
|
+
identifier: str,
|
164
|
+
*,
|
165
|
+
client: Union[Client],
|
166
|
+
stream: Union[Unset, bool] = UNSET,
|
167
|
+
) -> Optional[Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]]:
|
168
|
+
"""Get process logs in realtime
|
169
|
+
|
170
|
+
Get the stdout and stderr output of a process in realtime
|
171
|
+
|
172
|
+
Args:
|
173
|
+
identifier (str):
|
174
|
+
stream (Union[Unset, bool]):
|
175
|
+
|
176
|
+
Raises:
|
177
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
178
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
179
|
+
|
180
|
+
Returns:
|
181
|
+
Union[ErrorResponse, GetProcessIdentifierLogsStreamResponse200]
|
182
|
+
"""
|
183
|
+
|
184
|
+
return (
|
185
|
+
await asyncio_detailed(
|
186
|
+
identifier=identifier,
|
187
|
+
client=client,
|
188
|
+
stream=stream,
|
189
|
+
)
|
190
|
+
).parsed
|
@@ -0,0 +1,176 @@
|
|
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.error_response import ErrorResponse
|
9
|
+
from ...models.process_request import ProcessRequest
|
10
|
+
from ...models.process_response import ProcessResponse
|
11
|
+
from ...types import Response
|
12
|
+
|
13
|
+
|
14
|
+
def _get_kwargs(
|
15
|
+
*,
|
16
|
+
body: ProcessRequest,
|
17
|
+
) -> dict[str, Any]:
|
18
|
+
headers: dict[str, Any] = {}
|
19
|
+
|
20
|
+
_kwargs: dict[str, Any] = {
|
21
|
+
"method": "post",
|
22
|
+
"url": "/process",
|
23
|
+
}
|
24
|
+
|
25
|
+
if type(body) == dict:
|
26
|
+
_body = body
|
27
|
+
else:
|
28
|
+
_body = body.to_dict()
|
29
|
+
|
30
|
+
_kwargs["json"] = _body
|
31
|
+
headers["Content-Type"] = "application/json"
|
32
|
+
|
33
|
+
_kwargs["headers"] = headers
|
34
|
+
return _kwargs
|
35
|
+
|
36
|
+
|
37
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[ErrorResponse, ProcessResponse]]:
|
38
|
+
if response.status_code == 200:
|
39
|
+
response_200 = ProcessResponse.from_dict(response.json())
|
40
|
+
|
41
|
+
return response_200
|
42
|
+
if response.status_code == 400:
|
43
|
+
response_400 = ErrorResponse.from_dict(response.json())
|
44
|
+
|
45
|
+
return response_400
|
46
|
+
if response.status_code == 500:
|
47
|
+
response_500 = ErrorResponse.from_dict(response.json())
|
48
|
+
|
49
|
+
return response_500
|
50
|
+
if client.raise_on_unexpected_status:
|
51
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
52
|
+
else:
|
53
|
+
return None
|
54
|
+
|
55
|
+
|
56
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[ErrorResponse, ProcessResponse]]:
|
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
|
+
*,
|
67
|
+
client: Union[Client],
|
68
|
+
body: ProcessRequest,
|
69
|
+
) -> Response[Union[ErrorResponse, ProcessResponse]]:
|
70
|
+
"""Execute a command
|
71
|
+
|
72
|
+
Execute a command and return process information
|
73
|
+
|
74
|
+
Args:
|
75
|
+
body (ProcessRequest):
|
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[ErrorResponse, ProcessResponse]]
|
83
|
+
"""
|
84
|
+
|
85
|
+
kwargs = _get_kwargs(
|
86
|
+
body=body,
|
87
|
+
)
|
88
|
+
|
89
|
+
response = client.get_httpx_client().request(
|
90
|
+
**kwargs,
|
91
|
+
)
|
92
|
+
|
93
|
+
return _build_response(client=client, response=response)
|
94
|
+
|
95
|
+
|
96
|
+
def sync(
|
97
|
+
*,
|
98
|
+
client: Union[Client],
|
99
|
+
body: ProcessRequest,
|
100
|
+
) -> Optional[Union[ErrorResponse, ProcessResponse]]:
|
101
|
+
"""Execute a command
|
102
|
+
|
103
|
+
Execute a command and return process information
|
104
|
+
|
105
|
+
Args:
|
106
|
+
body (ProcessRequest):
|
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[ErrorResponse, ProcessResponse]
|
114
|
+
"""
|
115
|
+
|
116
|
+
return sync_detailed(
|
117
|
+
client=client,
|
118
|
+
body=body,
|
119
|
+
).parsed
|
120
|
+
|
121
|
+
|
122
|
+
async def asyncio_detailed(
|
123
|
+
*,
|
124
|
+
client: Union[Client],
|
125
|
+
body: ProcessRequest,
|
126
|
+
) -> Response[Union[ErrorResponse, ProcessResponse]]:
|
127
|
+
"""Execute a command
|
128
|
+
|
129
|
+
Execute a command and return process information
|
130
|
+
|
131
|
+
Args:
|
132
|
+
body (ProcessRequest):
|
133
|
+
|
134
|
+
Raises:
|
135
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
136
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
137
|
+
|
138
|
+
Returns:
|
139
|
+
Response[Union[ErrorResponse, ProcessResponse]]
|
140
|
+
"""
|
141
|
+
|
142
|
+
kwargs = _get_kwargs(
|
143
|
+
body=body,
|
144
|
+
)
|
145
|
+
|
146
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
147
|
+
|
148
|
+
return _build_response(client=client, response=response)
|
149
|
+
|
150
|
+
|
151
|
+
async def asyncio(
|
152
|
+
*,
|
153
|
+
client: Union[Client],
|
154
|
+
body: ProcessRequest,
|
155
|
+
) -> Optional[Union[ErrorResponse, ProcessResponse]]:
|
156
|
+
"""Execute a command
|
157
|
+
|
158
|
+
Execute a command and return process information
|
159
|
+
|
160
|
+
Args:
|
161
|
+
body (ProcessRequest):
|
162
|
+
|
163
|
+
Raises:
|
164
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
165
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
166
|
+
|
167
|
+
Returns:
|
168
|
+
Union[ErrorResponse, ProcessResponse]
|
169
|
+
"""
|
170
|
+
|
171
|
+
return (
|
172
|
+
await asyncio_detailed(
|
173
|
+
client=client,
|
174
|
+
body=body,
|
175
|
+
)
|
176
|
+
).parsed
|