跳到主要内容

Schema

执行资源操作前,用 schemacapabilities 查看命令面。

产品

ecctl schema --list

输出形态:

{
"products": [
{"name": "ack"},
{"name": "ecs"},
{"name": "lingjun"},
{"name": "vpc"}
]
}

完整输出中包含 descriptions。

资源和动作

ecctl schema --list ecs

ECS 命令面当前包含 16 个资源,包括:

ResourceActions
instancelist, get, create, update, delete, exec, monitor, reboot, renew, sendfile, start, stop
disklist, get, create, update, delete, attach, clone, detach, monitor, reinit, reset
sglist, get, create, update, delete, authorize, revoke
imagelist, get, create, update, delete, copy, export, import

完整公开覆盖见资源覆盖

命令 Schema

简要 schema:

ecctl schema ecs.instance.create --brief

批量 schema 查询:

ecctl schema vpc.vpc.create vpc.vswitch.create ecs.sg.create

该批量命令返回以 schema 名称为 key 的 JSON object。对于 mutation 命令,schema 可包含:

  • 必填参数
  • 输出 CLI 形态
  • 风险等级
  • dry-run 支持
  • 幂等模式
  • waiter 名称、目标状态、轮询命令和超时

Capabilities

ecctl capabilities --output json

capabilities payload 声明:

  • schema version 1
  • 输出模式 jsontext
  • 结构化错误写入 stdout
  • 错误字段包括 kindcodemessageretryablesuggestionfieldaccepted_values
  • 公开产品/资源/动作覆盖

推荐流程

  1. 运行 ecctl schema --list
  2. 运行 ecctl schema --list <product>
  3. 运行 ecctl schema <product>.[<parent>.]<resource>.<action> --brief;只有嵌套资源需要包含父资源段。
  4. 需要人类可读 flag 描述时,对具体命令使用 --help
  5. 执行云操作时显式指定 --region,并使用已知 profile。