forked from openshift/origin
/
clusterresourcequota.go
57 lines (49 loc) · 2.37 KB
/
clusterresourcequota.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// This file was automatically generated by informer-gen
package internalversion
import (
quota "github.com/openshift/origin/pkg/quota/apis/quota"
internalinterfaces "github.com/openshift/origin/pkg/quota/generated/informers/internalversion/internalinterfaces"
internalclientset "github.com/openshift/origin/pkg/quota/generated/internalclientset"
internalversion "github.com/openshift/origin/pkg/quota/generated/listers/quota/internalversion"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
time "time"
)
// ClusterResourceQuotaInformer provides access to a shared informer and lister for
// ClusterResourceQuotas.
type ClusterResourceQuotaInformer interface {
Informer() cache.SharedIndexInformer
Lister() internalversion.ClusterResourceQuotaLister
}
type clusterResourceQuotaInformer struct {
factory internalinterfaces.SharedInformerFactory
}
// NewClusterResourceQuotaInformer constructs a new informer for ClusterResourceQuota type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewClusterResourceQuotaInformer(client internalclientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
return client.Quota().ClusterResourceQuotas().List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
return client.Quota().ClusterResourceQuotas().Watch(options)
},
},
"a.ClusterResourceQuota{},
resyncPeriod,
indexers,
)
}
func defaultClusterResourceQuotaInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewClusterResourceQuotaInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
}
func (f *clusterResourceQuotaInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor("a.ClusterResourceQuota{}, defaultClusterResourceQuotaInformer)
}
func (f *clusterResourceQuotaInformer) Lister() internalversion.ClusterResourceQuotaLister {
return internalversion.NewClusterResourceQuotaLister(f.Informer().GetIndexer())
}