-
Notifications
You must be signed in to change notification settings - Fork 320
Expand file tree
/
Copy pathsecurity_monitoring_rules.py
More file actions
101 lines (82 loc) · 3.11 KB
/
security_monitoring_rules.py
File metadata and controls
101 lines (82 loc) · 3.11 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# 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
"""
Security Monitoring Rule API.
"""
from typing import Any, Dict, Optional
from datadog.api.resources import (
GetableAPIResource,
CreateableAPIResource,
ListableAPIResource,
UpdatableAPIResource,
DeletableAPIResource,
ActionAPIResource,
)
class SecurityMonitoringRule(
GetableAPIResource,
CreateableAPIResource,
ListableAPIResource,
UpdatableAPIResource,
DeletableAPIResource,
ActionAPIResource,
):
"""
A wrapper around Security Monitoring Rule API.
"""
_resource_name = "security_monitoring/rules"
_api_version = "v2"
@classmethod
def get_all(cls, **params):
# type: (**Any) -> Any
"""
Get all security monitoring rules.
:param params: additional parameters to filter security monitoring rules
:type params: dict
:returns: Dictionary representing the API's JSON response
"""
return super(SecurityMonitoringRule, cls).get_all(**params)
@classmethod
def get(cls, rule_id, **params): # type: ignore[override]
# type: (str, **Any) -> Any
"""
Get a security monitoring rule's details.
:param rule_id: ID of the security monitoring rule
:type rule_id: str
:returns: Dictionary representing the API's JSON response
"""
return super(SecurityMonitoringRule, cls).get(rule_id, **params)
@classmethod
def create(cls, attach_host_name=False, method="POST", id=None, params=None, **body):
# type: (bool, str, Optional[Any], Optional[Dict[str, Any]], **Any) -> Any
"""
Create a security monitoring rule.
:param body: Parameters to create the security monitoring rule with
:type body: dict
:returns: Dictionary representing the API's JSON response
"""
return super(SecurityMonitoringRule, cls).create(
attach_host_name=attach_host_name, method=method, id=id, params=params, **body
)
@classmethod
def update(cls, rule_id, **params): # type: ignore[override]
# type: (str, **Any) -> Any
"""
Update a security monitoring rule.
:param rule_id: ID of the security monitoring rule to update
:type rule_id: str
:param params: Parameters to update the security monitoring rule with
:type params: dict
:returns: Dictionary representing the API's JSON response
"""
return super(SecurityMonitoringRule, cls).update(rule_id, **params)
@classmethod
def delete(cls, rule_id, **params): # type: ignore[override]
# type: (str, **Any) -> Any
"""
Delete a security monitoring rule.
:param rule_id: ID of the security monitoring rule to delete
:type rule_id: str
:returns: Dictionary representing the API's JSON response
"""
return super(SecurityMonitoringRule, cls).delete(rule_id, **params)