...

Source file src/k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/clientset.go

Documentation: k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset

     1  /*
     2  Copyright The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  // Code generated by client-gen. DO NOT EDIT.
    18  
    19  package clientset
    20  
    21  import (
    22  	"fmt"
    23  	"net/http"
    24  
    25  	discovery "k8s.io/client-go/discovery"
    26  	rest "k8s.io/client-go/rest"
    27  	flowcontrol "k8s.io/client-go/util/flowcontrol"
    28  	apiregistrationv1 "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/typed/apiregistration/v1"
    29  	apiregistrationv1beta1 "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/typed/apiregistration/v1beta1"
    30  )
    31  
    32  type Interface interface {
    33  	Discovery() discovery.DiscoveryInterface
    34  	ApiregistrationV1() apiregistrationv1.ApiregistrationV1Interface
    35  	ApiregistrationV1beta1() apiregistrationv1beta1.ApiregistrationV1beta1Interface
    36  }
    37  
    38  // Clientset contains the clients for groups.
    39  type Clientset struct {
    40  	*discovery.DiscoveryClient
    41  	apiregistrationV1      *apiregistrationv1.ApiregistrationV1Client
    42  	apiregistrationV1beta1 *apiregistrationv1beta1.ApiregistrationV1beta1Client
    43  }
    44  
    45  // ApiregistrationV1 retrieves the ApiregistrationV1Client
    46  func (c *Clientset) ApiregistrationV1() apiregistrationv1.ApiregistrationV1Interface {
    47  	return c.apiregistrationV1
    48  }
    49  
    50  // ApiregistrationV1beta1 retrieves the ApiregistrationV1beta1Client
    51  func (c *Clientset) ApiregistrationV1beta1() apiregistrationv1beta1.ApiregistrationV1beta1Interface {
    52  	return c.apiregistrationV1beta1
    53  }
    54  
    55  // Discovery retrieves the DiscoveryClient
    56  func (c *Clientset) Discovery() discovery.DiscoveryInterface {
    57  	if c == nil {
    58  		return nil
    59  	}
    60  	return c.DiscoveryClient
    61  }
    62  
    63  // NewForConfig creates a new Clientset for the given config.
    64  // If config's RateLimiter is not set and QPS and Burst are acceptable,
    65  // NewForConfig will generate a rate-limiter in configShallowCopy.
    66  // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
    67  // where httpClient was generated with rest.HTTPClientFor(c).
    68  func NewForConfig(c *rest.Config) (*Clientset, error) {
    69  	configShallowCopy := *c
    70  
    71  	if configShallowCopy.UserAgent == "" {
    72  		configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent()
    73  	}
    74  
    75  	// share the transport between all clients
    76  	httpClient, err := rest.HTTPClientFor(&configShallowCopy)
    77  	if err != nil {
    78  		return nil, err
    79  	}
    80  
    81  	return NewForConfigAndClient(&configShallowCopy, httpClient)
    82  }
    83  
    84  // NewForConfigAndClient creates a new Clientset for the given config and http client.
    85  // Note the http client provided takes precedence over the configured transport values.
    86  // If config's RateLimiter is not set and QPS and Burst are acceptable,
    87  // NewForConfigAndClient will generate a rate-limiter in configShallowCopy.
    88  func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) {
    89  	configShallowCopy := *c
    90  	if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
    91  		if configShallowCopy.Burst <= 0 {
    92  			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")
    93  		}
    94  		configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
    95  	}
    96  
    97  	var cs Clientset
    98  	var err error
    99  	cs.apiregistrationV1, err = apiregistrationv1.NewForConfigAndClient(&configShallowCopy, httpClient)
   100  	if err != nil {
   101  		return nil, err
   102  	}
   103  	cs.apiregistrationV1beta1, err = apiregistrationv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient)
   104  	if err != nil {
   105  		return nil, err
   106  	}
   107  
   108  	cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient)
   109  	if err != nil {
   110  		return nil, err
   111  	}
   112  	return &cs, nil
   113  }
   114  
   115  // NewForConfigOrDie creates a new Clientset for the given config and
   116  // panics if there is an error in the config.
   117  func NewForConfigOrDie(c *rest.Config) *Clientset {
   118  	cs, err := NewForConfig(c)
   119  	if err != nil {
   120  		panic(err)
   121  	}
   122  	return cs
   123  }
   124  
   125  // New creates a new Clientset for the given RESTClient.
   126  func New(c rest.Interface) *Clientset {
   127  	var cs Clientset
   128  	cs.apiregistrationV1 = apiregistrationv1.New(c)
   129  	cs.apiregistrationV1beta1 = apiregistrationv1beta1.New(c)
   130  
   131  	cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
   132  	return &cs
   133  }
   134  

View as plain text