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

package v1alpha1

import (
	v1alpha1 "github.com/openshift/api/operator/v1alpha1"
	"k8s.io/apimachinery/pkg/api/errors"
	"k8s.io/apimachinery/pkg/labels"
	"k8s.io/client-go/tools/cache"
)

// ImageContentSourcePolicyLister helps list ImageContentSourcePolicies.
type ImageContentSourcePolicyLister interface {
	// List lists all ImageContentSourcePolicies in the indexer.
	List(selector labels.Selector) (ret []*v1alpha1.ImageContentSourcePolicy, err error)
	// Get retrieves the ImageContentSourcePolicy from the index for a given name.
	Get(name string) (*v1alpha1.ImageContentSourcePolicy, error)
	ImageContentSourcePolicyListerExpansion
}

// imageContentSourcePolicyLister implements the ImageContentSourcePolicyLister interface.
type imageContentSourcePolicyLister struct {
	indexer cache.Indexer
}

// NewImageContentSourcePolicyLister returns a new ImageContentSourcePolicyLister.
func NewImageContentSourcePolicyLister(indexer cache.Indexer) ImageContentSourcePolicyLister {
	return &imageContentSourcePolicyLister{indexer: indexer}
}

// List lists all ImageContentSourcePolicies in the indexer.
func (s *imageContentSourcePolicyLister) List(selector labels.Selector) (ret []*v1alpha1.ImageContentSourcePolicy, err error) {
	err = cache.ListAll(s.indexer, selector, func(m interface{}) {
		ret = append(ret, m.(*v1alpha1.ImageContentSourcePolicy))
	})
	return ret, err
}

// Get retrieves the ImageContentSourcePolicy from the index for a given name.
func (s *imageContentSourcePolicyLister) Get(name string) (*v1alpha1.ImageContentSourcePolicy, error) {
	obj, exists, err := s.indexer.GetByKey(name)
	if err != nil {
		return nil, err
	}
	if !exists {
		return nil, errors.NewNotFound(v1alpha1.Resource("imagecontentsourcepolicy"), name)
	}
	return obj.(*v1alpha1.ImageContentSourcePolicy), nil
}
