更新
中心提供的可用更新,以及安装更新的请求。
本组中的操作及其访问规则、重试规则、参数和响应。每个请求都需携带密钥:Authorization: Bearer <密钥>(参见“身份验证”)。
操作
获取更新状态
GET HEAD /api/v1/system/updates
访问: 管理员 · 重试: 可安全重试(读取)
返回主机更新程序报告的信息:已安装的版本和数据库架构(schema)、发现的最新发布(latest)、自动更新设置(automatic、hourUTC、pin、channel、statistics)、phase(idle、checking、updating、failed)、上一次 error、上次心跳和设置的 revision,以及仍在更新程序邮箱中等待的请求(pending)。没有连接主机更新程序时,snapshot 为 null。把 revision 传给 requestSystemUpdate。
响应 200
| 字段 | 类型 | 必需 | 规则 |
|---|---|---|---|
snapshot | object | 是 | 可以为 null |
snapshot.revision | integer | 是 | 0–2147483646 |
snapshot.currentVersion | string | 是 | 匹配 ^(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})$ |
snapshot.currentSchema | integer | 是 | 0–2147483647 |
snapshot.automatic | boolean | 是 | — |
snapshot.hourUTC | integer | 是 | 0–23 |
snapshot.pin | string | 是 | 匹配 ^(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})$; 可以为 null |
snapshot.heartbeatAt | string (date-time) | 是 | — |
snapshot.checkedAt | string (date-time) | 是 | 可以为 null |
snapshot.latest | object | 是 | 可以为 null |
snapshot.latest.version | string | 是 | 匹配 ^(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})$ |
snapshot.latest.schema | integer | 是 | 0–2147483647 |
snapshot.latest.sha256 | string | 是 | SHA-256:64 位小写十六进制数字 |
snapshot.phase | string | 是 | 取值之一:idle, checking, updating, failed |
snapshot.error | string | 是 | 取值之一:check_failed, update_failed, conflict, maintenance_required, recovery_required, null; 可以为 null |
snapshot.lastAttemptDay | string | 是 | 可以为 null |
snapshot.lastRequestId | string (uuid) | 是 | 可以为 null |
snapshot.statistics | boolean | 否 | — |
snapshot.channel | string | 否 | 取值之一:stable, beta |
pending | object | 是 | 取值之一:null |
pending.id | string (uuid) | 是 | — |
pending.expectedRevision | integer | 是 | 0–2147483646 |
pending.kind | string | 是 | 取值之一:check |
pending.version | string | 是 | 匹配 ^(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})$ |
pending.sha256 | string | 是 | SHA-256:64 位小写十六进制数字 |
pending.automatic | boolean | 是 | — |
pending.hourUTC | integer | 是 | 0–23 |
pending.statistics | boolean | 否 | — |
响应: 200, 400, 401, 403, 404, 409, 422, 503, 507
示例
curl -X GET "$ARKVORY_URL/api/v1/system/updates" \
-H "Authorization: Bearer $ARKVORY_TOKEN"请求更新操作
POST /api/v1/system/updates/requests
访问: 管理员 · 重试: 仅在携带预期修订版本时重试(compare-and-swap)
向主机更新程序下达一条由它执行的命令:kind 为 check 表示检查新发布版本,apply 表示安装给定的稳定版 version 及其 sha256,configure 表示设置 automatic、hourUTC 以及可选的 statistics。请将新的 UUID 作为 id 发送,并附上来自 getSystemUpdates 的 expectedRevision;409 revision_mismatch 表示设置已变化,503 busy 表示有请求正在等待或更新程序正在工作,503 unavailable 表示没有连接更新程序或其心跳已超过五分钟。响应 202 只表示请求已排队:请在 getSystemUpdates 中跟踪 phase、currentVersion 和 lastRequestId。使用相同的 id 和请求体重复请求是安全的。
请求正文 (application/json)
| 字段 | 类型 | 必需 | 规则 |
|---|---|---|---|
id | string (uuid) | 是 | — |
expectedRevision | integer | 是 | 0–2147483646 |
kind | string | 是 | 取值之一:check |
version | string | 是 | 匹配 ^(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})$ |
sha256 | string | 是 | SHA-256:64 位小写十六进制数字 |
automatic | boolean | 是 | — |
hourUTC | integer | 是 | 0–23 |
statistics | boolean | 否 | — |
响应 202
| 字段 | 类型 | 必需 | 规则 |
|---|---|---|---|
id | string (uuid) | 是 | — |
响应: 202, 400, 401, 403, 404, 405, 409, 413, 415, 422, 503, 507
示例
curl -X POST "$ARKVORY_URL/api/v1/system/updates/requests" \
-H "Authorization: Bearer $ARKVORY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"id":"00000000-0000-4000-8000-000000000000","expectedRevision":0,"kind":"check"}'