-
Notifications
You must be signed in to change notification settings - Fork 116
/
opt.go
50 lines (44 loc) · 1.86 KB
/
opt.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package alerts
// OptionType defines type of option for alert manager setup.
type OptionType int
const (
// ttlOption defines the time to live for alerts that are cleared (default half day)
// ttlOption is only valid for alerts manager creation.
ttlOption OptionType = iota
// timeSpanOption provides a way to tell a filter that it should also apply filtering based
// on the time span. Such option is useful for creating efficient filters that fetch efficiently
// from kvdb and apply filtering after fetching.
timeSpanOption
// countSpanOption provides a way to tell filter that it should apply filtering based on
// the count span. Such option is useful for creating efficient filters that fetch efficiently
// from kvdb and apply filtering after fetching.
countSpanOption
// minSeverityOption provides a way to tell filter that it should apply filtering based on
// the severity. Such option is useful for creating efficient filters that fetch efficiently
// from kvdb and apply filtering after fetching.
minSeverityOption
// flagCheckOption provides a way to tell filter that it should apply filtering based on
// the clear flag. Such option is useful for creating efficient filters that fetch efficiently
// from kvdb and apply filtering after fetching.
flagCheckOption
// resourceIDOption provides a way to tell filter that it should apply filtering based on
// the resource id. Such option is useful for creating efficient filters that fetch efficiently
// from kvdb and apply filtering after fetching.
resourceIdOption
)
// Option defines what is an option.
type Option interface {
GetType() OptionType
GetValue() interface{}
}
// option implements Option interface.
type option struct {
optionType OptionType
value interface{}
}
func (o *option) GetType() OptionType {
return o.optionType
}
func (o *option) GetValue() interface{} {
return o.value
}