首页 > 解决方案 > AWS Eventbridge 规则能否匹配数组内的对象

问题描述

我正在尝试使用事件桥规则匹配事件。但是,如果它的数组包含具有某些特定属性的对象并且我正在努力解决如何做到这一点,我需要匹配该事件。

一个示例事件:

{
    "version": "0",
    "id": "396bfea8-6311-c1ab-44cf-d44d93014a89",
    "detail-type": "ExampleEvent",
    "source": "example.com",
    "account": "207772098559",
    "time": "2020-05-31T19:44:55Z",
    "region": "eu-west-1",
    "resources": [],
    "detail": {
        "Id": "2fbf7f1b0b0f462ba16b6076812f1b77",
        "Data": {
            "entities": [
                {
                    "entityType": "task",
                    "action": "update",
                    "entityId": "bbf74ec6-8762-48d6-b09f-23a97834fc2f"
                },
                {
                    "entityType": "note",
                    "action": "update",
                    "entityId": "bbf74ec6-8762-48d6-b09f-23a97834fc2f"
                }
            ]
        }
    }
}

我希望规则匹配实体集合包含实体类型任务和操作更新的任何项目的位置。我原以为它看起来像下面这样,但这会得到错误“无法识别的匹配类型实体类型”,因为它认为数组内的对象意味着我正在尝试使用一种受支持的匹配类型。

{
    "source": [
        "example.com"
    ],
    "detail-type": [
        "ExampleEvent"
    ],
    "detail": {
        "Data": {
            "entities": [
                {
                    "entityType": [
                        "Task"
                    ],
                    "action": [
                        "update"
                    ]
                }
            ]
        }
    }
}

标签: amazon-web-services

解决方案


推荐阅读