// Code generated by informer-gen. DO NOT EDIT.

package v1

import (
	"context"
	time "time"

	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	runtime "k8s.io/apimachinery/pkg/runtime"
	watch "k8s.io/apimachinery/pkg/watch"
	cache "k8s.io/client-go/tools/cache"
	versioned "open-cluster-management.io/api/client/work/clientset/versioned"
	internalinterfaces "open-cluster-management.io/api/client/work/informers/externalversions/internalinterfaces"
	v1 "open-cluster-management.io/api/client/work/listers/work/v1"
	workv1 "open-cluster-management.io/api/work/v1"
)

// AppliedManifestWorkInformer provides access to a shared informer and lister for
// AppliedManifestWorks.
type AppliedManifestWorkInformer interface {
	Informer() cache.SharedIndexInformer
	Lister() v1.AppliedManifestWorkLister
}

type appliedManifestWorkInformer struct {
	factory          internalinterfaces.SharedInformerFactory
	tweakListOptions internalinterfaces.TweakListOptionsFunc
}

// NewAppliedManifestWorkInformer constructs a new informer for AppliedManifestWork type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewAppliedManifestWorkInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
	return NewFilteredAppliedManifestWorkInformer(client, resyncPeriod, indexers, nil)
}

// NewFilteredAppliedManifestWorkInformer constructs a new informer for AppliedManifestWork type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredAppliedManifestWorkInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
	return cache.NewSharedIndexInformer(
		&cache.ListWatch{
			ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
				if tweakListOptions != nil {
					tweakListOptions(&options)
				}
				return client.WorkV1().AppliedManifestWorks().List(context.TODO(), options)
			},
			WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
				if tweakListOptions != nil {
					tweakListOptions(&options)
				}
				return client.WorkV1().AppliedManifestWorks().Watch(context.TODO(), options)
			},
		},
		&workv1.AppliedManifestWork{},
		resyncPeriod,
		indexers,
	)
}

func (f *appliedManifestWorkInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
	return NewFilteredAppliedManifestWorkInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}

func (f *appliedManifestWorkInformer) Informer() cache.SharedIndexInformer {
	return f.factory.InformerFor(&workv1.AppliedManifestWork{}, f.defaultInformer)
}

func (f *appliedManifestWorkInformer) Lister() v1.AppliedManifestWorkLister {
	return v1.NewAppliedManifestWorkLister(f.Informer().GetIndexer())
}
