-
Notifications
You must be signed in to change notification settings - Fork 3
/
negotiatedapiresource.go
179 lines (151 loc) · 7.69 KB
/
negotiatedapiresource.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"
)
// NegotiatedAPIResourceClusterInformer provides access to a shared informer and lister for
// NegotiatedAPIResources.
type NegotiatedAPIResourceClusterInformer interface {
Cluster(logicalcluster.Name) NegotiatedAPIResourceInformer
Informer() kcpcache.ScopeableSharedIndexInformer
Lister() apiresourcev1alpha1listers.NegotiatedAPIResourceClusterLister
}
type negotiatedAPIResourceClusterInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// NewNegotiatedAPIResourceClusterInformer constructs a new informer for NegotiatedAPIResource 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 NewNegotiatedAPIResourceClusterInformer(client clientset.ClusterInterface, resyncPeriod time.Duration, indexers cache.Indexers) kcpcache.ScopeableSharedIndexInformer {
return NewFilteredNegotiatedAPIResourceClusterInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredNegotiatedAPIResourceClusterInformer constructs a new informer for NegotiatedAPIResource 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 NewFilteredNegotiatedAPIResourceClusterInformer(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().NegotiatedAPIResources().List(context.TODO(), options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ApiresourceV1alpha1().NegotiatedAPIResources().Watch(context.TODO(), options)
},
},
&apiresourcev1alpha1.NegotiatedAPIResource{},
resyncPeriod,
indexers,
)
}
func (f *negotiatedAPIResourceClusterInformer) defaultInformer(client clientset.ClusterInterface, resyncPeriod time.Duration) kcpcache.ScopeableSharedIndexInformer {
return NewFilteredNegotiatedAPIResourceClusterInformer(client, resyncPeriod, cache.Indexers{
kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc,
},
f.tweakListOptions,
)
}
func (f *negotiatedAPIResourceClusterInformer) Informer() kcpcache.ScopeableSharedIndexInformer {
return f.factory.InformerFor(&apiresourcev1alpha1.NegotiatedAPIResource{}, f.defaultInformer)
}
func (f *negotiatedAPIResourceClusterInformer) Lister() apiresourcev1alpha1listers.NegotiatedAPIResourceClusterLister {
return apiresourcev1alpha1listers.NewNegotiatedAPIResourceClusterLister(f.Informer().GetIndexer())
}
// NegotiatedAPIResourceInformer provides access to a shared informer and lister for
// NegotiatedAPIResources.
type NegotiatedAPIResourceInformer interface {
Informer() cache.SharedIndexInformer
Lister() apiresourcev1alpha1listers.NegotiatedAPIResourceLister
}
func (f *negotiatedAPIResourceClusterInformer) Cluster(clusterName logicalcluster.Name) NegotiatedAPIResourceInformer {
return &negotiatedAPIResourceInformer{
informer: f.Informer().Cluster(clusterName),
lister: f.Lister().Cluster(clusterName),
}
}
type negotiatedAPIResourceInformer struct {
informer cache.SharedIndexInformer
lister apiresourcev1alpha1listers.NegotiatedAPIResourceLister
}
func (f *negotiatedAPIResourceInformer) Informer() cache.SharedIndexInformer {
return f.informer
}
func (f *negotiatedAPIResourceInformer) Lister() apiresourcev1alpha1listers.NegotiatedAPIResourceLister {
return f.lister
}
type negotiatedAPIResourceScopedInformer struct {
factory internalinterfaces.SharedScopedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
func (f *negotiatedAPIResourceScopedInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&apiresourcev1alpha1.NegotiatedAPIResource{}, f.defaultInformer)
}
func (f *negotiatedAPIResourceScopedInformer) Lister() apiresourcev1alpha1listers.NegotiatedAPIResourceLister {
return apiresourcev1alpha1listers.NewNegotiatedAPIResourceLister(f.Informer().GetIndexer())
}
// NewNegotiatedAPIResourceInformer constructs a new informer for NegotiatedAPIResource 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 NewNegotiatedAPIResourceInformer(client scopedclientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredNegotiatedAPIResourceInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredNegotiatedAPIResourceInformer constructs a new informer for NegotiatedAPIResource 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 NewFilteredNegotiatedAPIResourceInformer(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().NegotiatedAPIResources().List(context.TODO(), options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ApiresourceV1alpha1().NegotiatedAPIResources().Watch(context.TODO(), options)
},
},
&apiresourcev1alpha1.NegotiatedAPIResource{},
resyncPeriod,
indexers,
)
}
func (f *negotiatedAPIResourceScopedInformer) defaultInformer(client scopedclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredNegotiatedAPIResourceInformer(client, resyncPeriod, cache.Indexers{}, f.tweakListOptions)
}