mcsmapi 0.1.6__py3-none-any.whl → 0.1.8b1__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 +3 -4
- mcsmapi/apis/daemon.py +33 -38
- mcsmapi/apis/file.py +122 -135
- mcsmapi/apis/image.py +28 -29
- mcsmapi/apis/instance.py +107 -126
- mcsmapi/apis/overview.py +12 -8
- mcsmapi/apis/user.py +37 -37
- mcsmapi/models/common.py +30 -0
- mcsmapi/models/daemon.py +60 -96
- mcsmapi/models/file.py +89 -78
- mcsmapi/models/image.py +93 -85
- mcsmapi/models/instance.py +155 -133
- mcsmapi/models/overview.py +148 -57
- mcsmapi/models/user.py +80 -57
- mcsmapi/pool.py +1 -0
- mcsmapi/request.py +20 -14
- {mcsmapi-0.1.6.dist-info → mcsmapi-0.1.8b1.dist-info}/METADATA +6 -3
- mcsmapi-0.1.8b1.dist-info/RECORD +24 -0
- mcsmapi-0.1.6.dist-info/RECORD +0 -23
- {mcsmapi-0.1.6.dist-info → mcsmapi-0.1.8b1.dist-info}/WHEEL +0 -0
- {mcsmapi-0.1.6.dist-info → mcsmapi-0.1.8b1.dist-info}/licenses/LICENSE +0 -0
- {mcsmapi-0.1.6.dist-info → mcsmapi-0.1.8b1.dist-info}/top_level.txt +0 -0
mcsmapi/models/image.py
CHANGED
@@ -1,207 +1,215 @@
|
|
1
|
-
from typing import
|
1
|
+
from typing import Literal
|
2
2
|
from pydantic import BaseModel
|
3
3
|
|
4
4
|
|
5
5
|
class DockerConfig(BaseModel):
|
6
6
|
"""容器配置"""
|
7
7
|
|
8
|
-
"""容器名称"""
|
9
8
|
containerName: str = ""
|
10
|
-
"""
|
9
|
+
"""容器名称"""
|
11
10
|
image: str = ""
|
12
|
-
"""
|
13
|
-
|
14
|
-
"""
|
15
|
-
|
11
|
+
"""镜像名称"""
|
12
|
+
ports: list[str] = []
|
13
|
+
"""容器端口映射, eg:["25565:25565/tcp"]"""
|
14
|
+
extraVolumes: list[str] = []
|
16
15
|
"""额外挂载卷路径"""
|
17
|
-
|
18
|
-
"""
|
19
|
-
|
20
|
-
"""
|
21
|
-
|
22
|
-
"""
|
23
|
-
io: Optional[Union[str, int]] = None
|
24
|
-
"""网络模式(例如: bridge, host)"""
|
16
|
+
memory: int = 0
|
17
|
+
"""容器分配内存(单位: MB)"""
|
18
|
+
memorySwap: int | None = None
|
19
|
+
"""容器分配 swap 内存(单位: MB)"""
|
20
|
+
memorySwappiness: int | None = None
|
21
|
+
"""虚拟内存使用倾向(0-100)"""
|
25
22
|
networkMode: str = "bridge"
|
23
|
+
"""网络模式(例如: bridge, host)"""
|
24
|
+
networkAliases: list[str] = []
|
26
25
|
"""网络别名列表"""
|
27
|
-
|
28
|
-
"""
|
29
|
-
|
30
|
-
"""
|
31
|
-
|
26
|
+
maxSpace: int = 0
|
27
|
+
"""容器可使用的最大磁盘空间(单位: MB)"""
|
28
|
+
network: int = 0
|
29
|
+
"""网络配置(已弃用)"""
|
30
|
+
io: int = 0
|
31
|
+
"""容器的 IO 限制"""
|
32
|
+
cpusetCpus: str = ""
|
33
|
+
"""绑定的 CPU 核心, eg: `0,1`"""
|
34
|
+
cpuUsage: int = 0
|
35
|
+
"""限制CPU 使用率(单位: %)"""
|
36
|
+
workingDir: str = "/workspace/"
|
32
37
|
"""工作目录"""
|
33
|
-
|
38
|
+
env: list[str] = []
|
34
39
|
"""环境变量设置"""
|
35
|
-
|
40
|
+
changeWorkdir: bool = True
|
41
|
+
"""是否更变容器默认工作目录"""
|
36
42
|
|
37
43
|
|
38
44
|
class DockerImageItem(BaseModel):
|
39
45
|
"""Docker 镜像信息"""
|
40
46
|
|
41
|
-
"""镜像唯一 ID"""
|
42
47
|
Id: str = ""
|
43
|
-
"""
|
48
|
+
"""镜像唯一 ID"""
|
44
49
|
ParentId: str = ""
|
45
|
-
"""
|
46
|
-
RepoTags:
|
50
|
+
"""父镜像 ID"""
|
51
|
+
RepoTags: list[str] = []
|
52
|
+
"""镜像仓库标签, eg: ["ubuntu:latest"]"""
|
53
|
+
RepoDigests: list[str] = []
|
47
54
|
"""镜像摘要"""
|
48
|
-
RepoDigests: List[str] = []
|
49
|
-
"""镜像创建时间(Unix 时间戳)"""
|
50
55
|
Created: int = 0
|
51
|
-
"""
|
56
|
+
"""镜像创建时间(Unix 时间戳)"""
|
52
57
|
Size: int = 0
|
53
|
-
"""
|
58
|
+
"""镜像大小(单位: 字节)"""
|
54
59
|
VirtualSize: int = 0
|
55
|
-
"""
|
60
|
+
"""镜像的虚拟大小"""
|
56
61
|
SharedSize: int = 0
|
57
|
-
"""
|
62
|
+
"""共享存储空间大小"""
|
58
63
|
Labels: dict[str, str] = {}
|
59
|
-
"""
|
64
|
+
"""镜像标签"""
|
60
65
|
Containers: int = 0
|
66
|
+
"""依赖该镜像运行的容器数量"""
|
61
67
|
|
62
68
|
|
63
69
|
class DockerContainerItemPort(BaseModel):
|
64
70
|
"""Docker 容器端口映射"""
|
65
71
|
|
66
|
-
"""容器内部端口"""
|
67
72
|
PrivatePort: int = 0
|
73
|
+
"""容器内部端口"""
|
74
|
+
PublicPort: int | None = None
|
68
75
|
"""映射到宿主机的端口"""
|
69
|
-
|
70
|
-
"""端口类型
|
71
|
-
Type: str = ""
|
76
|
+
Type: Literal["tcp", "udp"] = "tcp"
|
77
|
+
"""端口类型"""
|
72
78
|
|
73
79
|
|
74
80
|
class DockerContainerItemNetworkSettingsNetwork(BaseModel):
|
75
81
|
"""Docker 容器网络设置信息"""
|
76
82
|
|
77
|
-
"""网络 ID"""
|
78
83
|
NetworkID: str = ""
|
79
|
-
"""
|
84
|
+
"""网络 ID"""
|
80
85
|
EndpointID: str = ""
|
81
|
-
"""
|
86
|
+
"""网络端点 ID"""
|
82
87
|
Gateway: str = ""
|
83
|
-
"""
|
88
|
+
"""网关地址"""
|
84
89
|
IPAddress: str = ""
|
85
|
-
"""IP
|
90
|
+
"""分配的 IP 地址"""
|
86
91
|
IPPrefixLen: int = 0
|
87
|
-
"""
|
92
|
+
"""IP 地址前缀长度"""
|
88
93
|
IPv6Gateway: str = ""
|
89
|
-
"""IPv6
|
94
|
+
"""IPv6 网关地址"""
|
90
95
|
GlobalIPv6Address: str = ""
|
91
|
-
"""IPv6
|
96
|
+
"""IPv6 地址"""
|
92
97
|
GlobalIPv6PrefixLen: int = 0
|
93
|
-
"""
|
98
|
+
"""IPv6 地址前缀长度"""
|
94
99
|
MacAddress: str = ""
|
100
|
+
"""MAC 地址"""
|
95
101
|
|
96
102
|
|
97
103
|
class DockerContainerItemNetworkSettings(BaseModel):
|
98
104
|
"""Docker 容器的网络配置信息"""
|
99
105
|
|
100
|
-
"""容器连接的所有网络"""
|
101
106
|
Networks: dict[str, DockerContainerItemNetworkSettingsNetwork] = {}
|
107
|
+
"""容器连接的所有网络"""
|
102
108
|
|
103
109
|
|
104
110
|
class DockerContainerItemMount(BaseModel):
|
105
111
|
"""容器挂载点信息"""
|
106
112
|
|
107
|
-
"""挂载名称"""
|
108
113
|
Name: str = ""
|
109
|
-
"""
|
114
|
+
"""挂载名称"""
|
110
115
|
Source: str = ""
|
111
|
-
"""
|
116
|
+
"""源路径"""
|
112
117
|
Destination: str = ""
|
113
|
-
"""
|
118
|
+
"""目标路径"""
|
114
119
|
Driver: str = ""
|
115
|
-
"""
|
120
|
+
"""驱动类型"""
|
116
121
|
Mode: str = ""
|
117
|
-
"""
|
122
|
+
"""挂载模式"""
|
118
123
|
RW: bool = False
|
119
|
-
"""
|
124
|
+
"""是否允许读写"""
|
120
125
|
Propagation: str = ""
|
126
|
+
"""传播模式"""
|
121
127
|
|
122
128
|
|
123
129
|
class DockerContainerItemHostConfig(BaseModel):
|
124
130
|
"""Docker 宿主机配置"""
|
125
131
|
|
126
|
-
"""网络模式"""
|
127
132
|
NetworkMode: str = ""
|
133
|
+
"""网络模式"""
|
128
134
|
|
129
135
|
|
130
136
|
class DockerContainerItem(BaseModel):
|
131
137
|
"""Docker 容器详细信息"""
|
132
138
|
|
133
|
-
"""容器 ID"""
|
134
139
|
Id: str = ""
|
140
|
+
"""容器 ID"""
|
141
|
+
Names: list[str] = []
|
135
142
|
"""容器名称列表"""
|
136
|
-
Names: List[str] = []
|
137
|
-
"""运行的镜像名称"""
|
138
143
|
Image: str = ""
|
139
|
-
"""
|
144
|
+
"""运行的镜像名称"""
|
140
145
|
ImageID: str = ""
|
141
|
-
"""
|
146
|
+
"""镜像 ID"""
|
142
147
|
Command: str = ""
|
143
|
-
"""
|
148
|
+
"""容器启动命令"""
|
144
149
|
Created: int = 0
|
145
|
-
"""
|
150
|
+
"""容器创建时间(Unix 时间戳)"""
|
146
151
|
State: str = ""
|
147
|
-
"""
|
152
|
+
"""容器状态"""
|
148
153
|
Status: str = ""
|
154
|
+
"""容器运行状态描述"""
|
155
|
+
Ports: list[DockerContainerItemPort] = []
|
149
156
|
"""端口映射信息"""
|
150
|
-
Ports: List[DockerContainerItemPort] = []
|
151
|
-
"""容器标签信息"""
|
152
157
|
Labels: dict[str, str] = {}
|
153
|
-
"""
|
158
|
+
"""容器标签信息"""
|
154
159
|
SizeRw: int = 0
|
155
|
-
"""
|
160
|
+
"""读写层大小(单位: 字节)"""
|
156
161
|
SizeRootFs: int = 0
|
157
|
-
"""
|
162
|
+
"""根文件系统大小(单位: 字节)"""
|
158
163
|
HostConfig: DockerContainerItemHostConfig = DockerContainerItemHostConfig()
|
164
|
+
"""宿主机配置"""
|
165
|
+
NetworkSettings: DockerContainerItemNetworkSettings = (
|
166
|
+
DockerContainerItemNetworkSettings()
|
167
|
+
)
|
159
168
|
"""容器网络配置"""
|
160
|
-
|
169
|
+
Mounts: list[DockerContainerItemMount] = []
|
161
170
|
"""容器挂载信息"""
|
162
|
-
Mounts: List[DockerContainerItemMount] = []
|
163
171
|
|
164
172
|
|
165
173
|
class DockerNetworkItemIPAMConfig(BaseModel):
|
166
174
|
"""Docker 网络 IPAM 配置信息"""
|
167
175
|
|
168
|
-
"""子网地址"""
|
169
176
|
Subnet: str = ""
|
177
|
+
"""子网地址"""
|
170
178
|
|
171
179
|
|
172
180
|
class DockerNetworkItemIPAM(BaseModel):
|
173
181
|
"""Docker 网络的 IP 地址管理"""
|
174
182
|
|
175
|
-
"""驱动类型"""
|
176
183
|
Driver: str = ""
|
184
|
+
"""驱动类型"""
|
185
|
+
Config: list[DockerNetworkItemIPAMConfig] = []
|
177
186
|
"""IPAM 配置"""
|
178
|
-
Config: List[DockerNetworkItemIPAMConfig] = []
|
179
187
|
|
180
188
|
|
181
189
|
class DockerNetworkItem(BaseModel):
|
182
190
|
"""Docker 网络详细信息"""
|
183
191
|
|
184
|
-
"""网络名称"""
|
185
192
|
Name: str = ""
|
186
|
-
"""
|
193
|
+
"""网络名称"""
|
187
194
|
Id: str = ""
|
188
|
-
"""
|
195
|
+
"""网络 ID"""
|
189
196
|
Created: str = ""
|
190
|
-
"""
|
197
|
+
"""网络创建时间"""
|
191
198
|
Scope: str = ""
|
192
|
-
"""
|
199
|
+
"""网络作用范围(local/global)"""
|
193
200
|
Driver: str = ""
|
194
|
-
"""
|
201
|
+
"""网络驱动类型"""
|
195
202
|
EnableIPv6: bool = False
|
196
|
-
"""
|
203
|
+
"""是否启用 IPv6"""
|
197
204
|
Internal: bool = False
|
198
|
-
"""
|
205
|
+
"""是否为内部网络"""
|
199
206
|
Attachable: bool = False
|
200
|
-
"""
|
207
|
+
"""是否可附加"""
|
201
208
|
Ingress: bool = False
|
202
|
-
"""
|
209
|
+
"""是否为入口网络"""
|
203
210
|
IPAM: DockerNetworkItemIPAM = DockerNetworkItemIPAM()
|
204
|
-
"""
|
211
|
+
"""IPAM 配置信息"""
|
205
212
|
Options: dict[str, str] = {}
|
213
|
+
"""网络选项"""
|
214
|
+
Containers: dict[str, dict] = {}
|
206
215
|
"""连接到此网络的容器信息"""
|
207
|
-
Containers: Optional[dict[str, dict]] = {}
|