k8c.io/api/v3@v3.0.0-20230904060738-b0a93889c0b6/pkg/generated/informers/externalversions/kubermatic/v1/user.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  	kubermaticv1 "k8c.io/api/v3/pkg/apis/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/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  // UserInformer provides access to a shared informer and lister for
    20  // Users.
    21  type UserInformer interface {
    22  	Informer() cache.SharedIndexInformer
    23  	Lister() v1.UserLister
    24  }
    25  
    26  type userInformer struct {
    27  	factory          internalinterfaces.SharedInformerFactory
    28  	tweakListOptions internalinterfaces.TweakListOptionsFunc
    29  	namespace        string
    30  }
    31  
    32  // NewUserInformer constructs a new informer for User 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 NewUserInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
    36  	return NewFilteredUserInformer(client, namespace, resyncPeriod, indexers, nil)
    37  }
    38  
    39  // NewFilteredUserInformer constructs a new informer for User 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 NewFilteredUserInformer(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.KubermaticV1().Users(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.KubermaticV1().Users(namespace).Watch(context.TODO(), options)
    56  			},
    57  		},
    58  		&kubermaticv1.User{},
    59  		resyncPeriod,
    60  		indexers,
    61  	)
    62  }
    63  
    64  func (f *userInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
    65  	return NewFilteredUserInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
    66  }
    67  
    68  func (f *userInformer) Informer() cache.SharedIndexInformer {
    69  	return f.factory.InformerFor(&kubermaticv1.User{}, f.defaultInformer)
    70  }
    71  
    72  func (f *userInformer) Lister() v1.UserLister {
    73  	return v1.NewUserLister(f.Informer().GetIndexer())
    74  }