// 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"
)

// ExtendedDaemonsetSettingLister helps list ExtendedDaemonsetSettings.
type ExtendedDaemonsetSettingLister interface {
	// List lists all ExtendedDaemonsetSettings in the indexer.
	List(selector labels.Selector) (ret []*v1alpha1.ExtendedDaemonsetSetting, err error)
	// ExtendedDaemonsetSettings returns an object that can list and get ExtendedDaemonsetSettings.
	ExtendedDaemonsetSettings(namespace string) ExtendedDaemonsetSettingNamespaceLister
	ExtendedDaemonsetSettingListerExpansion
}

// extendedDaemonsetSettingLister implements the ExtendedDaemonsetSettingLister interface.
type extendedDaemonsetSettingLister struct {
	indexer cache.Indexer
}

// NewExtendedDaemonsetSettingLister returns a new ExtendedDaemonsetSettingLister.
func NewExtendedDaemonsetSettingLister(indexer cache.Indexer) ExtendedDaemonsetSettingLister {
	return &extendedDaemonsetSettingLister{indexer: indexer}
}

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

// ExtendedDaemonsetSettings returns an object that can list and get ExtendedDaemonsetSettings.
func (s *extendedDaemonsetSettingLister) ExtendedDaemonsetSettings(namespace string) ExtendedDaemonsetSettingNamespaceLister {
	return extendedDaemonsetSettingNamespaceLister{indexer: s.indexer, namespace: namespace}
}

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

// extendedDaemonsetSettingNamespaceLister implements the ExtendedDaemonsetSettingNamespaceLister
// interface.
type extendedDaemonsetSettingNamespaceLister struct {
	indexer   cache.Indexer
	namespace string
}

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

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