Observação
O acesso a essa página exige autorização. Você pode tentar entrar ou alterar diretórios.
O acesso a essa página exige autorização. Você pode tentar alterar os diretórios.
本文提供了容器注册表事件的属性和架构。 有关事件架构的简介,请参阅Azure 事件网格事件架构。
可用事件类型
Azure 容器注册表发出以下事件类型:
| 事件类型 | 说明 |
|---|---|
| Microsoft。ContainerRegistry.ImagePushed | 推送映像时引发。 |
| Microsoft。ContainerRegistry.ImageDeleted | 删除映像时引发。 |
| Microsoft。ContainerRegistry.ChartPushed | 推送 Helm 图表时引发。 |
| Microsoft。ContainerRegistry.ChartDeleted | 删除 Helm 图表时引发。 |
示例事件
以下示例显示了映像推送事件的架构:
[{
"id": "831e1650-001e-001b-66ab-eeb76e069631",
"source": "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.ContainerRegistry/registries/<name>",
"subject": "aci-helloworld:v1",
"type": "Microsoft.ContainerRegistry.ImagePushed",
"time": "2018-04-25T21:39:47.6549614Z",
"data": {
"id": "31c51664-e5bd-416a-a5df-e5206bc47ed0",
"timestamp": "2018-04-25T21:39:47.276585742Z",
"action": "push",
"target": {
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 3023,
"digest": "sha256:213bbc182920ab41e18edc2001e06abcca6735d87782d9cef68abd83941cf0e5",
"length": 3023,
"repository": "aci-helloworld",
"tag": "v1"
},
"request": {
"id": "7c66f28b-de19-40a4-821c-6f5f6c0003a4",
"host": "demo.azurecr.io",
"method": "PUT",
"useragent": "docker/18.03.0-ce go/go1.9.4 git-commit/0520e24 os/windows arch/amd64 UpstreamClient(Docker-Client/18.03.0-ce \\\\(windows\\\\))"
}
},
"specversion": "1.0"
}]
映像删除事件的架构与此类似:
[{
"id": "f06e3921-301f-42ec-b368-212f7d5354bd",
"source": "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.ContainerRegistry/registries/<name>",
"subject": "aci-helloworld",
"type": "Microsoft.ContainerRegistry.ImageDeleted",
"time": "2018-04-26T17:56:01.8211268Z",
"data": {
"id": "f06e3921-301f-42ec-b368-212f7d5354bd",
"timestamp": "2018-04-26T17:56:00.996603117Z",
"action": "delete",
"target": {
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"digest": "sha256:213bbc182920ab41e18edc2001e06abcca6735d87782d9cef68abd83941cf0e5",
"repository": "aci-helloworld"
},
"request": {
"id": "aeda5b99-4197-409f-b8a8-ff539edb7de2",
"host": "demo.azurecr.io",
"method": "DELETE",
"useragent": "python-requests/2.18.4"
}
},
"specversion": "1.0"
}]
图表推送事件的架构类似于映像推送事件的架构,但不包括请求对象:
[{
"id": "ea3a9c28-5b17-40f6-a500-3f02b6829277",
"source": "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.ContainerRegistry/registries/<name>",
"subject": "mychart:1.0.0",
"type": "Microsoft.ContainerRegistry.ChartPushed",
"time": "2019-03-12T22:16:31.5164086Z",
"data": {
"id":"ea3a9c28-5b17-40f6-a500-3f02b682927",
"timestamp":"2019-03-12T22:16:31.0087496+00:00",
"action":"chart_push",
"target":{
"mediaType":"application/vnd.acr.helm.chart",
"size":25265,
"digest":"sha256:7f060075264b5ba7c14c23672698152ae6a3ebac1c47916e4efe19cd624d5fab",
"repository":"repo",
"tag":"mychart-1.0.0.tgz",
"name":"mychart",
"version":"1.0.0"
}
},
"specversion": "1.0"
}]
图表删除事件的架构类似于映像删除事件的架构,但不包括请求对象:
[{
"id": "39136b3a-1a7e-416f-a09e-5c85d5402fca",
"source": "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.ContainerRegistry/registries/<name>",
"subject": "mychart:1.0.0",
"type": "Microsoft.ContainerRegistry.ChartDeleted",
"time": "019-03-12T22:42:08.7034064Z",
"data": {
"id":"ea3a9c28-5b17-40f6-a500-3f02b682927",
"timestamp":"2019-03-12T22:42:08.3783775+00:00",
"action":"chart_delete",
"target":{
"mediaType":"application/vnd.acr.helm.chart",
"size":25265,
"digest":"sha256:7f060075264b5ba7c14c23672698152ae6a3ebac1c47916e4efe19cd624d5fab",
"repository":"repo",
"tag":"mychart-1.0.0.tgz",
"name":"mychart",
"version":"1.0.0"
}
},
"specversion": "1.0"
}]
事件属性
事件具有以下顶层数据:
| 财产 | 类型 | 说明 |
|---|---|---|
source |
字符串 | 事件源的完整资源路径。 此字段不可写入。 事件网格提供此值。 |
subject |
字符串 | Publisher定义的事件主题路径。 |
type |
字符串 | 该事件源的其中一种注册事件类型。 |
time |
字符串 | 事件生成的时间是基于提供者的 UTC 时间。 |
id |
字符串 | 事件的唯一标识符。 |
data |
对象 | Blob 存储事件数据。 |
specversion |
字符串 | CloudEvents 架构规范版本。 |
数据对象具有以下属性:
| 财产 | 类型 | 说明 |
|---|---|---|
id |
字符串 | 事件识别码 |
timestamp |
字符串 | 事件发生的时间。 |
action |
字符串 | 包含提供事件的作。 |
target |
对象 | 事件的目标。 |
request |
对象 | 生成事件的请求。 |
目标对象具有以下属性:
| 财产 | 类型 | 说明 |
|---|---|---|
mediaType |
字符串 | 被引用对象的 MIME 类型。 |
size |
整数 | 内容的字节数。 与 Length 字段相同。 |
digest |
字符串 | 注册表 V2 HTTP API 规范定义的内容的摘要。 |
length |
整数 | 内容的字节数。 与“大小”字段相同。 |
repository |
字符串 | 存储库名称。 |
tag |
字符串 | 标记名称。 |
name |
字符串 | 图表名称。 |
version |
字符串 | 图表版本。 |
请求对象具有以下属性:
| 财产 | 类型 | 说明 |
|---|---|---|
id |
字符串 | 启动事件的请求的 ID。 |
addr |
字符串 | 发起事件的客户端连接的 IP 或主机名和可能端口。 此值是标准 http 请求中的 RemoteAddr。 |
host |
字符串 | 注册表实例的外部可访问主机名,由传入请求上的 http 主机标头指定。 |
method |
字符串 | 生成事件的请求方法。 |
useragent |
字符串 | 请求的用户代理标头。 |
connectedRegistry 对象具有以下属性:
| 财产 | 类型 | 说明 |
|---|---|---|
name |
字符串 | 生成此事件的连接注册表的名称。 |
后续步骤
- 有关Azure 事件网格简介,请参阅 什么是事件网格?
- 有关创建Azure 事件网格订阅的详细信息,请参阅 Event Grid 订阅架构。