validatingwebhookconfiguration.go 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. Copyright The Kubernetes Authors.
  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. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. // Code generated by informer-gen. DO NOT EDIT.
  14. package v1beta1
  15. import (
  16. "context"
  17. time "time"
  18. admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1"
  19. v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  20. runtime "k8s.io/apimachinery/pkg/runtime"
  21. watch "k8s.io/apimachinery/pkg/watch"
  22. internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
  23. kubernetes "k8s.io/client-go/kubernetes"
  24. v1beta1 "k8s.io/client-go/listers/admissionregistration/v1beta1"
  25. cache "k8s.io/client-go/tools/cache"
  26. )
  27. // ValidatingWebhookConfigurationInformer provides access to a shared informer and lister for
  28. // ValidatingWebhookConfigurations.
  29. type ValidatingWebhookConfigurationInformer interface {
  30. Informer() cache.SharedIndexInformer
  31. Lister() v1beta1.ValidatingWebhookConfigurationLister
  32. }
  33. type validatingWebhookConfigurationInformer struct {
  34. factory internalinterfaces.SharedInformerFactory
  35. tweakListOptions internalinterfaces.TweakListOptionsFunc
  36. }
  37. // NewValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type.
  38. // Always prefer using an informer factory to get a shared informer instead of getting an independent
  39. // one. This reduces memory footprint and number of connections to the server.
  40. func NewValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
  41. return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, indexers, nil)
  42. }
  43. // NewFilteredValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type.
  44. // Always prefer using an informer factory to get a shared informer instead of getting an independent
  45. // one. This reduces memory footprint and number of connections to the server.
  46. func NewFilteredValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
  47. return cache.NewSharedIndexInformer(
  48. &cache.ListWatch{
  49. ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
  50. if tweakListOptions != nil {
  51. tweakListOptions(&options)
  52. }
  53. return client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().List(context.TODO(), options)
  54. },
  55. WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
  56. if tweakListOptions != nil {
  57. tweakListOptions(&options)
  58. }
  59. return client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().Watch(context.TODO(), options)
  60. },
  61. },
  62. &admissionregistrationv1beta1.ValidatingWebhookConfiguration{},
  63. resyncPeriod,
  64. indexers,
  65. )
  66. }
  67. func (f *validatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
  68. return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
  69. }
  70. func (f *validatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer {
  71. return f.factory.InformerFor(&admissionregistrationv1beta1.ValidatingWebhookConfiguration{}, f.defaultInformer)
  72. }
  73. func (f *validatingWebhookConfigurationInformer) Lister() v1beta1.ValidatingWebhookConfigurationLister {
  74. return v1beta1.NewValidatingWebhookConfigurationLister(f.Informer().GetIndexer())
  75. }