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

package v1alpha1

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

// ClusterClaimLister helps list ClusterClaims.
// All objects returned here must be treated as read-only.
type ClusterClaimLister interface {
	// List lists all ClusterClaims in the indexer.
	// Objects returned here must be treated as read-only.
	List(selector labels.Selector) (ret []*v1alpha1.ClusterClaim, err error)
	// Get retrieves the ClusterClaim from the index for a given name.
	// Objects returned here must be treated as read-only.
	Get(name string) (*v1alpha1.ClusterClaim, error)
	ClusterClaimListerExpansion
}

// clusterClaimLister implements the ClusterClaimLister interface.
type clusterClaimLister struct {
	indexer cache.Indexer
}

// NewClusterClaimLister returns a new ClusterClaimLister.
func NewClusterClaimLister(indexer cache.Indexer) ClusterClaimLister {
	return &clusterClaimLister{indexer: indexer}
}

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

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