/*

Don't alter this file, it was generated.

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

package v1alpha1

import (
	v1alpha1 "code.cloudfoundry.org/quarks-operator/pkg/kube/apis/boshdeployment/v1alpha1"
	"k8s.io/apimachinery/pkg/api/errors"
	"k8s.io/apimachinery/pkg/labels"
	"k8s.io/client-go/tools/cache"
)

// BOSHDeploymentLister helps list BOSHDeployments.
type BOSHDeploymentLister interface {
	// List lists all BOSHDeployments in the indexer.
	List(selector labels.Selector) (ret []*v1alpha1.BOSHDeployment, err error)
	// BOSHDeployments returns an object that can list and get BOSHDeployments.
	BOSHDeployments(namespace string) BOSHDeploymentNamespaceLister
	BOSHDeploymentListerExpansion
}

// bOSHDeploymentLister implements the BOSHDeploymentLister interface.
type bOSHDeploymentLister struct {
	indexer cache.Indexer
}

// NewBOSHDeploymentLister returns a new BOSHDeploymentLister.
func NewBOSHDeploymentLister(indexer cache.Indexer) BOSHDeploymentLister {
	return &bOSHDeploymentLister{indexer: indexer}
}

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

// BOSHDeployments returns an object that can list and get BOSHDeployments.
func (s *bOSHDeploymentLister) BOSHDeployments(namespace string) BOSHDeploymentNamespaceLister {
	return bOSHDeploymentNamespaceLister{indexer: s.indexer, namespace: namespace}
}

// BOSHDeploymentNamespaceLister helps list and get BOSHDeployments.
type BOSHDeploymentNamespaceLister interface {
	// List lists all BOSHDeployments in the indexer for a given namespace.
	List(selector labels.Selector) (ret []*v1alpha1.BOSHDeployment, err error)
	// Get retrieves the BOSHDeployment from the indexer for a given namespace and name.
	Get(name string) (*v1alpha1.BOSHDeployment, error)
	BOSHDeploymentNamespaceListerExpansion
}

// bOSHDeploymentNamespaceLister implements the BOSHDeploymentNamespaceLister
// interface.
type bOSHDeploymentNamespaceLister struct {
	indexer   cache.Indexer
	namespace string
}

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

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