...

Source file src/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/clientset.go

Documentation: github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned

     1  /*
     2  Copyright 2019 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 versioned
    20  
    21  import (
    22  	k8scnicncfiov1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1"
    23  	discovery "k8s.io/client-go/discovery"
    24  	rest "k8s.io/client-go/rest"
    25  	flowcontrol "k8s.io/client-go/util/flowcontrol"
    26  )
    27  
    28  type Interface interface {
    29  	Discovery() discovery.DiscoveryInterface
    30  	K8sCniCncfIoV1() k8scnicncfiov1.K8sCniCncfIoV1Interface
    31  }
    32  
    33  // Clientset contains the clients for groups. Each group has exactly one
    34  // version included in a Clientset.
    35  type Clientset struct {
    36  	*discovery.DiscoveryClient
    37  	k8sCniCncfIoV1 *k8scnicncfiov1.K8sCniCncfIoV1Client
    38  }
    39  
    40  // K8sCniCncfIoV1 retrieves the K8sCniCncfIoV1Client
    41  func (c *Clientset) K8sCniCncfIoV1() k8scnicncfiov1.K8sCniCncfIoV1Interface {
    42  	return c.k8sCniCncfIoV1
    43  }
    44  
    45  // Discovery retrieves the DiscoveryClient
    46  func (c *Clientset) Discovery() discovery.DiscoveryInterface {
    47  	if c == nil {
    48  		return nil
    49  	}
    50  	return c.DiscoveryClient
    51  }
    52  
    53  // NewForConfig creates a new Clientset for the given config.
    54  func NewForConfig(c *rest.Config) (*Clientset, error) {
    55  	configShallowCopy := *c
    56  	if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
    57  		configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
    58  	}
    59  	var cs Clientset
    60  	var err error
    61  	cs.k8sCniCncfIoV1, err = k8scnicncfiov1.NewForConfig(&configShallowCopy)
    62  	if err != nil {
    63  		return nil, err
    64  	}
    65  
    66  	cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
    67  	if err != nil {
    68  		return nil, err
    69  	}
    70  	return &cs, nil
    71  }
    72  
    73  // NewForConfigOrDie creates a new Clientset for the given config and
    74  // panics if there is an error in the config.
    75  func NewForConfigOrDie(c *rest.Config) *Clientset {
    76  	var cs Clientset
    77  	cs.k8sCniCncfIoV1 = k8scnicncfiov1.NewForConfigOrDie(c)
    78  
    79  	cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
    80  	return &cs
    81  }
    82  
    83  // New creates a new Clientset for the given RESTClient.
    84  func New(c rest.Interface) *Clientset {
    85  	var cs Clientset
    86  	cs.k8sCniCncfIoV1 = k8scnicncfiov1.New(c)
    87  
    88  	cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
    89  	return &cs
    90  }
    91  

View as plain text