Tuesday, 21 September 2021

Invalid constructor input for UpdateAlertPolicyRequest

I'm trying to update an alert policy with Cloud Functions. I have the following lines of code:

filter = "resource.type = \"l7_lb_rule\" AND metric.type = \"logging.googleapis.com/user/stuff_here\"")
alert_policy = {"conditions":[{"condition_absent":{"duration": '1800s',"filter": '{}'.format(filter)}, "displayName":'test'}], "displayName":'test'), "combiner":"OR"}
policy = monitoring_v3.AlertPolicy.from_json(json.dumps(alert_policy))
client_alert.update_alert_policy(policy)

I'm running the same update with the API explorer and it's working. However the cloud functions return me this error TypeError: Invalid constructor input for UpdateAlertPolicyRequest: display_name: "test"

I'm also wondering where I should pass the name of the alert I want to update. I tried to pass the name as a parameters or the alert_policy object but it always return me some kind of errors.



from Invalid constructor input for UpdateAlertPolicyRequest

No comments:

Post a Comment