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

package v1alpha1

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

// FederatedResourceQuotaLister helps list FederatedResourceQuotas.
// All objects returned here must be treated as read-only.
type FederatedResourceQuotaLister interface {
	// List lists all FederatedResourceQuotas in the indexer.
	// Objects returned here must be treated as read-only.
	List(selector labels.Selector) (ret []*v1alpha1.FederatedResourceQuota, err error)
	// FederatedResourceQuotas returns an object that can list and get FederatedResourceQuotas.
	FederatedResourceQuotas(namespace string) FederatedResourceQuotaNamespaceLister
	FederatedResourceQuotaListerExpansion
}

// federatedResourceQuotaLister implements the FederatedResourceQuotaLister interface.
type federatedResourceQuotaLister struct {
	indexer cache.Indexer
}

// NewFederatedResourceQuotaLister returns a new FederatedResourceQuotaLister.
func NewFederatedResourceQuotaLister(indexer cache.Indexer) FederatedResourceQuotaLister {
	return &federatedResourceQuotaLister{indexer: indexer}
}

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

// FederatedResourceQuotas returns an object that can list and get FederatedResourceQuotas.
func (s *federatedResourceQuotaLister) FederatedResourceQuotas(namespace string) FederatedResourceQuotaNamespaceLister {
	return federatedResourceQuotaNamespaceLister{indexer: s.indexer, namespace: namespace}
}

// FederatedResourceQuotaNamespaceLister helps list and get FederatedResourceQuotas.
// All objects returned here must be treated as read-only.
type FederatedResourceQuotaNamespaceLister interface {
	// List lists all FederatedResourceQuotas in the indexer for a given namespace.
	// Objects returned here must be treated as read-only.
	List(selector labels.Selector) (ret []*v1alpha1.FederatedResourceQuota, err error)
	// Get retrieves the FederatedResourceQuota from the indexer for a given namespace and name.
	// Objects returned here must be treated as read-only.
	Get(name string) (*v1alpha1.FederatedResourceQuota, error)
	FederatedResourceQuotaNamespaceListerExpansion
}

// federatedResourceQuotaNamespaceLister implements the FederatedResourceQuotaNamespaceLister
// interface.
type federatedResourceQuotaNamespaceLister struct {
	indexer   cache.Indexer
	namespace string
}

// List lists all FederatedResourceQuotas in the indexer for a given namespace.
func (s federatedResourceQuotaNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.FederatedResourceQuota, err error) {
	err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
		ret = append(ret, m.(*v1alpha1.FederatedResourceQuota))
	})
	return ret, err
}

// Get retrieves the FederatedResourceQuota from the indexer for a given namespace and name.
func (s federatedResourceQuotaNamespaceLister) Get(name string) (*v1alpha1.FederatedResourceQuota, error) {
	obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
	if err != nil {
		return nil, err
	}
	if !exists {
		return nil, errors.NewNotFound(v1alpha1.Resource("federatedresourcequota"), name)
	}
	return obj.(*v1alpha1.FederatedResourceQuota), nil
}
