forked from ebauman/crder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conversion.go
49 lines (34 loc) · 858 Bytes
/
conversion.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
package crder
import apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
type Conversion struct {
Webhook bool
Service apiextv1.ServiceReference
CABundle string
URL string
Versions []string
}
type conversionCustomizer func(cc *Conversion)
func (cc *Conversion) StrategyNone() *Conversion {
cc.Webhook = false
return cc
}
func (cc *Conversion) StrategyWebhook() *Conversion {
cc.Webhook = true
return cc
}
func (cc *Conversion) WithCABundle(bundle string) *Conversion {
cc.CABundle = bundle
return cc
}
func (cc *Conversion) WithService(service apiextv1.ServiceReference) *Conversion {
cc.Service = service
return cc
}
func (cc *Conversion) WithURL(url string) *Conversion {
cc.URL = url
return cc
}
func (cc *Conversion) WithVersions(versions ...string) *Conversion {
cc.Versions = versions
return cc
}