cmdop 0.1.25__py3-none-any.whl → 0.1.27__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.
- cmdop/__init__.py +9 -4
- cmdop/_generated/rpc_messages/browser_pb2.py +138 -138
- cmdop/_generated/rpc_messages/browser_pb2.pyi +6 -2
- cmdop/api/generated/machines/__init__.py +1 -1
- cmdop/api/generated/machines/enums.py +0 -112
- cmdop/api/generated/machines/machines__api__machine_sharing/client.py +21 -6
- cmdop/api/generated/machines/machines__api__machine_sharing/models.py +46 -19
- cmdop/api/generated/machines/machines__api__machine_sharing/sync_client.py +20 -5
- cmdop/api/generated/machines/machines__api__machines/client.py +90 -25
- cmdop/api/generated/machines/machines__api__machines/models.py +143 -125
- cmdop/api/generated/machines/machines__api__machines/sync_client.py +84 -19
- cmdop/api/generated/machines/schema.json +72 -0
- cmdop/api/generated/system/__init__.py +1 -1
- cmdop/api/generated/system/enums.py +0 -52
- cmdop/api/generated/system/schema.json +54 -0
- cmdop/api/generated/system/system__api__oauth/client.py +42 -12
- cmdop/api/generated/system/system__api__oauth/models.py +111 -85
- cmdop/api/generated/system/system__api__oauth/sync_client.py +38 -8
- cmdop/api/generated/system/system__api__system/client.py +98 -23
- cmdop/api/generated/system/system__api__system/models.py +83 -83
- cmdop/api/generated/system/system__api__system/sync_client.py +94 -19
- cmdop/api/generated/workspaces/__init__.py +1 -1
- cmdop/api/generated/workspaces/enums.py +0 -137
- cmdop/api/generated/workspaces/schema.json +47 -0
- cmdop/api/generated/workspaces/workspaces__api__workspaces/client.py +156 -41
- cmdop/api/generated/workspaces/workspaces__api__workspaces/models.py +126 -85
- cmdop/api/generated/workspaces/workspaces__api__workspaces/sync_client.py +145 -29
- cmdop/helpers/__init__.py +0 -4
- cmdop/services/browser/service/sync.py +4 -0
- cmdop/services/files.py +159 -17
- {cmdop-0.1.25.dist-info → cmdop-0.1.27.dist-info}/METADATA +47 -19
- {cmdop-0.1.25.dist-info → cmdop-0.1.27.dist-info}/RECORD +34 -36
- cmdop/helpers/cleaner.py +0 -53
- cmdop/helpers/formatting.py +0 -15
- {cmdop-0.1.25.dist-info → cmdop-0.1.27.dist-info}/WHEEL +0 -0
- {cmdop-0.1.25.dist-info → cmdop-0.1.27.dist-info}/licenses/LICENSE +0 -0
|
@@ -6,31 +6,7 @@ from typing import Any
|
|
|
6
6
|
|
|
7
7
|
from pydantic import BaseModel, ConfigDict, Field
|
|
8
8
|
|
|
9
|
-
from ..enums import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class PaginatedMachineLogList(BaseModel):
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
Response model (includes read-only fields).
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
model_config = ConfigDict(
|
|
19
|
-
validate_assignment=True,
|
|
20
|
-
extra="allow",
|
|
21
|
-
frozen=False,
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
count: int = Field(description='Total number of items across all pages')
|
|
25
|
-
page: int = Field(description='Current page number (1-based)')
|
|
26
|
-
pages: int = Field(description='Total number of pages')
|
|
27
|
-
page_size: int = Field(description='Number of items per page')
|
|
28
|
-
has_next: bool = Field(description='Whether there is a next page')
|
|
29
|
-
has_previous: bool = Field(description='Whether there is a previous page')
|
|
30
|
-
next_page: int | None = Field(None, description='Next page number (null if no next page)')
|
|
31
|
-
previous_page: int | None = Field(None, description='Previous page number (null if no previous page)')
|
|
32
|
-
results: list[dict[str, Any]] = Field(description='Array of items for current page')
|
|
33
|
-
|
|
9
|
+
from ..enums import MachineLogLevel, MachineOs, MachineStatus, MachinesMachinesUpdateMetricsCreateRequestStatus
|
|
34
10
|
|
|
35
11
|
|
|
36
12
|
class MachineLog(BaseModel):
|
|
@@ -51,12 +27,12 @@ class MachineLog(BaseModel):
|
|
|
51
27
|
machine_name: Any = ...
|
|
52
28
|
level: MachineLogLevel = Field(description='* `info` - Info\n* `warning` - Warning\n* `error` - Error')
|
|
53
29
|
message: str = ...
|
|
54
|
-
source: str = Field(None, max_length=100)
|
|
30
|
+
source: str | None = Field(None, max_length=100)
|
|
55
31
|
created_at: Any = ...
|
|
56
32
|
|
|
57
33
|
|
|
58
34
|
|
|
59
|
-
class
|
|
35
|
+
class PaginatedMachineLogList(BaseModel):
|
|
60
36
|
"""
|
|
61
37
|
|
|
62
38
|
Response model (includes read-only fields).
|
|
@@ -76,13 +52,33 @@ class PaginatedMachineList(BaseModel):
|
|
|
76
52
|
has_previous: bool = Field(description='Whether there is a previous page')
|
|
77
53
|
next_page: int | None = Field(None, description='Next page number (null if no next page)')
|
|
78
54
|
previous_page: int | None = Field(None, description='Previous page number (null if no previous page)')
|
|
79
|
-
results: list[
|
|
55
|
+
results: list[MachineLog] = Field(description='Array of items for current page')
|
|
80
56
|
|
|
81
57
|
|
|
82
58
|
|
|
83
|
-
class
|
|
59
|
+
class MachineLogRequest(BaseModel):
|
|
84
60
|
"""
|
|
85
|
-
Serializer for
|
|
61
|
+
Serializer for MachineLog model.
|
|
62
|
+
|
|
63
|
+
Request model (no read-only fields).
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
model_config = ConfigDict(
|
|
67
|
+
validate_assignment=True,
|
|
68
|
+
extra="allow",
|
|
69
|
+
frozen=False,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
machine: str = ...
|
|
73
|
+
level: MachineLogLevel = Field(description='* `info` - Info\n* `warning` - Warning\n* `error` - Error')
|
|
74
|
+
message: str = Field(min_length=1)
|
|
75
|
+
source: str | None = Field(None, max_length=100)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class ActiveTerminalSession(BaseModel):
|
|
80
|
+
"""
|
|
81
|
+
Serializer for active terminal session info.
|
|
86
82
|
|
|
87
83
|
Response model (includes read-only fields).
|
|
88
84
|
"""
|
|
@@ -93,11 +89,8 @@ class MachineCreate(BaseModel):
|
|
|
93
89
|
frozen=False,
|
|
94
90
|
)
|
|
95
91
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
hostname: str = Field(max_length=255)
|
|
99
|
-
os: MachineCreateOs = Field(description='* `macos` - macOS\n* `windows` - Windows\n* `linux` - Linux\n* `ios` - iOS\n* `android` - Android')
|
|
100
|
-
os_version: str = Field(None, max_length=50)
|
|
92
|
+
session_id: str = ...
|
|
93
|
+
created_at: str = ...
|
|
101
94
|
|
|
102
95
|
|
|
103
96
|
|
|
@@ -121,47 +114,46 @@ class Machine(BaseModel):
|
|
|
121
114
|
name: str = Field(max_length=100)
|
|
122
115
|
hostname: str = Field(max_length=255)
|
|
123
116
|
os: MachineOs = Field(description='* `macos` - macOS\n* `windows` - Windows\n* `linux` - Linux\n* `ios` - iOS\n* `android` - Android')
|
|
124
|
-
os_version: str = Field(None, max_length=50)
|
|
125
|
-
kernel_version: str = Field(None, max_length=50)
|
|
126
|
-
status: MachineStatus = Field(None, description='* `online` - Online\n* `offline` - Offline')
|
|
117
|
+
os_version: str | None = Field(None, max_length=50)
|
|
118
|
+
kernel_version: str | None = Field(None, max_length=50)
|
|
119
|
+
status: MachineStatus | None = Field(None, description='* `online` - Online\n* `offline` - Offline')
|
|
127
120
|
status_emoji: Any = ...
|
|
128
121
|
is_online: bool = ...
|
|
129
122
|
heartbeat_age_seconds: float = Field(description='Seconds since last heartbeat')
|
|
130
|
-
device_type: str = Field(None, description='Device type: desktop, ios, android', max_length=20)
|
|
123
|
+
device_type: str | None = Field(None, description='Device type: desktop, ios, android', max_length=20)
|
|
131
124
|
device_id: str | None = Field(None, description='Unique device identifier (UDID for iOS, Android ID for Android)', max_length=255)
|
|
132
|
-
architecture: str = Field(None, description='CPU architecture (arm64, x86_64, etc.)', max_length=50)
|
|
133
|
-
has_shell: bool = Field(None, description='Whether device has shell access (false for mobile)')
|
|
125
|
+
architecture: str | None = Field(None, description='CPU architecture (arm64, x86_64, etc.)', max_length=50)
|
|
126
|
+
has_shell: bool | None = Field(None, description='Whether device has shell access (false for mobile)')
|
|
134
127
|
public_ip: str | None = None
|
|
135
128
|
local_ips: list[str] = Field(description='List of local network IP addresses')
|
|
136
|
-
username: str = Field(None, description='Current username running the agent', max_length=255)
|
|
129
|
+
username: str | None = Field(None, description='Current username running the agent', max_length=255)
|
|
137
130
|
uid: int | None = Field(None, description='Unix user ID', ge=0, le=2147483647)
|
|
138
|
-
is_root: bool = Field(None, description='Whether agent is running as root/admin')
|
|
139
|
-
home_dir: str = Field(None, max_length=500)
|
|
140
|
-
cpu_model: str = Field(None, max_length=255)
|
|
141
|
-
cpu_count: int = Field(None, ge=0, le=32767)
|
|
142
|
-
total_ram_bytes: int = Field(None, ge=-9223372036854775808, le=9223372036854775808)
|
|
143
|
-
cpu_usage: float = None
|
|
144
|
-
memory_usage: float = None
|
|
145
|
-
memory_total_gb: float = None
|
|
146
|
-
disk_usage: float = None
|
|
147
|
-
disk_total_gb: float = None
|
|
148
|
-
battery_level: float = Field(None, description='-1 means no battery')
|
|
149
|
-
is_charging: bool = None
|
|
150
|
-
is_on_ac_power: bool = None
|
|
151
|
-
uptime_seconds: int = Field(None, ge=-9223372036854775808, le=9223372036854775808)
|
|
152
|
-
process_count: int = Field(None, ge=-2147483648, le=2147483647)
|
|
153
|
-
agent_version: str = Field(None, max_length=20)
|
|
154
|
-
last_seen: Any | None =
|
|
131
|
+
is_root: bool | None = Field(None, description='Whether agent is running as root/admin')
|
|
132
|
+
home_dir: str | None = Field(None, max_length=500)
|
|
133
|
+
cpu_model: str | None = Field(None, max_length=255)
|
|
134
|
+
cpu_count: int | None = Field(None, ge=0, le=32767)
|
|
135
|
+
total_ram_bytes: int | None = Field(None, ge=-9223372036854775808, le=9223372036854775808)
|
|
136
|
+
cpu_usage: float | None = None
|
|
137
|
+
memory_usage: float | None = None
|
|
138
|
+
memory_total_gb: float | None = None
|
|
139
|
+
disk_usage: float | None = None
|
|
140
|
+
disk_total_gb: float | None = None
|
|
141
|
+
battery_level: float | None = Field(None, description='-1 means no battery')
|
|
142
|
+
is_charging: bool | None = None
|
|
143
|
+
is_on_ac_power: bool | None = None
|
|
144
|
+
uptime_seconds: int | None = Field(None, ge=-9223372036854775808, le=9223372036854775808)
|
|
145
|
+
process_count: int | None = Field(None, ge=-2147483648, le=2147483647)
|
|
146
|
+
agent_version: str | None = Field(None, max_length=20)
|
|
147
|
+
last_seen: Any | None = None
|
|
155
148
|
created_at: Any = ...
|
|
156
|
-
active_terminal_session:
|
|
149
|
+
active_terminal_session: ActiveTerminalSession | None = None
|
|
157
150
|
|
|
158
151
|
|
|
159
152
|
|
|
160
|
-
class
|
|
153
|
+
class PaginatedMachineList(BaseModel):
|
|
161
154
|
"""
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
Request model (no read-only fields).
|
|
155
|
+
|
|
156
|
+
Response model (includes read-only fields).
|
|
165
157
|
"""
|
|
166
158
|
|
|
167
159
|
model_config = ConfigDict(
|
|
@@ -170,10 +162,15 @@ class MachineLogRequest(BaseModel):
|
|
|
170
162
|
frozen=False,
|
|
171
163
|
)
|
|
172
164
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
165
|
+
count: int = Field(description='Total number of items across all pages')
|
|
166
|
+
page: int = Field(description='Current page number (1-based)')
|
|
167
|
+
pages: int = Field(description='Total number of pages')
|
|
168
|
+
page_size: int = Field(description='Number of items per page')
|
|
169
|
+
has_next: bool = Field(description='Whether there is a next page')
|
|
170
|
+
has_previous: bool = Field(description='Whether there is a previous page')
|
|
171
|
+
next_page: int | None = Field(None, description='Next page number (null if no next page)')
|
|
172
|
+
previous_page: int | None = Field(None, description='Previous page number (null if no previous page)')
|
|
173
|
+
results: list[Machine] = Field(description='Array of items for current page')
|
|
177
174
|
|
|
178
175
|
|
|
179
176
|
|
|
@@ -193,8 +190,29 @@ class MachineCreateRequest(BaseModel):
|
|
|
193
190
|
workspace: str = ...
|
|
194
191
|
name: str = Field(min_length=1, max_length=100)
|
|
195
192
|
hostname: str = Field(min_length=1, max_length=255)
|
|
196
|
-
os:
|
|
197
|
-
os_version: str = Field(None, max_length=50)
|
|
193
|
+
os: MachineOs = Field(description='* `macos` - macOS\n* `windows` - Windows\n* `linux` - Linux\n* `ios` - iOS\n* `android` - Android')
|
|
194
|
+
os_version: str | None = Field(None, max_length=50)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
class MachineCreate(BaseModel):
|
|
199
|
+
"""
|
|
200
|
+
Serializer for creating machines.
|
|
201
|
+
|
|
202
|
+
Response model (includes read-only fields).
|
|
203
|
+
"""
|
|
204
|
+
|
|
205
|
+
model_config = ConfigDict(
|
|
206
|
+
validate_assignment=True,
|
|
207
|
+
extra="allow",
|
|
208
|
+
frozen=False,
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
workspace: str = ...
|
|
212
|
+
name: str = Field(max_length=100)
|
|
213
|
+
hostname: str = Field(max_length=255)
|
|
214
|
+
os: MachineOs = Field(description='* `macos` - macOS\n* `windows` - Windows\n* `linux` - Linux\n* `ios` - iOS\n* `android` - Android')
|
|
215
|
+
os_version: str | None = Field(None, max_length=50)
|
|
198
216
|
|
|
199
217
|
|
|
200
218
|
|
|
@@ -215,33 +233,33 @@ class MachineRequest(BaseModel):
|
|
|
215
233
|
workspace: str = ...
|
|
216
234
|
name: str = Field(min_length=1, max_length=100)
|
|
217
235
|
hostname: str = Field(min_length=1, max_length=255)
|
|
218
|
-
os:
|
|
219
|
-
os_version: str = Field(None, max_length=50)
|
|
220
|
-
kernel_version: str = Field(None, max_length=50)
|
|
221
|
-
status:
|
|
222
|
-
device_type: str = Field(None, description='Device type: desktop, ios, android', max_length=20)
|
|
236
|
+
os: MachineOs = Field(description='* `macos` - macOS\n* `windows` - Windows\n* `linux` - Linux\n* `ios` - iOS\n* `android` - Android')
|
|
237
|
+
os_version: str | None = Field(None, max_length=50)
|
|
238
|
+
kernel_version: str | None = Field(None, max_length=50)
|
|
239
|
+
status: MachineStatus | None = Field(None, description='* `online` - Online\n* `offline` - Offline')
|
|
240
|
+
device_type: str | None = Field(None, description='Device type: desktop, ios, android', max_length=20)
|
|
223
241
|
device_id: str | None = Field(None, description='Unique device identifier (UDID for iOS, Android ID for Android)', max_length=255)
|
|
224
|
-
architecture: str = Field(None, description='CPU architecture (arm64, x86_64, etc.)', max_length=50)
|
|
225
|
-
has_shell: bool = Field(None, description='Whether device has shell access (false for mobile)')
|
|
242
|
+
architecture: str | None = Field(None, description='CPU architecture (arm64, x86_64, etc.)', max_length=50)
|
|
243
|
+
has_shell: bool | None = Field(None, description='Whether device has shell access (false for mobile)')
|
|
226
244
|
public_ip: str | None = Field(None, min_length=1)
|
|
227
|
-
username: str = Field(None, description='Current username running the agent', max_length=255)
|
|
245
|
+
username: str | None = Field(None, description='Current username running the agent', max_length=255)
|
|
228
246
|
uid: int | None = Field(None, description='Unix user ID', ge=0, le=2147483647)
|
|
229
|
-
is_root: bool = Field(None, description='Whether agent is running as root/admin')
|
|
230
|
-
home_dir: str = Field(None, max_length=500)
|
|
231
|
-
cpu_model: str = Field(None, max_length=255)
|
|
232
|
-
cpu_count: int = Field(None, ge=0, le=32767)
|
|
233
|
-
total_ram_bytes: int = Field(None, ge=-9223372036854775808, le=9223372036854775808)
|
|
234
|
-
cpu_usage: float = None
|
|
235
|
-
memory_usage: float = None
|
|
236
|
-
memory_total_gb: float = None
|
|
237
|
-
disk_usage: float = None
|
|
238
|
-
disk_total_gb: float = None
|
|
239
|
-
battery_level: float = Field(None, description='-1 means no battery')
|
|
240
|
-
is_charging: bool = None
|
|
241
|
-
is_on_ac_power: bool = None
|
|
242
|
-
uptime_seconds: int = Field(None, ge=-9223372036854775808, le=9223372036854775808)
|
|
243
|
-
process_count: int = Field(None, ge=-2147483648, le=2147483647)
|
|
244
|
-
agent_version: str = Field(None, max_length=20)
|
|
247
|
+
is_root: bool | None = Field(None, description='Whether agent is running as root/admin')
|
|
248
|
+
home_dir: str | None = Field(None, max_length=500)
|
|
249
|
+
cpu_model: str | None = Field(None, max_length=255)
|
|
250
|
+
cpu_count: int | None = Field(None, ge=0, le=32767)
|
|
251
|
+
total_ram_bytes: int | None = Field(None, ge=-9223372036854775808, le=9223372036854775808)
|
|
252
|
+
cpu_usage: float | None = None
|
|
253
|
+
memory_usage: float | None = None
|
|
254
|
+
memory_total_gb: float | None = None
|
|
255
|
+
disk_usage: float | None = None
|
|
256
|
+
disk_total_gb: float | None = None
|
|
257
|
+
battery_level: float | None = Field(None, description='-1 means no battery')
|
|
258
|
+
is_charging: bool | None = None
|
|
259
|
+
is_on_ac_power: bool | None = None
|
|
260
|
+
uptime_seconds: int | None = Field(None, ge=-9223372036854775808, le=9223372036854775808)
|
|
261
|
+
process_count: int | None = Field(None, ge=-2147483648, le=2147483647)
|
|
262
|
+
agent_version: str | None = Field(None, max_length=20)
|
|
245
263
|
agent_token: str = Field(min_length=1, max_length=255)
|
|
246
264
|
|
|
247
265
|
|
|
@@ -260,37 +278,37 @@ class PatchedMachineRequest(BaseModel):
|
|
|
260
278
|
frozen=False,
|
|
261
279
|
)
|
|
262
280
|
|
|
263
|
-
workspace: str = None
|
|
264
|
-
name: str = Field(None, min_length=1, max_length=100)
|
|
265
|
-
hostname: str = Field(None, min_length=1, max_length=255)
|
|
266
|
-
os:
|
|
267
|
-
os_version: str = Field(None, max_length=50)
|
|
268
|
-
kernel_version: str = Field(None, max_length=50)
|
|
269
|
-
status:
|
|
270
|
-
device_type: str = Field(None, description='Device type: desktop, ios, android', max_length=20)
|
|
281
|
+
workspace: str | None = None
|
|
282
|
+
name: str | None = Field(None, min_length=1, max_length=100)
|
|
283
|
+
hostname: str | None = Field(None, min_length=1, max_length=255)
|
|
284
|
+
os: MachineOs | None = Field(None, description='* `macos` - macOS\n* `windows` - Windows\n* `linux` - Linux\n* `ios` - iOS\n* `android` - Android')
|
|
285
|
+
os_version: str | None = Field(None, max_length=50)
|
|
286
|
+
kernel_version: str | None = Field(None, max_length=50)
|
|
287
|
+
status: MachineStatus | None = Field(None, description='* `online` - Online\n* `offline` - Offline')
|
|
288
|
+
device_type: str | None = Field(None, description='Device type: desktop, ios, android', max_length=20)
|
|
271
289
|
device_id: str | None = Field(None, description='Unique device identifier (UDID for iOS, Android ID for Android)', max_length=255)
|
|
272
|
-
architecture: str = Field(None, description='CPU architecture (arm64, x86_64, etc.)', max_length=50)
|
|
273
|
-
has_shell: bool = Field(None, description='Whether device has shell access (false for mobile)')
|
|
290
|
+
architecture: str | None = Field(None, description='CPU architecture (arm64, x86_64, etc.)', max_length=50)
|
|
291
|
+
has_shell: bool | None = Field(None, description='Whether device has shell access (false for mobile)')
|
|
274
292
|
public_ip: str | None = Field(None, min_length=1)
|
|
275
|
-
username: str = Field(None, description='Current username running the agent', max_length=255)
|
|
293
|
+
username: str | None = Field(None, description='Current username running the agent', max_length=255)
|
|
276
294
|
uid: int | None = Field(None, description='Unix user ID', ge=0, le=2147483647)
|
|
277
|
-
is_root: bool = Field(None, description='Whether agent is running as root/admin')
|
|
278
|
-
home_dir: str = Field(None, max_length=500)
|
|
279
|
-
cpu_model: str = Field(None, max_length=255)
|
|
280
|
-
cpu_count: int = Field(None, ge=0, le=32767)
|
|
281
|
-
total_ram_bytes: int = Field(None, ge=-9223372036854775808, le=9223372036854775808)
|
|
282
|
-
cpu_usage: float = None
|
|
283
|
-
memory_usage: float = None
|
|
284
|
-
memory_total_gb: float = None
|
|
285
|
-
disk_usage: float = None
|
|
286
|
-
disk_total_gb: float = None
|
|
287
|
-
battery_level: float = Field(None, description='-1 means no battery')
|
|
288
|
-
is_charging: bool = None
|
|
289
|
-
is_on_ac_power: bool = None
|
|
290
|
-
uptime_seconds: int = Field(None, ge=-9223372036854775808, le=9223372036854775808)
|
|
291
|
-
process_count: int = Field(None, ge=-2147483648, le=2147483647)
|
|
292
|
-
agent_version: str = Field(None, max_length=20)
|
|
293
|
-
agent_token: str = Field(None, min_length=1, max_length=255)
|
|
295
|
+
is_root: bool | None = Field(None, description='Whether agent is running as root/admin')
|
|
296
|
+
home_dir: str | None = Field(None, max_length=500)
|
|
297
|
+
cpu_model: str | None = Field(None, max_length=255)
|
|
298
|
+
cpu_count: int | None = Field(None, ge=0, le=32767)
|
|
299
|
+
total_ram_bytes: int | None = Field(None, ge=-9223372036854775808, le=9223372036854775808)
|
|
300
|
+
cpu_usage: float | None = None
|
|
301
|
+
memory_usage: float | None = None
|
|
302
|
+
memory_total_gb: float | None = None
|
|
303
|
+
disk_usage: float | None = None
|
|
304
|
+
disk_total_gb: float | None = None
|
|
305
|
+
battery_level: float | None = Field(None, description='-1 means no battery')
|
|
306
|
+
is_charging: bool | None = None
|
|
307
|
+
is_on_ac_power: bool | None = None
|
|
308
|
+
uptime_seconds: int | None = Field(None, ge=-9223372036854775808, le=9223372036854775808)
|
|
309
|
+
process_count: int | None = Field(None, ge=-2147483648, le=2147483647)
|
|
310
|
+
agent_version: str | None = Field(None, max_length=20)
|
|
311
|
+
agent_token: str | None = Field(None, min_length=1, max_length=255)
|
|
294
312
|
|
|
295
313
|
|
|
296
314
|
|
|
@@ -306,9 +324,9 @@ class MachinesMachinesUpdateMetricsCreateRequest(BaseModel):
|
|
|
306
324
|
frozen=False,
|
|
307
325
|
)
|
|
308
326
|
|
|
309
|
-
cpu_usage: float = Field(None, ge=0.0, le=100.0)
|
|
310
|
-
memory_usage: float = Field(None, ge=0.0, le=100.0)
|
|
311
|
-
status: MachinesMachinesUpdateMetricsCreateRequestStatus = None
|
|
327
|
+
cpu_usage: float | None = Field(None, ge=0.0, le=100.0)
|
|
328
|
+
memory_usage: float | None = Field(None, ge=0.0, le=100.0)
|
|
329
|
+
status: MachinesMachinesUpdateMetricsCreateRequestStatus | None = None
|
|
312
330
|
|
|
313
331
|
|
|
314
332
|
|
|
@@ -12,14 +12,19 @@ class SyncMachinesMachinesAPI:
|
|
|
12
12
|
"""Initialize sync sub-client with shared httpx client."""
|
|
13
13
|
self._client = client
|
|
14
14
|
|
|
15
|
-
def logs_list(self, page: int | None = None, page_size: int | None = None) -> list[PaginatedMachineLogList]:
|
|
15
|
+
def logs_list(self, ordering: str | None = None, page: int | None = None, page_size: int | None = None, search: str | None = None) -> list[PaginatedMachineLogList]:
|
|
16
16
|
"""
|
|
17
17
|
ViewSet for MachineLog operations. Read-only except for creation. Logs
|
|
18
18
|
are created by agents.
|
|
19
19
|
"""
|
|
20
20
|
url = "/api/machines/logs/"
|
|
21
|
-
response = self._client.get(url, params={"page": page if page is not None else None, "page_size": page_size if page_size is not None else None})
|
|
22
|
-
response.
|
|
21
|
+
response = self._client.get(url, params={"ordering": ordering if ordering is not None else None, "page": page if page is not None else None, "page_size": page_size if page_size is not None else None, "search": search if search is not None else None})
|
|
22
|
+
if not response.is_success:
|
|
23
|
+
try:
|
|
24
|
+
error_body = response.json()
|
|
25
|
+
except Exception:
|
|
26
|
+
error_body = response.text
|
|
27
|
+
raise httpx.HTTPStatusError(f"{response.status_code}: {error_body}", request=response.request, response=response)
|
|
23
28
|
return PaginatedMachineLogList.model_validate(response.json())
|
|
24
29
|
|
|
25
30
|
|
|
@@ -30,7 +35,12 @@ class SyncMachinesMachinesAPI:
|
|
|
30
35
|
"""
|
|
31
36
|
url = "/api/machines/logs/"
|
|
32
37
|
response = self._client.post(url, json=data.model_dump(exclude_unset=True))
|
|
33
|
-
response.
|
|
38
|
+
if not response.is_success:
|
|
39
|
+
try:
|
|
40
|
+
error_body = response.json()
|
|
41
|
+
except Exception:
|
|
42
|
+
error_body = response.text
|
|
43
|
+
raise httpx.HTTPStatusError(f"{response.status_code}: {error_body}", request=response.request, response=response)
|
|
34
44
|
return MachineLog.model_validate(response.json())
|
|
35
45
|
|
|
36
46
|
|
|
@@ -41,18 +51,28 @@ class SyncMachinesMachinesAPI:
|
|
|
41
51
|
"""
|
|
42
52
|
url = f"/api/machines/logs/{id}/"
|
|
43
53
|
response = self._client.get(url)
|
|
44
|
-
response.
|
|
54
|
+
if not response.is_success:
|
|
55
|
+
try:
|
|
56
|
+
error_body = response.json()
|
|
57
|
+
except Exception:
|
|
58
|
+
error_body = response.text
|
|
59
|
+
raise httpx.HTTPStatusError(f"{response.status_code}: {error_body}", request=response.request, response=response)
|
|
45
60
|
return MachineLog.model_validate(response.json())
|
|
46
61
|
|
|
47
62
|
|
|
48
|
-
def machines_list(self, page: int | None = None, page_size: int | None = None) -> list[PaginatedMachineList]:
|
|
63
|
+
def machines_list(self, ordering: str | None = None, page: int | None = None, page_size: int | None = None, search: str | None = None) -> list[PaginatedMachineList]:
|
|
49
64
|
"""
|
|
50
65
|
ViewSet for Machine operations. Provides CRUD operations for remote
|
|
51
66
|
machines with monitoring capabilities.
|
|
52
67
|
"""
|
|
53
68
|
url = "/api/machines/machines/"
|
|
54
|
-
response = self._client.get(url, params={"page": page if page is not None else None, "page_size": page_size if page_size is not None else None})
|
|
55
|
-
response.
|
|
69
|
+
response = self._client.get(url, params={"ordering": ordering if ordering is not None else None, "page": page if page is not None else None, "page_size": page_size if page_size is not None else None, "search": search if search is not None else None})
|
|
70
|
+
if not response.is_success:
|
|
71
|
+
try:
|
|
72
|
+
error_body = response.json()
|
|
73
|
+
except Exception:
|
|
74
|
+
error_body = response.text
|
|
75
|
+
raise httpx.HTTPStatusError(f"{response.status_code}: {error_body}", request=response.request, response=response)
|
|
56
76
|
return PaginatedMachineList.model_validate(response.json())
|
|
57
77
|
|
|
58
78
|
|
|
@@ -63,7 +83,12 @@ class SyncMachinesMachinesAPI:
|
|
|
63
83
|
"""
|
|
64
84
|
url = "/api/machines/machines/"
|
|
65
85
|
response = self._client.post(url, json=data.model_dump(exclude_unset=True))
|
|
66
|
-
response.
|
|
86
|
+
if not response.is_success:
|
|
87
|
+
try:
|
|
88
|
+
error_body = response.json()
|
|
89
|
+
except Exception:
|
|
90
|
+
error_body = response.text
|
|
91
|
+
raise httpx.HTTPStatusError(f"{response.status_code}: {error_body}", request=response.request, response=response)
|
|
67
92
|
return MachineCreate.model_validate(response.json())
|
|
68
93
|
|
|
69
94
|
|
|
@@ -74,7 +99,12 @@ class SyncMachinesMachinesAPI:
|
|
|
74
99
|
"""
|
|
75
100
|
url = f"/api/machines/machines/{id}/"
|
|
76
101
|
response = self._client.get(url)
|
|
77
|
-
response.
|
|
102
|
+
if not response.is_success:
|
|
103
|
+
try:
|
|
104
|
+
error_body = response.json()
|
|
105
|
+
except Exception:
|
|
106
|
+
error_body = response.text
|
|
107
|
+
raise httpx.HTTPStatusError(f"{response.status_code}: {error_body}", request=response.request, response=response)
|
|
78
108
|
return Machine.model_validate(response.json())
|
|
79
109
|
|
|
80
110
|
|
|
@@ -85,7 +115,12 @@ class SyncMachinesMachinesAPI:
|
|
|
85
115
|
"""
|
|
86
116
|
url = f"/api/machines/machines/{id}/"
|
|
87
117
|
response = self._client.put(url, json=data.model_dump(exclude_unset=True))
|
|
88
|
-
response.
|
|
118
|
+
if not response.is_success:
|
|
119
|
+
try:
|
|
120
|
+
error_body = response.json()
|
|
121
|
+
except Exception:
|
|
122
|
+
error_body = response.text
|
|
123
|
+
raise httpx.HTTPStatusError(f"{response.status_code}: {error_body}", request=response.request, response=response)
|
|
89
124
|
return Machine.model_validate(response.json())
|
|
90
125
|
|
|
91
126
|
|
|
@@ -96,7 +131,12 @@ class SyncMachinesMachinesAPI:
|
|
|
96
131
|
"""
|
|
97
132
|
url = f"/api/machines/machines/{id}/"
|
|
98
133
|
response = self._client.patch(url, json=data.model_dump(exclude_unset=True) if data is not None else None)
|
|
99
|
-
response.
|
|
134
|
+
if not response.is_success:
|
|
135
|
+
try:
|
|
136
|
+
error_body = response.json()
|
|
137
|
+
except Exception:
|
|
138
|
+
error_body = response.text
|
|
139
|
+
raise httpx.HTTPStatusError(f"{response.status_code}: {error_body}", request=response.request, response=response)
|
|
100
140
|
return Machine.model_validate(response.json())
|
|
101
141
|
|
|
102
142
|
|
|
@@ -107,18 +147,28 @@ class SyncMachinesMachinesAPI:
|
|
|
107
147
|
"""
|
|
108
148
|
url = f"/api/machines/machines/{id}/"
|
|
109
149
|
response = self._client.delete(url)
|
|
110
|
-
response.
|
|
150
|
+
if not response.is_success:
|
|
151
|
+
try:
|
|
152
|
+
error_body = response.json()
|
|
153
|
+
except Exception:
|
|
154
|
+
error_body = response.text
|
|
155
|
+
raise httpx.HTTPStatusError(f"{response.status_code}: {error_body}", request=response.request, response=response)
|
|
111
156
|
|
|
112
157
|
|
|
113
|
-
def machines_logs_list(self, id: str, level: str | None = None, limit: int | None = None, page: int | None = None, page_size: int | None = None) -> list[PaginatedMachineLogList]:
|
|
158
|
+
def machines_logs_list(self, id: str, level: str | None = None, limit: int | None = None, ordering: str | None = None, page: int | None = None, page_size: int | None = None, search: str | None = None) -> list[PaginatedMachineLogList]:
|
|
114
159
|
"""
|
|
115
160
|
Get machine logs
|
|
116
161
|
|
|
117
162
|
Get logs for this machine.
|
|
118
163
|
"""
|
|
119
164
|
url = f"/api/machines/machines/{id}/logs/"
|
|
120
|
-
response = self._client.get(url, params={"level": level if level is not None else None, "limit": limit if limit is not None else None, "page": page if page is not None else None, "page_size": page_size if page_size is not None else None})
|
|
121
|
-
response.
|
|
165
|
+
response = self._client.get(url, params={"level": level if level is not None else None, "limit": limit if limit is not None else None, "ordering": ordering if ordering is not None else None, "page": page if page is not None else None, "page_size": page_size if page_size is not None else None, "search": search if search is not None else None})
|
|
166
|
+
if not response.is_success:
|
|
167
|
+
try:
|
|
168
|
+
error_body = response.json()
|
|
169
|
+
except Exception:
|
|
170
|
+
error_body = response.text
|
|
171
|
+
raise httpx.HTTPStatusError(f"{response.status_code}: {error_body}", request=response.request, response=response)
|
|
122
172
|
return PaginatedMachineLogList.model_validate(response.json())
|
|
123
173
|
|
|
124
174
|
|
|
@@ -130,7 +180,12 @@ class SyncMachinesMachinesAPI:
|
|
|
130
180
|
"""
|
|
131
181
|
url = f"/api/machines/machines/{id}/regenerate-token/"
|
|
132
182
|
response = self._client.post(url, json=data.model_dump(exclude_unset=True))
|
|
133
|
-
response.
|
|
183
|
+
if not response.is_success:
|
|
184
|
+
try:
|
|
185
|
+
error_body = response.json()
|
|
186
|
+
except Exception:
|
|
187
|
+
error_body = response.text
|
|
188
|
+
raise httpx.HTTPStatusError(f"{response.status_code}: {error_body}", request=response.request, response=response)
|
|
134
189
|
|
|
135
190
|
|
|
136
191
|
def machines_stats_retrieve(self, id: str) -> None:
|
|
@@ -141,7 +196,12 @@ class SyncMachinesMachinesAPI:
|
|
|
141
196
|
"""
|
|
142
197
|
url = f"/api/machines/machines/{id}/stats/"
|
|
143
198
|
response = self._client.get(url)
|
|
144
|
-
response.
|
|
199
|
+
if not response.is_success:
|
|
200
|
+
try:
|
|
201
|
+
error_body = response.json()
|
|
202
|
+
except Exception:
|
|
203
|
+
error_body = response.text
|
|
204
|
+
raise httpx.HTTPStatusError(f"{response.status_code}: {error_body}", request=response.request, response=response)
|
|
145
205
|
|
|
146
206
|
|
|
147
207
|
def machines_update_metrics_create(self, id: str, data: MachinesMachinesUpdateMetricsCreateRequest) -> Machine:
|
|
@@ -152,7 +212,12 @@ class SyncMachinesMachinesAPI:
|
|
|
152
212
|
"""
|
|
153
213
|
url = f"/api/machines/machines/{id}/update-metrics/"
|
|
154
214
|
response = self._client.post(url, json=data.model_dump(exclude_unset=True))
|
|
155
|
-
response.
|
|
215
|
+
if not response.is_success:
|
|
216
|
+
try:
|
|
217
|
+
error_body = response.json()
|
|
218
|
+
except Exception:
|
|
219
|
+
error_body = response.text
|
|
220
|
+
raise httpx.HTTPStatusError(f"{response.status_code}: {error_body}", request=response.request, response=response)
|
|
156
221
|
return Machine.model_validate(response.json())
|
|
157
222
|
|
|
158
223
|
|