// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-2019 Datadog, Inc.

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

package v1alpha1

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

// ExtendedDaemonSetLister helps list ExtendedDaemonSets.
type ExtendedDaemonSetLister interface {
	// List lists all ExtendedDaemonSets in the indexer.
	List(selector labels.Selector) (ret []*v1alpha1.ExtendedDaemonSet, err error)
	// ExtendedDaemonSets returns an object that can list and get ExtendedDaemonSets.
	ExtendedDaemonSets(namespace string) ExtendedDaemonSetNamespaceLister
	ExtendedDaemonSetListerExpansion
}

// extendedDaemonSetLister implements the ExtendedDaemonSetLister interface.
type extendedDaemonSetLister struct {
	indexer cache.Indexer
}

// NewExtendedDaemonSetLister returns a new ExtendedDaemonSetLister.
func NewExtendedDaemonSetLister(indexer cache.Indexer) ExtendedDaemonSetLister {
	return &extendedDaemonSetLister{indexer: indexer}
}

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

// ExtendedDaemonSets returns an object that can list and get ExtendedDaemonSets.
func (s *extendedDaemonSetLister) ExtendedDaemonSets(namespace string) ExtendedDaemonSetNamespaceLister {
	return extendedDaemonSetNamespaceLister{indexer: s.indexer, namespace: namespace}
}

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

// extendedDaemonSetNamespaceLister implements the ExtendedDaemonSetNamespaceLister
// interface.
type extendedDaemonSetNamespaceLister struct {
	indexer   cache.Indexer
	namespace string
}

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

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