github.com/giantswarm/apiextensions/v2@v2.6.2/pkg/clientset/versioned/clientset.go (about)

     1  /*
     2  Copyright 2020 Giant Swarm GmbH.
     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  	"fmt"
    23  
    24  	discovery "k8s.io/client-go/discovery"
    25  	rest "k8s.io/client-go/rest"
    26  	flowcontrol "k8s.io/client-go/util/flowcontrol"
    27  
    28  	applicationv1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/application/v1alpha1"
    29  	backupv1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/backup/v1alpha1"
    30  	corev1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/core/v1alpha1"
    31  	examplev1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/example/v1alpha1"
    32  	infrastructurev1alpha2 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/infrastructure/v1alpha2"
    33  	providerv1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/provider/v1alpha1"
    34  	releasev1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/release/v1alpha1"
    35  	securityv1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/security/v1alpha1"
    36  	toolingv1alpha1 "github.com/giantswarm/apiextensions/v2/pkg/clientset/versioned/typed/tooling/v1alpha1"
    37  )
    38  
    39  type Interface interface {
    40  	Discovery() discovery.DiscoveryInterface
    41  	ApplicationV1alpha1() applicationv1alpha1.ApplicationV1alpha1Interface
    42  	BackupV1alpha1() backupv1alpha1.BackupV1alpha1Interface
    43  	CoreV1alpha1() corev1alpha1.CoreV1alpha1Interface
    44  	ExampleV1alpha1() examplev1alpha1.ExampleV1alpha1Interface
    45  	InfrastructureV1alpha2() infrastructurev1alpha2.InfrastructureV1alpha2Interface
    46  	ProviderV1alpha1() providerv1alpha1.ProviderV1alpha1Interface
    47  	ReleaseV1alpha1() releasev1alpha1.ReleaseV1alpha1Interface
    48  	SecurityV1alpha1() securityv1alpha1.SecurityV1alpha1Interface
    49  	ToolingV1alpha1() toolingv1alpha1.ToolingV1alpha1Interface
    50  }
    51  
    52  // Clientset contains the clients for groups. Each group has exactly one
    53  // version included in a Clientset.
    54  type Clientset struct {
    55  	*discovery.DiscoveryClient
    56  	applicationV1alpha1    *applicationv1alpha1.ApplicationV1alpha1Client
    57  	backupV1alpha1         *backupv1alpha1.BackupV1alpha1Client
    58  	coreV1alpha1           *corev1alpha1.CoreV1alpha1Client
    59  	exampleV1alpha1        *examplev1alpha1.ExampleV1alpha1Client
    60  	infrastructureV1alpha2 *infrastructurev1alpha2.InfrastructureV1alpha2Client
    61  	providerV1alpha1       *providerv1alpha1.ProviderV1alpha1Client
    62  	releaseV1alpha1        *releasev1alpha1.ReleaseV1alpha1Client
    63  	securityV1alpha1       *securityv1alpha1.SecurityV1alpha1Client
    64  	toolingV1alpha1        *toolingv1alpha1.ToolingV1alpha1Client
    65  }
    66  
    67  // ApplicationV1alpha1 retrieves the ApplicationV1alpha1Client
    68  func (c *Clientset) ApplicationV1alpha1() applicationv1alpha1.ApplicationV1alpha1Interface {
    69  	return c.applicationV1alpha1
    70  }
    71  
    72  // BackupV1alpha1 retrieves the BackupV1alpha1Client
    73  func (c *Clientset) BackupV1alpha1() backupv1alpha1.BackupV1alpha1Interface {
    74  	return c.backupV1alpha1
    75  }
    76  
    77  // CoreV1alpha1 retrieves the CoreV1alpha1Client
    78  func (c *Clientset) CoreV1alpha1() corev1alpha1.CoreV1alpha1Interface {
    79  	return c.coreV1alpha1
    80  }
    81  
    82  // ExampleV1alpha1 retrieves the ExampleV1alpha1Client
    83  func (c *Clientset) ExampleV1alpha1() examplev1alpha1.ExampleV1alpha1Interface {
    84  	return c.exampleV1alpha1
    85  }
    86  
    87  // InfrastructureV1alpha2 retrieves the InfrastructureV1alpha2Client
    88  func (c *Clientset) InfrastructureV1alpha2() infrastructurev1alpha2.InfrastructureV1alpha2Interface {
    89  	return c.infrastructureV1alpha2
    90  }
    91  
    92  // ProviderV1alpha1 retrieves the ProviderV1alpha1Client
    93  func (c *Clientset) ProviderV1alpha1() providerv1alpha1.ProviderV1alpha1Interface {
    94  	return c.providerV1alpha1
    95  }
    96  
    97  // ReleaseV1alpha1 retrieves the ReleaseV1alpha1Client
    98  func (c *Clientset) ReleaseV1alpha1() releasev1alpha1.ReleaseV1alpha1Interface {
    99  	return c.releaseV1alpha1
   100  }
   101  
   102  // SecurityV1alpha1 retrieves the SecurityV1alpha1Client
   103  func (c *Clientset) SecurityV1alpha1() securityv1alpha1.SecurityV1alpha1Interface {
   104  	return c.securityV1alpha1
   105  }
   106  
   107  // ToolingV1alpha1 retrieves the ToolingV1alpha1Client
   108  func (c *Clientset) ToolingV1alpha1() toolingv1alpha1.ToolingV1alpha1Interface {
   109  	return c.toolingV1alpha1
   110  }
   111  
   112  // Discovery retrieves the DiscoveryClient
   113  func (c *Clientset) Discovery() discovery.DiscoveryInterface {
   114  	if c == nil {
   115  		return nil
   116  	}
   117  	return c.DiscoveryClient
   118  }
   119  
   120  // NewForConfig creates a new Clientset for the given config.
   121  // If config's RateLimiter is not set and QPS and Burst are acceptable,
   122  // NewForConfig will generate a rate-limiter in configShallowCopy.
   123  func NewForConfig(c *rest.Config) (*Clientset, error) {
   124  	configShallowCopy := *c
   125  	if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
   126  		if configShallowCopy.Burst <= 0 {
   127  			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")
   128  		}
   129  		configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
   130  	}
   131  	var cs Clientset
   132  	var err error
   133  	cs.applicationV1alpha1, err = applicationv1alpha1.NewForConfig(&configShallowCopy)
   134  	if err != nil {
   135  		return nil, err
   136  	}
   137  	cs.backupV1alpha1, err = backupv1alpha1.NewForConfig(&configShallowCopy)
   138  	if err != nil {
   139  		return nil, err
   140  	}
   141  	cs.coreV1alpha1, err = corev1alpha1.NewForConfig(&configShallowCopy)
   142  	if err != nil {
   143  		return nil, err
   144  	}
   145  	cs.exampleV1alpha1, err = examplev1alpha1.NewForConfig(&configShallowCopy)
   146  	if err != nil {
   147  		return nil, err
   148  	}
   149  	cs.infrastructureV1alpha2, err = infrastructurev1alpha2.NewForConfig(&configShallowCopy)
   150  	if err != nil {
   151  		return nil, err
   152  	}
   153  	cs.providerV1alpha1, err = providerv1alpha1.NewForConfig(&configShallowCopy)
   154  	if err != nil {
   155  		return nil, err
   156  	}
   157  	cs.releaseV1alpha1, err = releasev1alpha1.NewForConfig(&configShallowCopy)
   158  	if err != nil {
   159  		return nil, err
   160  	}
   161  	cs.securityV1alpha1, err = securityv1alpha1.NewForConfig(&configShallowCopy)
   162  	if err != nil {
   163  		return nil, err
   164  	}
   165  	cs.toolingV1alpha1, err = toolingv1alpha1.NewForConfig(&configShallowCopy)
   166  	if err != nil {
   167  		return nil, err
   168  	}
   169  
   170  	cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
   171  	if err != nil {
   172  		return nil, err
   173  	}
   174  	return &cs, nil
   175  }
   176  
   177  // NewForConfigOrDie creates a new Clientset for the given config and
   178  // panics if there is an error in the config.
   179  func NewForConfigOrDie(c *rest.Config) *Clientset {
   180  	var cs Clientset
   181  	cs.applicationV1alpha1 = applicationv1alpha1.NewForConfigOrDie(c)
   182  	cs.backupV1alpha1 = backupv1alpha1.NewForConfigOrDie(c)
   183  	cs.coreV1alpha1 = corev1alpha1.NewForConfigOrDie(c)
   184  	cs.exampleV1alpha1 = examplev1alpha1.NewForConfigOrDie(c)
   185  	cs.infrastructureV1alpha2 = infrastructurev1alpha2.NewForConfigOrDie(c)
   186  	cs.providerV1alpha1 = providerv1alpha1.NewForConfigOrDie(c)
   187  	cs.releaseV1alpha1 = releasev1alpha1.NewForConfigOrDie(c)
   188  	cs.securityV1alpha1 = securityv1alpha1.NewForConfigOrDie(c)
   189  	cs.toolingV1alpha1 = toolingv1alpha1.NewForConfigOrDie(c)
   190  
   191  	cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
   192  	return &cs
   193  }
   194  
   195  // New creates a new Clientset for the given RESTClient.
   196  func New(c rest.Interface) *Clientset {
   197  	var cs Clientset
   198  	cs.applicationV1alpha1 = applicationv1alpha1.New(c)
   199  	cs.backupV1alpha1 = backupv1alpha1.New(c)
   200  	cs.coreV1alpha1 = corev1alpha1.New(c)
   201  	cs.exampleV1alpha1 = examplev1alpha1.New(c)
   202  	cs.infrastructureV1alpha2 = infrastructurev1alpha2.New(c)
   203  	cs.providerV1alpha1 = providerv1alpha1.New(c)
   204  	cs.releaseV1alpha1 = releasev1alpha1.New(c)
   205  	cs.securityV1alpha1 = securityv1alpha1.New(c)
   206  	cs.toolingV1alpha1 = toolingv1alpha1.New(c)
   207  
   208  	cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
   209  	return &cs
   210  }