forked from kubernetes/kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 1
/
clientset.go
400 lines (362 loc) · 13.7 KB
/
clientset.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package release_1_5
import (
"github.com/golang/glog"
v1beta1apps "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/typed/apps/v1beta1"
v1beta1authentication "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/typed/authentication/v1beta1"
v1beta1authorization "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/typed/authorization/v1beta1"
v1autoscaling "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/typed/autoscaling/v1"
v1batch "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/typed/batch/v1"
v2alpha1batch "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/typed/batch/v2alpha1"
v1alpha1certificates "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/typed/certificates/v1alpha1"
v1core "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/typed/core/v1"
v1beta1extensions "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/typed/extensions/v1beta1"
v1beta1policy "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/typed/policy/v1beta1"
v1alpha1rbac "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/typed/rbac/v1alpha1"
v1beta1storage "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/typed/storage/v1beta1"
restclient "k8s.io/kubernetes/pkg/client/restclient"
discovery "k8s.io/kubernetes/pkg/client/typed/discovery"
"k8s.io/kubernetes/pkg/util/flowcontrol"
_ "k8s.io/kubernetes/plugin/pkg/client/auth"
)
type Interface interface {
Discovery() discovery.DiscoveryInterface
CoreV1() v1core.CoreV1Interface
// Deprecated: please explicitly pick a version if possible.
Core() v1core.CoreV1Interface
AppsV1beta1() v1beta1apps.AppsV1beta1Interface
// Deprecated: please explicitly pick a version if possible.
Apps() v1beta1apps.AppsV1beta1Interface
AuthenticationV1beta1() v1beta1authentication.AuthenticationV1beta1Interface
// Deprecated: please explicitly pick a version if possible.
Authentication() v1beta1authentication.AuthenticationV1beta1Interface
AuthorizationV1beta1() v1beta1authorization.AuthorizationV1beta1Interface
// Deprecated: please explicitly pick a version if possible.
Authorization() v1beta1authorization.AuthorizationV1beta1Interface
AutoscalingV1() v1autoscaling.AutoscalingV1Interface
// Deprecated: please explicitly pick a version if possible.
Autoscaling() v1autoscaling.AutoscalingV1Interface
BatchV1() v1batch.BatchV1Interface
// Deprecated: please explicitly pick a version if possible.
Batch() v1batch.BatchV1Interface
BatchV2alpha1() v2alpha1batch.BatchV2alpha1Interface
CertificatesV1alpha1() v1alpha1certificates.CertificatesV1alpha1Interface
// Deprecated: please explicitly pick a version if possible.
Certificates() v1alpha1certificates.CertificatesV1alpha1Interface
ExtensionsV1beta1() v1beta1extensions.ExtensionsV1beta1Interface
// Deprecated: please explicitly pick a version if possible.
Extensions() v1beta1extensions.ExtensionsV1beta1Interface
PolicyV1beta1() v1beta1policy.PolicyV1beta1Interface
// Deprecated: please explicitly pick a version if possible.
Policy() v1beta1policy.PolicyV1beta1Interface
RbacV1alpha1() v1alpha1rbac.RbacV1alpha1Interface
// Deprecated: please explicitly pick a version if possible.
Rbac() v1alpha1rbac.RbacV1alpha1Interface
StorageV1beta1() v1beta1storage.StorageV1beta1Interface
// Deprecated: please explicitly pick a version if possible.
Storage() v1beta1storage.StorageV1beta1Interface
}
// Clientset contains the clients for groups. Each group has exactly one
// version included in a Clientset.
type Clientset struct {
*discovery.DiscoveryClient
*v1core.CoreV1Client
*v1beta1apps.AppsV1beta1Client
*v1beta1authentication.AuthenticationV1beta1Client
*v1beta1authorization.AuthorizationV1beta1Client
*v1autoscaling.AutoscalingV1Client
*v1batch.BatchV1Client
*v2alpha1batch.BatchV2alpha1Client
*v1alpha1certificates.CertificatesV1alpha1Client
*v1beta1extensions.ExtensionsV1beta1Client
*v1beta1policy.PolicyV1beta1Client
*v1alpha1rbac.RbacV1alpha1Client
*v1beta1storage.StorageV1beta1Client
}
// CoreV1 retrieves the CoreV1Client
func (c *Clientset) CoreV1() v1core.CoreV1Interface {
if c == nil {
return nil
}
return c.CoreV1Client
}
// Deprecated: Core retrieves the default version of CoreClient.
// Please explicitly pick a version.
func (c *Clientset) Core() v1core.CoreV1Interface {
if c == nil {
return nil
}
return c.CoreV1Client
}
// AppsV1beta1 retrieves the AppsV1beta1Client
func (c *Clientset) AppsV1beta1() v1beta1apps.AppsV1beta1Interface {
if c == nil {
return nil
}
return c.AppsV1beta1Client
}
// Deprecated: Apps retrieves the default version of AppsClient.
// Please explicitly pick a version.
func (c *Clientset) Apps() v1beta1apps.AppsV1beta1Interface {
if c == nil {
return nil
}
return c.AppsV1beta1Client
}
// AuthenticationV1beta1 retrieves the AuthenticationV1beta1Client
func (c *Clientset) AuthenticationV1beta1() v1beta1authentication.AuthenticationV1beta1Interface {
if c == nil {
return nil
}
return c.AuthenticationV1beta1Client
}
// Deprecated: Authentication retrieves the default version of AuthenticationClient.
// Please explicitly pick a version.
func (c *Clientset) Authentication() v1beta1authentication.AuthenticationV1beta1Interface {
if c == nil {
return nil
}
return c.AuthenticationV1beta1Client
}
// AuthorizationV1beta1 retrieves the AuthorizationV1beta1Client
func (c *Clientset) AuthorizationV1beta1() v1beta1authorization.AuthorizationV1beta1Interface {
if c == nil {
return nil
}
return c.AuthorizationV1beta1Client
}
// Deprecated: Authorization retrieves the default version of AuthorizationClient.
// Please explicitly pick a version.
func (c *Clientset) Authorization() v1beta1authorization.AuthorizationV1beta1Interface {
if c == nil {
return nil
}
return c.AuthorizationV1beta1Client
}
// AutoscalingV1 retrieves the AutoscalingV1Client
func (c *Clientset) AutoscalingV1() v1autoscaling.AutoscalingV1Interface {
if c == nil {
return nil
}
return c.AutoscalingV1Client
}
// Deprecated: Autoscaling retrieves the default version of AutoscalingClient.
// Please explicitly pick a version.
func (c *Clientset) Autoscaling() v1autoscaling.AutoscalingV1Interface {
if c == nil {
return nil
}
return c.AutoscalingV1Client
}
// BatchV1 retrieves the BatchV1Client
func (c *Clientset) BatchV1() v1batch.BatchV1Interface {
if c == nil {
return nil
}
return c.BatchV1Client
}
// Deprecated: Batch retrieves the default version of BatchClient.
// Please explicitly pick a version.
func (c *Clientset) Batch() v1batch.BatchV1Interface {
if c == nil {
return nil
}
return c.BatchV1Client
}
// BatchV2alpha1 retrieves the BatchV2alpha1Client
func (c *Clientset) BatchV2alpha1() v2alpha1batch.BatchV2alpha1Interface {
if c == nil {
return nil
}
return c.BatchV2alpha1Client
}
// CertificatesV1alpha1 retrieves the CertificatesV1alpha1Client
func (c *Clientset) CertificatesV1alpha1() v1alpha1certificates.CertificatesV1alpha1Interface {
if c == nil {
return nil
}
return c.CertificatesV1alpha1Client
}
// Deprecated: Certificates retrieves the default version of CertificatesClient.
// Please explicitly pick a version.
func (c *Clientset) Certificates() v1alpha1certificates.CertificatesV1alpha1Interface {
if c == nil {
return nil
}
return c.CertificatesV1alpha1Client
}
// ExtensionsV1beta1 retrieves the ExtensionsV1beta1Client
func (c *Clientset) ExtensionsV1beta1() v1beta1extensions.ExtensionsV1beta1Interface {
if c == nil {
return nil
}
return c.ExtensionsV1beta1Client
}
// Deprecated: Extensions retrieves the default version of ExtensionsClient.
// Please explicitly pick a version.
func (c *Clientset) Extensions() v1beta1extensions.ExtensionsV1beta1Interface {
if c == nil {
return nil
}
return c.ExtensionsV1beta1Client
}
// PolicyV1beta1 retrieves the PolicyV1beta1Client
func (c *Clientset) PolicyV1beta1() v1beta1policy.PolicyV1beta1Interface {
if c == nil {
return nil
}
return c.PolicyV1beta1Client
}
// Deprecated: Policy retrieves the default version of PolicyClient.
// Please explicitly pick a version.
func (c *Clientset) Policy() v1beta1policy.PolicyV1beta1Interface {
if c == nil {
return nil
}
return c.PolicyV1beta1Client
}
// RbacV1alpha1 retrieves the RbacV1alpha1Client
func (c *Clientset) RbacV1alpha1() v1alpha1rbac.RbacV1alpha1Interface {
if c == nil {
return nil
}
return c.RbacV1alpha1Client
}
// Deprecated: Rbac retrieves the default version of RbacClient.
// Please explicitly pick a version.
func (c *Clientset) Rbac() v1alpha1rbac.RbacV1alpha1Interface {
if c == nil {
return nil
}
return c.RbacV1alpha1Client
}
// StorageV1beta1 retrieves the StorageV1beta1Client
func (c *Clientset) StorageV1beta1() v1beta1storage.StorageV1beta1Interface {
if c == nil {
return nil
}
return c.StorageV1beta1Client
}
// Deprecated: Storage retrieves the default version of StorageClient.
// Please explicitly pick a version.
func (c *Clientset) Storage() v1beta1storage.StorageV1beta1Interface {
if c == nil {
return nil
}
return c.StorageV1beta1Client
}
// Discovery retrieves the DiscoveryClient
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
return c.DiscoveryClient
}
// NewForConfig creates a new Clientset for the given config.
func NewForConfig(c *restclient.Config) (*Clientset, error) {
configShallowCopy := *c
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
}
var clientset Clientset
var err error
clientset.CoreV1Client, err = v1core.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
clientset.AppsV1beta1Client, err = v1beta1apps.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
clientset.AuthenticationV1beta1Client, err = v1beta1authentication.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
clientset.AuthorizationV1beta1Client, err = v1beta1authorization.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
clientset.AutoscalingV1Client, err = v1autoscaling.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
clientset.BatchV1Client, err = v1batch.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
clientset.BatchV2alpha1Client, err = v2alpha1batch.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
clientset.CertificatesV1alpha1Client, err = v1alpha1certificates.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
clientset.ExtensionsV1beta1Client, err = v1beta1extensions.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
clientset.PolicyV1beta1Client, err = v1beta1policy.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
clientset.RbacV1alpha1Client, err = v1alpha1rbac.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
clientset.StorageV1beta1Client, err = v1beta1storage.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil {
glog.Errorf("failed to create the DiscoveryClient: %v", err)
return nil, err
}
return &clientset, nil
}
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset
clientset.CoreV1Client = v1core.NewForConfigOrDie(c)
clientset.AppsV1beta1Client = v1beta1apps.NewForConfigOrDie(c)
clientset.AuthenticationV1beta1Client = v1beta1authentication.NewForConfigOrDie(c)
clientset.AuthorizationV1beta1Client = v1beta1authorization.NewForConfigOrDie(c)
clientset.AutoscalingV1Client = v1autoscaling.NewForConfigOrDie(c)
clientset.BatchV1Client = v1batch.NewForConfigOrDie(c)
clientset.BatchV2alpha1Client = v2alpha1batch.NewForConfigOrDie(c)
clientset.CertificatesV1alpha1Client = v1alpha1certificates.NewForConfigOrDie(c)
clientset.ExtensionsV1beta1Client = v1beta1extensions.NewForConfigOrDie(c)
clientset.PolicyV1beta1Client = v1beta1policy.NewForConfigOrDie(c)
clientset.RbacV1alpha1Client = v1alpha1rbac.NewForConfigOrDie(c)
clientset.StorageV1beta1Client = v1beta1storage.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset
}
// New creates a new Clientset for the given RESTClient.
func New(c restclient.Interface) *Clientset {
var clientset Clientset
clientset.CoreV1Client = v1core.New(c)
clientset.AppsV1beta1Client = v1beta1apps.New(c)
clientset.AuthenticationV1beta1Client = v1beta1authentication.New(c)
clientset.AuthorizationV1beta1Client = v1beta1authorization.New(c)
clientset.AutoscalingV1Client = v1autoscaling.New(c)
clientset.BatchV1Client = v1batch.New(c)
clientset.BatchV2alpha1Client = v2alpha1batch.New(c)
clientset.CertificatesV1alpha1Client = v1alpha1certificates.New(c)
clientset.ExtensionsV1beta1Client = v1beta1extensions.New(c)
clientset.PolicyV1beta1Client = v1beta1policy.New(c)
clientset.RbacV1alpha1Client = v1alpha1rbac.New(c)
clientset.StorageV1beta1Client = v1beta1storage.New(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &clientset
}