github.com/argoproj/argo-cd/v3@v3.2.1/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 "context" 7 time "time" 8 9 apisapplicationv1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" 10 versioned "github.com/argoproj/argo-cd/v3/pkg/client/clientset/versioned" 11 internalinterfaces "github.com/argoproj/argo-cd/v3/pkg/client/informers/externalversions/internalinterfaces" 12 applicationv1alpha1 "github.com/argoproj/argo-cd/v3/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() applicationv1alpha1.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.Background(), 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.Background(), options) 56 }, 57 ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { 58 if tweakListOptions != nil { 59 tweakListOptions(&options) 60 } 61 return client.ArgoprojV1alpha1().AppProjects(namespace).List(ctx, options) 62 }, 63 WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { 64 if tweakListOptions != nil { 65 tweakListOptions(&options) 66 } 67 return client.ArgoprojV1alpha1().AppProjects(namespace).Watch(ctx, options) 68 }, 69 }, 70 &apisapplicationv1alpha1.AppProject{}, 71 resyncPeriod, 72 indexers, 73 ) 74 } 75 76 func (f *appProjectInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 77 return NewFilteredAppProjectInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 78 } 79 80 func (f *appProjectInformer) Informer() cache.SharedIndexInformer { 81 return f.factory.InformerFor(&apisapplicationv1alpha1.AppProject{}, f.defaultInformer) 82 } 83 84 func (f *appProjectInformer) Lister() applicationv1alpha1.AppProjectLister { 85 return applicationv1alpha1.NewAppProjectLister(f.Informer().GetIndexer()) 86 }