forked from DataDog/datadogpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinfrastructure.py
More file actions
28 lines (22 loc) · 1014 Bytes
/
infrastructure.py
File metadata and controls
28 lines (22 loc) · 1014 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2015-Present Datadog, Inc
from datadog.api.resources import SearchableAPIResource
class Infrastructure(SearchableAPIResource):
"""
A wrapper around Infrastructure HTTP API.
"""
_resource_name = "search"
@classmethod
def search(cls, **params):
"""
Search for entities in Datadog.
:param q: a query to search for host and metrics
:type q: string query
:returns: Dictionary representing the API's JSON response
"""
# Deprecate the hosts search param
query = params.get("q", "").split(":")
if len(query) > 1 and query[0] == "hosts":
print("[DEPRECATION] Infrastructure.search() is deprecated for ", "hosts. Use `Hosts.search` instead.")
return super(Infrastructure, cls)._search(**params)