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

package v1alpha2

import (
	time "time"

	configv1alpha2 "istio.io/client-go/pkg/apis/config/v1alpha2"
	versioned "istio.io/client-go/pkg/clientset/versioned"
	internalinterfaces "istio.io/client-go/pkg/informers/externalversions/internalinterfaces"
	v1alpha2 "istio.io/client-go/pkg/listers/config/v1alpha2"
	v1 "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"
)

// QuotaSpecBindingInformer provides access to a shared informer and lister for
// QuotaSpecBindings.
type QuotaSpecBindingInformer interface {
	Informer() cache.SharedIndexInformer
	Lister() v1alpha2.QuotaSpecBindingLister
}

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

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

// NewFilteredQuotaSpecBindingInformer constructs a new informer for QuotaSpecBinding 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 NewFilteredQuotaSpecBindingInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
	return cache.NewSharedIndexInformer(
		&cache.ListWatch{
			ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
				if tweakListOptions != nil {
					tweakListOptions(&options)
				}
				return client.ConfigV1alpha2().QuotaSpecBindings(namespace).List(options)
			},
			WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
				if tweakListOptions != nil {
					tweakListOptions(&options)
				}
				return client.ConfigV1alpha2().QuotaSpecBindings(namespace).Watch(options)
			},
		},
		&configv1alpha2.QuotaSpecBinding{},
		resyncPeriod,
		indexers,
	)
}

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

func (f *quotaSpecBindingInformer) Informer() cache.SharedIndexInformer {
	return f.factory.InformerFor(&configv1alpha2.QuotaSpecBinding{}, f.defaultInformer)
}

func (f *quotaSpecBindingInformer) Lister() v1alpha2.QuotaSpecBindingLister {
	return v1alpha2.NewQuotaSpecBindingLister(f.Informer().GetIndexer())
}
