cyberdesk 1.7.0__py3-none-any.whl → 1.9.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cyberdesk might be problematic. Click here for more details.
- cyberdesk/__init__.py +11 -1
- cyberdesk/client.py +188 -0
- {cyberdesk-1.7.0.dist-info → cyberdesk-1.9.0.dist-info}/METADATA +39 -17
- {cyberdesk-1.7.0.dist-info → cyberdesk-1.9.0.dist-info}/RECORD +43 -15
- openapi_client/cyberdesk_cloud_client/api/computer/fs_list_v1_computer_machine_id_fs_list_get.py +188 -0
- openapi_client/cyberdesk_cloud_client/api/computer/fs_read_v1_computer_machine_id_fs_read_get.py +188 -0
- openapi_client/cyberdesk_cloud_client/api/computer/fs_write_v1_computer_machine_id_fs_write_post.py +201 -0
- openapi_client/cyberdesk_cloud_client/api/computer/powershell_exec_v1_computer_machine_id_shell_powershell_exec_post.py +219 -0
- openapi_client/cyberdesk_cloud_client/api/computer/powershell_session_v1_computer_machine_id_shell_powershell_session_post.py +219 -0
- openapi_client/cyberdesk_cloud_client/api/run_attachments/__init__.py +1 -0
- openapi_client/cyberdesk_cloud_client/api/run_attachments/create_run_attachment_v1_run_attachments_post.py +184 -0
- openapi_client/cyberdesk_cloud_client/api/run_attachments/delete_run_attachment_v1_run_attachments_attachment_id_delete.py +170 -0
- openapi_client/cyberdesk_cloud_client/api/run_attachments/download_run_attachment_v1_run_attachments_attachment_id_download_get.py +170 -0
- openapi_client/cyberdesk_cloud_client/api/run_attachments/get_run_attachment_v1_run_attachments_attachment_id_get.py +172 -0
- openapi_client/cyberdesk_cloud_client/api/run_attachments/list_run_attachments_v1_run_attachments_get.py +240 -0
- openapi_client/cyberdesk_cloud_client/api/run_attachments/update_run_attachment_v1_run_attachments_attachment_id_put.py +194 -0
- openapi_client/cyberdesk_cloud_client/models/__init__.py +42 -0
- openapi_client/cyberdesk_cloud_client/models/attachment_type.py +9 -0
- openapi_client/cyberdesk_cloud_client/models/file_input.py +99 -0
- openapi_client/cyberdesk_cloud_client/models/file_write_request.py +78 -0
- openapi_client/cyberdesk_cloud_client/models/fs_list_v1_computer_machine_id_fs_list_get_response_fs_list_v1_computer_machine_id_fs_list_get.py +44 -0
- openapi_client/cyberdesk_cloud_client/models/fs_read_v1_computer_machine_id_fs_read_get_response_fs_read_v1_computer_machine_id_fs_read_get.py +44 -0
- openapi_client/cyberdesk_cloud_client/models/fs_write_v1_computer_machine_id_fs_write_post_response_fs_write_v1_computer_machine_id_fs_write_post.py +44 -0
- openapi_client/cyberdesk_cloud_client/models/paginated_response_run_attachment_response.py +97 -0
- openapi_client/cyberdesk_cloud_client/models/power_shell_exec_request.py +110 -0
- openapi_client/cyberdesk_cloud_client/models/power_shell_session_request.py +81 -0
- openapi_client/cyberdesk_cloud_client/models/powershell_exec_v1_computer_machine_id_shell_powershell_exec_post_response_powershell_exec_v1_computer_machine_id_shell_powershell_exec_post.py +47 -0
- openapi_client/cyberdesk_cloud_client/models/powershell_session_v1_computer_machine_id_shell_powershell_session_post_response_powershell_session_v1_computer_machine_id_shell_powershell_session_post.py +47 -0
- openapi_client/cyberdesk_cloud_client/models/run_attachment_create.py +157 -0
- openapi_client/cyberdesk_cloud_client/models/run_attachment_response.py +189 -0
- openapi_client/cyberdesk_cloud_client/models/run_attachment_update.py +84 -0
- openapi_client/cyberdesk_cloud_client/models/run_create.py +41 -0
- openapi_client/cyberdesk_cloud_client/models/run_response.py +26 -0
- openapi_client/cyberdesk_cloud_client/models/trajectory_create.py +40 -1
- openapi_client/cyberdesk_cloud_client/models/trajectory_create_original_input_values_type_0.py +44 -0
- openapi_client/cyberdesk_cloud_client/models/trajectory_response.py +40 -1
- openapi_client/cyberdesk_cloud_client/models/trajectory_response_original_input_values_type_0.py +44 -0
- openapi_client/cyberdesk_cloud_client/models/workflow_create.py +9 -0
- openapi_client/cyberdesk_cloud_client/models/workflow_response.py +9 -0
- openapi_client/cyberdesk_cloud_client/models/workflow_update.py +20 -0
- {cyberdesk-1.7.0.dist-info → cyberdesk-1.9.0.dist-info}/WHEEL +0 -0
- {cyberdesk-1.7.0.dist-info → cyberdesk-1.9.0.dist-info}/licenses/LICENSE +0 -0
- {cyberdesk-1.7.0.dist-info → cyberdesk-1.9.0.dist-info}/top_level.txt +0 -0
openapi_client/cyberdesk_cloud_client/api/computer/fs_read_v1_computer_machine_id_fs_read_get.py
ADDED
|
@@ -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 AuthenticatedClient, Client
|
|
8
|
+
from ...models.fs_read_v1_computer_machine_id_fs_read_get_response_fs_read_v1_computer_machine_id_fs_read_get import (
|
|
9
|
+
FsReadV1ComputerMachineIdFsReadGetResponseFsReadV1ComputerMachineIdFsReadGet,
|
|
10
|
+
)
|
|
11
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
12
|
+
from ...types import UNSET, Response
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
machine_id: str,
|
|
17
|
+
*,
|
|
18
|
+
path: str,
|
|
19
|
+
) -> dict[str, Any]:
|
|
20
|
+
params: dict[str, Any] = {}
|
|
21
|
+
|
|
22
|
+
params["path"] = path
|
|
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"/v1/computer/{machine_id}/fs/read",
|
|
29
|
+
"params": params,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return _kwargs
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _parse_response(
|
|
36
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
37
|
+
) -> Optional[Union[FsReadV1ComputerMachineIdFsReadGetResponseFsReadV1ComputerMachineIdFsReadGet, HTTPValidationError]]:
|
|
38
|
+
if response.status_code == 200:
|
|
39
|
+
response_200 = FsReadV1ComputerMachineIdFsReadGetResponseFsReadV1ComputerMachineIdFsReadGet.from_dict(
|
|
40
|
+
response.json()
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
return response_200
|
|
44
|
+
if response.status_code == 422:
|
|
45
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
46
|
+
|
|
47
|
+
return response_422
|
|
48
|
+
if client.raise_on_unexpected_status:
|
|
49
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
50
|
+
else:
|
|
51
|
+
return None
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _build_response(
|
|
55
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
56
|
+
) -> Response[Union[FsReadV1ComputerMachineIdFsReadGetResponseFsReadV1ComputerMachineIdFsReadGet, HTTPValidationError]]:
|
|
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
|
+
machine_id: str,
|
|
67
|
+
*,
|
|
68
|
+
client: AuthenticatedClient,
|
|
69
|
+
path: str,
|
|
70
|
+
) -> Response[Union[FsReadV1ComputerMachineIdFsReadGetResponseFsReadV1ComputerMachineIdFsReadGet, HTTPValidationError]]:
|
|
71
|
+
"""Read file contents
|
|
72
|
+
|
|
73
|
+
Read file contents from the machine (base64 encoded).
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
machine_id (str):
|
|
77
|
+
path (str):
|
|
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[FsReadV1ComputerMachineIdFsReadGetResponseFsReadV1ComputerMachineIdFsReadGet, HTTPValidationError]]
|
|
85
|
+
"""
|
|
86
|
+
|
|
87
|
+
kwargs = _get_kwargs(
|
|
88
|
+
machine_id=machine_id,
|
|
89
|
+
path=path,
|
|
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
|
+
machine_id: str,
|
|
101
|
+
*,
|
|
102
|
+
client: AuthenticatedClient,
|
|
103
|
+
path: str,
|
|
104
|
+
) -> Optional[Union[FsReadV1ComputerMachineIdFsReadGetResponseFsReadV1ComputerMachineIdFsReadGet, HTTPValidationError]]:
|
|
105
|
+
"""Read file contents
|
|
106
|
+
|
|
107
|
+
Read file contents from the machine (base64 encoded).
|
|
108
|
+
|
|
109
|
+
Args:
|
|
110
|
+
machine_id (str):
|
|
111
|
+
path (str):
|
|
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[FsReadV1ComputerMachineIdFsReadGetResponseFsReadV1ComputerMachineIdFsReadGet, HTTPValidationError]
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
return sync_detailed(
|
|
122
|
+
machine_id=machine_id,
|
|
123
|
+
client=client,
|
|
124
|
+
path=path,
|
|
125
|
+
).parsed
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
async def asyncio_detailed(
|
|
129
|
+
machine_id: str,
|
|
130
|
+
*,
|
|
131
|
+
client: AuthenticatedClient,
|
|
132
|
+
path: str,
|
|
133
|
+
) -> Response[Union[FsReadV1ComputerMachineIdFsReadGetResponseFsReadV1ComputerMachineIdFsReadGet, HTTPValidationError]]:
|
|
134
|
+
"""Read file contents
|
|
135
|
+
|
|
136
|
+
Read file contents from the machine (base64 encoded).
|
|
137
|
+
|
|
138
|
+
Args:
|
|
139
|
+
machine_id (str):
|
|
140
|
+
path (str):
|
|
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[FsReadV1ComputerMachineIdFsReadGetResponseFsReadV1ComputerMachineIdFsReadGet, HTTPValidationError]]
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
kwargs = _get_kwargs(
|
|
151
|
+
machine_id=machine_id,
|
|
152
|
+
path=path,
|
|
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
|
+
machine_id: str,
|
|
162
|
+
*,
|
|
163
|
+
client: AuthenticatedClient,
|
|
164
|
+
path: str,
|
|
165
|
+
) -> Optional[Union[FsReadV1ComputerMachineIdFsReadGetResponseFsReadV1ComputerMachineIdFsReadGet, HTTPValidationError]]:
|
|
166
|
+
"""Read file contents
|
|
167
|
+
|
|
168
|
+
Read file contents from the machine (base64 encoded).
|
|
169
|
+
|
|
170
|
+
Args:
|
|
171
|
+
machine_id (str):
|
|
172
|
+
path (str):
|
|
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[FsReadV1ComputerMachineIdFsReadGetResponseFsReadV1ComputerMachineIdFsReadGet, HTTPValidationError]
|
|
180
|
+
"""
|
|
181
|
+
|
|
182
|
+
return (
|
|
183
|
+
await asyncio_detailed(
|
|
184
|
+
machine_id=machine_id,
|
|
185
|
+
client=client,
|
|
186
|
+
path=path,
|
|
187
|
+
)
|
|
188
|
+
).parsed
|
openapi_client/cyberdesk_cloud_client/api/computer/fs_write_v1_computer_machine_id_fs_write_post.py
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.file_write_request import FileWriteRequest
|
|
9
|
+
from ...models.fs_write_v1_computer_machine_id_fs_write_post_response_fs_write_v1_computer_machine_id_fs_write_post import (
|
|
10
|
+
FsWriteV1ComputerMachineIdFsWritePostResponseFsWriteV1ComputerMachineIdFsWritePost,
|
|
11
|
+
)
|
|
12
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
13
|
+
from ...types import Response
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _get_kwargs(
|
|
17
|
+
machine_id: str,
|
|
18
|
+
*,
|
|
19
|
+
body: FileWriteRequest,
|
|
20
|
+
) -> dict[str, Any]:
|
|
21
|
+
headers: dict[str, Any] = {}
|
|
22
|
+
|
|
23
|
+
_kwargs: dict[str, Any] = {
|
|
24
|
+
"method": "post",
|
|
25
|
+
"url": f"/v1/computer/{machine_id}/fs/write",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
_kwargs["json"] = body.to_dict()
|
|
29
|
+
|
|
30
|
+
headers["Content-Type"] = "application/json"
|
|
31
|
+
|
|
32
|
+
_kwargs["headers"] = headers
|
|
33
|
+
return _kwargs
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _parse_response(
|
|
37
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
38
|
+
) -> Optional[
|
|
39
|
+
Union[FsWriteV1ComputerMachineIdFsWritePostResponseFsWriteV1ComputerMachineIdFsWritePost, HTTPValidationError]
|
|
40
|
+
]:
|
|
41
|
+
if response.status_code == 200:
|
|
42
|
+
response_200 = FsWriteV1ComputerMachineIdFsWritePostResponseFsWriteV1ComputerMachineIdFsWritePost.from_dict(
|
|
43
|
+
response.json()
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
return response_200
|
|
47
|
+
if response.status_code == 422:
|
|
48
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
49
|
+
|
|
50
|
+
return response_422
|
|
51
|
+
if client.raise_on_unexpected_status:
|
|
52
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
53
|
+
else:
|
|
54
|
+
return None
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _build_response(
|
|
58
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
59
|
+
) -> Response[
|
|
60
|
+
Union[FsWriteV1ComputerMachineIdFsWritePostResponseFsWriteV1ComputerMachineIdFsWritePost, HTTPValidationError]
|
|
61
|
+
]:
|
|
62
|
+
return Response(
|
|
63
|
+
status_code=HTTPStatus(response.status_code),
|
|
64
|
+
content=response.content,
|
|
65
|
+
headers=response.headers,
|
|
66
|
+
parsed=_parse_response(client=client, response=response),
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def sync_detailed(
|
|
71
|
+
machine_id: str,
|
|
72
|
+
*,
|
|
73
|
+
client: AuthenticatedClient,
|
|
74
|
+
body: FileWriteRequest,
|
|
75
|
+
) -> Response[
|
|
76
|
+
Union[FsWriteV1ComputerMachineIdFsWritePostResponseFsWriteV1ComputerMachineIdFsWritePost, HTTPValidationError]
|
|
77
|
+
]:
|
|
78
|
+
"""Write file contents
|
|
79
|
+
|
|
80
|
+
Write file contents to the machine.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
machine_id (str):
|
|
84
|
+
body (FileWriteRequest):
|
|
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[FsWriteV1ComputerMachineIdFsWritePostResponseFsWriteV1ComputerMachineIdFsWritePost, HTTPValidationError]]
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
kwargs = _get_kwargs(
|
|
95
|
+
machine_id=machine_id,
|
|
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
|
+
machine_id: str,
|
|
108
|
+
*,
|
|
109
|
+
client: AuthenticatedClient,
|
|
110
|
+
body: FileWriteRequest,
|
|
111
|
+
) -> Optional[
|
|
112
|
+
Union[FsWriteV1ComputerMachineIdFsWritePostResponseFsWriteV1ComputerMachineIdFsWritePost, HTTPValidationError]
|
|
113
|
+
]:
|
|
114
|
+
"""Write file contents
|
|
115
|
+
|
|
116
|
+
Write file contents to the machine.
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
machine_id (str):
|
|
120
|
+
body (FileWriteRequest):
|
|
121
|
+
|
|
122
|
+
Raises:
|
|
123
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
124
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
Union[FsWriteV1ComputerMachineIdFsWritePostResponseFsWriteV1ComputerMachineIdFsWritePost, HTTPValidationError]
|
|
128
|
+
"""
|
|
129
|
+
|
|
130
|
+
return sync_detailed(
|
|
131
|
+
machine_id=machine_id,
|
|
132
|
+
client=client,
|
|
133
|
+
body=body,
|
|
134
|
+
).parsed
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
async def asyncio_detailed(
|
|
138
|
+
machine_id: str,
|
|
139
|
+
*,
|
|
140
|
+
client: AuthenticatedClient,
|
|
141
|
+
body: FileWriteRequest,
|
|
142
|
+
) -> Response[
|
|
143
|
+
Union[FsWriteV1ComputerMachineIdFsWritePostResponseFsWriteV1ComputerMachineIdFsWritePost, HTTPValidationError]
|
|
144
|
+
]:
|
|
145
|
+
"""Write file contents
|
|
146
|
+
|
|
147
|
+
Write file contents to the machine.
|
|
148
|
+
|
|
149
|
+
Args:
|
|
150
|
+
machine_id (str):
|
|
151
|
+
body (FileWriteRequest):
|
|
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
|
+
Response[Union[FsWriteV1ComputerMachineIdFsWritePostResponseFsWriteV1ComputerMachineIdFsWritePost, HTTPValidationError]]
|
|
159
|
+
"""
|
|
160
|
+
|
|
161
|
+
kwargs = _get_kwargs(
|
|
162
|
+
machine_id=machine_id,
|
|
163
|
+
body=body,
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
167
|
+
|
|
168
|
+
return _build_response(client=client, response=response)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
async def asyncio(
|
|
172
|
+
machine_id: str,
|
|
173
|
+
*,
|
|
174
|
+
client: AuthenticatedClient,
|
|
175
|
+
body: FileWriteRequest,
|
|
176
|
+
) -> Optional[
|
|
177
|
+
Union[FsWriteV1ComputerMachineIdFsWritePostResponseFsWriteV1ComputerMachineIdFsWritePost, HTTPValidationError]
|
|
178
|
+
]:
|
|
179
|
+
"""Write file contents
|
|
180
|
+
|
|
181
|
+
Write file contents to the machine.
|
|
182
|
+
|
|
183
|
+
Args:
|
|
184
|
+
machine_id (str):
|
|
185
|
+
body (FileWriteRequest):
|
|
186
|
+
|
|
187
|
+
Raises:
|
|
188
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
189
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
190
|
+
|
|
191
|
+
Returns:
|
|
192
|
+
Union[FsWriteV1ComputerMachineIdFsWritePostResponseFsWriteV1ComputerMachineIdFsWritePost, HTTPValidationError]
|
|
193
|
+
"""
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
await asyncio_detailed(
|
|
197
|
+
machine_id=machine_id,
|
|
198
|
+
client=client,
|
|
199
|
+
body=body,
|
|
200
|
+
)
|
|
201
|
+
).parsed
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
9
|
+
from ...models.power_shell_exec_request import PowerShellExecRequest
|
|
10
|
+
from ...models.powershell_exec_v1_computer_machine_id_shell_powershell_exec_post_response_powershell_exec_v1_computer_machine_id_shell_powershell_exec_post import (
|
|
11
|
+
PowershellExecV1ComputerMachineIdShellPowershellExecPostResponsePowershellExecV1ComputerMachineIdShellPowershellExecPost,
|
|
12
|
+
)
|
|
13
|
+
from ...types import Response
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _get_kwargs(
|
|
17
|
+
machine_id: str,
|
|
18
|
+
*,
|
|
19
|
+
body: PowerShellExecRequest,
|
|
20
|
+
) -> dict[str, Any]:
|
|
21
|
+
headers: dict[str, Any] = {}
|
|
22
|
+
|
|
23
|
+
_kwargs: dict[str, Any] = {
|
|
24
|
+
"method": "post",
|
|
25
|
+
"url": f"/v1/computer/{machine_id}/shell/powershell/exec",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
_kwargs["json"] = body.to_dict()
|
|
29
|
+
|
|
30
|
+
headers["Content-Type"] = "application/json"
|
|
31
|
+
|
|
32
|
+
_kwargs["headers"] = headers
|
|
33
|
+
return _kwargs
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _parse_response(
|
|
37
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
38
|
+
) -> Optional[
|
|
39
|
+
Union[
|
|
40
|
+
HTTPValidationError,
|
|
41
|
+
PowershellExecV1ComputerMachineIdShellPowershellExecPostResponsePowershellExecV1ComputerMachineIdShellPowershellExecPost,
|
|
42
|
+
]
|
|
43
|
+
]:
|
|
44
|
+
if response.status_code == 200:
|
|
45
|
+
response_200 = PowershellExecV1ComputerMachineIdShellPowershellExecPostResponsePowershellExecV1ComputerMachineIdShellPowershellExecPost.from_dict(
|
|
46
|
+
response.json()
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
return response_200
|
|
50
|
+
if response.status_code == 422:
|
|
51
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
52
|
+
|
|
53
|
+
return response_422
|
|
54
|
+
if client.raise_on_unexpected_status:
|
|
55
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
56
|
+
else:
|
|
57
|
+
return None
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _build_response(
|
|
61
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
62
|
+
) -> Response[
|
|
63
|
+
Union[
|
|
64
|
+
HTTPValidationError,
|
|
65
|
+
PowershellExecV1ComputerMachineIdShellPowershellExecPostResponsePowershellExecV1ComputerMachineIdShellPowershellExecPost,
|
|
66
|
+
]
|
|
67
|
+
]:
|
|
68
|
+
return Response(
|
|
69
|
+
status_code=HTTPStatus(response.status_code),
|
|
70
|
+
content=response.content,
|
|
71
|
+
headers=response.headers,
|
|
72
|
+
parsed=_parse_response(client=client, response=response),
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def sync_detailed(
|
|
77
|
+
machine_id: str,
|
|
78
|
+
*,
|
|
79
|
+
client: AuthenticatedClient,
|
|
80
|
+
body: PowerShellExecRequest,
|
|
81
|
+
) -> Response[
|
|
82
|
+
Union[
|
|
83
|
+
HTTPValidationError,
|
|
84
|
+
PowershellExecV1ComputerMachineIdShellPowershellExecPostResponsePowershellExecV1ComputerMachineIdShellPowershellExecPost,
|
|
85
|
+
]
|
|
86
|
+
]:
|
|
87
|
+
"""Execute PowerShell command
|
|
88
|
+
|
|
89
|
+
Execute PowerShell command on the machine.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
machine_id (str):
|
|
93
|
+
body (PowerShellExecRequest):
|
|
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
|
+
Response[Union[HTTPValidationError, PowershellExecV1ComputerMachineIdShellPowershellExecPostResponsePowershellExecV1ComputerMachineIdShellPowershellExecPost]]
|
|
101
|
+
"""
|
|
102
|
+
|
|
103
|
+
kwargs = _get_kwargs(
|
|
104
|
+
machine_id=machine_id,
|
|
105
|
+
body=body,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
response = client.get_httpx_client().request(
|
|
109
|
+
**kwargs,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
return _build_response(client=client, response=response)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def sync(
|
|
116
|
+
machine_id: str,
|
|
117
|
+
*,
|
|
118
|
+
client: AuthenticatedClient,
|
|
119
|
+
body: PowerShellExecRequest,
|
|
120
|
+
) -> Optional[
|
|
121
|
+
Union[
|
|
122
|
+
HTTPValidationError,
|
|
123
|
+
PowershellExecV1ComputerMachineIdShellPowershellExecPostResponsePowershellExecV1ComputerMachineIdShellPowershellExecPost,
|
|
124
|
+
]
|
|
125
|
+
]:
|
|
126
|
+
"""Execute PowerShell command
|
|
127
|
+
|
|
128
|
+
Execute PowerShell command on the machine.
|
|
129
|
+
|
|
130
|
+
Args:
|
|
131
|
+
machine_id (str):
|
|
132
|
+
body (PowerShellExecRequest):
|
|
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
|
+
Union[HTTPValidationError, PowershellExecV1ComputerMachineIdShellPowershellExecPostResponsePowershellExecV1ComputerMachineIdShellPowershellExecPost]
|
|
140
|
+
"""
|
|
141
|
+
|
|
142
|
+
return sync_detailed(
|
|
143
|
+
machine_id=machine_id,
|
|
144
|
+
client=client,
|
|
145
|
+
body=body,
|
|
146
|
+
).parsed
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
async def asyncio_detailed(
|
|
150
|
+
machine_id: str,
|
|
151
|
+
*,
|
|
152
|
+
client: AuthenticatedClient,
|
|
153
|
+
body: PowerShellExecRequest,
|
|
154
|
+
) -> Response[
|
|
155
|
+
Union[
|
|
156
|
+
HTTPValidationError,
|
|
157
|
+
PowershellExecV1ComputerMachineIdShellPowershellExecPostResponsePowershellExecV1ComputerMachineIdShellPowershellExecPost,
|
|
158
|
+
]
|
|
159
|
+
]:
|
|
160
|
+
"""Execute PowerShell command
|
|
161
|
+
|
|
162
|
+
Execute PowerShell command on the machine.
|
|
163
|
+
|
|
164
|
+
Args:
|
|
165
|
+
machine_id (str):
|
|
166
|
+
body (PowerShellExecRequest):
|
|
167
|
+
|
|
168
|
+
Raises:
|
|
169
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
170
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
171
|
+
|
|
172
|
+
Returns:
|
|
173
|
+
Response[Union[HTTPValidationError, PowershellExecV1ComputerMachineIdShellPowershellExecPostResponsePowershellExecV1ComputerMachineIdShellPowershellExecPost]]
|
|
174
|
+
"""
|
|
175
|
+
|
|
176
|
+
kwargs = _get_kwargs(
|
|
177
|
+
machine_id=machine_id,
|
|
178
|
+
body=body,
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
182
|
+
|
|
183
|
+
return _build_response(client=client, response=response)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
async def asyncio(
|
|
187
|
+
machine_id: str,
|
|
188
|
+
*,
|
|
189
|
+
client: AuthenticatedClient,
|
|
190
|
+
body: PowerShellExecRequest,
|
|
191
|
+
) -> Optional[
|
|
192
|
+
Union[
|
|
193
|
+
HTTPValidationError,
|
|
194
|
+
PowershellExecV1ComputerMachineIdShellPowershellExecPostResponsePowershellExecV1ComputerMachineIdShellPowershellExecPost,
|
|
195
|
+
]
|
|
196
|
+
]:
|
|
197
|
+
"""Execute PowerShell command
|
|
198
|
+
|
|
199
|
+
Execute PowerShell command on the machine.
|
|
200
|
+
|
|
201
|
+
Args:
|
|
202
|
+
machine_id (str):
|
|
203
|
+
body (PowerShellExecRequest):
|
|
204
|
+
|
|
205
|
+
Raises:
|
|
206
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
207
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
208
|
+
|
|
209
|
+
Returns:
|
|
210
|
+
Union[HTTPValidationError, PowershellExecV1ComputerMachineIdShellPowershellExecPostResponsePowershellExecV1ComputerMachineIdShellPowershellExecPost]
|
|
211
|
+
"""
|
|
212
|
+
|
|
213
|
+
return (
|
|
214
|
+
await asyncio_detailed(
|
|
215
|
+
machine_id=machine_id,
|
|
216
|
+
client=client,
|
|
217
|
+
body=body,
|
|
218
|
+
)
|
|
219
|
+
).parsed
|