Skip to content

Commit

Permalink
Merge pull request #1510 from MattDavis00/mattdavis/DLP-1479
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbednarz committed Mar 4, 2024
2 parents 7a070bc + 350bc11 commit 7789ba8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 22 deletions.
3 changes: 3 additions & 0 deletions .changelog/1510.txt
@@ -0,0 +1,3 @@
```release-note:bug
dlp: added optional ContextAwareness support
```
13 changes: 7 additions & 6 deletions dlp_profile.go
Expand Up @@ -50,12 +50,13 @@ type DLPContextAwareness struct {
// DLPProfile represents a DLP Profile, which contains a set
// of entries.
type DLPProfile struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Description string `json:"description,omitempty"`
AllowedMatchCount int `json:"allowed_match_count"`
ContextAwareness DLPContextAwareness `json:"context_awareness,omitempty"`
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Description string `json:"description,omitempty"`
AllowedMatchCount int `json:"allowed_match_count"`

ContextAwareness *DLPContextAwareness `json:"context_awareness,omitempty"`

// The following fields are omitted for predefined DLP
// profiles.
Expand Down
21 changes: 5 additions & 16 deletions dlp_profile_test.go
Expand Up @@ -75,13 +75,7 @@ func TestDLPProfiles(t *testing.T) {
"updated_at": "2022-10-18T08:00:57Z",
"type": "custom",
"description": "just a custom profile example",
"allowed_match_count": 1,
"context_awareness": {
"enabled": false,
"skip": {
"files": false
}
}
"allowed_match_count": 1
}
]
}
Expand All @@ -98,7 +92,7 @@ func TestDLPProfiles(t *testing.T) {
Type: "predefined",
Description: "",
AllowedMatchCount: 0,
ContextAwareness: DLPContextAwareness{
ContextAwareness: &DLPContextAwareness{
Enabled: BoolPtr(true),
Skip: DLPContextAwarenessSkip{
Files: BoolPtr(true),
Expand Down Expand Up @@ -126,12 +120,7 @@ func TestDLPProfiles(t *testing.T) {
Type: "custom",
Description: "just a custom profile example",
AllowedMatchCount: 1,
ContextAwareness: DLPContextAwareness{
Enabled: BoolPtr(false),
Skip: DLPContextAwarenessSkip{
Files: BoolPtr(false),
},
},
// Omit ContextAwareness to test ContextAwareness optionality
Entries: []DLPEntry{
{
ID: "ef79b054-12d4-4067-bb30-b85f6267b91c",
Expand Down Expand Up @@ -211,7 +200,7 @@ func TestGetDLPProfile(t *testing.T) {
Type: "custom",
Description: "just a custom profile example",
AllowedMatchCount: 42,
ContextAwareness: DLPContextAwareness{
ContextAwareness: &DLPContextAwareness{
Enabled: BoolPtr(false),
Skip: DLPContextAwarenessSkip{
Files: BoolPtr(false),
Expand Down Expand Up @@ -586,7 +575,7 @@ func TestUpdateDLPPredefinedProfile(t *testing.T) {
Type: "predefined",
Description: "example predefined profile",
AllowedMatchCount: 0,
ContextAwareness: DLPContextAwareness{
ContextAwareness: &DLPContextAwareness{
Enabled: BoolPtr(true),
Skip: DLPContextAwarenessSkip{
Files: BoolPtr(true),
Expand Down

0 comments on commit 7789ba8

Please sign in to comment.