协议消息 Condition has no "conditionAbsent" field error with create_alert_policy method

Protocol message Condition has no "conditionAbsent" field error with create_alert_policy method

我正尝试在 python 中使用 Cloud Functions 创建警报策略。我有以下非常简单的警报策略:

alert_policy = {
    'combiner': 'OR',
    'conditions': [
        {
            'conditionAbsent': {
                'duration': '3900s',
                'filter': 'resource.type = "l7_lb_rule" AND metric.type = "logging.googleapis.com/user/name_stuff_here"'
            }
        }
    ]
}

当运行函数出现如下错误:Protocol message Condition has no "conditionAbsent" field error

这个告警策略应该怎么写?我也有一些错误,因为 Displayname 字段我已经完全删除了。是否有警报策略生成器或类似的东西,我可以在其中验证警报 json?

仔细查看文档,我发现 conditionAbsent 应该作为 condition_absent

传递