Skip to content

Commit

Permalink
DLP-1723: add ocr_enabled flag to DLP profiles (#1600)
Browse files Browse the repository at this point in the history
* DLP-1723: add ocr_enabled flag to DLP profiles

* add changelog

---------

Co-authored-by: Inanna Malick <inanna@cloudflare.com>
Co-authored-by: Jacob Bednarz <jacob.bednarz@gmail.com>
  • Loading branch information
3 people committed Mar 25, 2024
1 parent 694d672 commit 18282f1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changelog/1600.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
dlp: Adds support for ocr_enabled boolean flag
```
1 change: 1 addition & 0 deletions dlp_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type DLPProfile struct {
Type string `json:"type,omitempty"`
Description string `json:"description,omitempty"`
AllowedMatchCount int `json:"allowed_match_count"`
OCREnabled *bool `json:"ocr_enabled,omitempty"`

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

Expand Down
12 changes: 9 additions & 3 deletions dlp_profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ func TestDLPProfiles(t *testing.T) {
"skip": {
"files": true
}
}
},
"ocr_enabled": false
},
{
"id": "29678c26-a191-428d-9f63-6e20a4a636a4",
Expand All @@ -75,7 +76,8 @@ func TestDLPProfiles(t *testing.T) {
"updated_at": "2022-10-18T08:00:57Z",
"type": "custom",
"description": "just a custom profile example",
"allowed_match_count": 1
"allowed_match_count": 1,
"ocr_enabled": true
}
]
}
Expand All @@ -98,6 +100,7 @@ func TestDLPProfiles(t *testing.T) {
Files: BoolPtr(true),
},
},
OCREnabled: BoolPtr(false),
Entries: []DLPEntry{
{
ID: "111b9d4b-a5c6-40f0-957d-9d53b25dd84a",
Expand All @@ -121,6 +124,7 @@ func TestDLPProfiles(t *testing.T) {
Description: "just a custom profile example",
AllowedMatchCount: 1,
// Omit ContextAwareness to test ContextAwareness optionality
OCREnabled: BoolPtr(true),
Entries: []DLPEntry{
{
ID: "ef79b054-12d4-4067-bb30-b85f6267b91c",
Expand Down Expand Up @@ -271,7 +275,8 @@ func TestCreateDLPCustomProfiles(t *testing.T) {
"updated_at": "2022-10-18T08:00:57Z",
"type": "custom",
"description": "`+requestProfile.Description+`",
"allowed_match_count": 0
"allowed_match_count": 0,
"ocr_enabled": true
}]
}`)
}
Expand Down Expand Up @@ -303,6 +308,7 @@ func TestCreateDLPCustomProfiles(t *testing.T) {
CreatedAt: &createdAt,
UpdatedAt: &updatedAt,
AllowedMatchCount: 0,
OCREnabled: BoolPtr(true),
},
}

Expand Down

0 comments on commit 18282f1

Please sign in to comment.