事件网格 EG-事件:事件示例

时间:2023-11-09 10:32:06

事件示例

事件源发布到事件网格的事件示例如下:

{
    "events":[{
	"id": "4b26115b-778e-11ec-833e-cf74******",
        "specversion": "1.0",
	"source": "HC.OBS",
	"type": "object:put",
	"datacontenttype": "application/json",
	"subject": "xxx.jpg",
	"time": "2022-01-17T12:07:48.955Z",
	"data": {
		"name": "test01",
		"state": "enable"
	}
    }]
}

示例中涉及的参数说明如表1所示。

表1 事件参数说明

参数

类型

是否必选

示例值

说明

id

String

4b26115b-778e-*******-833e-cf74af

事件ID。标识事件的唯一值。

specversion

String

1.0

CloudEvents协议版本。

source

String

HC.OBS

事件源。标明事件的来源。

type

String

object:put

事件类型。标明与事件源相关的事件类型。

datacontenttype

String

application/json

参数“data”的内容格式。

目前只支持application/json格式。

subject

String

xxx.jpg

事件主题。标明事件具体的主题形式。

time

Timestamp

2022-01-17T12:07:48.955Z

事件产生的时间。

data

Struct

{
    "name": "test01",
    "state": "enable"
}

事件内容。JSON对象格式。

support.huaweicloud.com/usermanual-eg/eg-ug-015.html