事件网格 EG-过滤规则示例:除外匹配

时间:2023-11-01 16:19:48

除外匹配

指定某个String类型字段与除了提供的值之外的任何值进行匹配。如下表所示,过滤规则只匹配“type”不是“object:get”的事件。

从事件源接收的事件

过滤规则

过滤后的事件

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

指定某个Number类型字段与除了提供的值之外的任何值进行匹配。如下表所示,过滤规则只匹配“data”下“age”不是“11”的事件。

从事件源接收的事件

过滤规则

过滤后的事件

{    "events":[{"id": "4b26115b-778e-11ec-******",        "specversion": "1.0","source": "HC.OBS","type": "object:put","datacontenttype": "application/json","subject": "xxx.jpg","time": "2022-01-17T12:07:00.955Z","data": {"name": "test01","state": "enable",                "age":10}    }]}
{   "source": [{   "op": "StringIn",   "values": ["HC.OBS"]}],  "data":{    "age":[{     "op": "NumberNotIn",     "values":[11]           }]  }} 
{    "events":[{"id": "4b26115b-778e-11ec-******",        "specversion": "1.0","source": "HC.OBS","type": "object:put","datacontenttype": "application/json","subject": "xxx.jpg","time": "2022-01-17T12:07:00.955Z","data": {"name": "test01","state": "enable",                "age":10}    }]}
support.huaweicloud.com/usermanual-eg/eg-ug-019.html