|
| 1 | +# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. |
| 2 | +# This product includes software developed at Datadog (https://www.datadoghq.com/). |
| 3 | +# Copyright 2015-Present Datadog, Inc |
| 4 | +""" |
| 5 | +Security Monitoring Rule API. |
| 6 | +""" |
| 7 | + |
| 8 | +from datadog.api.resources import ( |
| 9 | + GetableAPIResource, |
| 10 | + CreateableAPIResource, |
| 11 | + ListableAPIResource, |
| 12 | + UpdatableAPIResource, |
| 13 | + DeletableAPIResource, |
| 14 | + ActionAPIResource, |
| 15 | +) |
| 16 | + |
| 17 | + |
| 18 | +class SecurityMonitoringRule( |
| 19 | + GetableAPIResource, |
| 20 | + CreateableAPIResource, |
| 21 | + ListableAPIResource, |
| 22 | + UpdatableAPIResource, |
| 23 | + DeletableAPIResource, |
| 24 | + ActionAPIResource, |
| 25 | +): |
| 26 | + """ |
| 27 | + A wrapper around Security Monitoring Rule API. |
| 28 | + """ |
| 29 | + |
| 30 | + _resource_name = "security_monitoring/rules" |
| 31 | + _api_version = "v2" |
| 32 | + |
| 33 | + @classmethod |
| 34 | + def get_all(cls, **params): |
| 35 | + """ |
| 36 | + Get all security monitoring rules. |
| 37 | +
|
| 38 | + :param params: additional parameters to filter security monitoring rules |
| 39 | + :type params: dict |
| 40 | +
|
| 41 | + :returns: Dictionary representing the API's JSON response |
| 42 | + """ |
| 43 | + return super(SecurityMonitoringRule, cls).get_all(**params) |
| 44 | + |
| 45 | + @classmethod |
| 46 | + def get(cls, rule_id, **params): |
| 47 | + """ |
| 48 | + Get a security monitoring rule's details. |
| 49 | +
|
| 50 | + :param rule_id: ID of the security monitoring rule |
| 51 | + :type rule_id: str |
| 52 | +
|
| 53 | + :returns: Dictionary representing the API's JSON response |
| 54 | + """ |
| 55 | + return super(SecurityMonitoringRule, cls).get(rule_id, **params) |
| 56 | + |
| 57 | + @classmethod |
| 58 | + def create(cls, **params): |
| 59 | + """ |
| 60 | + Create a security monitoring rule. |
| 61 | +
|
| 62 | + :param params: Parameters to create the security monitoring rule with |
| 63 | + :type params: dict |
| 64 | +
|
| 65 | + :returns: Dictionary representing the API's JSON response |
| 66 | + """ |
| 67 | + return super(SecurityMonitoringRule, cls).create(**params) |
| 68 | + |
| 69 | + @classmethod |
| 70 | + def update(cls, rule_id, **params): |
| 71 | + """ |
| 72 | + Update a security monitoring rule. |
| 73 | +
|
| 74 | + :param rule_id: ID of the security monitoring rule to update |
| 75 | + :type rule_id: str |
| 76 | + :param params: Parameters to update the security monitoring rule with |
| 77 | + :type params: dict |
| 78 | +
|
| 79 | + :returns: Dictionary representing the API's JSON response |
| 80 | + """ |
| 81 | + return super(SecurityMonitoringRule, cls).update(rule_id, **params) |
| 82 | + |
| 83 | + @classmethod |
| 84 | + def delete(cls, rule_id, **params): |
| 85 | + """ |
| 86 | + Delete a security monitoring rule. |
| 87 | +
|
| 88 | + :param rule_id: ID of the security monitoring rule to delete |
| 89 | + :type rule_id: str |
| 90 | +
|
| 91 | + :returns: Dictionary representing the API's JSON response |
| 92 | + """ |
| 93 | + return super(SecurityMonitoringRule, cls).delete(rule_id, **params) |
0 commit comments