Skip to content

Commit 54f6f56

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add suppressions to SensitiveDataScannerRule resource (#3564)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 46aa7c7 commit 54f6f56

26 files changed

Lines changed: 346 additions & 96 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56089,8 +56089,9 @@ components:
5608956089

5609056090
The number of keywords in the list must be less than or equal to 30.'
5609156091
example:
56092-
- credit card
56093-
- cc
56092+
- email
56093+
- address
56094+
- login
5609456095
items:
5609556096
type: string
5609656097
type: array
@@ -56229,6 +56230,8 @@ components:
5622956230
maximum: 5
5623056231
minimum: 1
5623156232
type: integer
56233+
suppressions:
56234+
$ref: '#/components/schemas/SensitiveDataScannerSuppressions'
5623256235
tags:
5623356236
description: List of tags.
5623456237
items:
@@ -56450,6 +56453,41 @@ components:
5645056453
type:
5645156454
$ref: '#/components/schemas/SensitiveDataScannerStandardPatternType'
5645256455
type: object
56456+
SensitiveDataScannerSuppressions:
56457+
description: 'Object describing the suppressions for a rule. There are three
56458+
types of suppressions, `starts_with`, `ends_with`, and `exact_match`.
56459+
56460+
Suppressed matches are not obfuscated, counted in metrics, or displayed in
56461+
the Findings page.'
56462+
properties:
56463+
ends_with:
56464+
description: List of strings to use for suppression of matches ending with
56465+
these strings.
56466+
example:
56467+
- '@example.com'
56468+
- another.example.com
56469+
items:
56470+
type: string
56471+
type: array
56472+
exact_match:
56473+
description: List of strings to use for suppression of matches exactly matching
56474+
these strings.
56475+
example:
56476+
- admin@example.com
56477+
- user@example.com
56478+
items:
56479+
type: string
56480+
type: array
56481+
starts_with:
56482+
description: List of strings to use for suppression of matches starting
56483+
with these strings.
56484+
example:
56485+
- admin
56486+
- user
56487+
items:
56488+
type: string
56489+
type: array
56490+
type: object
5645356491
SensitiveDataScannerTextReplacement:
5645456492
description: Object describing how the scanned event will be replaced.
5645556493
properties:

api/datadogV2/model_sensitive_data_scanner_rule_attributes.go

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ type SensitiveDataScannerRuleAttributes struct {
3030
Pattern *string `json:"pattern,omitempty"`
3131
// Integer from 1 (high) to 5 (low) indicating rule issue severity.
3232
Priority *int64 `json:"priority,omitempty"`
33+
// Object describing the suppressions for a rule. There are three types of suppressions, `starts_with`, `ends_with`, and `exact_match`.
34+
// Suppressed matches are not obfuscated, counted in metrics, or displayed in the Findings page.
35+
Suppressions *SensitiveDataScannerSuppressions `json:"suppressions,omitempty"`
3336
// List of tags.
3437
Tags []string `json:"tags,omitempty"`
3538
// Object describing how the scanned event will be replaced.
@@ -280,6 +283,34 @@ func (o *SensitiveDataScannerRuleAttributes) SetPriority(v int64) {
280283
o.Priority = &v
281284
}
282285

286+
// GetSuppressions returns the Suppressions field value if set, zero value otherwise.
287+
func (o *SensitiveDataScannerRuleAttributes) GetSuppressions() SensitiveDataScannerSuppressions {
288+
if o == nil || o.Suppressions == nil {
289+
var ret SensitiveDataScannerSuppressions
290+
return ret
291+
}
292+
return *o.Suppressions
293+
}
294+
295+
// GetSuppressionsOk returns a tuple with the Suppressions field value if set, nil otherwise
296+
// and a boolean to check if the value has been set.
297+
func (o *SensitiveDataScannerRuleAttributes) GetSuppressionsOk() (*SensitiveDataScannerSuppressions, bool) {
298+
if o == nil || o.Suppressions == nil {
299+
return nil, false
300+
}
301+
return o.Suppressions, true
302+
}
303+
304+
// HasSuppressions returns a boolean if a field has been set.
305+
func (o *SensitiveDataScannerRuleAttributes) HasSuppressions() bool {
306+
return o != nil && o.Suppressions != nil
307+
}
308+
309+
// SetSuppressions gets a reference to the given SensitiveDataScannerSuppressions and assigns it to the Suppressions field.
310+
func (o *SensitiveDataScannerRuleAttributes) SetSuppressions(v SensitiveDataScannerSuppressions) {
311+
o.Suppressions = &v
312+
}
313+
283314
// GetTags returns the Tags field value if set, zero value otherwise.
284315
func (o *SensitiveDataScannerRuleAttributes) GetTags() []string {
285316
if o == nil || o.Tags == nil {
@@ -366,6 +397,9 @@ func (o SensitiveDataScannerRuleAttributes) MarshalJSON() ([]byte, error) {
366397
if o.Priority != nil {
367398
toSerialize["priority"] = o.Priority
368399
}
400+
if o.Suppressions != nil {
401+
toSerialize["suppressions"] = o.Suppressions
402+
}
369403
if o.Tags != nil {
370404
toSerialize["tags"] = o.Tags
371405
}
@@ -390,6 +424,7 @@ func (o *SensitiveDataScannerRuleAttributes) UnmarshalJSON(bytes []byte) (err er
390424
Namespaces []string `json:"namespaces,omitempty"`
391425
Pattern *string `json:"pattern,omitempty"`
392426
Priority *int64 `json:"priority,omitempty"`
427+
Suppressions *SensitiveDataScannerSuppressions `json:"suppressions,omitempty"`
393428
Tags []string `json:"tags,omitempty"`
394429
TextReplacement *SensitiveDataScannerTextReplacement `json:"text_replacement,omitempty"`
395430
}{}
@@ -398,7 +433,7 @@ func (o *SensitiveDataScannerRuleAttributes) UnmarshalJSON(bytes []byte) (err er
398433
}
399434
additionalProperties := make(map[string]interface{})
400435
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
401-
datadog.DeleteKeys(additionalProperties, &[]string{"description", "excluded_namespaces", "included_keyword_configuration", "is_enabled", "name", "namespaces", "pattern", "priority", "tags", "text_replacement"})
436+
datadog.DeleteKeys(additionalProperties, &[]string{"description", "excluded_namespaces", "included_keyword_configuration", "is_enabled", "name", "namespaces", "pattern", "priority", "suppressions", "tags", "text_replacement"})
402437
} else {
403438
return err
404439
}
@@ -415,6 +450,10 @@ func (o *SensitiveDataScannerRuleAttributes) UnmarshalJSON(bytes []byte) (err er
415450
o.Namespaces = all.Namespaces
416451
o.Pattern = all.Pattern
417452
o.Priority = all.Priority
453+
if all.Suppressions != nil && all.Suppressions.UnparsedObject != nil && o.UnparsedObject == nil {
454+
hasInvalidField = true
455+
}
456+
o.Suppressions = all.Suppressions
418457
o.Tags = all.Tags
419458
if all.TextReplacement != nil && all.TextReplacement.UnparsedObject != nil && o.UnparsedObject == nil {
420459
hasInvalidField = true
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV2
6+
7+
import (
8+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
9+
)
10+
11+
// SensitiveDataScannerSuppressions Object describing the suppressions for a rule. There are three types of suppressions, `starts_with`, `ends_with`, and `exact_match`.
12+
// Suppressed matches are not obfuscated, counted in metrics, or displayed in the Findings page.
13+
type SensitiveDataScannerSuppressions struct {
14+
// List of strings to use for suppression of matches ending with these strings.
15+
EndsWith []string `json:"ends_with,omitempty"`
16+
// List of strings to use for suppression of matches exactly matching these strings.
17+
ExactMatch []string `json:"exact_match,omitempty"`
18+
// List of strings to use for suppression of matches starting with these strings.
19+
StartsWith []string `json:"starts_with,omitempty"`
20+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
21+
UnparsedObject map[string]interface{} `json:"-"`
22+
AdditionalProperties map[string]interface{} `json:"-"`
23+
}
24+
25+
// NewSensitiveDataScannerSuppressions instantiates a new SensitiveDataScannerSuppressions object.
26+
// This constructor will assign default values to properties that have it defined,
27+
// and makes sure properties required by API are set, but the set of arguments
28+
// will change when the set of required properties is changed.
29+
func NewSensitiveDataScannerSuppressions() *SensitiveDataScannerSuppressions {
30+
this := SensitiveDataScannerSuppressions{}
31+
return &this
32+
}
33+
34+
// NewSensitiveDataScannerSuppressionsWithDefaults instantiates a new SensitiveDataScannerSuppressions object.
35+
// This constructor will only assign default values to properties that have it defined,
36+
// but it doesn't guarantee that properties required by API are set.
37+
func NewSensitiveDataScannerSuppressionsWithDefaults() *SensitiveDataScannerSuppressions {
38+
this := SensitiveDataScannerSuppressions{}
39+
return &this
40+
}
41+
42+
// GetEndsWith returns the EndsWith field value if set, zero value otherwise.
43+
func (o *SensitiveDataScannerSuppressions) GetEndsWith() []string {
44+
if o == nil || o.EndsWith == nil {
45+
var ret []string
46+
return ret
47+
}
48+
return o.EndsWith
49+
}
50+
51+
// GetEndsWithOk returns a tuple with the EndsWith field value if set, nil otherwise
52+
// and a boolean to check if the value has been set.
53+
func (o *SensitiveDataScannerSuppressions) GetEndsWithOk() (*[]string, bool) {
54+
if o == nil || o.EndsWith == nil {
55+
return nil, false
56+
}
57+
return &o.EndsWith, true
58+
}
59+
60+
// HasEndsWith returns a boolean if a field has been set.
61+
func (o *SensitiveDataScannerSuppressions) HasEndsWith() bool {
62+
return o != nil && o.EndsWith != nil
63+
}
64+
65+
// SetEndsWith gets a reference to the given []string and assigns it to the EndsWith field.
66+
func (o *SensitiveDataScannerSuppressions) SetEndsWith(v []string) {
67+
o.EndsWith = v
68+
}
69+
70+
// GetExactMatch returns the ExactMatch field value if set, zero value otherwise.
71+
func (o *SensitiveDataScannerSuppressions) GetExactMatch() []string {
72+
if o == nil || o.ExactMatch == nil {
73+
var ret []string
74+
return ret
75+
}
76+
return o.ExactMatch
77+
}
78+
79+
// GetExactMatchOk returns a tuple with the ExactMatch field value if set, nil otherwise
80+
// and a boolean to check if the value has been set.
81+
func (o *SensitiveDataScannerSuppressions) GetExactMatchOk() (*[]string, bool) {
82+
if o == nil || o.ExactMatch == nil {
83+
return nil, false
84+
}
85+
return &o.ExactMatch, true
86+
}
87+
88+
// HasExactMatch returns a boolean if a field has been set.
89+
func (o *SensitiveDataScannerSuppressions) HasExactMatch() bool {
90+
return o != nil && o.ExactMatch != nil
91+
}
92+
93+
// SetExactMatch gets a reference to the given []string and assigns it to the ExactMatch field.
94+
func (o *SensitiveDataScannerSuppressions) SetExactMatch(v []string) {
95+
o.ExactMatch = v
96+
}
97+
98+
// GetStartsWith returns the StartsWith field value if set, zero value otherwise.
99+
func (o *SensitiveDataScannerSuppressions) GetStartsWith() []string {
100+
if o == nil || o.StartsWith == nil {
101+
var ret []string
102+
return ret
103+
}
104+
return o.StartsWith
105+
}
106+
107+
// GetStartsWithOk returns a tuple with the StartsWith field value if set, nil otherwise
108+
// and a boolean to check if the value has been set.
109+
func (o *SensitiveDataScannerSuppressions) GetStartsWithOk() (*[]string, bool) {
110+
if o == nil || o.StartsWith == nil {
111+
return nil, false
112+
}
113+
return &o.StartsWith, true
114+
}
115+
116+
// HasStartsWith returns a boolean if a field has been set.
117+
func (o *SensitiveDataScannerSuppressions) HasStartsWith() bool {
118+
return o != nil && o.StartsWith != nil
119+
}
120+
121+
// SetStartsWith gets a reference to the given []string and assigns it to the StartsWith field.
122+
func (o *SensitiveDataScannerSuppressions) SetStartsWith(v []string) {
123+
o.StartsWith = v
124+
}
125+
126+
// MarshalJSON serializes the struct using spec logic.
127+
func (o SensitiveDataScannerSuppressions) MarshalJSON() ([]byte, error) {
128+
toSerialize := map[string]interface{}{}
129+
if o.UnparsedObject != nil {
130+
return datadog.Marshal(o.UnparsedObject)
131+
}
132+
if o.EndsWith != nil {
133+
toSerialize["ends_with"] = o.EndsWith
134+
}
135+
if o.ExactMatch != nil {
136+
toSerialize["exact_match"] = o.ExactMatch
137+
}
138+
if o.StartsWith != nil {
139+
toSerialize["starts_with"] = o.StartsWith
140+
}
141+
142+
for key, value := range o.AdditionalProperties {
143+
toSerialize[key] = value
144+
}
145+
return datadog.Marshal(toSerialize)
146+
}
147+
148+
// UnmarshalJSON deserializes the given payload.
149+
func (o *SensitiveDataScannerSuppressions) UnmarshalJSON(bytes []byte) (err error) {
150+
all := struct {
151+
EndsWith []string `json:"ends_with,omitempty"`
152+
ExactMatch []string `json:"exact_match,omitempty"`
153+
StartsWith []string `json:"starts_with,omitempty"`
154+
}{}
155+
if err = datadog.Unmarshal(bytes, &all); err != nil {
156+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
157+
}
158+
additionalProperties := make(map[string]interface{})
159+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
160+
datadog.DeleteKeys(additionalProperties, &[]string{"ends_with", "exact_match", "starts_with"})
161+
} else {
162+
return err
163+
}
164+
o.EndsWith = all.EndsWith
165+
o.ExactMatch = all.ExactMatch
166+
o.StartsWith = all.StartsWith
167+
168+
if len(additionalProperties) > 0 {
169+
o.AdditionalProperties = additionalProperties
170+
}
171+
172+
return nil
173+
}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2026-01-19T13:11:03.221Z
1+
2026-02-04T15:35:09.418Z

0 commit comments

Comments
 (0)