...
1 package recerr
2
3 import corev1 "k8s.io/api/core/v1"
4
5
6
7 type Option func(*options)
8
9 type options struct {
10 notification bool
11 eventType string
12 }
13
14
15
16
17
18 func WithoutNotification() Option {
19 return func(o *options) {
20 o.notification = false
21 }
22 }
23
24
25
26
27
28 func WithEvent(eventType string) Option {
29 return func(o *options) {
30 o.eventType = eventType
31 }
32 }
33
34 func makeOptions(o *options, opts ...Option) *options {
35 if o.eventType == "" {
36 o.eventType = corev1.EventTypeWarning
37 }
38 for _, opt := range opts {
39 opt(o)
40 }
41 return o
42 }
43
View as plain text