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,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 Client
|
8
|
+
from ...models.error_response import ErrorResponse
|
9
|
+
from ...models.port_monitor_request import PortMonitorRequest
|
10
|
+
from ...models.post_network_process_pid_monitor_response_200 import (
|
11
|
+
PostNetworkProcessPidMonitorResponse200,
|
12
|
+
)
|
13
|
+
from ...types import Response
|
14
|
+
|
15
|
+
|
16
|
+
def _get_kwargs(
|
17
|
+
pid: int,
|
18
|
+
*,
|
19
|
+
body: PortMonitorRequest,
|
20
|
+
) -> dict[str, Any]:
|
21
|
+
headers: dict[str, Any] = {}
|
22
|
+
|
23
|
+
_kwargs: dict[str, Any] = {
|
24
|
+
"method": "post",
|
25
|
+
"url": f"/network/process/{pid}/monitor",
|
26
|
+
}
|
27
|
+
|
28
|
+
if type(body) == dict:
|
29
|
+
_body = body
|
30
|
+
else:
|
31
|
+
_body = body.to_dict()
|
32
|
+
|
33
|
+
_kwargs["json"] = _body
|
34
|
+
headers["Content-Type"] = "application/json"
|
35
|
+
|
36
|
+
_kwargs["headers"] = headers
|
37
|
+
return _kwargs
|
38
|
+
|
39
|
+
|
40
|
+
def _parse_response(
|
41
|
+
*, client: Client, response: httpx.Response
|
42
|
+
) -> Optional[Union[ErrorResponse, PostNetworkProcessPidMonitorResponse200]]:
|
43
|
+
if response.status_code == 200:
|
44
|
+
response_200 = PostNetworkProcessPidMonitorResponse200.from_dict(response.json())
|
45
|
+
|
46
|
+
return response_200
|
47
|
+
if response.status_code == 400:
|
48
|
+
response_400 = ErrorResponse.from_dict(response.json())
|
49
|
+
|
50
|
+
return response_400
|
51
|
+
if response.status_code == 500:
|
52
|
+
response_500 = ErrorResponse.from_dict(response.json())
|
53
|
+
|
54
|
+
return response_500
|
55
|
+
if client.raise_on_unexpected_status:
|
56
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
57
|
+
else:
|
58
|
+
return None
|
59
|
+
|
60
|
+
|
61
|
+
def _build_response(
|
62
|
+
*, client: Client, response: httpx.Response
|
63
|
+
) -> Response[Union[ErrorResponse, PostNetworkProcessPidMonitorResponse200]]:
|
64
|
+
return Response(
|
65
|
+
status_code=HTTPStatus(response.status_code),
|
66
|
+
content=response.content,
|
67
|
+
headers=response.headers,
|
68
|
+
parsed=_parse_response(client=client, response=response),
|
69
|
+
)
|
70
|
+
|
71
|
+
|
72
|
+
def sync_detailed(
|
73
|
+
pid: int,
|
74
|
+
*,
|
75
|
+
client: Union[Client],
|
76
|
+
body: PortMonitorRequest,
|
77
|
+
) -> Response[Union[ErrorResponse, PostNetworkProcessPidMonitorResponse200]]:
|
78
|
+
"""Start monitoring ports for a process
|
79
|
+
|
80
|
+
Start monitoring for new ports opened by a process
|
81
|
+
|
82
|
+
Args:
|
83
|
+
pid (int):
|
84
|
+
body (PortMonitorRequest):
|
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[ErrorResponse, PostNetworkProcessPidMonitorResponse200]]
|
92
|
+
"""
|
93
|
+
|
94
|
+
kwargs = _get_kwargs(
|
95
|
+
pid=pid,
|
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
|
+
pid: int,
|
108
|
+
*,
|
109
|
+
client: Union[Client],
|
110
|
+
body: PortMonitorRequest,
|
111
|
+
) -> Optional[Union[ErrorResponse, PostNetworkProcessPidMonitorResponse200]]:
|
112
|
+
"""Start monitoring ports for a process
|
113
|
+
|
114
|
+
Start monitoring for new ports opened by a process
|
115
|
+
|
116
|
+
Args:
|
117
|
+
pid (int):
|
118
|
+
body (PortMonitorRequest):
|
119
|
+
|
120
|
+
Raises:
|
121
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
122
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
123
|
+
|
124
|
+
Returns:
|
125
|
+
Union[ErrorResponse, PostNetworkProcessPidMonitorResponse200]
|
126
|
+
"""
|
127
|
+
|
128
|
+
return sync_detailed(
|
129
|
+
pid=pid,
|
130
|
+
client=client,
|
131
|
+
body=body,
|
132
|
+
).parsed
|
133
|
+
|
134
|
+
|
135
|
+
async def asyncio_detailed(
|
136
|
+
pid: int,
|
137
|
+
*,
|
138
|
+
client: Union[Client],
|
139
|
+
body: PortMonitorRequest,
|
140
|
+
) -> Response[Union[ErrorResponse, PostNetworkProcessPidMonitorResponse200]]:
|
141
|
+
"""Start monitoring ports for a process
|
142
|
+
|
143
|
+
Start monitoring for new ports opened by a process
|
144
|
+
|
145
|
+
Args:
|
146
|
+
pid (int):
|
147
|
+
body (PortMonitorRequest):
|
148
|
+
|
149
|
+
Raises:
|
150
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
151
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
152
|
+
|
153
|
+
Returns:
|
154
|
+
Response[Union[ErrorResponse, PostNetworkProcessPidMonitorResponse200]]
|
155
|
+
"""
|
156
|
+
|
157
|
+
kwargs = _get_kwargs(
|
158
|
+
pid=pid,
|
159
|
+
body=body,
|
160
|
+
)
|
161
|
+
|
162
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
163
|
+
|
164
|
+
return _build_response(client=client, response=response)
|
165
|
+
|
166
|
+
|
167
|
+
async def asyncio(
|
168
|
+
pid: int,
|
169
|
+
*,
|
170
|
+
client: Union[Client],
|
171
|
+
body: PortMonitorRequest,
|
172
|
+
) -> Optional[Union[ErrorResponse, PostNetworkProcessPidMonitorResponse200]]:
|
173
|
+
"""Start monitoring ports for a process
|
174
|
+
|
175
|
+
Start monitoring for new ports opened by a process
|
176
|
+
|
177
|
+
Args:
|
178
|
+
pid (int):
|
179
|
+
body (PortMonitorRequest):
|
180
|
+
|
181
|
+
Raises:
|
182
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
183
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
184
|
+
|
185
|
+
Returns:
|
186
|
+
Union[ErrorResponse, PostNetworkProcessPidMonitorResponse200]
|
187
|
+
"""
|
188
|
+
|
189
|
+
return (
|
190
|
+
await asyncio_detailed(
|
191
|
+
pid=pid,
|
192
|
+
client=client,
|
193
|
+
body=body,
|
194
|
+
)
|
195
|
+
).parsed
|
File without changes
|
@@ -0,0 +1,163 @@
|
|
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.success_response import SuccessResponse
|
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": "delete",
|
18
|
+
"url": f"/process/{identifier}",
|
19
|
+
}
|
20
|
+
|
21
|
+
return _kwargs
|
22
|
+
|
23
|
+
|
24
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[ErrorResponse, SuccessResponse]]:
|
25
|
+
if response.status_code == 200:
|
26
|
+
response_200 = SuccessResponse.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 response.status_code == 500:
|
34
|
+
response_500 = ErrorResponse.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(*, client: Client, response: httpx.Response) -> Response[Union[ErrorResponse, SuccessResponse]]:
|
44
|
+
return Response(
|
45
|
+
status_code=HTTPStatus(response.status_code),
|
46
|
+
content=response.content,
|
47
|
+
headers=response.headers,
|
48
|
+
parsed=_parse_response(client=client, response=response),
|
49
|
+
)
|
50
|
+
|
51
|
+
|
52
|
+
def sync_detailed(
|
53
|
+
identifier: str,
|
54
|
+
*,
|
55
|
+
client: Union[Client],
|
56
|
+
) -> Response[Union[ErrorResponse, SuccessResponse]]:
|
57
|
+
"""Stop a process
|
58
|
+
|
59
|
+
Gracefully stop a running process
|
60
|
+
|
61
|
+
Args:
|
62
|
+
identifier (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[ErrorResponse, SuccessResponse]]
|
70
|
+
"""
|
71
|
+
|
72
|
+
kwargs = _get_kwargs(
|
73
|
+
identifier=identifier,
|
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
|
+
identifier: str,
|
85
|
+
*,
|
86
|
+
client: Union[Client],
|
87
|
+
) -> Optional[Union[ErrorResponse, SuccessResponse]]:
|
88
|
+
"""Stop a process
|
89
|
+
|
90
|
+
Gracefully stop a running process
|
91
|
+
|
92
|
+
Args:
|
93
|
+
identifier (str):
|
94
|
+
|
95
|
+
Raises:
|
96
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
97
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
98
|
+
|
99
|
+
Returns:
|
100
|
+
Union[ErrorResponse, SuccessResponse]
|
101
|
+
"""
|
102
|
+
|
103
|
+
return sync_detailed(
|
104
|
+
identifier=identifier,
|
105
|
+
client=client,
|
106
|
+
).parsed
|
107
|
+
|
108
|
+
|
109
|
+
async def asyncio_detailed(
|
110
|
+
identifier: str,
|
111
|
+
*,
|
112
|
+
client: Union[Client],
|
113
|
+
) -> Response[Union[ErrorResponse, SuccessResponse]]:
|
114
|
+
"""Stop a process
|
115
|
+
|
116
|
+
Gracefully stop a running process
|
117
|
+
|
118
|
+
Args:
|
119
|
+
identifier (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[Union[ErrorResponse, SuccessResponse]]
|
127
|
+
"""
|
128
|
+
|
129
|
+
kwargs = _get_kwargs(
|
130
|
+
identifier=identifier,
|
131
|
+
)
|
132
|
+
|
133
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
134
|
+
|
135
|
+
return _build_response(client=client, response=response)
|
136
|
+
|
137
|
+
|
138
|
+
async def asyncio(
|
139
|
+
identifier: str,
|
140
|
+
*,
|
141
|
+
client: Union[Client],
|
142
|
+
) -> Optional[Union[ErrorResponse, SuccessResponse]]:
|
143
|
+
"""Stop a process
|
144
|
+
|
145
|
+
Gracefully stop a running process
|
146
|
+
|
147
|
+
Args:
|
148
|
+
identifier (str):
|
149
|
+
|
150
|
+
Raises:
|
151
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
152
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
153
|
+
|
154
|
+
Returns:
|
155
|
+
Union[ErrorResponse, SuccessResponse]
|
156
|
+
"""
|
157
|
+
|
158
|
+
return (
|
159
|
+
await asyncio_detailed(
|
160
|
+
identifier=identifier,
|
161
|
+
client=client,
|
162
|
+
)
|
163
|
+
).parsed
|
@@ -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 Client
|
8
|
+
from ...models.error_response import ErrorResponse
|
9
|
+
from ...models.process_kill_request import ProcessKillRequest
|
10
|
+
from ...models.success_response import SuccessResponse
|
11
|
+
from ...types import Response
|
12
|
+
|
13
|
+
|
14
|
+
def _get_kwargs(
|
15
|
+
identifier: str,
|
16
|
+
*,
|
17
|
+
body: ProcessKillRequest,
|
18
|
+
) -> dict[str, Any]:
|
19
|
+
headers: dict[str, Any] = {}
|
20
|
+
|
21
|
+
_kwargs: dict[str, Any] = {
|
22
|
+
"method": "delete",
|
23
|
+
"url": f"/process/{identifier}/kill",
|
24
|
+
}
|
25
|
+
|
26
|
+
if type(body) == dict:
|
27
|
+
_body = body
|
28
|
+
else:
|
29
|
+
_body = body.to_dict()
|
30
|
+
|
31
|
+
_kwargs["json"] = _body
|
32
|
+
headers["Content-Type"] = "application/json"
|
33
|
+
|
34
|
+
_kwargs["headers"] = headers
|
35
|
+
return _kwargs
|
36
|
+
|
37
|
+
|
38
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[ErrorResponse, SuccessResponse]]:
|
39
|
+
if response.status_code == 200:
|
40
|
+
response_200 = SuccessResponse.from_dict(response.json())
|
41
|
+
|
42
|
+
return response_200
|
43
|
+
if response.status_code == 404:
|
44
|
+
response_404 = ErrorResponse.from_dict(response.json())
|
45
|
+
|
46
|
+
return response_404
|
47
|
+
if response.status_code == 500:
|
48
|
+
response_500 = ErrorResponse.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(*, client: Client, response: httpx.Response) -> Response[Union[ErrorResponse, SuccessResponse]]:
|
58
|
+
return Response(
|
59
|
+
status_code=HTTPStatus(response.status_code),
|
60
|
+
content=response.content,
|
61
|
+
headers=response.headers,
|
62
|
+
parsed=_parse_response(client=client, response=response),
|
63
|
+
)
|
64
|
+
|
65
|
+
|
66
|
+
def sync_detailed(
|
67
|
+
identifier: str,
|
68
|
+
*,
|
69
|
+
client: Union[Client],
|
70
|
+
body: ProcessKillRequest,
|
71
|
+
) -> Response[Union[ErrorResponse, SuccessResponse]]:
|
72
|
+
"""Kill a process
|
73
|
+
|
74
|
+
Forcefully kill a running process
|
75
|
+
|
76
|
+
Args:
|
77
|
+
identifier (str):
|
78
|
+
body (ProcessKillRequest):
|
79
|
+
|
80
|
+
Raises:
|
81
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
82
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
83
|
+
|
84
|
+
Returns:
|
85
|
+
Response[Union[ErrorResponse, SuccessResponse]]
|
86
|
+
"""
|
87
|
+
|
88
|
+
kwargs = _get_kwargs(
|
89
|
+
identifier=identifier,
|
90
|
+
body=body,
|
91
|
+
)
|
92
|
+
|
93
|
+
response = client.get_httpx_client().request(
|
94
|
+
**kwargs,
|
95
|
+
)
|
96
|
+
|
97
|
+
return _build_response(client=client, response=response)
|
98
|
+
|
99
|
+
|
100
|
+
def sync(
|
101
|
+
identifier: str,
|
102
|
+
*,
|
103
|
+
client: Union[Client],
|
104
|
+
body: ProcessKillRequest,
|
105
|
+
) -> Optional[Union[ErrorResponse, SuccessResponse]]:
|
106
|
+
"""Kill a process
|
107
|
+
|
108
|
+
Forcefully kill a running process
|
109
|
+
|
110
|
+
Args:
|
111
|
+
identifier (str):
|
112
|
+
body (ProcessKillRequest):
|
113
|
+
|
114
|
+
Raises:
|
115
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
116
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
117
|
+
|
118
|
+
Returns:
|
119
|
+
Union[ErrorResponse, SuccessResponse]
|
120
|
+
"""
|
121
|
+
|
122
|
+
return sync_detailed(
|
123
|
+
identifier=identifier,
|
124
|
+
client=client,
|
125
|
+
body=body,
|
126
|
+
).parsed
|
127
|
+
|
128
|
+
|
129
|
+
async def asyncio_detailed(
|
130
|
+
identifier: str,
|
131
|
+
*,
|
132
|
+
client: Union[Client],
|
133
|
+
body: ProcessKillRequest,
|
134
|
+
) -> Response[Union[ErrorResponse, SuccessResponse]]:
|
135
|
+
"""Kill a process
|
136
|
+
|
137
|
+
Forcefully kill a running process
|
138
|
+
|
139
|
+
Args:
|
140
|
+
identifier (str):
|
141
|
+
body (ProcessKillRequest):
|
142
|
+
|
143
|
+
Raises:
|
144
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
145
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
146
|
+
|
147
|
+
Returns:
|
148
|
+
Response[Union[ErrorResponse, SuccessResponse]]
|
149
|
+
"""
|
150
|
+
|
151
|
+
kwargs = _get_kwargs(
|
152
|
+
identifier=identifier,
|
153
|
+
body=body,
|
154
|
+
)
|
155
|
+
|
156
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
157
|
+
|
158
|
+
return _build_response(client=client, response=response)
|
159
|
+
|
160
|
+
|
161
|
+
async def asyncio(
|
162
|
+
identifier: str,
|
163
|
+
*,
|
164
|
+
client: Union[Client],
|
165
|
+
body: ProcessKillRequest,
|
166
|
+
) -> Optional[Union[ErrorResponse, SuccessResponse]]:
|
167
|
+
"""Kill a process
|
168
|
+
|
169
|
+
Forcefully kill a running process
|
170
|
+
|
171
|
+
Args:
|
172
|
+
identifier (str):
|
173
|
+
body (ProcessKillRequest):
|
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[ErrorResponse, SuccessResponse]
|
181
|
+
"""
|
182
|
+
|
183
|
+
return (
|
184
|
+
await asyncio_detailed(
|
185
|
+
identifier=identifier,
|
186
|
+
client=client,
|
187
|
+
body=body,
|
188
|
+
)
|
189
|
+
).parsed
|
@@ -0,0 +1,135 @@
|
|
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.process_response import ProcessResponse
|
9
|
+
from ...types import Response
|
10
|
+
|
11
|
+
|
12
|
+
def _get_kwargs() -> dict[str, Any]:
|
13
|
+
_kwargs: dict[str, Any] = {
|
14
|
+
"method": "get",
|
15
|
+
"url": "/process",
|
16
|
+
}
|
17
|
+
|
18
|
+
return _kwargs
|
19
|
+
|
20
|
+
|
21
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[list["ProcessResponse"]]:
|
22
|
+
if response.status_code == 200:
|
23
|
+
response_200 = []
|
24
|
+
_response_200 = response.json()
|
25
|
+
for response_200_item_data in _response_200:
|
26
|
+
response_200_item = ProcessResponse.from_dict(response_200_item_data)
|
27
|
+
|
28
|
+
response_200.append(response_200_item)
|
29
|
+
|
30
|
+
return response_200
|
31
|
+
if client.raise_on_unexpected_status:
|
32
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
33
|
+
else:
|
34
|
+
return None
|
35
|
+
|
36
|
+
|
37
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[list["ProcessResponse"]]:
|
38
|
+
return Response(
|
39
|
+
status_code=HTTPStatus(response.status_code),
|
40
|
+
content=response.content,
|
41
|
+
headers=response.headers,
|
42
|
+
parsed=_parse_response(client=client, response=response),
|
43
|
+
)
|
44
|
+
|
45
|
+
|
46
|
+
def sync_detailed(
|
47
|
+
*,
|
48
|
+
client: Union[Client],
|
49
|
+
) -> Response[list["ProcessResponse"]]:
|
50
|
+
"""List all processes
|
51
|
+
|
52
|
+
Get a list of all running and completed processes
|
53
|
+
|
54
|
+
Raises:
|
55
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
56
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
57
|
+
|
58
|
+
Returns:
|
59
|
+
Response[list['ProcessResponse']]
|
60
|
+
"""
|
61
|
+
|
62
|
+
kwargs = _get_kwargs()
|
63
|
+
|
64
|
+
response = client.get_httpx_client().request(
|
65
|
+
**kwargs,
|
66
|
+
)
|
67
|
+
|
68
|
+
return _build_response(client=client, response=response)
|
69
|
+
|
70
|
+
|
71
|
+
def sync(
|
72
|
+
*,
|
73
|
+
client: Union[Client],
|
74
|
+
) -> Optional[list["ProcessResponse"]]:
|
75
|
+
"""List all processes
|
76
|
+
|
77
|
+
Get a list of all running and completed processes
|
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
|
+
list['ProcessResponse']
|
85
|
+
"""
|
86
|
+
|
87
|
+
return sync_detailed(
|
88
|
+
client=client,
|
89
|
+
).parsed
|
90
|
+
|
91
|
+
|
92
|
+
async def asyncio_detailed(
|
93
|
+
*,
|
94
|
+
client: Union[Client],
|
95
|
+
) -> Response[list["ProcessResponse"]]:
|
96
|
+
"""List all processes
|
97
|
+
|
98
|
+
Get a list of all running and completed processes
|
99
|
+
|
100
|
+
Raises:
|
101
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
102
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
103
|
+
|
104
|
+
Returns:
|
105
|
+
Response[list['ProcessResponse']]
|
106
|
+
"""
|
107
|
+
|
108
|
+
kwargs = _get_kwargs()
|
109
|
+
|
110
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
111
|
+
|
112
|
+
return _build_response(client=client, response=response)
|
113
|
+
|
114
|
+
|
115
|
+
async def asyncio(
|
116
|
+
*,
|
117
|
+
client: Union[Client],
|
118
|
+
) -> Optional[list["ProcessResponse"]]:
|
119
|
+
"""List all processes
|
120
|
+
|
121
|
+
Get a list of all running and completed processes
|
122
|
+
|
123
|
+
Raises:
|
124
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
125
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
126
|
+
|
127
|
+
Returns:
|
128
|
+
list['ProcessResponse']
|
129
|
+
"""
|
130
|
+
|
131
|
+
return (
|
132
|
+
await asyncio_detailed(
|
133
|
+
client=client,
|
134
|
+
)
|
135
|
+
).parsed
|