blob: 08d13803ba43f9c6bc002cdd587751bfd9a2ada5 [file] [log] [blame]
Matthias Andreas Benkard832a54e2019-01-29 09:27:38 +01001/*
2Copyright The Kubernetes Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17// Code generated by lister-gen. DO NOT EDIT.
18
19package v2beta1
20
21import (
22 v2beta1 "k8s.io/api/autoscaling/v2beta1"
23 "k8s.io/apimachinery/pkg/api/errors"
24 "k8s.io/apimachinery/pkg/labels"
25 "k8s.io/client-go/tools/cache"
26)
27
28// HorizontalPodAutoscalerLister helps list HorizontalPodAutoscalers.
29type HorizontalPodAutoscalerLister interface {
30 // List lists all HorizontalPodAutoscalers in the indexer.
31 List(selector labels.Selector) (ret []*v2beta1.HorizontalPodAutoscaler, err error)
32 // HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers.
33 HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister
34 HorizontalPodAutoscalerListerExpansion
35}
36
37// horizontalPodAutoscalerLister implements the HorizontalPodAutoscalerLister interface.
38type horizontalPodAutoscalerLister struct {
39 indexer cache.Indexer
40}
41
42// NewHorizontalPodAutoscalerLister returns a new HorizontalPodAutoscalerLister.
43func NewHorizontalPodAutoscalerLister(indexer cache.Indexer) HorizontalPodAutoscalerLister {
44 return &horizontalPodAutoscalerLister{indexer: indexer}
45}
46
47// List lists all HorizontalPodAutoscalers in the indexer.
48func (s *horizontalPodAutoscalerLister) List(selector labels.Selector) (ret []*v2beta1.HorizontalPodAutoscaler, err error) {
49 err = cache.ListAll(s.indexer, selector, func(m interface{}) {
50 ret = append(ret, m.(*v2beta1.HorizontalPodAutoscaler))
51 })
52 return ret, err
53}
54
55// HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers.
56func (s *horizontalPodAutoscalerLister) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister {
57 return horizontalPodAutoscalerNamespaceLister{indexer: s.indexer, namespace: namespace}
58}
59
60// HorizontalPodAutoscalerNamespaceLister helps list and get HorizontalPodAutoscalers.
61type HorizontalPodAutoscalerNamespaceLister interface {
62 // List lists all HorizontalPodAutoscalers in the indexer for a given namespace.
63 List(selector labels.Selector) (ret []*v2beta1.HorizontalPodAutoscaler, err error)
64 // Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name.
65 Get(name string) (*v2beta1.HorizontalPodAutoscaler, error)
66 HorizontalPodAutoscalerNamespaceListerExpansion
67}
68
69// horizontalPodAutoscalerNamespaceLister implements the HorizontalPodAutoscalerNamespaceLister
70// interface.
71type horizontalPodAutoscalerNamespaceLister struct {
72 indexer cache.Indexer
73 namespace string
74}
75
76// List lists all HorizontalPodAutoscalers in the indexer for a given namespace.
77func (s horizontalPodAutoscalerNamespaceLister) List(selector labels.Selector) (ret []*v2beta1.HorizontalPodAutoscaler, err error) {
78 err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
79 ret = append(ret, m.(*v2beta1.HorizontalPodAutoscaler))
80 })
81 return ret, err
82}
83
84// Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name.
85func (s horizontalPodAutoscalerNamespaceLister) Get(name string) (*v2beta1.HorizontalPodAutoscaler, error) {
86 obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
87 if err != nil {
88 return nil, err
89 }
90 if !exists {
91 return nil, errors.NewNotFound(v2beta1.Resource("horizontalpodautoscaler"), name)
92 }
93 return obj.(*v2beta1.HorizontalPodAutoscaler), nil
94}