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

package v1

import (
	v1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
	"k8s.io/apimachinery/pkg/api/errors"
	"k8s.io/apimachinery/pkg/labels"
	"k8s.io/client-go/tools/cache"
)

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

// kubeletConfigLister implements the KubeletConfigLister interface.
type kubeletConfigLister struct {
	indexer cache.Indexer
}

// NewKubeletConfigLister returns a new KubeletConfigLister.
func NewKubeletConfigLister(indexer cache.Indexer) KubeletConfigLister {
	return &kubeletConfigLister{indexer: indexer}
}

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

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