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

GATE-4074: Adds support for the new Protocol Detection feature to teams accounts #1340

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/1340.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
teams-accounts: Adds support for protocol detection
```
17 changes: 11 additions & 6 deletions teams_accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ type TeamsConfiguration struct {
}

type TeamsAccountSettings struct {
Antivirus *TeamsAntivirus `json:"antivirus,omitempty"`
TLSDecrypt *TeamsTLSDecrypt `json:"tls_decrypt,omitempty"`
ActivityLog *TeamsActivityLog `json:"activity_log,omitempty"`
BlockPage *TeamsBlockPage `json:"block_page,omitempty"`
BrowserIsolation *BrowserIsolation `json:"browser_isolation,omitempty"`
FIPS *TeamsFIPS `json:"fips,omitempty"`
Antivirus *TeamsAntivirus `json:"antivirus,omitempty"`
TLSDecrypt *TeamsTLSDecrypt `json:"tls_decrypt,omitempty"`
ActivityLog *TeamsActivityLog `json:"activity_log,omitempty"`
BlockPage *TeamsBlockPage `json:"block_page,omitempty"`
BrowserIsolation *BrowserIsolation `json:"browser_isolation,omitempty"`
FIPS *TeamsFIPS `json:"fips,omitempty"`
ProtocolDetection *TeamsProtocolDetection `json:"protocol_detection,omitempty"`
}

type BrowserIsolation struct {
Expand All @@ -62,6 +63,10 @@ type TeamsTLSDecrypt struct {
Enabled bool `json:"enabled"`
}

type TeamsProtocolDetection struct {
Enabled bool `json:"enabled"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i do recommend all booleans as pointers but up to you folks - https://github.com/cloudflare/cloudflare-go/blob/master/docs/conventions.md#booleans

}

type TeamsActivityLog struct {
Enabled bool `json:"enabled"`
}
Expand Down
22 changes: 15 additions & 7 deletions teams_accounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ func TestTeamsAccountConfiguration(t *testing.T) {
"tls_decrypt": {
"enabled": true
},
"protocol_detection": {
"enabled": true
},
"fips": {
"tls": true
},
Expand Down Expand Up @@ -88,10 +91,11 @@ func TestTeamsAccountConfiguration(t *testing.T) {

if assert.NoError(t, err) {
assert.Equal(t, actual.Settings, TeamsAccountSettings{
Antivirus: &TeamsAntivirus{EnabledDownloadPhase: true},
ActivityLog: &TeamsActivityLog{Enabled: true},
TLSDecrypt: &TeamsTLSDecrypt{Enabled: true},
FIPS: &TeamsFIPS{TLS: true},
Antivirus: &TeamsAntivirus{EnabledDownloadPhase: true},
ActivityLog: &TeamsActivityLog{Enabled: true},
TLSDecrypt: &TeamsTLSDecrypt{Enabled: true},
ProtocolDetection: &TeamsProtocolDetection{Enabled: true},
FIPS: &TeamsFIPS{TLS: true},

BlockPage: &TeamsBlockPage{
Enabled: BoolPtr(true),
Expand Down Expand Up @@ -129,6 +133,9 @@ func TestTeamsAccountUpdateConfiguration(t *testing.T) {
},
"activity_log": {
"enabled": true
},
"protocol_detection": {
"enabled": true
}
}
}
Expand All @@ -137,9 +144,10 @@ func TestTeamsAccountUpdateConfiguration(t *testing.T) {
}

settings := TeamsAccountSettings{
Antivirus: &TeamsAntivirus{EnabledDownloadPhase: false},
ActivityLog: &TeamsActivityLog{Enabled: true},
TLSDecrypt: &TeamsTLSDecrypt{Enabled: true},
Antivirus: &TeamsAntivirus{EnabledDownloadPhase: false},
ActivityLog: &TeamsActivityLog{Enabled: true},
TLSDecrypt: &TeamsTLSDecrypt{Enabled: true},
ProtocolDetection: &TeamsProtocolDetection{Enabled: true},
}

mux.HandleFunc("/accounts/"+testAccountID+"/gateway/configuration", handler)
Expand Down