Closed brmurphy closed 8 years ago
@brmurphy thanks for this! I'll try to get this merged shortly.
something isn't adding up here with my condition_type
fix. The response back from the api is different.
When I query via GET
, I receive
{"id":<redact>,"type":"above","metric_name":"<redact>","source":"beta","threshold":50000.0,"duration":1200,"summary_function":"max"}
But to post, I need to use
{"metric_name": "<redact>", "duration": 1200, "source": "beta", "summary_function": "max", "condition_type": "above","threshold":50000.0}
Let me dig into this some more
I think I have a branch that will fix this which I can put up tomorrow. The API "wants" to use type
and you should be able to POST with type
and just not use condition_type
(which we can say is just used internally within the class). Ideally I'd like to be consistent but as this is contributed code (which we're super grateful for) we may not always fully vet everything.
In any case, incoming PR from me...
@brmurphy ok, tried to address this in #142, let me know if that might work for you.
Closing this in favor of #142
When attempting to create an alert with
services
andconditions
params, json deserialize would fail.In order to fix this, the conditions needed to be serialized correctly, and the services needed serialization AND encoding for id only.
And of course, add some tests for them.
Also, the
Alert.from_dict
method referencedtype
, notcondition_type
, which I think was introduced in a78e2d13662c3181f257c88c61e2367893647f6e