Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add priority field to SDS rule and standard-pattern #2317

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2023-12-13 18:05:04.193744",
"spec_repo_commit": "493effcf"
"regenerated": "2023-12-14 10:49:24.189468",
"spec_repo_commit": "43a99a56"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2023-12-13 18:05:04.210011",
"spec_repo_commit": "493effcf"
"regenerated": "2023-12-14 10:49:24.208935",
"spec_repo_commit": "43a99a56"
}
}
}
13 changes: 13 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16320,6 +16320,12 @@ components:
pattern:
description: Not included if there is a relationship to a standard pattern.
type: string
priority:
description: Integer from 1 (high) to 5 (low) indicating rule issue severity.
format: int64
maximum: 5
minimum: 1
type: integer
tags:
description: List of tags.
items:
Expand Down Expand Up @@ -16475,6 +16481,13 @@ components:
pattern:
description: Regex to match.
type: string
priority:
description: Integer from 1 (high) to 5 (low) indicating standard pattern
issue severity.
format: int64
maximum: 5
minimum: 1
type: integer
tags:
description: List of tags.
items:
Expand Down
37 changes: 36 additions & 1 deletion api/datadogV2/model_sensitive_data_scanner_rule_attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ type SensitiveDataScannerRuleAttributes struct {
Namespaces []string `json:"namespaces,omitempty"`
// Not included if there is a relationship to a standard pattern.
Pattern *string `json:"pattern,omitempty"`
// Integer from 1 (high) to 5 (low) indicating rule issue severity.
Priority *int64 `json:"priority,omitempty"`
// List of tags.
Tags []string `json:"tags,omitempty"`
// Object describing how the scanned event will be replaced.
Expand Down Expand Up @@ -217,6 +219,34 @@ func (o *SensitiveDataScannerRuleAttributes) SetPattern(v string) {
o.Pattern = &v
}

// GetPriority returns the Priority field value if set, zero value otherwise.
func (o *SensitiveDataScannerRuleAttributes) GetPriority() int64 {
if o == nil || o.Priority == nil {
var ret int64
return ret
}
return *o.Priority
}

// GetPriorityOk returns a tuple with the Priority field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SensitiveDataScannerRuleAttributes) GetPriorityOk() (*int64, bool) {
if o == nil || o.Priority == nil {
return nil, false
}
return o.Priority, true
}

// HasPriority returns a boolean if a field has been set.
func (o *SensitiveDataScannerRuleAttributes) HasPriority() bool {
return o != nil && o.Priority != nil
}

// SetPriority gets a reference to the given int64 and assigns it to the Priority field.
func (o *SensitiveDataScannerRuleAttributes) SetPriority(v int64) {
o.Priority = &v
}

// GetTags returns the Tags field value if set, zero value otherwise.
func (o *SensitiveDataScannerRuleAttributes) GetTags() []string {
if o == nil || o.Tags == nil {
Expand Down Expand Up @@ -297,6 +327,9 @@ func (o SensitiveDataScannerRuleAttributes) MarshalJSON() ([]byte, error) {
if o.Pattern != nil {
toSerialize["pattern"] = o.Pattern
}
if o.Priority != nil {
toSerialize["priority"] = o.Priority
}
if o.Tags != nil {
toSerialize["tags"] = o.Tags
}
Expand All @@ -319,6 +352,7 @@ func (o *SensitiveDataScannerRuleAttributes) UnmarshalJSON(bytes []byte) (err er
Name *string `json:"name,omitempty"`
Namespaces []string `json:"namespaces,omitempty"`
Pattern *string `json:"pattern,omitempty"`
Priority *int64 `json:"priority,omitempty"`
Tags []string `json:"tags,omitempty"`
TextReplacement *SensitiveDataScannerTextReplacement `json:"text_replacement,omitempty"`
}{}
Expand All @@ -327,7 +361,7 @@ func (o *SensitiveDataScannerRuleAttributes) UnmarshalJSON(bytes []byte) (err er
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"description", "excluded_namespaces", "is_enabled", "name", "namespaces", "pattern", "tags", "text_replacement"})
datadog.DeleteKeys(additionalProperties, &[]string{"description", "excluded_namespaces", "is_enabled", "name", "namespaces", "pattern", "priority", "tags", "text_replacement"})
} else {
return err
}
Expand All @@ -339,6 +373,7 @@ func (o *SensitiveDataScannerRuleAttributes) UnmarshalJSON(bytes []byte) (err er
o.Name = all.Name
o.Namespaces = all.Namespaces
o.Pattern = all.Pattern
o.Priority = all.Priority
o.Tags = all.Tags
if all.TextReplacement != nil && all.TextReplacement.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ type SensitiveDataScannerStandardPatternAttributes struct {
Name *string `json:"name,omitempty"`
// Regex to match.
Pattern *string `json:"pattern,omitempty"`
// Integer from 1 (high) to 5 (low) indicating standard pattern issue severity.
Priority *int64 `json:"priority,omitempty"`
// List of tags.
Tags []string `json:"tags,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
Expand Down Expand Up @@ -154,6 +156,34 @@ func (o *SensitiveDataScannerStandardPatternAttributes) SetPattern(v string) {
o.Pattern = &v
}

// GetPriority returns the Priority field value if set, zero value otherwise.
func (o *SensitiveDataScannerStandardPatternAttributes) GetPriority() int64 {
if o == nil || o.Priority == nil {
var ret int64
return ret
}
return *o.Priority
}

// GetPriorityOk returns a tuple with the Priority field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SensitiveDataScannerStandardPatternAttributes) GetPriorityOk() (*int64, bool) {
if o == nil || o.Priority == nil {
return nil, false
}
return o.Priority, true
}

// HasPriority returns a boolean if a field has been set.
func (o *SensitiveDataScannerStandardPatternAttributes) HasPriority() bool {
return o != nil && o.Priority != nil
}

// SetPriority gets a reference to the given int64 and assigns it to the Priority field.
func (o *SensitiveDataScannerStandardPatternAttributes) SetPriority(v int64) {
o.Priority = &v
}

// GetTags returns the Tags field value if set, zero value otherwise.
func (o *SensitiveDataScannerStandardPatternAttributes) GetTags() []string {
if o == nil || o.Tags == nil {
Expand Down Expand Up @@ -200,6 +230,9 @@ func (o SensitiveDataScannerStandardPatternAttributes) MarshalJSON() ([]byte, er
if o.Pattern != nil {
toSerialize["pattern"] = o.Pattern
}
if o.Priority != nil {
toSerialize["priority"] = o.Priority
}
if o.Tags != nil {
toSerialize["tags"] = o.Tags
}
Expand All @@ -217,21 +250,23 @@ func (o *SensitiveDataScannerStandardPatternAttributes) UnmarshalJSON(bytes []by
IncludedKeywords []string `json:"included_keywords,omitempty"`
Name *string `json:"name,omitempty"`
Pattern *string `json:"pattern,omitempty"`
Priority *int64 `json:"priority,omitempty"`
Tags []string `json:"tags,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"description", "included_keywords", "name", "pattern", "tags"})
datadog.DeleteKeys(additionalProperties, &[]string{"description", "included_keywords", "name", "pattern", "priority", "tags"})
} else {
return err
}
o.Description = all.Description
o.IncludedKeywords = all.IncludedKeywords
o.Name = all.Name
o.Pattern = all.Pattern
o.Priority = all.Priority
o.Tags = all.Tags

if len(additionalProperties) > 0 {
Expand Down
1 change: 1 addition & 0 deletions examples/v2/sensitive-data-scanner/CreateScanningRule.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func main() {
"sensitive_data:true",
},
IsEnabled: datadog.PtrBool(true),
Priority: datadog.PtrInt64(1),
},
Relationships: datadogV2.SensitiveDataScannerRuleRelationships{
Group: &datadogV2.SensitiveDataScannerGroupData{
Expand Down
1 change: 1 addition & 0 deletions examples/v2/sensitive-data-scanner/UpdateScanningRule.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func main() {
"sensitive_data:true",
},
IsEnabled: datadog.PtrBool(true),
Priority: datadog.PtrInt64(5),
},
Relationships: &datadogV2.SensitiveDataScannerRuleRelationships{
Group: &datadogV2.SensitiveDataScannerGroupData{
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-01-24T13:12:12.388Z
2023-12-13T09:06:38.820Z
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interactions:
method: GET
url: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config
response:
body: '{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","attributes":{},"type":"sensitive_data_scanner_configuration","relationships":{"groups":{"data":[]}}},"meta":{"version":12574,"count_limit":100,"group_count_limit":20,"is_pci_compliant":false,"has_highlight_enabled":true,"has_multi_pass_enabled":true}}
body: '{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","attributes":{},"type":"sensitive_data_scanner_configuration","relationships":{"groups":{"data":[{"id":"z9vY6YO8R-2q6dv_rTUOCA","type":"sensitive_data_scanner_group"},{"id":"01OnORacS5qHeVO7C97drg","type":"sensitive_data_scanner_group"}]}}},"meta":{"version":127243,"count_limit":100,"group_count_limit":20,"is_pci_compliant":false,"has_highlight_enabled":true,"has_multi_pass_enabled":true},"included":[{"id":"z9vY6YO8R-2q6dv_rTUOCA","attributes":{"name":"Example-Update_Scanning_Group_returns_OK_response_1696199477","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},{"id":"01OnORacS5qHeVO7C97drg","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}}]}

'
code: 200
Expand All @@ -29,7 +29,7 @@ interactions:
method: POST
url: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/groups
response:
body: '{"data":{"id":"z7iUhBfcSR6-1kTCPtmdpg","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},"meta":{"version":12575}}
body: '{"data":{"id":"Dyurbbz2Tk23SMEr4fcHCw","attributes":{"name":"my-test-group","is_enabled":false,"filter":{"query":"*"},"product_list":["logs"]},"type":"sensitive_data_scanner_group","relationships":{"configuration":{"data":{"id":"7957915c634d4dcb581fa154157f5ad9c2947f50be632fb5599862069f4d2d87","type":"sensitive_data_scanner_configuration"}},"rules":{"data":[]}}},"meta":{"version":127244}}

'
code: 200
Expand All @@ -40,7 +40,7 @@ interactions:
status: 200 OK
- request:
body: |
{"data":{"attributes":{"excluded_namespaces":["admin.name"],"is_enabled":true,"name":"Test-Create_Scanning_Rule_returns_OK_response-1674565932","namespaces":["admin"],"pattern":"pattern","tags":["sensitive_data:true"],"text_replacement":{"type":"none"}},"relationships":{"group":{"data":{"id":"z7iUhBfcSR6-1kTCPtmdpg","type":"sensitive_data_scanner_group"}}},"type":"sensitive_data_scanner_rule"},"meta":{}}
{"data":{"attributes":{"excluded_namespaces":["admin.name"],"is_enabled":true,"name":"Test-Create_Scanning_Rule_returns_OK_response-1702458398","namespaces":["admin"],"pattern":"pattern","priority":1,"tags":["sensitive_data:true"],"text_replacement":{"type":"none"}},"relationships":{"group":{"data":{"id":"Dyurbbz2Tk23SMEr4fcHCw","type":"sensitive_data_scanner_group"}}},"type":"sensitive_data_scanner_rule"},"meta":{}}
form: {}
headers:
Accept:
Expand All @@ -50,7 +50,7 @@ interactions:
method: POST
url: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/rules
response:
body: '{"data":{"id":"r3NAGDIXQcSyNhfFPUZLSg","attributes":{"name":"Test-Create_Scanning_Rule_returns_OK_response-1674565932","namespaces":["admin"],"excluded_namespaces":["admin.name"],"pattern":"pattern","text_replacement":{"type":"none"},"tags":["sensitive_data:true"],"is_enabled":true},"type":"sensitive_data_scanner_rule","relationships":{"group":{"data":{"id":"z7iUhBfcSR6-1kTCPtmdpg","type":"sensitive_data_scanner_group"}}}},"meta":{"version":12576}}
body: '{"data":{"id":"Xp3fpaEhSGKqtDFmXvJZwQ","attributes":{"name":"Test-Create_Scanning_Rule_returns_OK_response-1702458398","namespaces":["admin"],"excluded_namespaces":["admin.name"],"pattern":"pattern","text_replacement":{"type":"none"},"tags":["sensitive_data:true"],"is_enabled":true,"priority":1},"type":"sensitive_data_scanner_rule","relationships":{"group":{"data":{"id":"Dyurbbz2Tk23SMEr4fcHCw","type":"sensitive_data_scanner_group"}}}},"meta":{"version":127245}}

'
code: 200
Expand All @@ -69,9 +69,9 @@ interactions:
Content-Type:
- application/json
method: DELETE
url: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/rules/r3NAGDIXQcSyNhfFPUZLSg
url: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/rules/Xp3fpaEhSGKqtDFmXvJZwQ
response:
body: '{"meta":{"version":12577}}
body: '{"meta":{"version":127246}}

'
code: 200
Expand All @@ -90,9 +90,9 @@ interactions:
Content-Type:
- application/json
method: DELETE
url: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/groups/z7iUhBfcSR6-1kTCPtmdpg
url: https://api.datadoghq.com/api/v2/sensitive-data-scanner/config/groups/Dyurbbz2Tk23SMEr4fcHCw
response:
body: '{"meta":{"version":12578}}
body: '{"meta":{"version":127247}}

'
code: 200
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-01-24T13:12:20.575Z
2023-12-13T09:06:40.913Z
Loading
Loading