事件
游标之后的安装事件流,以及事件类型列表。
本组中的操作及其访问规则、重试规则、参数和响应。每个请求都需携带密钥:Authorization: Bearer <密钥>(参见“身份验证”)。
操作
读取安装的事件
GET HEAD /api/v1/events
访问: 任何有效的密钥或会话 · 重试: 可安全重试(读取)
按从旧到新的顺序,以 CloudEvents 1.0 格式返回游标 after 之后的最多 limit 个事件(1–500,默认 100):调用方可列出(artifact.list)的每个仓库中的发布、删除、文件修订、包注册、注解、附件、阶段、晋级,以及镜像、npm 和 Git LFS 的变更。不传 after 时,从保留的最早事件开始。要继续读取,请将 next 作为 after 传入:它也会越过调用方无权看到的事件,每个请求最多 5000 个。types 保留指定的类型或 artifact.* 这样的前缀,repository 只保留一个仓库。早于 oldest 的游标返回 410 events_cursor_expired;属于另一个 epoch 的游标(服务器已从备份恢复)返回 409 events_epoch_changed;两者都在 events 中带有当前的 epoch、oldest 和 head。请按 id 去重;事件只是提示,当前状态请通过常规路由读取。
参数
| 名称 | 位置 | 类型 | 必需 | 规则 |
|---|---|---|---|---|
after | 查询 | string | 否 | 匹配 ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}:(0|[1-9][0-9]{0,18})$; Event id or next of a page; without it the feed starts at oldest |
limit | 查询 | integer | 否 | 1–500 |
types | 查询 | string | 否 | 最多 2048 个字符; Comma-separated names or prefixes such as artifact.* |
repository | 查询 | string | 否 | 匹配 ^[a-z0-9][a-z0-9_-]{0,63}$ |
响应 200
| 字段 | 类型 | 必需 | 规则 |
|---|---|---|---|
epoch | string (uuid) | 是 | — |
items | 数组(object) | 是 | 最多 500 项 |
items[].specversion | string | 是 | 取值之一:1.0 |
items[].id | string | 是 | 匹配 ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}:(0|[1-9][0-9]{0,18})$; 事件 ID,<epoch>:<position>;按它去重 |
items[].source | string | 是 | — |
items[].type | string | 是 | — |
items[].subject | string | 是 | 制品 ID,文件事件则为路径 |
items[].time | string (date-time) | 是 | — |
items[].datacontenttype | string | 是 | 取值之一:application/json |
items[].dataschema | string | 是 | — |
items[].partitionkey | string | 是 | repository:<repository>;同一分区的事件保持提交顺序 |
items[].arkvoryposition | string | 是 | 用十进制数字表示的整数,以字符串形式发送 |
items[].arkvoryepoch | string (uuid) | 是 | — |
items[].data | object | 是 | 该类型的数据;其 JSON Schema 见类型列表 |
next | string | 是 | 匹配 ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}:(0|[1-9][0-9]{0,18})$ |
head | string | 是 | 用十进制数字表示的整数,以字符串形式发送 |
oldest | string | 是 | 用十进制数字表示的整数,以字符串形式发送 |
响应: 200, 400, 401, 403, 404, 409, 410, 422, 503, 507
示例
curl -X GET "$ARKVORY_URL/api/v1/events" \
-H "Authorization: Bearer $ARKVORY_TOKEN"列出事件类型
GET HEAD /api/v1/events/types
访问: 任何有效的密钥或会话 · 重试: 可安全重试(读取)
返回此服务器写入的每种事件类型:名称、schemaVersion、范围、读取者所需的权限、保持其顺序的分区,以及 data 的 JSON Schema。CloudEvents 的 type 为 arkvory.<name>.v<schemaVersion>。
响应 200
| 字段 | 类型 | 必需 | 规则 |
|---|---|---|---|
items | 数组(object) | 是 | — |
items[].name | string | 是 | — |
items[].schemaVersion | integer | 是 | 不小于 1 |
items[].scope | string | 是 | 取值之一:repository, system |
items[].permission | string | 是 | 取值之一:artifact.list, administrator |
items[].partition | string | 是 | — |
items[].description | string | 是 | — |
items[].dataSchema | object | 否 | — |
响应: 200, 400, 401, 403, 404, 409, 422, 503, 507
示例
curl -X GET "$ARKVORY_URL/api/v1/events/types" \
-H "Authorization: Bearer $ARKVORY_TOKEN"