k8c.io/api/v3@v3.0.0-20230904060738-b0a93889c0b6/pkg/generated/informers/externalversions/ee.kubermatic/v1/addon.go (about)

     1  // Code generated by informer-gen. DO NOT EDIT.
     2  
     3  package v1
     4  
     5  import (
     6  	"context"
     7  	time "time"
     8  
     9  	eekubermaticv1 "k8c.io/api/v3/pkg/apis/ee.kubermatic/v1"
    10  	versioned "k8c.io/api/v3/pkg/generated/clientset/versioned"
    11  	internalinterfaces "k8c.io/api/v3/pkg/generated/informers/externalversions/internalinterfaces"
    12  	v1 "k8c.io/api/v3/pkg/generated/listers/ee.kubermatic/v1"
    13  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    14  	runtime "k8s.io/apimachinery/pkg/runtime"
    15  	watch "k8s.io/apimachinery/pkg/watch"
    16  	cache "k8s.io/client-go/tools/cache"
    17  )
    18  
    19  // AddonInformer provides access to a shared informer and lister for
    20  // Addons.
    21  type AddonInformer interface {
    22  	Informer() cache.SharedIndexInformer
    23  	Lister() v1.AddonLister
    24  }
    25  
    26  type addonInformer struct {
    27  	factory          internalinterfaces.SharedInformerFactory
    28  	tweakListOptions internalinterfaces.TweakListOptionsFunc
    29  	namespace        string
    30  }
    31  
    32  // NewAddonInformer constructs a new informer for Addon type.
    33  // Always prefer using an informer factory to get a shared informer instead of getting an independent
    34  // one. This reduces memory footprint and number of connections to the server.
    35  func NewAddonInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
    36  	return NewFilteredAddonInformer(client, namespace, resyncPeriod, indexers, nil)
    37  }
    38  
    39  // NewFilteredAddonInformer constructs a new informer for Addon type.
    40  // Always prefer using an informer factory to get a shared informer instead of getting an independent
    41  // one. This reduces memory footprint and number of connections to the server.
    42  func NewFilteredAddonInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
    43  	return cache.NewSharedIndexInformer(
    44  		&cache.ListWatch{
    45  			ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
    46  				if tweakListOptions != nil {
    47  					tweakListOptions(&options)
    48  				}
    49  				return client.KubermaticEnterpriseV1().Addons(namespace).List(context.TODO(), options)
    50  			},
    51  			WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
    52  				if tweakListOptions != nil {
    53  					tweakListOptions(&options)
    54  				}
    55  				return client.KubermaticEnterpriseV1().Addons(namespace).Watch(context.TODO(), options)
    56  			},
    57  		},
    58  		&eekubermaticv1.Addon{},
    59  		resyncPeriod,
    60  		indexers,
    61  	)
    62  }
    63  
    64  func (f *addonInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
    65  	return NewFilteredAddonInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
    66  }
    67  
    68  func (f *addonInformer) Informer() cache.SharedIndexInformer {
    69  	return f.factory.InformerFor(&eekubermaticv1.Addon{}, f.defaultInformer)
    70  }
    71  
    72  func (f *addonInformer) Lister() v1.AddonLister {
    73  	return v1.NewAddonLister(f.Informer().GetIndexer())
    74  }