|
1
|
|
|
from base import DatadogBaseAction |
|
|
|
|
|
|
2
|
|
|
from datadog import api |
|
3
|
|
|
|
|
4
|
|
|
|
|
5
|
|
|
class DatadogCreateMonitor(DatadogBaseAction): |
|
6
|
|
|
def _run(self, **kwargs): |
|
7
|
|
|
return api.Monitor.create(**kwargs) |
|
8
|
|
|
|
|
9
|
|
|
|
|
10
|
|
|
class DatadogDeleteMonitor(DatadogBaseAction): |
|
11
|
|
|
def _run(self, **kwargs): |
|
12
|
|
|
return api.Monitor.delete(kwargs.pop("monitor_id")) |
|
13
|
|
|
|
|
14
|
|
|
|
|
15
|
|
|
class DatadogEditMonitor(DatadogBaseAction): |
|
16
|
|
|
def _run(self, **kwargs): |
|
17
|
|
|
return api.Monitor.update(kwargs.pop("monitor_id"), **kwargs) |
|
18
|
|
|
|
|
19
|
|
|
|
|
20
|
|
|
class DatadogAllMonitors(DatadogBaseAction): |
|
21
|
|
|
def _run(self): |
|
22
|
|
|
return api.Monitor.get_all() |
|
23
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
class DatadogGetMonitor(DatadogBaseAction): |
|
26
|
|
|
def _run(self, **kwargs): |
|
27
|
|
|
return api.Monitor.get(kwargs.pop("monitor_id"), **kwargs) |
|
28
|
|
|
|
|
29
|
|
|
|
|
30
|
|
|
class DatadogMuteAllMonitors(DatadogBaseAction): |
|
31
|
|
|
def _run(self): |
|
32
|
|
|
return api.Monitor.mute_all() |
|
33
|
|
|
|
|
34
|
|
|
|
|
35
|
|
|
class DatadogMuteMonitor(DatadogBaseAction): |
|
36
|
|
|
def _run(self, **kwargs): |
|
37
|
|
|
return api.Monitor.mute(kwargs.pop("monitor_id"), **kwargs) |
|
38
|
|
|
|
|
39
|
|
|
|
|
40
|
|
|
class DatadogUnmuteAllMonitors(DatadogBaseAction): |
|
41
|
|
|
def _run(self): |
|
42
|
|
|
return api.Monitor.unmute_all() |
|
43
|
|
|
|
|
44
|
|
|
|
|
45
|
|
|
class DatadogUnuteMonitor(DatadogBaseAction): |
|
46
|
|
|
def _run(self, **kwargs): |
|
47
|
|
|
return api.Monitor.unmute(kwargs.pop("monitor_id"), **kwargs) |
|
48
|
|
|
|