-
Notifications
You must be signed in to change notification settings - Fork 0
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
3456 Golang changes #255
base: master
Are you sure you want to change the base?
3456 Golang changes #255
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package quota | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
type QuotaConditions struct { | ||
Type string `json:"type"` | ||
Op string `json:"op"` | ||
Value string `json:"value"` | ||
Proto string `json:"proto"` | ||
} | ||
|
||
type QuotaExceedActions struct { | ||
ID string `json:"id"` | ||
Name string `json:name` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo - need double quotes around name There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ....still There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. HI @AlistairJohnParker , This code is no more used. We have moved this module to sync settings. Will talk to John S and invalidate this branch. Please ignore this for now. Thanks for the review. |
||
Description string `json:description` | ||
Action string `json:action` | ||
Priority string `json:priroity` | ||
Default bool `json:enabled` | ||
} | ||
|
||
type QuotaAction struct { | ||
Type string `json:"type"` | ||
QuotaID string `json:"quota_id"` | ||
ExceedActionID string `json:"exceed_action_id"` | ||
} | ||
|
||
type QuotaConfiguration struct { | ||
ID string `json:"id"` | ||
Name string `json:"name"` | ||
Description string `json:"description"` | ||
Period string `json:"period"` | ||
DataSize string `json:"datasize"` | ||
} | ||
|
||
type QuotaRules struct { | ||
ID string `json:"id"` | ||
Name string `json:"name"` | ||
Description string `json:"description"` | ||
Conditions []*QuotaConditions `json:"conditions"` | ||
Actions *QuotaAction `json:"action"` | ||
|
||
Command string | ||
MatchCmd string | ||
Timer *time.Ticker | ||
ChSignal chan bool | ||
} | ||
|
||
// QuotaSettings is the main data structure for Quota Management. | ||
// It contains an array of QuotaConfigurations, an array of QuotaRules and an array | ||
// of exceed_actions. | ||
type QuotaSettings struct { | ||
Enabled bool `json:"enabled"` | ||
Configurations []*QuotaConfiguration `json:"configuration"` | ||
Rules []*QuotaRules `json:"rules"` | ||
ExceedActions []*QuotaExceedActions `json:"exceed_actions"` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of adding new structures for all of these, we can reuse the policy manager object structures:
golang-shared/services/settings/policy/object.go
Line 13 in 15ca598
this will simplify policy manager integration as well