mcsmapi 0.1.5b2__py3-none-any.whl → 0.1.7__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.
mcsmapi/__init__.py CHANGED
@@ -1,5 +1,4 @@
1
1
  import urllib.parse
2
- from mcsmapi.models.overview import OverviewModel
3
2
  from mcsmapi.pool import ApiPool
4
3
  from mcsmapi.apis.file import File
5
4
  from mcsmapi.apis.user import User
@@ -11,12 +10,12 @@ from mcsmapi.request import Request
11
10
 
12
11
 
13
12
  class MCSMAPI:
13
+
14
14
  def __init__(self, url: str, timeout: int = 5) -> None:
15
15
  split_url = urllib.parse.urlsplit(url)
16
16
  Request.set_mcsm_url(
17
17
  urllib.parse.urljoin(f"{split_url.scheme}://{split_url.netloc}", "")
18
18
  )
19
- self.authentication = None
20
19
  Request.set_timeout(timeout)
21
20
 
22
21
  def login(self, username: str, password: str) -> "MCSMAPI":
@@ -35,8 +34,8 @@ class MCSMAPI:
35
34
  self.authentication = "apikey"
36
35
  return self
37
36
 
38
- def overview(self) -> OverviewModel:
39
- return Overview().init()
37
+ def overview(self) -> Overview:
38
+ return Overview()
40
39
 
41
40
  def instance(self) -> Instance:
42
41
  return Instance()
mcsmapi/apis/daemon.py CHANGED
@@ -2,11 +2,11 @@ from typing import Any
2
2
  from mcsmapi.pool import ApiPool
3
3
  from mcsmapi.request import send
4
4
  from mcsmapi.models.daemon import DaemonConfig, DaemonModel
5
- from mcsmapi.models.daemon.instance import InstanceDetail
6
5
 
7
6
 
8
7
  class Daemon:
9
- def show(self) -> list[DaemonConfig]:
8
+ @staticmethod
9
+ def show() -> list[DaemonConfig]:
10
10
  """
11
11
  获取全部节点配置信息
12
12
 
@@ -18,11 +18,12 @@ class Daemon:
18
18
  f"{ApiPool.SERVICE}/remote_services_list",
19
19
  )
20
20
  return [DaemonConfig(**daemon) for daemon in daemons]
21
-
22
- def system(self) -> list[DaemonModel]:
21
+
22
+ @staticmethod
23
+ def system() -> list[DaemonModel]:
23
24
  """
24
25
  获取全部节点的系统信息
25
-
26
+
26
27
  返回:
27
28
  - List[DaemonModel]: 节点系统信息列表
28
29
  """
@@ -31,34 +32,9 @@ class Daemon:
31
32
  f"{ApiPool.SERVICE}/remote_services_system",
32
33
  )
33
34
  return [DaemonModel(**daemon) for daemon in daemons]
34
-
35
- def instances(self, daemonId: str, page: int = 0, page_size: int = 10, instance_name: str = "", status: int = 0, tag: list[str] | None = None) -> list[InstanceDetail]:
36
- """
37
- 查询指定节点下的实例详细信息
38
-
39
- 参数:
40
- - `daemonId` (str): 要查询的守护进程(Daemon)的唯一标识符。
41
- - `page` (int, 默认=0): 分页查询的页码(从 0 开始)。
42
- - `page_size` (int, 默认=10): 每页返回的实例数量。
43
- - `instance_name` (str, 默认=""): 过滤指定名称的实例。
44
- - `status` (int, 默认=0): 过滤指定状态的实例,如运行中、已停止等。
45
- - `tag` (List[str] | None, 默认=None): 根据标签筛选实例(可选参数)。
46
-
47
- 返回:
48
- - `List[InstanceDetail]`: 包含实例详细信息的列表。
49
-
50
- 注意:
51
- - 此方法尚未实现 (`raise RuntimeError`),因为 MCSM 官方文档未提供足够的信息。
52
- - 由于根据 MCSM 源代码的测试无法获取有效数据,目前无法完成该功能的开发。
53
- - 如果你有具体的实现思路,请在 issue 中提出
54
- - 可供参考 MCSM 源码: [daemon_router.ts 第 32 行](https://github.com/MCSManager/MCSManager/blob/master/panel%2Fsrc%2Fapp%2Frouters%2Fdaemon_router.ts#L32-L32)
55
- - 模型定义代码: https://github.com/MCSManager/MCSManager/blob/master/frontend%2Fsrc%2Fservices%2Fapis%2Findex.ts#L86-L86
56
- - 测试地址示例:
57
- `http://localhost:23333/api/service/remote_service_instances?apikey=xxx&daemonId=xxx&page=0&page_size=10&status=3&instance_name=`
58
- """
59
- raise RuntimeError("此方法尚未实现")
60
35
 
61
- def add(self, config: dict[str, Any]) -> str:
36
+ @staticmethod
37
+ def add(config: dict[str, Any]) -> str:
62
38
  """
63
39
  新增一个节点。
64
40
 
@@ -73,8 +49,8 @@ class Daemon:
73
49
  f"{ApiPool.SERVICE}/remote_service",
74
50
  data=DaemonConfig(**config).dict(),
75
51
  )
76
-
77
- def delete(self, daemonId: str) -> bool:
52
+ @staticmethod
53
+ def delete(daemonId: str) -> bool:
78
54
  """
79
55
  删除一个节点。
80
56
 
@@ -87,8 +63,8 @@ class Daemon:
87
63
  return send(
88
64
  "DELETE", f"{ApiPool.SERVICE}/remote_service", params={"uuid": daemonId}
89
65
  )
90
-
91
- def link(self, daemonId: str) -> bool:
66
+ @staticmethod
67
+ def link(daemonId: str) -> bool:
92
68
  """
93
69
  连接一个节点。
94
70
 
@@ -101,11 +77,11 @@ class Daemon:
101
77
  return send(
102
78
  "GET", f"{ApiPool.SERVICE}/link_remote_service", params={"uuid": daemonId}
103
79
  )
104
-
105
- def update(self, daemonId: str, config: dict[str, Any]) -> bool:
80
+ @staticmethod
81
+ def update(daemonId: str, config: dict[str, Any]) -> bool:
106
82
  """
107
83
  更新一个节点的配置。
108
-
84
+
109
85
  **不建议直接使用此函数,建议调用overview()后在remote属性内使用updateConfig方法按需更新**
110
86
 
111
87
  参数:
mcsmapi/apis/file.py CHANGED
@@ -1,19 +1,19 @@
1
1
  from mcsmapi.pool import ApiPool
2
2
  from mcsmapi.request import Request, send, upload
3
- from mcsmapi.models.file import CommonConfig, FileList
3
+ from mcsmapi.models.file import FileDownloadConfig, FileList
4
4
  import urllib.parse
5
5
  import os
6
6
 
7
7
 
8
8
  class File:
9
+ @staticmethod
9
10
  def show(
10
- self,
11
11
  daemonId: str,
12
12
  uuid: str,
13
13
  target: str = "",
14
14
  page: int = 0,
15
15
  page_size: int = 100,
16
- file_name: str = ""
16
+ file_name: str = "",
17
17
  ) -> FileList:
18
18
  """
19
19
  获取文件列表
@@ -43,7 +43,8 @@ class File:
43
43
  )
44
44
  return FileList(**result, daemonId=daemonId, uuid=uuid)
45
45
 
46
- def content(self, daemonId: str, uuid: str, target: str) -> str | bytes:
46
+ @staticmethod
47
+ def content(daemonId: str, uuid: str, target: str) -> str | bytes:
47
48
  """
48
49
  获取文件内容
49
50
 
@@ -62,7 +63,8 @@ class File:
62
63
  data={"target": target},
63
64
  )
64
65
 
65
- def update(self, daemonId: str, uuid: str, target: str, text: str) -> bool:
66
+ @staticmethod
67
+ def update(daemonId: str, uuid: str, target: str, text: str) -> bool:
66
68
  """
67
69
  更新文件内容
68
70
 
@@ -82,7 +84,8 @@ class File:
82
84
  data={"target": target, "text": text},
83
85
  )
84
86
 
85
- def download(self, daemonId: str, uuid: str, file_name: str) -> str:
87
+ @staticmethod
88
+ def download(daemonId: str, uuid: str, file_name: str) -> str:
86
89
  """
87
90
  下载文件
88
91
 
@@ -100,14 +103,13 @@ class File:
100
103
  f"{ApiPool.FILE}/download",
101
104
  params={"daemonId": daemonId, "uuid": uuid, "file_name": file_name},
102
105
  )
103
- result = CommonConfig(**result)
106
+ result = FileDownloadConfig(**result)
104
107
  protocol = Request.mcsm_url.split("://")[0]
105
108
  base_url = urllib.parse.urljoin(f"{protocol}://{result.addr}", "download")
106
109
  return urllib.parse.urljoin(base_url, f"{result.password}/{file_name}")
107
110
 
108
- async def upload(
109
- self, daemonId: str, uuid: str, file: bytes, upload_dir: str
110
- ) -> bool:
111
+ @staticmethod
112
+ async def upload(daemonId: str, uuid: str, file: bytes, upload_dir: str) -> bool:
111
113
  """
112
114
  上传文件
113
115
 
@@ -125,14 +127,15 @@ class File:
125
127
  f"{ApiPool.FILE}/upload",
126
128
  params={"daemonId": daemonId, "uuid": uuid, "upload_dir": upload_dir},
127
129
  )
128
- result = CommonConfig(**result)
130
+ result = FileDownloadConfig(**result)
129
131
  protocol = Request.mcsm_url.split("://")[0]
130
132
  base_url = urllib.parse.urljoin(f"{protocol}://{result.addr}", "upload")
131
133
  final_url = urllib.parse.urljoin(base_url, result.password)
132
134
  await upload(final_url, file)
133
135
  return True
134
136
 
135
- def copy(self, daemonId: str, uuid: str, copy_map: dict[str, str]) -> bool:
137
+ @staticmethod
138
+ def copy(daemonId: str, uuid: str, copy_map: dict[str, str]) -> bool:
136
139
  """
137
140
  复制多个文件夹或文件到指定位置。
138
141
 
@@ -152,7 +155,8 @@ class File:
152
155
  data={"targets": targets},
153
156
  )
154
157
 
155
- def copyOne(self, daemonId: str, uuid: str, source: str, target: str) -> bool:
158
+ @staticmethod
159
+ def copyOne(daemonId: str, uuid: str, source: str, target: str) -> bool:
156
160
  """
157
161
  复制单个文件或文件夹到指定位置。
158
162
 
@@ -165,9 +169,10 @@ class File:
165
169
  **返回:**
166
170
  - bool: 移动成功后返回True。
167
171
  """
168
- return self.copy(daemonId, uuid, {source: target})
172
+ return File.copy(daemonId, uuid, {source: target})
169
173
 
170
- def move(self, daemonId: str, uuid: str, copy_map: dict[str, str]) -> bool:
174
+ @staticmethod
175
+ def move(daemonId: str, uuid: str, copy_map: dict[str, str]) -> bool:
171
176
  """
172
177
  移动多个文件或文件夹到指定位置。
173
178
 
@@ -187,7 +192,8 @@ class File:
187
192
  data={"targets": targets},
188
193
  )
189
194
 
190
- def moveOne(self, daemonId: str, uuid: str, source: str, target: str) -> bool:
195
+ @staticmethod
196
+ def moveOne(daemonId: str, uuid: str, source: str, target: str) -> bool:
191
197
  """
192
198
  从源路径移动单个文件或文件夹到目标路径。
193
199
 
@@ -200,9 +206,10 @@ class File:
200
206
  返回:
201
207
  - bool: 移动成功后返回True。
202
208
  """
203
- return self.move(daemonId, uuid, {source: target})
209
+ return File.move(daemonId, uuid, {source: target})
204
210
 
205
- def rename(self, daemonId: str, uuid: str, source: str, new_name: str) -> bool:
211
+ @staticmethod
212
+ def rename(daemonId: str, uuid: str, source: str, new_name: str) -> bool:
206
213
  """
207
214
  重命名单个文件或文件夹。
208
215
 
@@ -217,9 +224,10 @@ class File:
217
224
  """
218
225
  directory = os.path.dirname(source)
219
226
  target = os.path.join(directory, new_name)
220
- return self.moveOne(daemonId, uuid, source, target)
227
+ return File.moveOne(daemonId, uuid, source, target)
221
228
 
222
- def zip(self, daemonId: str, uuid: str, source: str, targets: list[str]) -> bool:
229
+ @staticmethod
230
+ def zip(daemonId: str, uuid: str, source: str, targets: list[str]) -> bool:
223
231
  """
224
232
  压缩多个文件或文件夹到指定位置。
225
233
 
@@ -239,8 +247,9 @@ class File:
239
247
  data={"type": 1, "code": "utf-8", "source": source, "targets": targets},
240
248
  )
241
249
 
250
+ @staticmethod
242
251
  def unzip(
243
- self, daemonId: str, uuid: str, source: str, target: str, code: str = "utf-8"
252
+ daemonId: str, uuid: str, source: str, target: str, code: str = "utf-8"
244
253
  ) -> bool:
245
254
  """
246
255
  解压缩指定的zip文件到目标位置。
@@ -263,7 +272,8 @@ class File:
263
272
  data={"type": 2, "code": code, "source": source, "targets": target},
264
273
  )
265
274
 
266
- def delete(self, daemonId: str, uuid: str, targets: list[str]) -> bool:
275
+ @staticmethod
276
+ def delete(daemonId: str, uuid: str, targets: list[str]) -> bool:
267
277
  """
268
278
  删除多个文件或文件夹。
269
279
 
@@ -282,7 +292,8 @@ class File:
282
292
  data={"targets": targets},
283
293
  )
284
294
 
285
- def createFile(self, daemonId: str, uuid: str, target: str) -> bool:
295
+ @staticmethod
296
+ def createFile(daemonId: str, uuid: str, target: str) -> bool:
286
297
  """
287
298
  创建文件。
288
299
 
@@ -301,7 +312,8 @@ class File:
301
312
  data={"target": target},
302
313
  )
303
314
 
304
- def createFloder(self, daemonId: str, uuid: str, target: str) -> bool:
315
+ @staticmethod
316
+ def createFolder(daemonId: str, uuid: str, target: str) -> bool:
305
317
  """
306
318
  创建文件夹
307
319
 
mcsmapi/apis/image.py CHANGED
@@ -4,7 +4,8 @@ from mcsmapi.models.image import DockerImageItem, DockerContainerItem, DockerNet
4
4
 
5
5
 
6
6
  class Image:
7
- def images(self, daemonId: str) -> list[DockerImageItem]:
7
+ @staticmethod
8
+ def images(daemonId: str) -> list[DockerImageItem]:
8
9
  """
9
10
  获取镜像列表
10
11
 
@@ -24,7 +25,8 @@ class Image:
24
25
 
25
26
  return [DockerImageItem(**item) for item in result]
26
27
 
27
- def containers(self, daemonId: str) -> list[DockerContainerItem]:
28
+ @staticmethod
29
+ def containers(daemonId: str) -> list[DockerContainerItem]:
28
30
  """
29
31
  获取容器列表
30
32
 
@@ -44,7 +46,8 @@ class Image:
44
46
 
45
47
  return [DockerContainerItem(**item) for item in result]
46
48
 
47
- def network(self, daemonId: str) -> list[DockerNetworkItem]:
49
+ @staticmethod
50
+ def network(daemonId: str) -> list[DockerNetworkItem]:
48
51
  """
49
52
  获取网络接口列表
50
53
 
@@ -63,7 +66,8 @@ class Image:
63
66
  )
64
67
  return [DockerNetworkItem(**item) for item in result]
65
68
 
66
- def add(self, daemonId: str, dockerFile: str, name: str, tag: str) -> bool:
69
+ @staticmethod
70
+ def add(daemonId: str, dockerFile: str, name: str, tag: str) -> bool:
67
71
  """
68
72
  新增一个镜像
69
73
 
@@ -83,7 +87,8 @@ class Image:
83
87
  data={"dockerFile": dockerFile, "name": name, "tag": tag},
84
88
  )
85
89
 
86
- def progress(self, daemonId: str) -> dict[str, int]:
90
+ @staticmethod
91
+ def progress(daemonId: str) -> dict[str, int]:
87
92
  """
88
93
  获取镜像构建进度
89
94
 
mcsmapi/apis/instance.py CHANGED
@@ -10,8 +10,8 @@ from mcsmapi.models.instance import (
10
10
 
11
11
 
12
12
  class Instance:
13
+ @staticmethod
13
14
  def search(
14
- self,
15
15
  daemonId: str,
16
16
  page: int = 1,
17
17
  page_size: int = 20,
@@ -49,7 +49,8 @@ class Instance:
49
49
  )
50
50
  return InstanceSearchList(**result, daemonId=daemonId)
51
51
 
52
- def detail(self, daemonId: str, uuid: str) -> InstanceDetail:
52
+ @staticmethod
53
+ def detail(daemonId: str, uuid: str) -> InstanceDetail:
53
54
  """
54
55
  获取指定实例的详细信息
55
56
 
@@ -67,7 +68,8 @@ class Instance:
67
68
  )
68
69
  return InstanceDetail(**result)
69
70
 
70
- def create(self, daemonId: str, config: dict[str, Any]) -> InstanceCreateResult:
71
+ @staticmethod
72
+ def create(daemonId: str, config: dict[str, Any]) -> InstanceCreateResult:
71
73
  """
72
74
  创建一个实例。
73
75
 
@@ -86,10 +88,11 @@ class Instance:
86
88
  )
87
89
  return InstanceCreateResult(**result)
88
90
 
89
- def updateConfig(self, daemonId: str, uuid: str, config: dict) -> str | bool:
91
+ @staticmethod
92
+ def updateConfig(daemonId: str, uuid: str, config: dict) -> str | bool:
90
93
  """
91
94
  更新实例配置。
92
-
95
+
93
96
  **不建议直接使用此函数,建议调用search后在data属性内使用updateConfig方法按需更新**
94
97
 
95
98
  **参数:**
@@ -108,9 +111,8 @@ class Instance:
108
111
  )
109
112
  return result.get("uuid", True)
110
113
 
111
- def delete(
112
- self, daemonId: str, uuids: list[str], deleteFile: bool = False
113
- ) -> list[str]:
114
+ @staticmethod
115
+ def delete(daemonId: str, uuids: list[str], deleteFile: bool = False) -> list[str]:
114
116
  """
115
117
  删除实例。
116
118
 
@@ -129,7 +131,8 @@ class Instance:
129
131
  data={"uuids": uuids, "deleteFile": deleteFile},
130
132
  )
131
133
 
132
- def start(self, daemonId: str, uuid: str) -> str | bool:
134
+ @staticmethod
135
+ def start(daemonId: str, uuid: str) -> str | bool:
133
136
  """
134
137
  启动实例。
135
138
 
@@ -147,7 +150,8 @@ class Instance:
147
150
  )
148
151
  return result.get("instanceUuid", True)
149
152
 
150
- def stop(self, daemonId: str, uuid: str) -> str | bool:
153
+ @staticmethod
154
+ def stop(daemonId: str, uuid: str) -> str | bool:
151
155
  """
152
156
  关闭实例。
153
157
 
@@ -165,7 +169,8 @@ class Instance:
165
169
  )
166
170
  return result.get("instanceUuid", True)
167
171
 
168
- def restart(self, daemonId: str, uuid: str) -> str | bool:
172
+ @staticmethod
173
+ def restart(daemonId: str, uuid: str) -> str | bool:
169
174
  """
170
175
  重启实例。
171
176
 
@@ -183,7 +188,8 @@ class Instance:
183
188
  )
184
189
  return result.get("instanceUuid", True)
185
190
 
186
- def kill(self, daemonId: str, uuid: str) -> str | bool:
191
+ @staticmethod
192
+ def kill(daemonId: str, uuid: str) -> str | bool:
187
193
  """
188
194
  强制关闭实例。
189
195
 
@@ -201,7 +207,8 @@ class Instance:
201
207
  )
202
208
  return result.get("instanceUuid", True)
203
209
 
204
- def batchOperation(self, instances: list[dict[str, str]], operation: str) -> bool:
210
+ @staticmethod
211
+ def batchOperation(instances: list[dict[str, str]], operation: str) -> bool:
205
212
  """
206
213
  对多个实例进行批量操作。
207
214
 
@@ -217,7 +224,8 @@ class Instance:
217
224
  else:
218
225
  raise ValueError("operation must be one of start, stop, restart, kill")
219
226
 
220
- def update(self, daemonId: str, uuid: str) -> bool:
227
+ @staticmethod
228
+ def update(daemonId: str, uuid: str) -> bool:
221
229
  """
222
230
  升级实例。
223
231
 
@@ -229,12 +237,13 @@ class Instance:
229
237
  - bool: 返回操作结果,成功时返回True。
230
238
  """
231
239
  return send(
232
- "GET",
240
+ "POST",
233
241
  f"{ApiPool.PROTECTED_INSTANCE}/asynchronous",
234
242
  params={"daemonId": daemonId, "uuid": uuid, "task_name": "update"},
235
243
  )
236
244
 
237
- def command(self, daemonId: str, uuid: str, command: str) -> str:
245
+ @staticmethod
246
+ def command(daemonId: str, uuid: str, command: str) -> str:
238
247
  """
239
248
  向实例发送命令。
240
249
 
@@ -253,7 +262,8 @@ class Instance:
253
262
  )
254
263
  return result.get("instanceUuid", True)
255
264
 
256
- def get_output(self, daemonId: str, uuid: str, size: int | str = "") -> str:
265
+ @staticmethod
266
+ def get_output(daemonId: str, uuid: str, size: int | str = "") -> str:
257
267
  """
258
268
  获取实例输出。
259
269
 
@@ -271,8 +281,8 @@ class Instance:
271
281
  params={"daemonId": daemonId, "uuid": uuid, "size": size},
272
282
  )
273
283
 
284
+ @staticmethod
274
285
  def reinstall(
275
- self,
276
286
  daemonId: str,
277
287
  uuid: str,
278
288
  targetUrl: str,
mcsmapi/apis/overview.py CHANGED
@@ -1,17 +1,21 @@
1
1
  from mcsmapi.pool import ApiPool
2
2
  from mcsmapi.request import send
3
- from mcsmapi.models.overview import OverviewModel
3
+ from mcsmapi.models.overview import OverviewModel, LogDetail
4
4
 
5
5
 
6
6
  class Overview:
7
- def init(self):
7
+ @staticmethod
8
+ def overview():
8
9
  """
9
- 初始化方法,用于获取API概览信息并构建概览模型。
10
-
11
- 本方法通过发送GET请求获取API概览信息,确保返回的数据类型为字典,
12
- 然后使用这些数据来构建一个OverviewModel实例。
13
-
14
- :return: 返回一个OverviewModel实例,该实例使用获取的API概览信息进行初始化。
10
+ 获取面板基本信息
15
11
  """
16
12
  result = send("GET", ApiPool.OVERVIEW)
17
13
  return OverviewModel(**result)
14
+
15
+ @staticmethod
16
+ def logs():
17
+ """
18
+ 获取面板操作日志
19
+ """
20
+ result = send("GET", ApiPool.LOG)
21
+ return [LogDetail(**item) for item in result]
mcsmapi/apis/user.py CHANGED
@@ -5,8 +5,9 @@ from mcsmapi.models.user import SearchUserModel, UserConfig
5
5
 
6
6
 
7
7
  class User:
8
+ @staticmethod
8
9
  def search(
9
- self, username: str = "", page: int = 1, page_size: int = 20, role: str = ""
10
+ username: str = "", page: int = 1, page_size: int = 20, role: str = ""
10
11
  ) -> SearchUserModel:
11
12
  """根据用户名和角色搜索用户信息
12
13
 
@@ -32,7 +33,8 @@ class User:
32
33
  )
33
34
  return SearchUserModel(**result)
34
35
 
35
- def create(self, username: str, password: str, permission: int = 1) -> str | bool:
36
+ @staticmethod
37
+ def create(username: str, password: str, permission: int = 1) -> str | bool:
36
38
  """
37
39
  创建新用户的方法
38
40
 
@@ -50,7 +52,8 @@ class User:
50
52
  data={"username": username, "password": password, "permission": permission},
51
53
  ).get("uuid", True)
52
54
 
53
- def update(self, uuid: str, config: dict[str, Any]) -> bool:
55
+ @staticmethod
56
+ def update(uuid: str, config: dict[str, Any]) -> bool:
54
57
  """
55
58
  更新用户信息的方法
56
59
 
@@ -66,10 +69,11 @@ class User:
66
69
  return send(
67
70
  "PUT",
68
71
  ApiPool.AUTH,
69
- data={"uuid": uuid, "config": UserConfig(**config).dict()},
72
+ data={"uuid": uuid, "config": UserConfig(**config).model_dump()},
70
73
  )
71
74
 
72
- def delete(self, uuids: list[str]) -> bool:
75
+ @staticmethod
76
+ def delete(uuids: list[str]) -> bool:
73
77
  """
74
78
  删除用户的方法
75
79
 
@@ -0,0 +1,30 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class CpuMemChart(BaseModel):
5
+ """节点资源使用率信息"""
6
+
7
+ cpu: float
8
+ """cpu使用率"""
9
+ mem: float
10
+ """内存使用率"""
11
+
12
+
13
+ class ProcessInfo(BaseModel):
14
+ """节点进程详细信息"""
15
+
16
+ cpu: int
17
+ """远程节点使用的cpu资源(单位: byte)"""
18
+ memory: int
19
+ """远程节点使用的内存资源(单位: byte)"""
20
+ cwd: str
21
+ """远程节点的工作路径"""
22
+
23
+
24
+ class InstanceInfo(BaseModel):
25
+ """实例统计信息"""
26
+
27
+ running: int
28
+ """运行中实例数量"""
29
+ total: int
30
+ """全部实例数量"""