/
clientsets.go
132 lines (114 loc) · 4.7 KB
/
clientsets.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
package helper
import (
. "github.com/onsi/gomega"
config "github.com/openshift/client-go/config/clientset/versioned"
image "github.com/openshift/client-go/image/clientset/versioned"
machine "github.com/openshift/client-go/machine/clientset/versioned"
oauth "github.com/openshift/client-go/oauth/clientset/versioned"
project "github.com/openshift/client-go/project/clientset/versioned"
quotaclient "github.com/openshift/client-go/quota/clientset/versioned"
route "github.com/openshift/client-go/route/clientset/versioned"
security "github.com/openshift/client-go/security/clientset/versioned"
user "github.com/openshift/client-go/user/clientset/versioned"
operator "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned"
prometheusop "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned"
velero "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
)
// Impersonate sets impersonate user headers
func (h *H) Impersonate(user rest.ImpersonationConfig) *H {
h.restConfig.Impersonate = user
return h
}
// Cfg return a client for the Config API.
func (h *H) Cfg() config.Interface {
client, err := config.NewForConfig(h.restConfig)
Expect(err).ShouldNot(HaveOccurred(), "failed to configure Config client")
return client
}
// Dynamic returns a client that works on arbitrary types.
func (h *H) Dynamic() dynamic.Interface {
client, err := dynamic.NewForConfig(h.restConfig)
Expect(err).ShouldNot(HaveOccurred(), "failed to configure Dynamic client")
return client
}
// Security returns the clientset for Security objects.
func (h *H) Security() security.Interface {
client, err := security.NewForConfig(h.restConfig)
Expect(err).ShouldNot(HaveOccurred(), "failed to configure Security clientset")
return client
}
// Kube returns the clientset for Kubernetes upstream.
func (h *H) Kube() kubernetes.Interface {
client, err := kubernetes.NewForConfig(h.restConfig)
Expect(err).ShouldNot(HaveOccurred(), "failed to configure Kubernetes clientset")
return client
}
// Quota returns the client for Quota operations.
func (h *H) Quota() (*quotaclient.Clientset, error) {
client, err := quotaclient.NewForConfig(h.restConfig)
Expect(err).ShouldNot(HaveOccurred(), "failed to configure quota clientset")
return client, err
}
// Velero returns the clientset for Velero objects.
func (h *H) Velero() velero.Interface {
client, err := velero.NewForConfig(h.restConfig)
Expect(err).ShouldNot(HaveOccurred(), "failed to configure Velero clientset")
return client
}
// Image returns the clientset for images.
func (h *H) Image() image.Interface {
client, err := image.NewForConfig(h.restConfig)
Expect(err).ShouldNot(HaveOccurred(), "failed to configure Image clientset")
return client
}
// Route returns the clientset for routing.
func (h *H) Route() route.Interface {
client, err := route.NewForConfig(h.restConfig)
Expect(err).ShouldNot(HaveOccurred(), "failed to configure Route clientset")
return client
}
// Project returns the clientset for projects.
func (h *H) Project() project.Interface {
client, err := project.NewForConfig(h.restConfig)
Expect(err).ShouldNot(HaveOccurred(), "failed to configure Project clientset")
return client
}
// OAuth returns the clientset for oauth resources
func (h *H) OAuth() oauth.Interface {
client, err := oauth.NewForConfig(h.restConfig)
Expect(err).ShouldNot(HaveOccurred(), "failed to configure OAuth clientset")
return client
}
// User returns the clientset for users
func (h *H) User() user.Interface {
client, err := user.NewForConfig(h.restConfig)
Expect(err).ShouldNot(HaveOccurred(), "failed to configure Project clientset")
return client
}
// Operator returns the clientset for operator-lifecycle-manager
func (h *H) Operator() operator.Interface {
client, err := operator.NewForConfig(h.restConfig)
Expect(err).ShouldNot(HaveOccurred(), "failed to configure Operator clientset")
return client
}
// Machine returns the clientset for openshift-machine-api
func (h *H) Machine() machine.Interface {
client, err := machine.NewForConfig(h.restConfig)
Expect(err).ShouldNot(HaveOccurred(), "failed to configure Operator clientset")
return client
}
// REST returns a client for generic operations.
func (h *H) REST() *rest.RESTClient {
client, err := rest.RESTClientFor(h.restConfig)
Expect(err).ShouldNot(HaveOccurred(), "failed to configure REST client")
return client
}
// Monitoring returns the clientset for prometheus-operator
func (h *H) Prometheusop() prometheusop.Interface {
client, err := prometheusop.NewForConfig(h.restConfig)
Expect(err).ShouldNot(HaveOccurred(), "failed to configure Prometheus-operator clientset")
return client
}