github.com/argoproj/argo-cd@v1.8.7/pkg/client/informers/externalversions/application/v1alpha1/appproject.go (about)

     1  // Code generated by informer-gen. DO NOT EDIT.
     2  
     3  package v1alpha1
     4  
     5  import (
     6  	"context"
     7  	time "time"
     8  
     9  	applicationv1alpha1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
    10  	versioned "github.com/argoproj/argo-cd/pkg/client/clientset/versioned"
    11  	internalinterfaces "github.com/argoproj/argo-cd/pkg/client/informers/externalversions/internalinterfaces"
    12  	v1alpha1 "github.com/argoproj/argo-cd/pkg/client/listers/application/v1alpha1"
    13  	v1 "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  // AppProjectInformer provides access to a shared informer and lister for
    20  // AppProjects.
    21  type AppProjectInformer interface {
    22  	Informer() cache.SharedIndexInformer
    23  	Lister() v1alpha1.AppProjectLister
    24  }
    25  
    26  type appProjectInformer struct {
    27  	factory          internalinterfaces.SharedInformerFactory
    28  	tweakListOptions internalinterfaces.TweakListOptionsFunc
    29  	namespace        string
    30  }
    31  
    32  // NewAppProjectInformer constructs a new informer for AppProject 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 NewAppProjectInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
    36  	return NewFilteredAppProjectInformer(client, namespace, resyncPeriod, indexers, nil)
    37  }
    38  
    39  // NewFilteredAppProjectInformer constructs a new informer for AppProject 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 NewFilteredAppProjectInformer(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 v1.ListOptions) (runtime.Object, error) {
    46  				if tweakListOptions != nil {
    47  					tweakListOptions(&options)
    48  				}
    49  				return client.ArgoprojV1alpha1().AppProjects(namespace).List(context.TODO(), options)
    50  			},
    51  			WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
    52  				if tweakListOptions != nil {
    53  					tweakListOptions(&options)
    54  				}
    55  				return client.ArgoprojV1alpha1().AppProjects(namespace).Watch(context.TODO(), options)
    56  			},
    57  		},
    58  		&applicationv1alpha1.AppProject{},
    59  		resyncPeriod,
    60  		indexers,
    61  	)
    62  }
    63  
    64  func (f *appProjectInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
    65  	return NewFilteredAppProjectInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
    66  }
    67  
    68  func (f *appProjectInformer) Informer() cache.SharedIndexInformer {
    69  	return f.factory.InformerFor(&applicationv1alpha1.AppProject{}, f.defaultInformer)
    70  }
    71  
    72  func (f *appProjectInformer) Lister() v1alpha1.AppProjectLister {
    73  	return v1alpha1.NewAppProjectLister(f.Informer().GetIndexer())
    74  }