// 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"
)

// AttributeManifestInformer provides access to a shared informer and lister for
// AttributeManifests.
type AttributeManifestInformer interface {
	Informer() cache.SharedIndexInformer
	Lister() v1alpha2.AttributeManifestLister
}

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

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

// NewFilteredAttributeManifestInformer constructs a new informer for AttributeManifest 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 NewFilteredAttributeManifestInformer(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().AttributeManifests(namespace).List(options)
			},
			WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
				if tweakListOptions != nil {
					tweakListOptions(&options)
				}
				return client.ConfigV1alpha2().AttributeManifests(namespace).Watch(options)
			},
		},
		&configv1alpha2.AttributeManifest{},
		resyncPeriod,
		indexers,
	)
}

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

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

func (f *attributeManifestInformer) Lister() v1alpha2.AttributeManifestLister {
	return v1alpha2.NewAttributeManifestLister(f.Informer().GetIndexer())
}
