Skip to content

Commit a570a08

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Security Monitoring Suppression - Add data_exclusion_query field (#1940)
Co-authored-by: ci.datadog-api-spec <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
1 parent 17a3b9b commit a570a08

15 files changed

+176
-40
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-04-09 18:05:43.533229",
8-
"spec_repo_commit": "fc718bc2"
7+
"regenerated": "2024-04-10 15:01:01.395898",
8+
"spec_repo_commit": "7e61ac0f"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-04-09 18:05:43.550344",
13-
"spec_repo_commit": "fc718bc2"
12+
"regenerated": "2024-04-10 15:01:01.412691",
13+
"spec_repo_commit": "7e61ac0f"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18282,6 +18282,13 @@ components:
1828218282
type: integer
1828318283
creator:
1828418284
$ref: '#/components/schemas/SecurityMonitoringUser'
18285+
data_exclusion_query:
18286+
description: An exclusion query on the input data of the security rules,
18287+
which could be logs, Agent events, or other types of data based on the
18288+
security rule. Events matching this query are ignored by any detection
18289+
rules referenced in the suppression rule.
18290+
example: source:cloudtrail account_id:12345
18291+
type: string
1828518292
description:
1828618293
description: A description for the suppression rule.
1828718294
example: This rule suppresses low-severity signals in staging environments.
@@ -18330,6 +18337,13 @@ components:
1833018337
description: Object containing the attributes of the suppression rule to be
1833118338
created.
1833218339
properties:
18340+
data_exclusion_query:
18341+
description: An exclusion query on the input data of the security rules,
18342+
which could be logs, Agent events, or other types of data based on the
18343+
security rule. Events matching this query are ignored by any detection
18344+
rules referenced in the suppression rule.
18345+
example: source:cloudtrail account_id:12345
18346+
type: string
1833318347
description:
1833418348
description: A description for the suppression rule.
1833518349
example: This rule suppresses low-severity signals in staging environments.
@@ -18355,15 +18369,14 @@ components:
1835518369
type: string
1835618370
suppression_query:
1835718371
description: The suppression query of the suppression rule. If a signal
18358-
matches this query, it is suppressed and is not triggered . Same syntax
18359-
as the queries to search signals in the signal explorer.
18372+
matches this query, it is suppressed and is not triggered. It uses the
18373+
same syntax as the queries to search signals in the Signals Explorer.
1836018374
example: env:staging status:low
1836118375
type: string
1836218376
required:
1836318377
- name
1836418378
- enabled
1836518379
- rule_query
18366-
- suppression_query
1836718380
type: object
1836818381
SecurityMonitoringSuppressionCreateData:
1836918382
description: Object for a single suppression rule.
@@ -18407,6 +18420,13 @@ components:
1840718420
SecurityMonitoringSuppressionUpdateAttributes:
1840818421
description: The suppression rule properties to be updated.
1840918422
properties:
18423+
data_exclusion_query:
18424+
description: An exclusion query on the input data of the security rules,
18425+
which could be logs, Agent events, or other types of data based on the
18426+
security rule. Events matching this query are ignored by any detection
18427+
rules referenced in the suppression rule.
18428+
example: source:cloudtrail account_id:12345
18429+
type: string
1841018430
description:
1841118431
description: A description for the suppression rule.
1841218432
example: This rule suppresses low-severity signals in staging environments.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""
2+
Create a suppression rule with an exclusion query returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.security_monitoring_api import SecurityMonitoringApi
7+
from datadog_api_client.v2.model.security_monitoring_suppression_create_attributes import (
8+
SecurityMonitoringSuppressionCreateAttributes,
9+
)
10+
from datadog_api_client.v2.model.security_monitoring_suppression_create_data import (
11+
SecurityMonitoringSuppressionCreateData,
12+
)
13+
from datadog_api_client.v2.model.security_monitoring_suppression_create_request import (
14+
SecurityMonitoringSuppressionCreateRequest,
15+
)
16+
from datadog_api_client.v2.model.security_monitoring_suppression_type import SecurityMonitoringSuppressionType
17+
18+
body = SecurityMonitoringSuppressionCreateRequest(
19+
data=SecurityMonitoringSuppressionCreateData(
20+
attributes=SecurityMonitoringSuppressionCreateAttributes(
21+
description="This rule suppresses low-severity signals in staging environments.",
22+
enabled=True,
23+
expiration_date=1703187336000,
24+
name="Example-Security-Monitoring",
25+
rule_query="type:log_detection source:cloudtrail",
26+
data_exclusion_query="account_id:12345",
27+
),
28+
type=SecurityMonitoringSuppressionType.SUPPRESSIONS,
29+
),
30+
)
31+
32+
configuration = Configuration()
33+
with ApiClient(configuration) as api_client:
34+
api_instance = SecurityMonitoringApi(api_client)
35+
response = api_instance.create_security_monitoring_suppression(body=body)
36+
37+
print(response)

src/datadog_api_client/v2/model/security_monitoring_suppression_attributes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def openapi_types(_):
3131
return {
3232
"creation_date": (int,),
3333
"creator": (SecurityMonitoringUser,),
34+
"data_exclusion_query": (str,),
3435
"description": (str,),
3536
"enabled": (bool,),
3637
"expiration_date": (int,),
@@ -45,6 +46,7 @@ def openapi_types(_):
4546
attribute_map = {
4647
"creation_date": "creation_date",
4748
"creator": "creator",
49+
"data_exclusion_query": "data_exclusion_query",
4850
"description": "description",
4951
"enabled": "enabled",
5052
"expiration_date": "expiration_date",
@@ -60,6 +62,7 @@ def __init__(
6062
self_,
6163
creation_date: Union[int, UnsetType] = unset,
6264
creator: Union[SecurityMonitoringUser, UnsetType] = unset,
65+
data_exclusion_query: Union[str, UnsetType] = unset,
6366
description: Union[str, UnsetType] = unset,
6467
enabled: Union[bool, UnsetType] = unset,
6568
expiration_date: Union[int, UnsetType] = unset,
@@ -80,6 +83,9 @@ def __init__(
8083
:param creator: A user.
8184
:type creator: SecurityMonitoringUser, optional
8285
86+
:param data_exclusion_query: An exclusion query on the input data of the security rules, which could be logs, Agent events, or other types of data based on the security rule. Events matching this query are ignored by any detection rules referenced in the suppression rule.
87+
:type data_exclusion_query: str, optional
88+
8389
:param description: A description for the suppression rule.
8490
:type description: str, optional
8591
@@ -111,6 +117,8 @@ def __init__(
111117
kwargs["creation_date"] = creation_date
112118
if creator is not unset:
113119
kwargs["creator"] = creator
120+
if data_exclusion_query is not unset:
121+
kwargs["data_exclusion_query"] = data_exclusion_query
114122
if description is not unset:
115123
kwargs["description"] = description
116124
if enabled is not unset:

src/datadog_api_client/v2/model/security_monitoring_suppression_create_attributes.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class SecurityMonitoringSuppressionCreateAttributes(ModelNormal):
1717
@cached_property
1818
def openapi_types(_):
1919
return {
20+
"data_exclusion_query": (str,),
2021
"description": (str,),
2122
"enabled": (bool,),
2223
"expiration_date": (int,),
@@ -26,6 +27,7 @@ def openapi_types(_):
2627
}
2728

2829
attribute_map = {
30+
"data_exclusion_query": "data_exclusion_query",
2931
"description": "description",
3032
"enabled": "enabled",
3133
"expiration_date": "expiration_date",
@@ -39,14 +41,18 @@ def __init__(
3941
enabled: bool,
4042
name: str,
4143
rule_query: str,
42-
suppression_query: str,
44+
data_exclusion_query: Union[str, UnsetType] = unset,
4345
description: Union[str, UnsetType] = unset,
4446
expiration_date: Union[int, UnsetType] = unset,
47+
suppression_query: Union[str, UnsetType] = unset,
4548
**kwargs,
4649
):
4750
"""
4851
Object containing the attributes of the suppression rule to be created.
4952
53+
:param data_exclusion_query: An exclusion query on the input data of the security rules, which could be logs, Agent events, or other types of data based on the security rule. Events matching this query are ignored by any detection rules referenced in the suppression rule.
54+
:type data_exclusion_query: str, optional
55+
5056
:param description: A description for the suppression rule.
5157
:type description: str, optional
5258
@@ -62,16 +68,19 @@ def __init__(
6268
:param rule_query: The rule query of the suppression rule, with the same syntax as the search bar for detection rules.
6369
:type rule_query: str
6470
65-
:param suppression_query: The suppression query of the suppression rule. If a signal matches this query, it is suppressed and is not triggered . Same syntax as the queries to search signals in the signal explorer.
66-
:type suppression_query: str
71+
:param suppression_query: The suppression query of the suppression rule. If a signal matches this query, it is suppressed and is not triggered. It uses the same syntax as the queries to search signals in the Signals Explorer.
72+
:type suppression_query: str, optional
6773
"""
74+
if data_exclusion_query is not unset:
75+
kwargs["data_exclusion_query"] = data_exclusion_query
6876
if description is not unset:
6977
kwargs["description"] = description
7078
if expiration_date is not unset:
7179
kwargs["expiration_date"] = expiration_date
80+
if suppression_query is not unset:
81+
kwargs["suppression_query"] = suppression_query
7282
super().__init__(kwargs)
7383

7484
self_.enabled = enabled
7585
self_.name = name
7686
self_.rule_query = rule_query
77-
self_.suppression_query = suppression_query

src/datadog_api_client/v2/model/security_monitoring_suppression_update_attributes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class SecurityMonitoringSuppressionUpdateAttributes(ModelNormal):
2424
@cached_property
2525
def openapi_types(_):
2626
return {
27+
"data_exclusion_query": (str,),
2728
"description": (str,),
2829
"enabled": (bool,),
2930
"expiration_date": (int, none_type),
@@ -34,6 +35,7 @@ def openapi_types(_):
3435
}
3536

3637
attribute_map = {
38+
"data_exclusion_query": "data_exclusion_query",
3739
"description": "description",
3840
"enabled": "enabled",
3941
"expiration_date": "expiration_date",
@@ -45,6 +47,7 @@ def openapi_types(_):
4547

4648
def __init__(
4749
self_,
50+
data_exclusion_query: Union[str, UnsetType] = unset,
4851
description: Union[str, UnsetType] = unset,
4952
enabled: Union[bool, UnsetType] = unset,
5053
expiration_date: Union[int, none_type, UnsetType] = unset,
@@ -57,6 +60,9 @@ def __init__(
5760
"""
5861
The suppression rule properties to be updated.
5962
63+
:param data_exclusion_query: An exclusion query on the input data of the security rules, which could be logs, Agent events, or other types of data based on the security rule. Events matching this query are ignored by any detection rules referenced in the suppression rule.
64+
:type data_exclusion_query: str, optional
65+
6066
:param description: A description for the suppression rule.
6167
:type description: str, optional
6268
@@ -78,6 +84,8 @@ def __init__(
7884
:param version: The current version of the suppression. This is optional, but it can help prevent concurrent modifications.
7985
:type version: int, optional
8086
"""
87+
if data_exclusion_query is not unset:
88+
kwargs["data_exclusion_query"] = data_exclusion_query
8189
if description is not unset:
8290
kwargs["description"] = description
8391
if enabled is not unset:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-01-11T10:06:23.179Z
1+
2024-04-08T09:56:58.589Z

tests/v2/cassettes/test_scenarios/test_create_a_suppression_rule_returns_ok_response.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
interactions:
22
- request:
33
body: '{"data":{"attributes":{"description":"This rule suppresses low-severity
4-
signals in staging environments.","enabled":true,"expiration_date":1703187336000,"name":"Test-Create_a_suppression_rule_returns_OK_response-1704967583","rule_query":"type:log_detection
4+
signals in staging environments.","enabled":true,"expiration_date":1703187336000,"name":"Test-Create_a_suppression_rule_returns_OK_response-1712570218","rule_query":"type:log_detection
55
source:cloudtrail","suppression_query":"env:staging status:low"},"type":"suppressions"}}'
66
headers:
77
accept:
@@ -12,9 +12,9 @@ interactions:
1212
uri: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions
1313
response:
1414
body:
15-
string: '{"data":{"id":"5sx-nhj-htc","attributes":{"name":"Test-Create_a_suppression_rule_returns_OK_response-1704967583","enabled":true,"description":"This
15+
string: '{"data":{"id":"mu8-qje-pys","attributes":{"name":"Test-Create_a_suppression_rule_returns_OK_response-1712570218","enabled":true,"description":"This
1616
rule suppresses low-severity signals in staging environments.","rule_query":"type:log_detection
17-
source:cloudtrail","suppression_query":"env:staging status:low","expiration_date":1703187336000,"version":1,"creation_date":1704967583506,"update_date":1704967583506,"creator":{"name":null,"handle":"[email protected]"},"updater":{"name":null,"handle":"[email protected]"}},"type":"suppressions"}}
17+
source:cloudtrail","suppression_query":"env:staging status:low","log_exclusion_query":"","data_exclusion_query":"","expiration_date":1703187336000,"version":1,"creation_date":1712570219298,"update_date":1712570219298,"creator":{"name":null,"handle":"[email protected]"},"updater":{"name":null,"handle":"[email protected]"}},"type":"suppressions"}}
1818
1919
'
2020
headers:
@@ -29,7 +29,7 @@ interactions:
2929
accept:
3030
- '*/*'
3131
method: DELETE
32-
uri: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/5sx-nhj-htc
32+
uri: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/mu8-qje-pys
3333
response:
3434
body:
3535
string: ''
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2024-04-08T09:57:01.815Z
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
interactions:
2+
- request:
3+
body: '{"data":{"attributes":{"data_exclusion_query":"account_id:12345","description":"This
4+
rule suppresses low-severity signals in staging environments.","enabled":true,"expiration_date":1703187336000,"name":"Test-Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response-1712570221","rule_query":"type:log_detection
5+
source:cloudtrail"},"type":"suppressions"}}'
6+
headers:
7+
accept:
8+
- application/json
9+
content-type:
10+
- application/json
11+
method: POST
12+
uri: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions
13+
response:
14+
body:
15+
string: '{"data":{"id":"2dj-cxs-dg6","attributes":{"name":"Test-Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response-1712570221","enabled":true,"description":"This
16+
rule suppresses low-severity signals in staging environments.","rule_query":"type:log_detection
17+
source:cloudtrail","suppression_query":"","log_exclusion_query":"account_id:12345","data_exclusion_query":"account_id:12345","expiration_date":1703187336000,"version":1,"creation_date":1712570222285,"update_date":1712570222285,"creator":{"name":null,"handle":"[email protected]"},"updater":{"name":null,"handle":"[email protected]"}},"type":"suppressions"}}
18+
19+
'
20+
headers:
21+
content-type:
22+
- application/json
23+
status:
24+
code: 200
25+
message: OK
26+
- request:
27+
body: null
28+
headers:
29+
accept:
30+
- '*/*'
31+
method: DELETE
32+
uri: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/2dj-cxs-dg6
33+
response:
34+
body:
35+
string: ''
36+
headers:
37+
content-type:
38+
- text/html; charset=utf-8
39+
status:
40+
code: 204
41+
message: No Content
42+
version: 1

0 commit comments

Comments
 (0)