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

package v1

import (
	time "time"

	security_v1 "github.com/openshift/api/security/v1"
	versioned "github.com/openshift/client-go/security/clientset/versioned"
	internalinterfaces "github.com/openshift/client-go/security/informers/externalversions/internalinterfaces"
	v1 "github.com/openshift/client-go/security/listers/security/v1"
	meta_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"
)

// SecurityContextConstraintsInformer provides access to a shared informer and lister for
// SecurityContextConstraints.
type SecurityContextConstraintsInformer interface {
	Informer() cache.SharedIndexInformer
	Lister() v1.SecurityContextConstraintsLister
}

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

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

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

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

func (f *securityContextConstraintsInformer) Informer() cache.SharedIndexInformer {
	return f.factory.InformerFor(&security_v1.SecurityContextConstraints{}, f.defaultInformer)
}

func (f *securityContextConstraintsInformer) Lister() v1.SecurityContextConstraintsLister {
	return v1.NewSecurityContextConstraintsLister(f.Informer().GetIndexer())
}
