Skip to content

Commit

Permalink
Merge pull request #15 from signalsciences/AddBlockDurationSeconds
Browse files Browse the repository at this point in the history
'' is a valid value, dont omit on empty
  • Loading branch information
jhanrahan-sigsci committed Feb 2, 2021
2 parents 44c6a2a + 1263870 commit cf3f852
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
17 changes: 9 additions & 8 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ type UpdateSiteBody struct {
AgentLevel string `json:"agentLevel,omitempty"`
BlockDurationSeconds int `json:"blockDurationSeconds,omitempty"`
BlockHTTPCode int `json:"blockHTTPCode,omitempty"`
AgentAnonMode string `json:"agentAnonMode,omitempty"`
AgentAnonMode string `json:"agentAnonMode"`
}

// UpdateSite updates a site by name.
Expand Down Expand Up @@ -1827,7 +1827,7 @@ type CreateSiteBody struct {
Name string `json:"name,omitempty"` //Identifying name of the site
DisplayName string `json:"displayName,omitempty"` //Display name of the site
AgentLevel string `json:"agentLevel,omitempty"` //Agent action level - 'block', 'log' or 'off'
AgentAnonMode string `json:"agentAnonMode,omitempty"` //Agent IP anonimization mode - 'EU' or ''
AgentAnonMode string `json:"agentAnonMode"` //Agent IP anonimization mode - 'EU' or ''
BlockHTTPCode int `json:"blockHTTPCode,omitempty"` //HTTP response code to send when when traffic is being blocked
BlockDurationSeconds int `json:"blockDurationSeconds,omitempty"` //Duration to block an IP in seconds
}
Expand Down Expand Up @@ -2516,12 +2516,13 @@ type DetectionUpdateBody struct {

//AlertUpdateBody body needed to update an alert
type AlertUpdateBody struct {
LongName string `json:"longName"`
Interval int `json:"interval"` // 1, 10 or 60
Threshold int `json:"threshold"` // greater than 0, max 10000
SkipNotifications bool `json:"skipNotifications,omitempty"`
Enabled bool `json:"enabled"`
Action string `json:"action"`
LongName string `json:"longName"`
Interval int `json:"interval"` // 1, 10 or 60
Threshold int `json:"threshold"` // greater than 0, max 10000
SkipNotifications bool `json:"skipNotifications,omitempty"`
Enabled bool `json:"enabled"`
Action string `json:"action"`
BlockDurationSeconds int `json:"blockDurationSeconds,omitempty"`
}

// SiteTemplateRuleBody needed to update a site template rule
Expand Down
13 changes: 7 additions & 6 deletions api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1041,12 +1041,13 @@ func TestCreateReadUpdateDeleteSiteTemplate(t *testing.T) {
AlertAdds: []Alert{
{
AlertUpdateBody: AlertUpdateBody{
LongName: "LOGINATTEMPT-50-in-1",
Interval: 1,
Threshold: 50,
SkipNotifications: true,
Enabled: true,
Action: "info",
LongName: "LOGINATTEMPT-50-in-1",
Interval: 1,
Threshold: 50,
SkipNotifications: true,
Enabled: true,
Action: "info",
BlockDurationSeconds: 99677,
}},
},
AlertUpdates: []Alert{},
Expand Down

0 comments on commit cf3f852

Please sign in to comment.