forked from vmware-tanzu/velero
/
config.go
52 lines (44 loc) · 1.63 KB
/
config.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
// This file was automatically generated by informer-gen
package v1
import (
ark_v1 "github.com/heptio/ark/pkg/apis/ark/v1"
clientset "github.com/heptio/ark/pkg/generated/clientset"
internalinterfaces "github.com/heptio/ark/pkg/generated/informers/externalversions/internalinterfaces"
v1 "github.com/heptio/ark/pkg/generated/listers/ark/v1"
meta_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"
)
// ConfigInformer provides access to a shared informer and lister for
// Configs.
type ConfigInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1.ConfigLister
}
type configInformer struct {
factory internalinterfaces.SharedInformerFactory
}
func newConfigInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
sharedIndexInformer := cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) {
return client.ArkV1().Configs(meta_v1.NamespaceAll).List(options)
},
WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) {
return client.ArkV1().Configs(meta_v1.NamespaceAll).Watch(options)
},
},
&ark_v1.Config{},
resyncPeriod,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
)
return sharedIndexInformer
}
func (f *configInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&ark_v1.Config{}, newConfigInformer)
}
func (f *configInformer) Lister() v1.ConfigLister {
return v1.NewConfigLister(f.Informer().GetIndexer())
}