-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify monitor muting endpoints #58
Conversation
05b7caa
to
dde8ece
Compare
raise requests.exceptions.HTTPError("{0} ({1})".format( | ||
e.message, error_msg[0])) | ||
except json.JSONDecodeError: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you provide further details about the use case for this please ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! Some 403 responses include custom error messages. For example, if a user tries to $ dog monitor unmute_all
when the mute_all
setting isn't enabled, the 403 response includes the error message: 'Monitoring is not currently globally muted'
. Simply raising HttpError
, however, just gives the user a generic '403 Client forbidden error'
.
Thanks alot @wang-arthur. It looks great 👍 Before merging it, I think we should clarify which behaviors fall under the |
@@ -124,6 +124,14 @@ def request(cls, method, path, body=None, attach_host_name=False, response_forma | |||
if e.response.status_code == 404 or e.response.status_code == 400: | |||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
403 should probably be caught in this block and raise at this point https://github.com/DataDog/datadogpy/blob/clarify_mute_all/datadog/api/base.py#L160
Raising an AppError instead of an HTTPError for 403 responses also exposes the informational error message in the response.
Command does not add or clear mute settings for individual monitors. Rather, `mute_all` and `unmute_all` enable/disable a global setting (also known as downtime).
This argument allows users to clear all muted scopes of a monitor, instead of unmuting individual scopes one-by-one.
- Add test for unmuting all scopes - Update outdated mute tests
dde8ece
to
a124a35
Compare
Thanks @yannmh! I made the revisions we discussed and cleaned up the commit history. |
Thanks a lot @wang-arthur. Merging it for the v0.7.0 release 🚢 |
Clarify monitor muting endpoints
all_scopes
) to allow clearing all mute settings for a given monitor