github.com/argoproj/argo-cd@v1.8.7/pkg/client/clientset/versioned/clientset.go (about)

     1  // Code generated by client-gen. DO NOT EDIT.
     2  
     3  package versioned
     4  
     5  import (
     6  	"fmt"
     7  
     8  	argoprojv1alpha1 "github.com/argoproj/argo-cd/pkg/client/clientset/versioned/typed/application/v1alpha1"
     9  	discovery "k8s.io/client-go/discovery"
    10  	rest "k8s.io/client-go/rest"
    11  	flowcontrol "k8s.io/client-go/util/flowcontrol"
    12  )
    13  
    14  type Interface interface {
    15  	Discovery() discovery.DiscoveryInterface
    16  	ArgoprojV1alpha1() argoprojv1alpha1.ArgoprojV1alpha1Interface
    17  }
    18  
    19  // Clientset contains the clients for groups. Each group has exactly one
    20  // version included in a Clientset.
    21  type Clientset struct {
    22  	*discovery.DiscoveryClient
    23  	argoprojV1alpha1 *argoprojv1alpha1.ArgoprojV1alpha1Client
    24  }
    25  
    26  // ArgoprojV1alpha1 retrieves the ArgoprojV1alpha1Client
    27  func (c *Clientset) ArgoprojV1alpha1() argoprojv1alpha1.ArgoprojV1alpha1Interface {
    28  	return c.argoprojV1alpha1
    29  }
    30  
    31  // Discovery retrieves the DiscoveryClient
    32  func (c *Clientset) Discovery() discovery.DiscoveryInterface {
    33  	if c == nil {
    34  		return nil
    35  	}
    36  	return c.DiscoveryClient
    37  }
    38  
    39  // NewForConfig creates a new Clientset for the given config.
    40  // If config's RateLimiter is not set and QPS and Burst are acceptable,
    41  // NewForConfig will generate a rate-limiter in configShallowCopy.
    42  func NewForConfig(c *rest.Config) (*Clientset, error) {
    43  	configShallowCopy := *c
    44  	if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
    45  		if configShallowCopy.Burst <= 0 {
    46  			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")
    47  		}
    48  		configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
    49  	}
    50  	var cs Clientset
    51  	var err error
    52  	cs.argoprojV1alpha1, err = argoprojv1alpha1.NewForConfig(&configShallowCopy)
    53  	if err != nil {
    54  		return nil, err
    55  	}
    56  
    57  	cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
    58  	if err != nil {
    59  		return nil, err
    60  	}
    61  	return &cs, nil
    62  }
    63  
    64  // NewForConfigOrDie creates a new Clientset for the given config and
    65  // panics if there is an error in the config.
    66  func NewForConfigOrDie(c *rest.Config) *Clientset {
    67  	var cs Clientset
    68  	cs.argoprojV1alpha1 = argoprojv1alpha1.NewForConfigOrDie(c)
    69  
    70  	cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
    71  	return &cs
    72  }
    73  
    74  // New creates a new Clientset for the given RESTClient.
    75  func New(c rest.Interface) *Clientset {
    76  	var cs Clientset
    77  	cs.argoprojV1alpha1 = argoprojv1alpha1.New(c)
    78  
    79  	cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
    80  	return &cs
    81  }