Skip to content

Commit 34bf405

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add suppression tags (#3456)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 7d280a7 commit 34bf405

15 files changed

+197
-70
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46991,6 +46991,14 @@ components:
4699146991
the queries to search signals in the signal explorer.
4699246992
example: env:staging status:low
4699346993
type: string
46994+
tags:
46995+
description: List of tags associated with the suppression rule.
46996+
example:
46997+
- technique:T1110-brute-force
46998+
- source:cloudtrail
46999+
items:
47000+
type: string
47001+
type: array
4699447002
update_date:
4699547003
description: A Unix millisecond timestamp given the update date of the suppression
4699647004
rule.
@@ -47052,6 +47060,14 @@ components:
4705247060
same syntax as the queries to search signals in the Signals Explorer.
4705347061
example: env:staging status:low
4705447062
type: string
47063+
tags:
47064+
description: List of tags associated with the suppression rule.
47065+
example:
47066+
- technique:T1110-brute-force
47067+
- source:cloudtrail
47068+
items:
47069+
type: string
47070+
type: array
4705547071
required:
4705647072
- name
4705747073
- enabled
@@ -47147,6 +47163,14 @@ components:
4714747163
the queries to search signals in the signal explorer.
4714847164
example: env:staging status:low
4714947165
type: string
47166+
tags:
47167+
description: List of tags associated with the suppression rule.
47168+
example:
47169+
- technique:T1110-brute-force
47170+
- source:cloudtrail
47171+
items:
47172+
type: string
47173+
type: array
4715047174
version:
4715147175
description: The current version of the suppression. This is optional, but
4715247176
it can help prevent concurrent modifications.

api/datadogV2/model_security_monitoring_suppression_attributes.go

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ type SecurityMonitoringSuppressionAttributes struct {
3232
StartDate *int64 `json:"start_date,omitempty"`
3333
// The suppression query of the suppression rule. If a signal matches this query, it is suppressed and not triggered. Same syntax as the queries to search signals in the signal explorer.
3434
SuppressionQuery *string `json:"suppression_query,omitempty"`
35+
// List of tags associated with the suppression rule.
36+
Tags []string `json:"tags,omitempty"`
3537
// A Unix millisecond timestamp given the update date of the suppression rule.
3638
UpdateDate *int64 `json:"update_date,omitempty"`
3739
// A user.
@@ -368,6 +370,34 @@ func (o *SecurityMonitoringSuppressionAttributes) SetSuppressionQuery(v string)
368370
o.SuppressionQuery = &v
369371
}
370372

373+
// GetTags returns the Tags field value if set, zero value otherwise.
374+
func (o *SecurityMonitoringSuppressionAttributes) GetTags() []string {
375+
if o == nil || o.Tags == nil {
376+
var ret []string
377+
return ret
378+
}
379+
return o.Tags
380+
}
381+
382+
// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise
383+
// and a boolean to check if the value has been set.
384+
func (o *SecurityMonitoringSuppressionAttributes) GetTagsOk() (*[]string, bool) {
385+
if o == nil || o.Tags == nil {
386+
return nil, false
387+
}
388+
return &o.Tags, true
389+
}
390+
391+
// HasTags returns a boolean if a field has been set.
392+
func (o *SecurityMonitoringSuppressionAttributes) HasTags() bool {
393+
return o != nil && o.Tags != nil
394+
}
395+
396+
// SetTags gets a reference to the given []string and assigns it to the Tags field.
397+
func (o *SecurityMonitoringSuppressionAttributes) SetTags(v []string) {
398+
o.Tags = v
399+
}
400+
371401
// GetUpdateDate returns the UpdateDate field value if set, zero value otherwise.
372402
func (o *SecurityMonitoringSuppressionAttributes) GetUpdateDate() int64 {
373403
if o == nil || o.UpdateDate == nil {
@@ -491,6 +521,9 @@ func (o SecurityMonitoringSuppressionAttributes) MarshalJSON() ([]byte, error) {
491521
if o.SuppressionQuery != nil {
492522
toSerialize["suppression_query"] = o.SuppressionQuery
493523
}
524+
if o.Tags != nil {
525+
toSerialize["tags"] = o.Tags
526+
}
494527
if o.UpdateDate != nil {
495528
toSerialize["update_date"] = o.UpdateDate
496529
}
@@ -521,6 +554,7 @@ func (o *SecurityMonitoringSuppressionAttributes) UnmarshalJSON(bytes []byte) (e
521554
RuleQuery *string `json:"rule_query,omitempty"`
522555
StartDate *int64 `json:"start_date,omitempty"`
523556
SuppressionQuery *string `json:"suppression_query,omitempty"`
557+
Tags []string `json:"tags,omitempty"`
524558
UpdateDate *int64 `json:"update_date,omitempty"`
525559
Updater *SecurityMonitoringUser `json:"updater,omitempty"`
526560
Version *int32 `json:"version,omitempty"`
@@ -530,7 +564,7 @@ func (o *SecurityMonitoringSuppressionAttributes) UnmarshalJSON(bytes []byte) (e
530564
}
531565
additionalProperties := make(map[string]interface{})
532566
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
533-
datadog.DeleteKeys(additionalProperties, &[]string{"creation_date", "creator", "data_exclusion_query", "description", "editable", "enabled", "expiration_date", "name", "rule_query", "start_date", "suppression_query", "update_date", "updater", "version"})
567+
datadog.DeleteKeys(additionalProperties, &[]string{"creation_date", "creator", "data_exclusion_query", "description", "editable", "enabled", "expiration_date", "name", "rule_query", "start_date", "suppression_query", "tags", "update_date", "updater", "version"})
534568
} else {
535569
return err
536570
}
@@ -550,6 +584,7 @@ func (o *SecurityMonitoringSuppressionAttributes) UnmarshalJSON(bytes []byte) (e
550584
o.RuleQuery = all.RuleQuery
551585
o.StartDate = all.StartDate
552586
o.SuppressionQuery = all.SuppressionQuery
587+
o.Tags = all.Tags
553588
o.UpdateDate = all.UpdateDate
554589
if all.Updater != nil && all.Updater.UnparsedObject != nil && o.UnparsedObject == nil {
555590
hasInvalidField = true

api/datadogV2/model_security_monitoring_suppression_create_attributes.go

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ type SecurityMonitoringSuppressionCreateAttributes struct {
2828
StartDate *int64 `json:"start_date,omitempty"`
2929
// 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.
3030
SuppressionQuery *string `json:"suppression_query,omitempty"`
31+
// List of tags associated with the suppression rule.
32+
Tags []string `json:"tags,omitempty"`
3133
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
3234
UnparsedObject map[string]interface{} `json:"-"`
3335
AdditionalProperties map[string]interface{} `json:"-"`
@@ -262,6 +264,34 @@ func (o *SecurityMonitoringSuppressionCreateAttributes) SetSuppressionQuery(v st
262264
o.SuppressionQuery = &v
263265
}
264266

267+
// GetTags returns the Tags field value if set, zero value otherwise.
268+
func (o *SecurityMonitoringSuppressionCreateAttributes) GetTags() []string {
269+
if o == nil || o.Tags == nil {
270+
var ret []string
271+
return ret
272+
}
273+
return o.Tags
274+
}
275+
276+
// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise
277+
// and a boolean to check if the value has been set.
278+
func (o *SecurityMonitoringSuppressionCreateAttributes) GetTagsOk() (*[]string, bool) {
279+
if o == nil || o.Tags == nil {
280+
return nil, false
281+
}
282+
return &o.Tags, true
283+
}
284+
285+
// HasTags returns a boolean if a field has been set.
286+
func (o *SecurityMonitoringSuppressionCreateAttributes) HasTags() bool {
287+
return o != nil && o.Tags != nil
288+
}
289+
290+
// SetTags gets a reference to the given []string and assigns it to the Tags field.
291+
func (o *SecurityMonitoringSuppressionCreateAttributes) SetTags(v []string) {
292+
o.Tags = v
293+
}
294+
265295
// MarshalJSON serializes the struct using spec logic.
266296
func (o SecurityMonitoringSuppressionCreateAttributes) MarshalJSON() ([]byte, error) {
267297
toSerialize := map[string]interface{}{}
@@ -286,6 +316,9 @@ func (o SecurityMonitoringSuppressionCreateAttributes) MarshalJSON() ([]byte, er
286316
if o.SuppressionQuery != nil {
287317
toSerialize["suppression_query"] = o.SuppressionQuery
288318
}
319+
if o.Tags != nil {
320+
toSerialize["tags"] = o.Tags
321+
}
289322

290323
for key, value := range o.AdditionalProperties {
291324
toSerialize[key] = value
@@ -296,14 +329,15 @@ func (o SecurityMonitoringSuppressionCreateAttributes) MarshalJSON() ([]byte, er
296329
// UnmarshalJSON deserializes the given payload.
297330
func (o *SecurityMonitoringSuppressionCreateAttributes) UnmarshalJSON(bytes []byte) (err error) {
298331
all := struct {
299-
DataExclusionQuery *string `json:"data_exclusion_query,omitempty"`
300-
Description *string `json:"description,omitempty"`
301-
Enabled *bool `json:"enabled"`
302-
ExpirationDate *int64 `json:"expiration_date,omitempty"`
303-
Name *string `json:"name"`
304-
RuleQuery *string `json:"rule_query"`
305-
StartDate *int64 `json:"start_date,omitempty"`
306-
SuppressionQuery *string `json:"suppression_query,omitempty"`
332+
DataExclusionQuery *string `json:"data_exclusion_query,omitempty"`
333+
Description *string `json:"description,omitempty"`
334+
Enabled *bool `json:"enabled"`
335+
ExpirationDate *int64 `json:"expiration_date,omitempty"`
336+
Name *string `json:"name"`
337+
RuleQuery *string `json:"rule_query"`
338+
StartDate *int64 `json:"start_date,omitempty"`
339+
SuppressionQuery *string `json:"suppression_query,omitempty"`
340+
Tags []string `json:"tags,omitempty"`
307341
}{}
308342
if err = datadog.Unmarshal(bytes, &all); err != nil {
309343
return datadog.Unmarshal(bytes, &o.UnparsedObject)
@@ -319,7 +353,7 @@ func (o *SecurityMonitoringSuppressionCreateAttributes) UnmarshalJSON(bytes []by
319353
}
320354
additionalProperties := make(map[string]interface{})
321355
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
322-
datadog.DeleteKeys(additionalProperties, &[]string{"data_exclusion_query", "description", "enabled", "expiration_date", "name", "rule_query", "start_date", "suppression_query"})
356+
datadog.DeleteKeys(additionalProperties, &[]string{"data_exclusion_query", "description", "enabled", "expiration_date", "name", "rule_query", "start_date", "suppression_query", "tags"})
323357
} else {
324358
return err
325359
}
@@ -331,6 +365,7 @@ func (o *SecurityMonitoringSuppressionCreateAttributes) UnmarshalJSON(bytes []by
331365
o.RuleQuery = *all.RuleQuery
332366
o.StartDate = all.StartDate
333367
o.SuppressionQuery = all.SuppressionQuery
368+
o.Tags = all.Tags
334369

335370
if len(additionalProperties) > 0 {
336371
o.AdditionalProperties = additionalProperties

api/datadogV2/model_security_monitoring_suppression_update_attributes.go

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ type SecurityMonitoringSuppressionUpdateAttributes struct {
2626
StartDate datadog.NullableInt64 `json:"start_date,omitempty"`
2727
// The suppression query of the suppression rule. If a signal matches this query, it is suppressed and not triggered. Same syntax as the queries to search signals in the signal explorer.
2828
SuppressionQuery *string `json:"suppression_query,omitempty"`
29+
// List of tags associated with the suppression rule.
30+
Tags []string `json:"tags,omitempty"`
2931
// The current version of the suppression. This is optional, but it can help prevent concurrent modifications.
3032
Version *int32 `json:"version,omitempty"`
3133
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
@@ -296,6 +298,34 @@ func (o *SecurityMonitoringSuppressionUpdateAttributes) SetSuppressionQuery(v st
296298
o.SuppressionQuery = &v
297299
}
298300

301+
// GetTags returns the Tags field value if set, zero value otherwise.
302+
func (o *SecurityMonitoringSuppressionUpdateAttributes) GetTags() []string {
303+
if o == nil || o.Tags == nil {
304+
var ret []string
305+
return ret
306+
}
307+
return o.Tags
308+
}
309+
310+
// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise
311+
// and a boolean to check if the value has been set.
312+
func (o *SecurityMonitoringSuppressionUpdateAttributes) GetTagsOk() (*[]string, bool) {
313+
if o == nil || o.Tags == nil {
314+
return nil, false
315+
}
316+
return &o.Tags, true
317+
}
318+
319+
// HasTags returns a boolean if a field has been set.
320+
func (o *SecurityMonitoringSuppressionUpdateAttributes) HasTags() bool {
321+
return o != nil && o.Tags != nil
322+
}
323+
324+
// SetTags gets a reference to the given []string and assigns it to the Tags field.
325+
func (o *SecurityMonitoringSuppressionUpdateAttributes) SetTags(v []string) {
326+
o.Tags = v
327+
}
328+
299329
// GetVersion returns the Version field value if set, zero value otherwise.
300330
func (o *SecurityMonitoringSuppressionUpdateAttributes) GetVersion() int32 {
301331
if o == nil || o.Version == nil {
@@ -354,6 +384,9 @@ func (o SecurityMonitoringSuppressionUpdateAttributes) MarshalJSON() ([]byte, er
354384
if o.SuppressionQuery != nil {
355385
toSerialize["suppression_query"] = o.SuppressionQuery
356386
}
387+
if o.Tags != nil {
388+
toSerialize["tags"] = o.Tags
389+
}
357390
if o.Version != nil {
358391
toSerialize["version"] = o.Version
359392
}
@@ -375,14 +408,15 @@ func (o *SecurityMonitoringSuppressionUpdateAttributes) UnmarshalJSON(bytes []by
375408
RuleQuery *string `json:"rule_query,omitempty"`
376409
StartDate datadog.NullableInt64 `json:"start_date,omitempty"`
377410
SuppressionQuery *string `json:"suppression_query,omitempty"`
411+
Tags []string `json:"tags,omitempty"`
378412
Version *int32 `json:"version,omitempty"`
379413
}{}
380414
if err = datadog.Unmarshal(bytes, &all); err != nil {
381415
return datadog.Unmarshal(bytes, &o.UnparsedObject)
382416
}
383417
additionalProperties := make(map[string]interface{})
384418
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
385-
datadog.DeleteKeys(additionalProperties, &[]string{"data_exclusion_query", "description", "enabled", "expiration_date", "name", "rule_query", "start_date", "suppression_query", "version"})
419+
datadog.DeleteKeys(additionalProperties, &[]string{"data_exclusion_query", "description", "enabled", "expiration_date", "name", "rule_query", "start_date", "suppression_query", "tags", "version"})
386420
} else {
387421
return err
388422
}
@@ -394,6 +428,7 @@ func (o *SecurityMonitoringSuppressionUpdateAttributes) UnmarshalJSON(bytes []by
394428
o.RuleQuery = all.RuleQuery
395429
o.StartDate = all.StartDate
396430
o.SuppressionQuery = all.SuppressionQuery
431+
o.Tags = all.Tags
397432
o.Version = all.Version
398433

399434
if len(additionalProperties) > 0 {

examples/v2/security-monitoring/CreateSecurityMonitoringSuppression.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ func main() {
2323
Name: "Example-Security-Monitoring",
2424
RuleQuery: "type:log_detection source:cloudtrail",
2525
SuppressionQuery: datadog.PtrString("env:staging status:low"),
26+
Tags: []string{
27+
"technique:T1110-brute-force",
28+
"source:cloudtrail",
29+
},
2630
},
2731
Type: datadogV2.SECURITYMONITORINGSUPPRESSIONTYPE_SUPPRESSIONS,
2832
},
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-11-27T15:22:34.711Z
1+
2025-11-07T12:27:25.514Z

tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_a_suppression_rule_returns_OK_response.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
interactions:
22
- request:
33
body: |
4-
{"data":{"attributes":{"description":"This rule suppresses low-severity signals in staging environments.","enabled":true,"expiration_date":1734535354000,"name":"Test-Create_a_suppression_rule_returns_OK_response-1732720954","rule_query":"type:log_detection source:cloudtrail","start_date":1733584954000,"suppression_query":"env:staging status:low"},"type":"suppressions"}}
4+
{"data":{"attributes":{"description":"This rule suppresses low-severity signals in staging environments.","enabled":true,"expiration_date":1764332845000,"name":"Test-Create_a_suppression_rule_returns_OK_response-1762518445","rule_query":"type:log_detection source:cloudtrail","start_date":1763382445000,"suppression_query":"env:staging status:low","tags":["technique:T1110-brute-force","source:cloudtrail"]},"type":"suppressions"}}
55
form: {}
66
headers:
77
Accept:
@@ -12,10 +12,12 @@ interactions:
1212
method: POST
1313
url: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions
1414
response:
15-
body: '{"data":{"id":"ejv-ksi-r4j","type":"suppressions","attributes":{"creation_date":1732720954868,"creator":{"handle":"frog@datadoghq.com","name":""},"data_exclusion_query":"","description":"This
16-
rule suppresses low-severity signals in staging environments.","editable":true,"enabled":true,"expiration_date":1734535354000,"name":"Test-Create_a_suppression_rule_returns_OK_response-1732720954","rule_query":"type:log_detection
17-
source:cloudtrail","start_date":1733584954000,"suppression_query":"env:staging
18-
status:low","update_date":1732720954868,"updater":{"handle":"frog@datadoghq.com","name":""},"version":1}}}'
15+
body: '{"data":{"id":"oxk-jlo-pc8","type":"suppressions","attributes":{"creation_date":1762518446390,"creator":{"handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI
16+
Account"},"data_exclusion_query":"","description":"This rule suppresses low-severity
17+
signals in staging environments.","editable":true,"enabled":true,"expiration_date":1764332845000,"name":"Test-Create_a_suppression_rule_returns_OK_response-1762518445","rule_query":"type:log_detection
18+
source:cloudtrail","start_date":1763382445000,"suppression_query":"env:staging
19+
status:low","tags":["source:cloudtrail","technique:T1110-brute-force"],"update_date":1762518446390,"updater":{"handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI
20+
Account"},"version":1}}}'
1921
code: 200
2022
duration: 0ms
2123
headers:
@@ -30,7 +32,7 @@ interactions:
3032
- '*/*'
3133
id: 1
3234
method: DELETE
33-
url: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/ejv-ksi-r4j
35+
url: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/oxk-jlo-pc8
3436
response:
3537
body: ''
3638
code: 204
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-05-10T16:34:39.853Z
1+
2025-11-07T12:27:26.759Z

0 commit comments

Comments
 (0)