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

package v1

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

// ClusterManagerLister helps list ClusterManagers.
type ClusterManagerLister interface {
	// List lists all ClusterManagers in the indexer.
	List(selector labels.Selector) (ret []*v1.ClusterManager, err error)
	// Get retrieves the ClusterManager from the index for a given name.
	Get(name string) (*v1.ClusterManager, error)
	ClusterManagerListerExpansion
}

// clusterManagerLister implements the ClusterManagerLister interface.
type clusterManagerLister struct {
	indexer cache.Indexer
}

// NewClusterManagerLister returns a new ClusterManagerLister.
func NewClusterManagerLister(indexer cache.Indexer) ClusterManagerLister {
	return &clusterManagerLister{indexer: indexer}
}

// List lists all ClusterManagers in the indexer.
func (s *clusterManagerLister) List(selector labels.Selector) (ret []*v1.ClusterManager, err error) {
	err = cache.ListAll(s.indexer, selector, func(m interface{}) {
		ret = append(ret, m.(*v1.ClusterManager))
	})
	return ret, err
}

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