clientset.go 7.6 KB
Newer Older
J
Jeff 已提交
1
/*
2
Copyright 2020 The KubeSphere Authors.
J
Jeff 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15

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.
*/
R
runzexia 已提交
16 17

// Code generated by client-gen. DO NOT EDIT.
J
Jeff 已提交
18 19 20 21

package versioned

import (
22 23
	"fmt"

H
hongming 已提交
24 25 26
	discovery "k8s.io/client-go/discovery"
	rest "k8s.io/client-go/rest"
	flowcontrol "k8s.io/client-go/util/flowcontrol"
R
runzexia 已提交
27
	clusterv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/cluster/v1alpha1"
R
runzexia 已提交
28
	devopsv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/devops/v1alpha1"
R
runzexia 已提交
29
	devopsv1alpha3 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/devops/v1alpha3"
H
hongming 已提交
30
	iamv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/iam/v1alpha2"
31
	networkv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/network/v1alpha1"
J
Jeff 已提交
32
	servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/servicemesh/v1alpha2"
Z
zhangmin 已提交
33
	storagev1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/storage/v1alpha1"
H
hongming 已提交
34
	tenantv1alpha1 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/tenant/v1alpha1"
H
hongming 已提交
35
	tenantv1alpha2 "kubesphere.io/kubesphere/pkg/client/clientset/versioned/typed/tenant/v1alpha2"
J
Jeff 已提交
36 37 38 39
)

type Interface interface {
	Discovery() discovery.DiscoveryInterface
R
runzexia 已提交
40
	ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface
R
runzexia 已提交
41
	DevopsV1alpha1() devopsv1alpha1.DevopsV1alpha1Interface
R
runzexia 已提交
42
	DevopsV1alpha3() devopsv1alpha3.DevopsV1alpha3Interface
H
hongming 已提交
43
	IamV1alpha2() iamv1alpha2.IamV1alpha2Interface
44
	NetworkV1alpha1() networkv1alpha1.NetworkV1alpha1Interface
J
Jeff 已提交
45
	ServicemeshV1alpha2() servicemeshv1alpha2.ServicemeshV1alpha2Interface
Z
zhangmin 已提交
46
	StorageV1alpha1() storagev1alpha1.StorageV1alpha1Interface
H
hongming 已提交
47
	TenantV1alpha1() tenantv1alpha1.TenantV1alpha1Interface
H
hongming 已提交
48
	TenantV1alpha2() tenantv1alpha2.TenantV1alpha2Interface
J
Jeff 已提交
49 50 51 52 53 54
}

// Clientset contains the clients for groups. Each group has exactly one
// version included in a Clientset.
type Clientset struct {
	*discovery.DiscoveryClient
R
runzexia 已提交
55
	clusterV1alpha1     *clusterv1alpha1.ClusterV1alpha1Client
R
runzexia 已提交
56
	devopsV1alpha1      *devopsv1alpha1.DevopsV1alpha1Client
R
runzexia 已提交
57
	devopsV1alpha3      *devopsv1alpha3.DevopsV1alpha3Client
H
hongming 已提交
58
	iamV1alpha2         *iamv1alpha2.IamV1alpha2Client
59
	networkV1alpha1     *networkv1alpha1.NetworkV1alpha1Client
J
Jeff 已提交
60
	servicemeshV1alpha2 *servicemeshv1alpha2.ServicemeshV1alpha2Client
Z
zhangmin 已提交
61
	storageV1alpha1     *storagev1alpha1.StorageV1alpha1Client
H
hongming 已提交
62
	tenantV1alpha1      *tenantv1alpha1.TenantV1alpha1Client
H
hongming 已提交
63
	tenantV1alpha2      *tenantv1alpha2.TenantV1alpha2Client
R
runzexia 已提交
64 65 66 67 68
}

// ClusterV1alpha1 retrieves the ClusterV1alpha1Client
func (c *Clientset) ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface {
	return c.clusterV1alpha1
J
Jeff 已提交
69 70
}

R
runzexia 已提交
71 72 73 74 75
// DevopsV1alpha1 retrieves the DevopsV1alpha1Client
func (c *Clientset) DevopsV1alpha1() devopsv1alpha1.DevopsV1alpha1Interface {
	return c.devopsV1alpha1
}

R
runzexia 已提交
76 77 78 79 80
// DevopsV1alpha3 retrieves the DevopsV1alpha3Client
func (c *Clientset) DevopsV1alpha3() devopsv1alpha3.DevopsV1alpha3Interface {
	return c.devopsV1alpha3
}

H
hongming 已提交
81 82 83 84 85
// IamV1alpha2 retrieves the IamV1alpha2Client
func (c *Clientset) IamV1alpha2() iamv1alpha2.IamV1alpha2Interface {
	return c.iamV1alpha2
}

86 87 88 89 90
// NetworkV1alpha1 retrieves the NetworkV1alpha1Client
func (c *Clientset) NetworkV1alpha1() networkv1alpha1.NetworkV1alpha1Interface {
	return c.networkV1alpha1
}

J
Jeff 已提交
91 92 93 94 95
// ServicemeshV1alpha2 retrieves the ServicemeshV1alpha2Client
func (c *Clientset) ServicemeshV1alpha2() servicemeshv1alpha2.ServicemeshV1alpha2Interface {
	return c.servicemeshV1alpha2
}

Z
zhangmin 已提交
96 97 98 99 100
// StorageV1alpha1 retrieves the StorageV1alpha1Client
func (c *Clientset) StorageV1alpha1() storagev1alpha1.StorageV1alpha1Interface {
	return c.storageV1alpha1
}

H
hongming 已提交
101 102 103 104 105
// TenantV1alpha1 retrieves the TenantV1alpha1Client
func (c *Clientset) TenantV1alpha1() tenantv1alpha1.TenantV1alpha1Interface {
	return c.tenantV1alpha1
}

H
hongming 已提交
106 107 108 109 110
// TenantV1alpha2 retrieves the TenantV1alpha2Client
func (c *Clientset) TenantV1alpha2() tenantv1alpha2.TenantV1alpha2Interface {
	return c.tenantV1alpha2
}

J
Jeff 已提交
111 112 113 114 115 116 117 118 119
// Discovery retrieves the DiscoveryClient
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
	if c == nil {
		return nil
	}
	return c.DiscoveryClient
}

// NewForConfig creates a new Clientset for the given config.
120 121
// If config's RateLimiter is not set and QPS and Burst are acceptable,
// NewForConfig will generate a rate-limiter in configShallowCopy.
J
Jeff 已提交
122 123 124
func NewForConfig(c *rest.Config) (*Clientset, error) {
	configShallowCopy := *c
	if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
125 126 127
		if configShallowCopy.Burst <= 0 {
			return nil, fmt.Errorf("Burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0")
		}
J
Jeff 已提交
128 129 130 131
		configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
	}
	var cs Clientset
	var err error
R
runzexia 已提交
132 133 134 135
	cs.clusterV1alpha1, err = clusterv1alpha1.NewForConfig(&configShallowCopy)
	if err != nil {
		return nil, err
	}
R
runzexia 已提交
136 137 138 139
	cs.devopsV1alpha1, err = devopsv1alpha1.NewForConfig(&configShallowCopy)
	if err != nil {
		return nil, err
	}
R
runzexia 已提交
140 141 142 143
	cs.devopsV1alpha3, err = devopsv1alpha3.NewForConfig(&configShallowCopy)
	if err != nil {
		return nil, err
	}
H
hongming 已提交
144 145 146 147
	cs.iamV1alpha2, err = iamv1alpha2.NewForConfig(&configShallowCopy)
	if err != nil {
		return nil, err
	}
148 149 150 151
	cs.networkV1alpha1, err = networkv1alpha1.NewForConfig(&configShallowCopy)
	if err != nil {
		return nil, err
	}
J
Jeff 已提交
152 153 154 155
	cs.servicemeshV1alpha2, err = servicemeshv1alpha2.NewForConfig(&configShallowCopy)
	if err != nil {
		return nil, err
	}
Z
zhangmin 已提交
156 157 158 159
	cs.storageV1alpha1, err = storagev1alpha1.NewForConfig(&configShallowCopy)
	if err != nil {
		return nil, err
	}
H
hongming 已提交
160 161 162 163
	cs.tenantV1alpha1, err = tenantv1alpha1.NewForConfig(&configShallowCopy)
	if err != nil {
		return nil, err
	}
H
hongming 已提交
164 165 166 167
	cs.tenantV1alpha2, err = tenantv1alpha2.NewForConfig(&configShallowCopy)
	if err != nil {
		return nil, err
	}
J
Jeff 已提交
168 169 170 171 172 173 174 175 176 177 178 179

	cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
	if err != nil {
		return nil, err
	}
	return &cs, nil
}

// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *Clientset {
	var cs Clientset
R
runzexia 已提交
180
	cs.clusterV1alpha1 = clusterv1alpha1.NewForConfigOrDie(c)
R
runzexia 已提交
181
	cs.devopsV1alpha1 = devopsv1alpha1.NewForConfigOrDie(c)
R
runzexia 已提交
182
	cs.devopsV1alpha3 = devopsv1alpha3.NewForConfigOrDie(c)
H
hongming 已提交
183
	cs.iamV1alpha2 = iamv1alpha2.NewForConfigOrDie(c)
184
	cs.networkV1alpha1 = networkv1alpha1.NewForConfigOrDie(c)
J
Jeff 已提交
185
	cs.servicemeshV1alpha2 = servicemeshv1alpha2.NewForConfigOrDie(c)
Z
zhangmin 已提交
186
	cs.storageV1alpha1 = storagev1alpha1.NewForConfigOrDie(c)
H
hongming 已提交
187
	cs.tenantV1alpha1 = tenantv1alpha1.NewForConfigOrDie(c)
H
hongming 已提交
188
	cs.tenantV1alpha2 = tenantv1alpha2.NewForConfigOrDie(c)
J
Jeff 已提交
189 190 191 192 193 194 195 196

	cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
	return &cs
}

// New creates a new Clientset for the given RESTClient.
func New(c rest.Interface) *Clientset {
	var cs Clientset
R
runzexia 已提交
197
	cs.clusterV1alpha1 = clusterv1alpha1.New(c)
R
runzexia 已提交
198
	cs.devopsV1alpha1 = devopsv1alpha1.New(c)
R
runzexia 已提交
199
	cs.devopsV1alpha3 = devopsv1alpha3.New(c)
H
hongming 已提交
200
	cs.iamV1alpha2 = iamv1alpha2.New(c)
201
	cs.networkV1alpha1 = networkv1alpha1.New(c)
J
Jeff 已提交
202
	cs.servicemeshV1alpha2 = servicemeshv1alpha2.New(c)
Z
zhangmin 已提交
203
	cs.storageV1alpha1 = storagev1alpha1.New(c)
H
hongming 已提交
204
	cs.tenantV1alpha1 = tenantv1alpha1.New(c)
H
hongming 已提交
205
	cs.tenantV1alpha2 = tenantv1alpha2.New(c)
J
Jeff 已提交
206 207 208 209

	cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
	return &cs
}