-
Notifications
You must be signed in to change notification settings - Fork 3
/
apiresourceimport.go
179 lines (151 loc) · 7.48 KB
/
apiresourceimport.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
Copyright The KCP 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 kcp code-generator. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
kcpcache "github.com/kcp-dev/apimachinery/v2/pkg/cache"
kcpinformers "github.com/kcp-dev/apimachinery/v2/third_party/informers"
"github.com/kcp-dev/logicalcluster/v3"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/tools/cache"
apiresourcev1alpha1 "github.com/kcp-dev/contrib-tmc/apis/apiresource/v1alpha1"
scopedclientset "github.com/kcp-dev/contrib-tmc/client/clientset/versioned"
clientset "github.com/kcp-dev/contrib-tmc/client/clientset/versioned/cluster"
"github.com/kcp-dev/contrib-tmc/client/informers/externalversions/internalinterfaces"
apiresourcev1alpha1listers "github.com/kcp-dev/contrib-tmc/client/listers/apiresource/v1alpha1"
)
// APIResourceImportClusterInformer provides access to a shared informer and lister for
// APIResourceImports.
type APIResourceImportClusterInformer interface {
Cluster(logicalcluster.Name) APIResourceImportInformer
Informer() kcpcache.ScopeableSharedIndexInformer
Lister() apiresourcev1alpha1listers.APIResourceImportClusterLister
}
type aPIResourceImportClusterInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// NewAPIResourceImportClusterInformer constructs a new informer for APIResourceImport 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 NewAPIResourceImportClusterInformer(client clientset.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers) kcpcache.ScopeableSharedIndexInformer {
return NewFilteredAPIResourceImportClusterInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredAPIResourceImportClusterInformer constructs a new informer for APIResourceImport 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 NewFilteredAPIResourceImportClusterInformer(client clientset.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) kcpcache.ScopeableSharedIndexInformer {
return kcpinformers.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ApiresourceV1alpha1().APIResourceImports().List(context.TODO(), options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ApiresourceV1alpha1().APIResourceImports().Watch(context.TODO(), options)
},
},
&apiresourcev1alpha1.APIResourceImport{},
resyncPeriod,
indexers,
)
}
func (f *aPIResourceImportClusterInformer) defaultInformer(client clientset.ClusterInterface, resyncPeriod time.Duration) kcpcache.ScopeableSharedIndexInformer {
return NewFilteredAPIResourceImportClusterInformer(client, resyncPeriod, cache.Indexers{
kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc,
},
f.tweakListOptions,
)
}
func (f *aPIResourceImportClusterInformer) Informer() kcpcache.ScopeableSharedIndexInformer {
return f.factory.InformerFor(&apiresourcev1alpha1.APIResourceImport{}, f.defaultInformer)
}
func (f *aPIResourceImportClusterInformer) Lister() apiresourcev1alpha1listers.APIResourceImportClusterLister {
return apiresourcev1alpha1listers.NewAPIResourceImportClusterLister(f.Informer().GetIndexer())
}
// APIResourceImportInformer provides access to a shared informer and lister for
// APIResourceImports.
type APIResourceImportInformer interface {
Informer() cache.SharedIndexInformer
Lister() apiresourcev1alpha1listers.APIResourceImportLister
}
func (f *aPIResourceImportClusterInformer) Cluster(clusterName logicalcluster.Name) APIResourceImportInformer {
return &aPIResourceImportInformer{
informer: f.Informer().Cluster(clusterName),
lister: f.Lister().Cluster(clusterName),
}
}
type aPIResourceImportInformer struct {
informer cache.SharedIndexInformer
lister apiresourcev1alpha1listers.APIResourceImportLister
}
func (f *aPIResourceImportInformer) Informer() cache.SharedIndexInformer {
return f.informer
}
func (f *aPIResourceImportInformer) Lister() apiresourcev1alpha1listers.APIResourceImportLister {
return f.lister
}
type aPIResourceImportScopedInformer struct {
factory internalinterfaces.SharedScopedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
func (f *aPIResourceImportScopedInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&apiresourcev1alpha1.APIResourceImport{}, f.defaultInformer)
}
func (f *aPIResourceImportScopedInformer) Lister() apiresourcev1alpha1listers.APIResourceImportLister {
return apiresourcev1alpha1listers.NewAPIResourceImportLister(f.Informer().GetIndexer())
}
// NewAPIResourceImportInformer constructs a new informer for APIResourceImport 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 NewAPIResourceImportInformer(client scopedclientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredAPIResourceImportInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredAPIResourceImportInformer constructs a new informer for APIResourceImport 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 NewFilteredAPIResourceImportInformer(client scopedclientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ApiresourceV1alpha1().APIResourceImports().List(context.TODO(), options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ApiresourceV1alpha1().APIResourceImports().Watch(context.TODO(), options)
},
},
&apiresourcev1alpha1.APIResourceImport{},
resyncPeriod,
indexers,
)
}
func (f *aPIResourceImportScopedInformer) defaultInformer(client scopedclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredAPIResourceImportInformer(client, resyncPeriod, cache.Indexers{}, f.tweakListOptions)
}