blob: d3e741a86936b8619ebf0012f3dde7a5ababd2fe [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 v1beta1
20
21import (
22 v1beta1 "k8s.io/api/extensions/v1beta1"
23 "k8s.io/apimachinery/pkg/api/errors"
24 "k8s.io/apimachinery/pkg/labels"
25 "k8s.io/client-go/tools/cache"
26)
27
28// ReplicaSetLister helps list ReplicaSets.
29type ReplicaSetLister interface {
30 // List lists all ReplicaSets in the indexer.
31 List(selector labels.Selector) (ret []*v1beta1.ReplicaSet, err error)
32 // ReplicaSets returns an object that can list and get ReplicaSets.
33 ReplicaSets(namespace string) ReplicaSetNamespaceLister
34 ReplicaSetListerExpansion
35}
36
37// replicaSetLister implements the ReplicaSetLister interface.
38type replicaSetLister struct {
39 indexer cache.Indexer
40}
41
42// NewReplicaSetLister returns a new ReplicaSetLister.
43func NewReplicaSetLister(indexer cache.Indexer) ReplicaSetLister {
44 return &replicaSetLister{indexer: indexer}
45}
46
47// List lists all ReplicaSets in the indexer.
48func (s *replicaSetLister) List(selector labels.Selector) (ret []*v1beta1.ReplicaSet, err error) {
49 err = cache.ListAll(s.indexer, selector, func(m interface{}) {
50 ret = append(ret, m.(*v1beta1.ReplicaSet))
51 })
52 return ret, err
53}
54
55// ReplicaSets returns an object that can list and get ReplicaSets.
56func (s *replicaSetLister) ReplicaSets(namespace string) ReplicaSetNamespaceLister {
57 return replicaSetNamespaceLister{indexer: s.indexer, namespace: namespace}
58}
59
60// ReplicaSetNamespaceLister helps list and get ReplicaSets.
61type ReplicaSetNamespaceLister interface {
62 // List lists all ReplicaSets in the indexer for a given namespace.
63 List(selector labels.Selector) (ret []*v1beta1.ReplicaSet, err error)
64 // Get retrieves the ReplicaSet from the indexer for a given namespace and name.
65 Get(name string) (*v1beta1.ReplicaSet, error)
66 ReplicaSetNamespaceListerExpansion
67}
68
69// replicaSetNamespaceLister implements the ReplicaSetNamespaceLister
70// interface.
71type replicaSetNamespaceLister struct {
72 indexer cache.Indexer
73 namespace string
74}
75
76// List lists all ReplicaSets in the indexer for a given namespace.
77func (s replicaSetNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.ReplicaSet, err error) {
78 err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
79 ret = append(ret, m.(*v1beta1.ReplicaSet))
80 })
81 return ret, err
82}
83
84// Get retrieves the ReplicaSet from the indexer for a given namespace and name.
85func (s replicaSetNamespaceLister) Get(name string) (*v1beta1.ReplicaSet, 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(v1beta1.Resource("replicaset"), name)
92 }
93 return obj.(*v1beta1.ReplicaSet), nil
94}