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

package v1alpha1

import (
	"context"
	time "time"

	sealedsecretsv1alpha1 "github.com/bitnami-labs/sealed-secrets/pkg/apis/sealedsecrets/v1alpha1"
	versioned "github.com/bitnami-labs/sealed-secrets/pkg/client/clientset/versioned"
	internalinterfaces "github.com/bitnami-labs/sealed-secrets/pkg/client/informers/externalversions/internalinterfaces"
	v1alpha1 "github.com/bitnami-labs/sealed-secrets/pkg/client/listers/sealedsecrets/v1alpha1"
	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"
)

// SealedSecretInformer provides access to a shared informer and lister for
// SealedSecrets.
type SealedSecretInformer interface {
	Informer() cache.SharedIndexInformer
	Lister() v1alpha1.SealedSecretLister
}

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

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

// NewFilteredSealedSecretInformer constructs a new informer for SealedSecret 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 NewFilteredSealedSecretInformer(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.BitnamiV1alpha1().SealedSecrets(namespace).List(context.TODO(), options)
			},
			WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
				if tweakListOptions != nil {
					tweakListOptions(&options)
				}
				return client.BitnamiV1alpha1().SealedSecrets(namespace).Watch(context.TODO(), options)
			},
		},
		&sealedsecretsv1alpha1.SealedSecret{},
		resyncPeriod,
		indexers,
	)
}

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

func (f *sealedSecretInformer) Informer() cache.SharedIndexInformer {
	return f.factory.InformerFor(&sealedsecretsv1alpha1.SealedSecret{}, f.defaultInformer)
}

func (f *sealedSecretInformer) Lister() v1alpha1.SealedSecretLister {
	return v1alpha1.NewSealedSecretLister(f.Informer().GetIndexer())
}
