-
Notifications
You must be signed in to change notification settings - Fork 53
/
options.go
47 lines (38 loc) · 1015 Bytes
/
options.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
package storage
import corev1 "github.com/rancher/opni/pkg/apis/core/v1"
type TokenCreateOptions struct {
Labels map[string]string
Capabilities []*corev1.TokenCapability
MaxUsages int64
}
func NewTokenCreateOptions() TokenCreateOptions {
return TokenCreateOptions{
Labels: map[string]string{},
Capabilities: []*corev1.TokenCapability{},
}
}
type TokenCreateOption func(*TokenCreateOptions)
func (o *TokenCreateOptions) Apply(opts ...TokenCreateOption) {
for _, op := range opts {
op(o)
}
}
func WithLabels(labels map[string]string) TokenCreateOption {
return func(o *TokenCreateOptions) {
o.Labels = labels
}
}
func WithCapabilities(capabilities []*corev1.TokenCapability) TokenCreateOption {
return func(o *TokenCreateOptions) {
o.Capabilities = capabilities
}
}
func WithMaxUsages(usages int64) TokenCreateOption {
return func(o *TokenCreateOptions) {
o.MaxUsages = usages
}
}
type AlertFilterOptions struct {
Labels map[string]string
Range *corev1.TimeRange
}