/*
Copyright 2022 The Knative Authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

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

package v1alpha1

import (
	labels "k8s.io/apimachinery/pkg/labels"
	listers "k8s.io/client-go/listers"
	cache "k8s.io/client-go/tools/cache"
	autoscalingv1alpha1 "knative.dev/serving/pkg/apis/autoscaling/v1alpha1"
)

// MetricLister helps list Metrics.
// All objects returned here must be treated as read-only.
type MetricLister interface {
	// List lists all Metrics in the indexer.
	// Objects returned here must be treated as read-only.
	List(selector labels.Selector) (ret []*autoscalingv1alpha1.Metric, err error)
	// Metrics returns an object that can list and get Metrics.
	Metrics(namespace string) MetricNamespaceLister
	MetricListerExpansion
}

// metricLister implements the MetricLister interface.
type metricLister struct {
	listers.ResourceIndexer[*autoscalingv1alpha1.Metric]
}

// NewMetricLister returns a new MetricLister.
func NewMetricLister(indexer cache.Indexer) MetricLister {
	return &metricLister{listers.New[*autoscalingv1alpha1.Metric](indexer, autoscalingv1alpha1.Resource("metric"))}
}

// Metrics returns an object that can list and get Metrics.
func (s *metricLister) Metrics(namespace string) MetricNamespaceLister {
	return metricNamespaceLister{listers.NewNamespaced[*autoscalingv1alpha1.Metric](s.ResourceIndexer, namespace)}
}

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

// metricNamespaceLister implements the MetricNamespaceLister
// interface.
type metricNamespaceLister struct {
	listers.ResourceIndexer[*autoscalingv1alpha1.Metric]
}
