clientset.go 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // Copyright 2021 the Kilo authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // Code generated by client-gen. DO NOT EDIT.
  15. package versioned
  16. import (
  17. kilov1alpha1 "github.com/squat/kilo/pkg/k8s/clientset/versioned/typed/kilo/v1alpha1"
  18. discovery "k8s.io/client-go/discovery"
  19. rest "k8s.io/client-go/rest"
  20. flowcontrol "k8s.io/client-go/util/flowcontrol"
  21. )
  22. type Interface interface {
  23. Discovery() discovery.DiscoveryInterface
  24. KiloV1alpha1() kilov1alpha1.KiloV1alpha1Interface
  25. }
  26. // Clientset contains the clients for groups. Each group has exactly one
  27. // version included in a Clientset.
  28. type Clientset struct {
  29. *discovery.DiscoveryClient
  30. kiloV1alpha1 *kilov1alpha1.KiloV1alpha1Client
  31. }
  32. // KiloV1alpha1 retrieves the KiloV1alpha1Client
  33. func (c *Clientset) KiloV1alpha1() kilov1alpha1.KiloV1alpha1Interface {
  34. return c.kiloV1alpha1
  35. }
  36. // Discovery retrieves the DiscoveryClient
  37. func (c *Clientset) Discovery() discovery.DiscoveryInterface {
  38. if c == nil {
  39. return nil
  40. }
  41. return c.DiscoveryClient
  42. }
  43. // NewForConfig creates a new Clientset for the given config.
  44. func NewForConfig(c *rest.Config) (*Clientset, error) {
  45. configShallowCopy := *c
  46. if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
  47. configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
  48. }
  49. var cs Clientset
  50. var err error
  51. cs.kiloV1alpha1, err = kilov1alpha1.NewForConfig(&configShallowCopy)
  52. if err != nil {
  53. return nil, err
  54. }
  55. cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
  56. if err != nil {
  57. return nil, err
  58. }
  59. return &cs, nil
  60. }
  61. // NewForConfigOrDie creates a new Clientset for the given config and
  62. // panics if there is an error in the config.
  63. func NewForConfigOrDie(c *rest.Config) *Clientset {
  64. var cs Clientset
  65. cs.kiloV1alpha1 = kilov1alpha1.NewForConfigOrDie(c)
  66. cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
  67. return &cs
  68. }
  69. // New creates a new Clientset for the given RESTClient.
  70. func New(c rest.Interface) *Clientset {
  71. var cs Clientset
  72. cs.kiloV1alpha1 = kilov1alpha1.New(c)
  73. cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
  74. return &cs
  75. }