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 SLO search endpoint and update get_all #744

Merged
merged 2 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
23 changes: 21 additions & 2 deletions datadog/api/service_level_objectives.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,17 @@ def get(cls, id, **params):
return super(ServiceLevelObjective, cls).get(id, **params)

@classmethod
def get_all(cls, query=None, ids=None, offset=0, limit=100, **params):
def get_all(cls, query=None, tags_query=None, metrics_query=None, ids=None, offset=0, limit=100, **params):
"""
Get all SLO details.

:param query: optional search query - syntax in UI && online documentation
:param query: optional search query to filter results for SLO name
:type query: str

:param tags_query: optional search query to filter results for a single SLO tag
:type query: str

:param metrics_query: optional search query to filter results based on SLO numerator and denominator
:type query: str

:param ids: optional list of SLO ids to get many specific SLOs at once.
Expand All @@ -73,6 +79,10 @@ def get_all(cls, query=None, ids=None, offset=0, limit=100, **params):
search_terms["query"] = query
if ids:
search_terms["ids"] = ids
if tags_query:
search_terms["tags_query"] = tags_query
if metrics_query:
search_terms["metrics_query"] = metrics_query
search_terms["offset"] = offset
search_terms["limit"] = limit

Expand Down Expand Up @@ -192,3 +202,12 @@ def history(cls, id, from_ts, to_ts, **params):
body=None,
suppress_response_errors_on_codes=[200],
)

@classmethod
def search(cls, **params):
"""
Search SLOs.

:returns: Dictionary representing the API's JSON response
"""
return super(ServiceLevelObjective, cls)._trigger_class_action("GET", "search", params=params)
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2020-02-03T17:20:32.354741+01:00
2022-11-14T12:55:56.691827+01:00
Loading