blaxel 0.1.9rc37__py3-none-any.whl → 0.1.10rc39__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/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 +167 -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 +35 -0
- blaxel/sandbox/client/models/delete_network_process_pid_monitor_response_200.py +45 -0
- blaxel/sandbox/client/models/directory.py +110 -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/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/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.10rc39.dist-info}/METADATA +1 -1
- {blaxel-0.1.9rc37.dist-info → blaxel-0.1.10rc39.dist-info}/RECORD +48 -8
- {blaxel-0.1.9rc37.dist-info → blaxel-0.1.10rc39.dist-info}/WHEEL +0 -0
- {blaxel-0.1.9rc37.dist-info → blaxel-0.1.10rc39.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,169 @@
|
|
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_network_process_pid_monitor_response_200 import (
|
9
|
+
DeleteNetworkProcessPidMonitorResponse200,
|
10
|
+
)
|
11
|
+
from ...models.error_response import ErrorResponse
|
12
|
+
from ...types import Response
|
13
|
+
|
14
|
+
|
15
|
+
def _get_kwargs(
|
16
|
+
pid: int,
|
17
|
+
) -> dict[str, Any]:
|
18
|
+
_kwargs: dict[str, Any] = {
|
19
|
+
"method": "delete",
|
20
|
+
"url": f"/network/process/{pid}/monitor",
|
21
|
+
}
|
22
|
+
|
23
|
+
return _kwargs
|
24
|
+
|
25
|
+
|
26
|
+
def _parse_response(
|
27
|
+
*, client: Client, response: httpx.Response
|
28
|
+
) -> Optional[Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]]:
|
29
|
+
if response.status_code == 200:
|
30
|
+
response_200 = DeleteNetworkProcessPidMonitorResponse200.from_dict(response.json())
|
31
|
+
|
32
|
+
return response_200
|
33
|
+
if response.status_code == 400:
|
34
|
+
response_400 = ErrorResponse.from_dict(response.json())
|
35
|
+
|
36
|
+
return response_400
|
37
|
+
if response.status_code == 500:
|
38
|
+
response_500 = ErrorResponse.from_dict(response.json())
|
39
|
+
|
40
|
+
return response_500
|
41
|
+
if client.raise_on_unexpected_status:
|
42
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
43
|
+
else:
|
44
|
+
return None
|
45
|
+
|
46
|
+
|
47
|
+
def _build_response(
|
48
|
+
*, client: Client, response: httpx.Response
|
49
|
+
) -> Response[Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]]:
|
50
|
+
return Response(
|
51
|
+
status_code=HTTPStatus(response.status_code),
|
52
|
+
content=response.content,
|
53
|
+
headers=response.headers,
|
54
|
+
parsed=_parse_response(client=client, response=response),
|
55
|
+
)
|
56
|
+
|
57
|
+
|
58
|
+
def sync_detailed(
|
59
|
+
pid: int,
|
60
|
+
*,
|
61
|
+
client: Union[Client],
|
62
|
+
) -> Response[Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]]:
|
63
|
+
"""Stop monitoring ports for a process
|
64
|
+
|
65
|
+
Stop monitoring for new ports opened by a process
|
66
|
+
|
67
|
+
Args:
|
68
|
+
pid (int):
|
69
|
+
|
70
|
+
Raises:
|
71
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
72
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
73
|
+
|
74
|
+
Returns:
|
75
|
+
Response[Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]]
|
76
|
+
"""
|
77
|
+
|
78
|
+
kwargs = _get_kwargs(
|
79
|
+
pid=pid,
|
80
|
+
)
|
81
|
+
|
82
|
+
response = client.get_httpx_client().request(
|
83
|
+
**kwargs,
|
84
|
+
)
|
85
|
+
|
86
|
+
return _build_response(client=client, response=response)
|
87
|
+
|
88
|
+
|
89
|
+
def sync(
|
90
|
+
pid: int,
|
91
|
+
*,
|
92
|
+
client: Union[Client],
|
93
|
+
) -> Optional[Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]]:
|
94
|
+
"""Stop monitoring ports for a process
|
95
|
+
|
96
|
+
Stop monitoring for new ports opened by a process
|
97
|
+
|
98
|
+
Args:
|
99
|
+
pid (int):
|
100
|
+
|
101
|
+
Raises:
|
102
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
103
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
104
|
+
|
105
|
+
Returns:
|
106
|
+
Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]
|
107
|
+
"""
|
108
|
+
|
109
|
+
return sync_detailed(
|
110
|
+
pid=pid,
|
111
|
+
client=client,
|
112
|
+
).parsed
|
113
|
+
|
114
|
+
|
115
|
+
async def asyncio_detailed(
|
116
|
+
pid: int,
|
117
|
+
*,
|
118
|
+
client: Union[Client],
|
119
|
+
) -> Response[Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]]:
|
120
|
+
"""Stop monitoring ports for a process
|
121
|
+
|
122
|
+
Stop monitoring for new ports opened by a process
|
123
|
+
|
124
|
+
Args:
|
125
|
+
pid (int):
|
126
|
+
|
127
|
+
Raises:
|
128
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
129
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
130
|
+
|
131
|
+
Returns:
|
132
|
+
Response[Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]]
|
133
|
+
"""
|
134
|
+
|
135
|
+
kwargs = _get_kwargs(
|
136
|
+
pid=pid,
|
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
|
+
pid: int,
|
146
|
+
*,
|
147
|
+
client: Union[Client],
|
148
|
+
) -> Optional[Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]]:
|
149
|
+
"""Stop monitoring ports for a process
|
150
|
+
|
151
|
+
Stop monitoring for new ports opened by a process
|
152
|
+
|
153
|
+
Args:
|
154
|
+
pid (int):
|
155
|
+
|
156
|
+
Raises:
|
157
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
158
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
159
|
+
|
160
|
+
Returns:
|
161
|
+
Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]
|
162
|
+
"""
|
163
|
+
|
164
|
+
return (
|
165
|
+
await asyncio_detailed(
|
166
|
+
pid=pid,
|
167
|
+
client=client,
|
168
|
+
)
|
169
|
+
).parsed
|
@@ -0,0 +1,169 @@
|
|
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_network_process_pid_ports_response_200 import (
|
10
|
+
GetNetworkProcessPidPortsResponse200,
|
11
|
+
)
|
12
|
+
from ...types import Response
|
13
|
+
|
14
|
+
|
15
|
+
def _get_kwargs(
|
16
|
+
pid: int,
|
17
|
+
) -> dict[str, Any]:
|
18
|
+
_kwargs: dict[str, Any] = {
|
19
|
+
"method": "get",
|
20
|
+
"url": f"/network/process/{pid}/ports",
|
21
|
+
}
|
22
|
+
|
23
|
+
return _kwargs
|
24
|
+
|
25
|
+
|
26
|
+
def _parse_response(
|
27
|
+
*, client: Client, response: httpx.Response
|
28
|
+
) -> Optional[Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]]:
|
29
|
+
if response.status_code == 200:
|
30
|
+
response_200 = GetNetworkProcessPidPortsResponse200.from_dict(response.json())
|
31
|
+
|
32
|
+
return response_200
|
33
|
+
if response.status_code == 400:
|
34
|
+
response_400 = ErrorResponse.from_dict(response.json())
|
35
|
+
|
36
|
+
return response_400
|
37
|
+
if response.status_code == 500:
|
38
|
+
response_500 = ErrorResponse.from_dict(response.json())
|
39
|
+
|
40
|
+
return response_500
|
41
|
+
if client.raise_on_unexpected_status:
|
42
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
43
|
+
else:
|
44
|
+
return None
|
45
|
+
|
46
|
+
|
47
|
+
def _build_response(
|
48
|
+
*, client: Client, response: httpx.Response
|
49
|
+
) -> Response[Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]]:
|
50
|
+
return Response(
|
51
|
+
status_code=HTTPStatus(response.status_code),
|
52
|
+
content=response.content,
|
53
|
+
headers=response.headers,
|
54
|
+
parsed=_parse_response(client=client, response=response),
|
55
|
+
)
|
56
|
+
|
57
|
+
|
58
|
+
def sync_detailed(
|
59
|
+
pid: int,
|
60
|
+
*,
|
61
|
+
client: Union[Client],
|
62
|
+
) -> Response[Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]]:
|
63
|
+
"""Get open ports for a process
|
64
|
+
|
65
|
+
Get a list of all open ports for a process
|
66
|
+
|
67
|
+
Args:
|
68
|
+
pid (int):
|
69
|
+
|
70
|
+
Raises:
|
71
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
72
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
73
|
+
|
74
|
+
Returns:
|
75
|
+
Response[Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]]
|
76
|
+
"""
|
77
|
+
|
78
|
+
kwargs = _get_kwargs(
|
79
|
+
pid=pid,
|
80
|
+
)
|
81
|
+
|
82
|
+
response = client.get_httpx_client().request(
|
83
|
+
**kwargs,
|
84
|
+
)
|
85
|
+
|
86
|
+
return _build_response(client=client, response=response)
|
87
|
+
|
88
|
+
|
89
|
+
def sync(
|
90
|
+
pid: int,
|
91
|
+
*,
|
92
|
+
client: Union[Client],
|
93
|
+
) -> Optional[Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]]:
|
94
|
+
"""Get open ports for a process
|
95
|
+
|
96
|
+
Get a list of all open ports for a process
|
97
|
+
|
98
|
+
Args:
|
99
|
+
pid (int):
|
100
|
+
|
101
|
+
Raises:
|
102
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
103
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
104
|
+
|
105
|
+
Returns:
|
106
|
+
Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]
|
107
|
+
"""
|
108
|
+
|
109
|
+
return sync_detailed(
|
110
|
+
pid=pid,
|
111
|
+
client=client,
|
112
|
+
).parsed
|
113
|
+
|
114
|
+
|
115
|
+
async def asyncio_detailed(
|
116
|
+
pid: int,
|
117
|
+
*,
|
118
|
+
client: Union[Client],
|
119
|
+
) -> Response[Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]]:
|
120
|
+
"""Get open ports for a process
|
121
|
+
|
122
|
+
Get a list of all open ports for a process
|
123
|
+
|
124
|
+
Args:
|
125
|
+
pid (int):
|
126
|
+
|
127
|
+
Raises:
|
128
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
129
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
130
|
+
|
131
|
+
Returns:
|
132
|
+
Response[Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]]
|
133
|
+
"""
|
134
|
+
|
135
|
+
kwargs = _get_kwargs(
|
136
|
+
pid=pid,
|
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
|
+
pid: int,
|
146
|
+
*,
|
147
|
+
client: Union[Client],
|
148
|
+
) -> Optional[Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]]:
|
149
|
+
"""Get open ports for a process
|
150
|
+
|
151
|
+
Get a list of all open ports for a process
|
152
|
+
|
153
|
+
Args:
|
154
|
+
pid (int):
|
155
|
+
|
156
|
+
Raises:
|
157
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
158
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
159
|
+
|
160
|
+
Returns:
|
161
|
+
Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]
|
162
|
+
"""
|
163
|
+
|
164
|
+
return (
|
165
|
+
await asyncio_detailed(
|
166
|
+
pid=pid,
|
167
|
+
client=client,
|
168
|
+
)
|
169
|
+
).parsed
|
@@ -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
|