compshare-cli 0.3.2__tar.gz → 0.3.3__tar.gz
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.
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/PKG-INFO +75 -18
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/README.md +74 -17
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/pyproject.toml +1 -1
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/__init__.py +1 -1
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/actions.py +15 -7
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/api.py +0 -4
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/cli.py +100 -42
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/commands/common.py +25 -2
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/commands/image.py +104 -42
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/commands/instance.py +553 -85
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/commands/storage.py +11 -36
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/commands/team.py +19 -4
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/i18n.py +98 -6
- compshare_cli-0.3.3/src/compshare_cli/instance_templates.py +202 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/location.py +38 -21
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/output.py +4 -1
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/ssh.py +54 -9
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli.egg-info/PKG-INFO +75 -18
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli.egg-info/SOURCES.txt +2 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/tests/test_actions.py +10 -5
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/tests/test_cli.py +859 -112
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/tests/test_feedback.py +1 -0
- compshare_cli-0.3.3/tests/test_instance_templates.py +73 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/tests/test_location.py +47 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/tests/test_ssh.py +17 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/LICENSE +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/setup.cfg +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/__main__.py +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/commands/__init__.py +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/commands/ask.py +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/commands/doctor.py +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/commands/feedback.py +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/config.py +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/errors.py +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/insights.py +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/parsing.py +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/qa.py +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/runtime.py +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/sdk.py +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli/ssh_cache.py +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli.egg-info/dependency_links.txt +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli.egg-info/entry_points.txt +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli.egg-info/requires.txt +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/src/compshare_cli.egg-info/top_level.txt +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/tests/test_api.py +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/tests/test_config.py +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/tests/test_output.py +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/tests/test_parsing.py +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/tests/test_qa.py +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/tests/test_sdk.py +0 -0
- {compshare_cli-0.3.2 → compshare_cli-0.3.3}/tests/test_ssh_cache.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: compshare-cli
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: Command-line client for CompShare GPU compute
|
|
5
5
|
Author: CompShare
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -35,13 +35,14 @@ Dynamic: license-file
|
|
|
35
35
|
- 可通过 `compshare feedback` 反馈 CLI 问题和建议
|
|
36
36
|
- 基于官方 [`ucloud-sdk-python3`](https://github.com/ucloud/ucloud-sdk-python3)
|
|
37
37
|
|
|
38
|
-
当前版本:`0.3.
|
|
38
|
+
当前版本:`0.3.3`,要求 Python 3.9 或更高版本。
|
|
39
39
|
|
|
40
40
|
## 安装
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
43
|
pip install compshare-cli
|
|
44
44
|
compshare -h
|
|
45
|
+
compshare --version
|
|
45
46
|
```
|
|
46
47
|
|
|
47
48
|
本地开发:
|
|
@@ -101,6 +102,11 @@ compshare instance search --region cn-sh2 --zone cn-sh2-02 \
|
|
|
101
102
|
--gpu 4090 --image IMAGE_ID --available
|
|
102
103
|
compshare instance list --all
|
|
103
104
|
|
|
105
|
+
# 聚焦查看实例信息;多个分组可组合
|
|
106
|
+
compshare instance show INSTANCE_ID --ip --softwares
|
|
107
|
+
compshare instance show INSTANCE_ID --spec --disks --billing
|
|
108
|
+
compshare instance show INSTANCE_ID --image --status
|
|
109
|
+
|
|
104
110
|
# 交互式创建
|
|
105
111
|
compshare instance create
|
|
106
112
|
|
|
@@ -121,9 +127,10 @@ compshare --json instance ssh INSTANCE_ID -- nvidia-smi
|
|
|
121
127
|
# 强制刷新或禁用本地 SSH 连接缓存
|
|
122
128
|
compshare instance ssh INSTANCE_ID --refresh
|
|
123
129
|
compshare instance ssh INSTANCE_ID --no-cache
|
|
124
|
-
#
|
|
125
|
-
compshare instance
|
|
126
|
-
compshare instance
|
|
130
|
+
# 在本地与实例间双向复制;实例路径以 : 开头,目录会自动递归复制
|
|
131
|
+
compshare instance cp INSTANCE_ID ./model.bin :/workspace/model.bin
|
|
132
|
+
compshare instance cp INSTANCE_ID ./dataset :/workspace/dataset
|
|
133
|
+
compshare instance cp INSTANCE_ID :/workspace/result ./result
|
|
127
134
|
|
|
128
135
|
# 产品问答
|
|
129
136
|
compshare ask "按量实例关机以后,云硬盘还收费吗?"
|
|
@@ -148,16 +155,44 @@ compshare instance create \
|
|
|
148
155
|
|
|
149
156
|
使用 `--dry-run` 只检查库存、价格和请求,不创建资源。
|
|
150
157
|
|
|
158
|
+
本地实例模板可以保存常用创建参数,不依赖控制台或后端模板接口:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
compshare instance template create training-4090 \
|
|
162
|
+
--description '4090 训练环境' \
|
|
163
|
+
--gpu 4090 \
|
|
164
|
+
--count 1 \
|
|
165
|
+
--cpu 16 \
|
|
166
|
+
--memory 64GiB \
|
|
167
|
+
--image IMAGE_ID \
|
|
168
|
+
--region cn-sh2 \
|
|
169
|
+
--zone cn-sh2-02 \
|
|
170
|
+
--disk 100GiB \
|
|
171
|
+
--charge Postpay
|
|
172
|
+
|
|
173
|
+
compshare instance template list
|
|
174
|
+
compshare instance template show training-4090
|
|
175
|
+
compshare instance create --template training-4090 --yes
|
|
176
|
+
|
|
177
|
+
# 本次显式参数优先于模板值
|
|
178
|
+
compshare instance create --template training-4090 --cpu 32 --memory 128GiB --yes
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
模板存放在 `~/.config/compshare/instance-templates.json`;可用
|
|
182
|
+
`compshare instance template path` 查看实际路径。模板只保存实例创建参数,不保存 API
|
|
183
|
+
凭证、`--yes`、`--show-sensitive` 或其他执行控制选项。
|
|
184
|
+
|
|
151
185
|
## 功能入口
|
|
152
186
|
|
|
153
187
|
```text
|
|
188
|
+
compshare config API 凭证配置
|
|
189
|
+
compshare feedback 反馈 CLI 问题或建议
|
|
190
|
+
compshare doctor 配置、鉴权、网络与 SSH 环境诊断
|
|
191
|
+
compshare ask 产品使用和计费问答
|
|
154
192
|
compshare instance GPU 实例、规格、库存、价格和生命周期
|
|
155
193
|
compshare image 平台、自定义、社区及共享镜像
|
|
156
194
|
compshare storage 云盘和 US3 挂载
|
|
157
195
|
compshare team 团队、邀请、成员额度、账单和审计
|
|
158
|
-
compshare doctor 配置、鉴权、网络与 SSH 环境诊断
|
|
159
|
-
compshare ask 产品使用和计费问答
|
|
160
|
-
compshare feedback 反馈 CLI 问题或建议
|
|
161
196
|
```
|
|
162
197
|
|
|
163
198
|
## 产品问答
|
|
@@ -191,45 +226,63 @@ compshare instance -h
|
|
|
191
226
|
compshare instance create -h
|
|
192
227
|
```
|
|
193
228
|
|
|
229
|
+
## 命令补全
|
|
230
|
+
|
|
231
|
+
CLI 支持 Bash、Zsh、Fish 和 PowerShell 命令补全。为当前 Shell 自动安装:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
compshare --install-completion
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
如需检查、复制或自行加载补全脚本:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
compshare --show-completion
|
|
241
|
+
```
|
|
242
|
+
|
|
194
243
|
## 脚本调用
|
|
195
244
|
|
|
196
245
|
`--json`、`--profile` 和 `--show-sensitive` 是全局选项,必须放在子命令前:
|
|
197
246
|
|
|
198
247
|
```bash
|
|
199
248
|
compshare --json instance list --status Running --all
|
|
200
|
-
compshare --profile production image list --source community
|
|
249
|
+
compshare --profile production image list --source community
|
|
201
250
|
compshare --json --show-sensitive instance show uhost-xxxxxxxx
|
|
202
251
|
```
|
|
203
252
|
|
|
204
253
|
JSON 模式不会启动交互向导。生命周期操作可使用 `--wait`、`--no-wait` 和
|
|
205
254
|
`--timeout` 控制等待行为;部分批量操作失败时,CLI 返回非零退出码。默认输出会递归隐藏
|
|
206
255
|
密码、IP、访问 URL 和登录命令;只有显式指定 `--show-sensitive` 才会输出原值。
|
|
256
|
+
`instance show` 可使用 `--ip`、`--softwares`、`--spec`、`--disks`、`--billing`、
|
|
257
|
+
`--image` 和 `--status` 聚焦输出一个或多个信息分组;不传这些选项时保持完整摘要。
|
|
207
258
|
|
|
208
259
|
Region 和 Zone 是资源参数,放在对应子命令后:
|
|
209
260
|
|
|
210
261
|
```bash
|
|
211
|
-
compshare instance list --region cn-sh2
|
|
262
|
+
compshare instance list --region cn-sh2 --zone cn-sh2-02
|
|
212
263
|
compshare instance create --region cn-sh2 --zone cn-sh2-02
|
|
213
|
-
compshare image list --source custom
|
|
264
|
+
compshare image list --source custom
|
|
265
|
+
compshare storage disk list
|
|
214
266
|
```
|
|
215
267
|
|
|
216
|
-
|
|
268
|
+
镜像列表、网络检测和软件端口列表可进行全局查询,Region/Zone 只是可选过滤条件。CLI
|
|
269
|
+
不保存或自动注入默认 Region/Zone;确实依赖地域的资源操作仍需显式传入。按实例 ID
|
|
217
270
|
执行的生命周期操作使用 `DescribeCompShareInstance` 响应中的 Region 和 Zone;响应缺少任一
|
|
218
271
|
字段时会停止操作,不会从 Zone 推导或用请求 Region 补齐。
|
|
219
272
|
|
|
220
273
|
## 语言
|
|
221
274
|
|
|
222
275
|
```bash
|
|
223
|
-
compshare lang en
|
|
224
|
-
compshare lang zh
|
|
225
|
-
compshare lang # 查看当前语言
|
|
276
|
+
compshare --lang en --help
|
|
277
|
+
compshare --lang zh --help
|
|
226
278
|
```
|
|
227
279
|
|
|
228
|
-
|
|
280
|
+
`--lang` 会保存所选语言,后续命令继续使用;也可以通过 `COMPSHARE_LANG=en` 临时覆盖。
|
|
229
281
|
|
|
230
282
|
## 安全说明
|
|
231
283
|
|
|
232
284
|
- 配置目录和文件分别使用 `0700`、`0600` 权限。
|
|
285
|
+
- 本地实例模板文件同样使用 `0600` 权限,所在目录使用 `0700` 权限。
|
|
233
286
|
- API 私钥不会出现在命令输出中。
|
|
234
287
|
- 默认使用 `***` 隐藏密码、私钥、IP、访问 URL、令牌和登录命令,包括嵌套 JSON 字段。
|
|
235
288
|
- `instance ssh` 在支持的交互式终端中通过伪终端自动填写登录密码,不会打印密码或将其放入进程参数。
|
|
@@ -239,9 +292,13 @@ compshare lang # 查看当前语言
|
|
|
239
292
|
- `--json` 始终以 UTF-8 字节输出,不依赖 Windows 活动代码页或终端编码。
|
|
240
293
|
- `instance ssh` 默认将 API 返回的 SSH 命令和密码按 profile/实例缓存 1 小时;Windows 使用当前用户的 DPAPI 加密密码,其他平台将缓存文件权限限制为当前用户。可用 `--refresh` 强制更新、`--no-cache` 禁用;重置密码和重装实例会清除对应缓存。
|
|
241
294
|
- 实例创建是异步操作;`instance create` 默认等待到 `Running`,显式使用 `--no-wait` 才会在创建接口返回后立即退出。`instance ssh` 也会默认等待实例运行后再连接。
|
|
242
|
-
- `instance
|
|
295
|
+
- `instance cp INSTANCE_ID SOURCE DESTINATION` 可自动认证并双向复制文件或目录;实例侧路径
|
|
296
|
+
使用 `:/path` 表示。旧的 `instance scp INSTANCE_ID LOCAL_PATH REMOTE_PATH` 上传语法继续兼容。
|
|
297
|
+
- `--json instance cp ...` 会真实执行复制,并返回 `ok`、`phase`、`exit_code`、
|
|
298
|
+
`stdout`、`stderr` 和 `error`;只有显式使用 `--print` 才仅输出命令。
|
|
243
299
|
- `--show-sensitive` 会恢复这些字段的原始值;请勿在共享终端、CI 日志或 Agent 会话中使用。
|
|
244
|
-
-
|
|
300
|
+
- 删除、关机、重启、重装和改配等操作默认要求输入 `y` 或 `n` 确认;空输入或无效输入
|
|
301
|
+
最多重试三次。JSON 模式不启动确认提示,执行这类操作必须显式使用 `--yes`。
|
|
245
302
|
|
|
246
303
|
## 开发校验
|
|
247
304
|
|
|
@@ -10,13 +10,14 @@
|
|
|
10
10
|
- 可通过 `compshare feedback` 反馈 CLI 问题和建议
|
|
11
11
|
- 基于官方 [`ucloud-sdk-python3`](https://github.com/ucloud/ucloud-sdk-python3)
|
|
12
12
|
|
|
13
|
-
当前版本:`0.3.
|
|
13
|
+
当前版本:`0.3.3`,要求 Python 3.9 或更高版本。
|
|
14
14
|
|
|
15
15
|
## 安装
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
pip install compshare-cli
|
|
19
19
|
compshare -h
|
|
20
|
+
compshare --version
|
|
20
21
|
```
|
|
21
22
|
|
|
22
23
|
本地开发:
|
|
@@ -76,6 +77,11 @@ compshare instance search --region cn-sh2 --zone cn-sh2-02 \
|
|
|
76
77
|
--gpu 4090 --image IMAGE_ID --available
|
|
77
78
|
compshare instance list --all
|
|
78
79
|
|
|
80
|
+
# 聚焦查看实例信息;多个分组可组合
|
|
81
|
+
compshare instance show INSTANCE_ID --ip --softwares
|
|
82
|
+
compshare instance show INSTANCE_ID --spec --disks --billing
|
|
83
|
+
compshare instance show INSTANCE_ID --image --status
|
|
84
|
+
|
|
79
85
|
# 交互式创建
|
|
80
86
|
compshare instance create
|
|
81
87
|
|
|
@@ -96,9 +102,10 @@ compshare --json instance ssh INSTANCE_ID -- nvidia-smi
|
|
|
96
102
|
# 强制刷新或禁用本地 SSH 连接缓存
|
|
97
103
|
compshare instance ssh INSTANCE_ID --refresh
|
|
98
104
|
compshare instance ssh INSTANCE_ID --no-cache
|
|
99
|
-
#
|
|
100
|
-
compshare instance
|
|
101
|
-
compshare instance
|
|
105
|
+
# 在本地与实例间双向复制;实例路径以 : 开头,目录会自动递归复制
|
|
106
|
+
compshare instance cp INSTANCE_ID ./model.bin :/workspace/model.bin
|
|
107
|
+
compshare instance cp INSTANCE_ID ./dataset :/workspace/dataset
|
|
108
|
+
compshare instance cp INSTANCE_ID :/workspace/result ./result
|
|
102
109
|
|
|
103
110
|
# 产品问答
|
|
104
111
|
compshare ask "按量实例关机以后,云硬盘还收费吗?"
|
|
@@ -123,16 +130,44 @@ compshare instance create \
|
|
|
123
130
|
|
|
124
131
|
使用 `--dry-run` 只检查库存、价格和请求,不创建资源。
|
|
125
132
|
|
|
133
|
+
本地实例模板可以保存常用创建参数,不依赖控制台或后端模板接口:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
compshare instance template create training-4090 \
|
|
137
|
+
--description '4090 训练环境' \
|
|
138
|
+
--gpu 4090 \
|
|
139
|
+
--count 1 \
|
|
140
|
+
--cpu 16 \
|
|
141
|
+
--memory 64GiB \
|
|
142
|
+
--image IMAGE_ID \
|
|
143
|
+
--region cn-sh2 \
|
|
144
|
+
--zone cn-sh2-02 \
|
|
145
|
+
--disk 100GiB \
|
|
146
|
+
--charge Postpay
|
|
147
|
+
|
|
148
|
+
compshare instance template list
|
|
149
|
+
compshare instance template show training-4090
|
|
150
|
+
compshare instance create --template training-4090 --yes
|
|
151
|
+
|
|
152
|
+
# 本次显式参数优先于模板值
|
|
153
|
+
compshare instance create --template training-4090 --cpu 32 --memory 128GiB --yes
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
模板存放在 `~/.config/compshare/instance-templates.json`;可用
|
|
157
|
+
`compshare instance template path` 查看实际路径。模板只保存实例创建参数,不保存 API
|
|
158
|
+
凭证、`--yes`、`--show-sensitive` 或其他执行控制选项。
|
|
159
|
+
|
|
126
160
|
## 功能入口
|
|
127
161
|
|
|
128
162
|
```text
|
|
163
|
+
compshare config API 凭证配置
|
|
164
|
+
compshare feedback 反馈 CLI 问题或建议
|
|
165
|
+
compshare doctor 配置、鉴权、网络与 SSH 环境诊断
|
|
166
|
+
compshare ask 产品使用和计费问答
|
|
129
167
|
compshare instance GPU 实例、规格、库存、价格和生命周期
|
|
130
168
|
compshare image 平台、自定义、社区及共享镜像
|
|
131
169
|
compshare storage 云盘和 US3 挂载
|
|
132
170
|
compshare team 团队、邀请、成员额度、账单和审计
|
|
133
|
-
compshare doctor 配置、鉴权、网络与 SSH 环境诊断
|
|
134
|
-
compshare ask 产品使用和计费问答
|
|
135
|
-
compshare feedback 反馈 CLI 问题或建议
|
|
136
171
|
```
|
|
137
172
|
|
|
138
173
|
## 产品问答
|
|
@@ -166,45 +201,63 @@ compshare instance -h
|
|
|
166
201
|
compshare instance create -h
|
|
167
202
|
```
|
|
168
203
|
|
|
204
|
+
## 命令补全
|
|
205
|
+
|
|
206
|
+
CLI 支持 Bash、Zsh、Fish 和 PowerShell 命令补全。为当前 Shell 自动安装:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
compshare --install-completion
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
如需检查、复制或自行加载补全脚本:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
compshare --show-completion
|
|
216
|
+
```
|
|
217
|
+
|
|
169
218
|
## 脚本调用
|
|
170
219
|
|
|
171
220
|
`--json`、`--profile` 和 `--show-sensitive` 是全局选项,必须放在子命令前:
|
|
172
221
|
|
|
173
222
|
```bash
|
|
174
223
|
compshare --json instance list --status Running --all
|
|
175
|
-
compshare --profile production image list --source community
|
|
224
|
+
compshare --profile production image list --source community
|
|
176
225
|
compshare --json --show-sensitive instance show uhost-xxxxxxxx
|
|
177
226
|
```
|
|
178
227
|
|
|
179
228
|
JSON 模式不会启动交互向导。生命周期操作可使用 `--wait`、`--no-wait` 和
|
|
180
229
|
`--timeout` 控制等待行为;部分批量操作失败时,CLI 返回非零退出码。默认输出会递归隐藏
|
|
181
230
|
密码、IP、访问 URL 和登录命令;只有显式指定 `--show-sensitive` 才会输出原值。
|
|
231
|
+
`instance show` 可使用 `--ip`、`--softwares`、`--spec`、`--disks`、`--billing`、
|
|
232
|
+
`--image` 和 `--status` 聚焦输出一个或多个信息分组;不传这些选项时保持完整摘要。
|
|
182
233
|
|
|
183
234
|
Region 和 Zone 是资源参数,放在对应子命令后:
|
|
184
235
|
|
|
185
236
|
```bash
|
|
186
|
-
compshare instance list --region cn-sh2
|
|
237
|
+
compshare instance list --region cn-sh2 --zone cn-sh2-02
|
|
187
238
|
compshare instance create --region cn-sh2 --zone cn-sh2-02
|
|
188
|
-
compshare image list --source custom
|
|
239
|
+
compshare image list --source custom
|
|
240
|
+
compshare storage disk list
|
|
189
241
|
```
|
|
190
242
|
|
|
191
|
-
|
|
243
|
+
镜像列表、网络检测和软件端口列表可进行全局查询,Region/Zone 只是可选过滤条件。CLI
|
|
244
|
+
不保存或自动注入默认 Region/Zone;确实依赖地域的资源操作仍需显式传入。按实例 ID
|
|
192
245
|
执行的生命周期操作使用 `DescribeCompShareInstance` 响应中的 Region 和 Zone;响应缺少任一
|
|
193
246
|
字段时会停止操作,不会从 Zone 推导或用请求 Region 补齐。
|
|
194
247
|
|
|
195
248
|
## 语言
|
|
196
249
|
|
|
197
250
|
```bash
|
|
198
|
-
compshare lang en
|
|
199
|
-
compshare lang zh
|
|
200
|
-
compshare lang # 查看当前语言
|
|
251
|
+
compshare --lang en --help
|
|
252
|
+
compshare --lang zh --help
|
|
201
253
|
```
|
|
202
254
|
|
|
203
|
-
|
|
255
|
+
`--lang` 会保存所选语言,后续命令继续使用;也可以通过 `COMPSHARE_LANG=en` 临时覆盖。
|
|
204
256
|
|
|
205
257
|
## 安全说明
|
|
206
258
|
|
|
207
259
|
- 配置目录和文件分别使用 `0700`、`0600` 权限。
|
|
260
|
+
- 本地实例模板文件同样使用 `0600` 权限,所在目录使用 `0700` 权限。
|
|
208
261
|
- API 私钥不会出现在命令输出中。
|
|
209
262
|
- 默认使用 `***` 隐藏密码、私钥、IP、访问 URL、令牌和登录命令,包括嵌套 JSON 字段。
|
|
210
263
|
- `instance ssh` 在支持的交互式终端中通过伪终端自动填写登录密码,不会打印密码或将其放入进程参数。
|
|
@@ -214,9 +267,13 @@ compshare lang # 查看当前语言
|
|
|
214
267
|
- `--json` 始终以 UTF-8 字节输出,不依赖 Windows 活动代码页或终端编码。
|
|
215
268
|
- `instance ssh` 默认将 API 返回的 SSH 命令和密码按 profile/实例缓存 1 小时;Windows 使用当前用户的 DPAPI 加密密码,其他平台将缓存文件权限限制为当前用户。可用 `--refresh` 强制更新、`--no-cache` 禁用;重置密码和重装实例会清除对应缓存。
|
|
216
269
|
- 实例创建是异步操作;`instance create` 默认等待到 `Running`,显式使用 `--no-wait` 才会在创建接口返回后立即退出。`instance ssh` 也会默认等待实例运行后再连接。
|
|
217
|
-
- `instance
|
|
270
|
+
- `instance cp INSTANCE_ID SOURCE DESTINATION` 可自动认证并双向复制文件或目录;实例侧路径
|
|
271
|
+
使用 `:/path` 表示。旧的 `instance scp INSTANCE_ID LOCAL_PATH REMOTE_PATH` 上传语法继续兼容。
|
|
272
|
+
- `--json instance cp ...` 会真实执行复制,并返回 `ok`、`phase`、`exit_code`、
|
|
273
|
+
`stdout`、`stderr` 和 `error`;只有显式使用 `--print` 才仅输出命令。
|
|
218
274
|
- `--show-sensitive` 会恢复这些字段的原始值;请勿在共享终端、CI 日志或 Agent 会话中使用。
|
|
219
|
-
-
|
|
275
|
+
- 删除、关机、重启、重装和改配等操作默认要求输入 `y` 或 `n` 确认;空输入或无效输入
|
|
276
|
+
最多重试三次。JSON 模式不启动确认提示,执行这类操作必须显式使用 `--yes`。
|
|
220
277
|
|
|
221
278
|
## 开发校验
|
|
222
279
|
|
|
@@ -34,8 +34,9 @@ INSTANCE_ACTIONS = frozenset(
|
|
|
34
34
|
|
|
35
35
|
IMAGE_ACTIONS = frozenset(
|
|
36
36
|
{
|
|
37
|
-
"
|
|
37
|
+
"CreateCompShareImageFavorite",
|
|
38
38
|
"CreateCompShareCustomImage",
|
|
39
|
+
"DeleteCompShareImageFavorite",
|
|
39
40
|
"DescribeCommunityImages",
|
|
40
41
|
"DescribeCompShareCustomImages",
|
|
41
42
|
"DescribeCompShareImages",
|
|
@@ -47,7 +48,6 @@ IMAGE_ACTIONS = frozenset(
|
|
|
47
48
|
"GetCompShareImageCreateProgress",
|
|
48
49
|
"ModifyCompShareImageShareAccount",
|
|
49
50
|
"PublishCompShareImage",
|
|
50
|
-
"RemoveFavoriteImage",
|
|
51
51
|
"TerminateCompShareCustomImage",
|
|
52
52
|
"UpdateCompShareImage",
|
|
53
53
|
}
|
|
@@ -59,6 +59,7 @@ STORAGE_ACTIONS = frozenset(
|
|
|
59
59
|
"AttachUS3",
|
|
60
60
|
"CreateAndAttachCompshareDisk",
|
|
61
61
|
"DeleteCompshareDisk",
|
|
62
|
+
"DescribeCompshareDisk",
|
|
62
63
|
"DetachCompshareDisk",
|
|
63
64
|
"GetCompShareAttachedDiskUpgradePrice",
|
|
64
65
|
"ResizeCompShareDisk",
|
|
@@ -89,9 +90,16 @@ TEAM_ACTIONS = frozenset(
|
|
|
89
90
|
|
|
90
91
|
PUBLIC_ACTIONS = INSTANCE_ACTIONS | IMAGE_ACTIONS | STORAGE_ACTIONS | TEAM_ACTIONS
|
|
91
92
|
|
|
92
|
-
#
|
|
93
|
-
|
|
94
|
-
COMING_SOON_ACTIONS = frozenset({"GetCompShareInstanceMonitor"})
|
|
93
|
+
# No unavailable API actions are currently exposed as placeholders.
|
|
94
|
+
COMING_SOON_ACTIONS = frozenset()
|
|
95
95
|
|
|
96
|
-
# Documented publicly but unavailable in the production API
|
|
97
|
-
UNAVAILABLE_ACTIONS = frozenset(
|
|
96
|
+
# Documented publicly but unavailable in the production API.
|
|
97
|
+
UNAVAILABLE_ACTIONS = frozenset(
|
|
98
|
+
{
|
|
99
|
+
"AddFavoriteImage",
|
|
100
|
+
"DescribeFavoriteImages",
|
|
101
|
+
"GetCompShareInstanceMonitor",
|
|
102
|
+
"GetSoftwareURL",
|
|
103
|
+
"RemoveFavoriteImage",
|
|
104
|
+
}
|
|
105
|
+
)
|
|
@@ -228,10 +228,6 @@ def error_hint(action: str, code: int) -> Optional[str]:
|
|
|
228
228
|
("GetCompShareInstanceMonitor", 230): (
|
|
229
229
|
"This production endpoint is currently incompatible; use the console for monitoring."
|
|
230
230
|
),
|
|
231
|
-
("GetSoftwareURL", 230): (
|
|
232
|
-
"This production endpoint currently rejects its action; "
|
|
233
|
-
"use instance show or the console."
|
|
234
|
-
),
|
|
235
231
|
}
|
|
236
232
|
return tr(hints[(action, code)]) if (action, code) in hints else None
|
|
237
233
|
|