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

package v1

import (
	"context"
	time "time"

	versioned "github.com/open-cluster-management/api/client/operator/clientset/versioned"
	internalinterfaces "github.com/open-cluster-management/api/client/operator/informers/externalversions/internalinterfaces"
	v1 "github.com/open-cluster-management/api/client/operator/listers/operator/v1"
	operatorv1 "github.com/open-cluster-management/api/operator/v1"
	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"
)

// ClusterManagerInformer provides access to a shared informer and lister for
// ClusterManagers.
type ClusterManagerInformer interface {
	Informer() cache.SharedIndexInformer
	Lister() v1.ClusterManagerLister
}

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

// NewClusterManagerInformer constructs a new informer for ClusterManager 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 NewClusterManagerInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
	return NewFilteredClusterManagerInformer(client, resyncPeriod, indexers, nil)
}

// NewFilteredClusterManagerInformer constructs a new informer for ClusterManager 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 NewFilteredClusterManagerInformer(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.OperatorV1().ClusterManagers().List(context.TODO(), options)
			},
			WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
				if tweakListOptions != nil {
					tweakListOptions(&options)
				}
				return client.OperatorV1().ClusterManagers().Watch(context.TODO(), options)
			},
		},
		&operatorv1.ClusterManager{},
		resyncPeriod,
		indexers,
	)
}

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

func (f *clusterManagerInformer) Informer() cache.SharedIndexInformer {
	return f.factory.InformerFor(&operatorv1.ClusterManager{}, f.defaultInformer)
}

func (f *clusterManagerInformer) Lister() v1.ClusterManagerLister {
	return v1.NewClusterManagerLister(f.Informer().GetIndexer())
}
