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

package v1

import (
	context "context"
	time "time"

	apisclimanagerv1 "github.com/openshift/cli-manager-operator/pkg/apis/climanager/v1"
	versioned "github.com/openshift/cli-manager-operator/pkg/generated/clientset/versioned"
	internalinterfaces "github.com/openshift/cli-manager-operator/pkg/generated/informers/externalversions/internalinterfaces"
	climanagerv1 "github.com/openshift/cli-manager-operator/pkg/generated/listers/climanager/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"
)

// CliManagerInformer provides access to a shared informer and lister for
// CliManagers.
type CliManagerInformer interface {
	Informer() cache.SharedIndexInformer
	Lister() climanagerv1.CliManagerLister
}

type cliManagerInformer struct {
	factory          internalinterfaces.SharedInformerFactory
	tweakListOptions internalinterfaces.TweakListOptionsFunc
	namespace        string
}

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

// NewFilteredCliManagerInformer constructs a new informer for CliManager 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 NewFilteredCliManagerInformer(client versioned.Interface, namespace string, 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.ClimanagersV1().CliManagers(namespace).List(context.Background(), options)
			},
			WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
				if tweakListOptions != nil {
					tweakListOptions(&options)
				}
				return client.ClimanagersV1().CliManagers(namespace).Watch(context.Background(), options)
			},
			ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) {
				if tweakListOptions != nil {
					tweakListOptions(&options)
				}
				return client.ClimanagersV1().CliManagers(namespace).List(ctx, options)
			},
			WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) {
				if tweakListOptions != nil {
					tweakListOptions(&options)
				}
				return client.ClimanagersV1().CliManagers(namespace).Watch(ctx, options)
			},
		},
		&apisclimanagerv1.CliManager{},
		resyncPeriod,
		indexers,
	)
}

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

func (f *cliManagerInformer) Informer() cache.SharedIndexInformer {
	return f.factory.InformerFor(&apisclimanagerv1.CliManager{}, f.defaultInformer)
}

func (f *cliManagerInformer) Lister() climanagerv1.CliManagerLister {
	return climanagerv1.NewCliManagerLister(f.Informer().GetIndexer())
}
