Skip to content
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

Add monitor and monitor groups search API endpoints #299

Merged
merged 2 commits into from
Oct 16, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
CHANGELOG
=========
# 0.23.0 / 2018-10-13
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change the date to "Unreleased" for now? We generally set it after the pypi package is released


Add [monitor search](https://docs.datadoghq.com/api/?lang=python#monitors-search) and [monitor groups search](https://docs.datadoghq.com/api/?lang=python#monitors-group-search) API endpoints.

# 0.22.0 / 2018-06-27

Expand Down
18 changes: 18 additions & 0 deletions datadog/api/monitors.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,21 @@ def unmute_all(cls):
:returns: Dictionary representing the API's JSON response
"""
return super(Monitor, cls)._trigger_class_action('POST', 'unmute_all')

@classmethod
def search_monitors(cls, **params):
"""
Search monitors

:returns: Dictionary representing the API's JSON response
"""
return super(Monitor, cls)._trigger_class_action('GET', 'search', params=params)

@classmethod
def search_monitor_groups(cls, **params):
"""
Search monitor monitor groups
isaacdd marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally avoid repeating the resource name in the method (for example api.Monitor.get instead of api.Monitor.get_monitor). For this reason, I think it'd be more consistent to rename both methods search and search_groups. What do you think?


:returns: Dictionary representing the API's JSON response
"""
return super(Monitor, cls)._trigger_class_action('GET', 'groups/search', params=params)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_readme_md_contents():

setup(
name="datadog",
version="0.22.0",
version="0.23.0",
install_requires=install_reqs,
tests_require=["nose", "mock"],
packages=[
Expand Down