-
Notifications
You must be signed in to change notification settings - Fork 21
/
generic.go
129 lines (112 loc) · 7.96 KB
/
generic.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
/*
Copyright The KubeDB 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 informer-gen. DO NOT EDIT.
package externalversions
import (
"fmt"
v1alpha1 "kubedb.dev/apimachinery/apis/catalog/v1alpha1"
kubedbv1alpha1 "kubedb.dev/apimachinery/apis/kubedb/v1alpha1"
opsv1alpha1 "kubedb.dev/apimachinery/apis/ops/v1alpha1"
schema "k8s.io/apimachinery/pkg/runtime/schema"
cache "k8s.io/client-go/tools/cache"
)
// GenericInformer is type of SharedIndexInformer which will locate and delegate to other
// sharedInformers based on type
type GenericInformer interface {
Informer() cache.SharedIndexInformer
Lister() cache.GenericLister
}
type genericInformer struct {
informer cache.SharedIndexInformer
resource schema.GroupResource
}
// Informer returns the SharedIndexInformer.
func (f *genericInformer) Informer() cache.SharedIndexInformer {
return f.informer
}
// Lister returns the GenericLister.
func (f *genericInformer) Lister() cache.GenericLister {
return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource)
}
// ForResource gives generic access to a shared informer of the matching type
// TODO extend this to unknown resources with a client pool
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
switch resource {
// Group=catalog.kubedb.com, Version=v1alpha1
case v1alpha1.SchemeGroupVersion.WithResource("elasticsearchversions"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Catalog().V1alpha1().ElasticsearchVersions().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("etcdversions"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Catalog().V1alpha1().EtcdVersions().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("memcachedversions"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Catalog().V1alpha1().MemcachedVersions().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("mongodbversions"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Catalog().V1alpha1().MongoDBVersions().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("mysqlversions"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Catalog().V1alpha1().MySQLVersions().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("perconaxtradbversions"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Catalog().V1alpha1().PerconaXtraDBVersions().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("pgbouncerversions"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Catalog().V1alpha1().PgBouncerVersions().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("postgresversions"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Catalog().V1alpha1().PostgresVersions().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("proxysqlversions"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Catalog().V1alpha1().ProxySQLVersions().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("redisversions"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Catalog().V1alpha1().RedisVersions().Informer()}, nil
// Group=kubedb.com, Version=v1alpha1
case kubedbv1alpha1.SchemeGroupVersion.WithResource("elasticsearches"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kubedb().V1alpha1().Elasticsearches().Informer()}, nil
case kubedbv1alpha1.SchemeGroupVersion.WithResource("etcds"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kubedb().V1alpha1().Etcds().Informer()}, nil
case kubedbv1alpha1.SchemeGroupVersion.WithResource("mariadbs"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kubedb().V1alpha1().MariaDBs().Informer()}, nil
case kubedbv1alpha1.SchemeGroupVersion.WithResource("memcacheds"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kubedb().V1alpha1().Memcacheds().Informer()}, nil
case kubedbv1alpha1.SchemeGroupVersion.WithResource("mongodbs"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kubedb().V1alpha1().MongoDBs().Informer()}, nil
case kubedbv1alpha1.SchemeGroupVersion.WithResource("mysqls"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kubedb().V1alpha1().MySQLs().Informer()}, nil
case kubedbv1alpha1.SchemeGroupVersion.WithResource("perconaxtradbs"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kubedb().V1alpha1().PerconaXtraDBs().Informer()}, nil
case kubedbv1alpha1.SchemeGroupVersion.WithResource("pgbouncers"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kubedb().V1alpha1().PgBouncers().Informer()}, nil
case kubedbv1alpha1.SchemeGroupVersion.WithResource("postgreses"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kubedb().V1alpha1().Postgreses().Informer()}, nil
case kubedbv1alpha1.SchemeGroupVersion.WithResource("proxysqls"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kubedb().V1alpha1().ProxySQLs().Informer()}, nil
case kubedbv1alpha1.SchemeGroupVersion.WithResource("redises"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Kubedb().V1alpha1().Redises().Informer()}, nil
// Group=ops.kubedb.com, Version=v1alpha1
case opsv1alpha1.SchemeGroupVersion.WithResource("elasticsearchopsrequests"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Ops().V1alpha1().ElasticsearchOpsRequests().Informer()}, nil
case opsv1alpha1.SchemeGroupVersion.WithResource("etcdopsrequests"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Ops().V1alpha1().EtcdOpsRequests().Informer()}, nil
case opsv1alpha1.SchemeGroupVersion.WithResource("memcachedopsrequests"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Ops().V1alpha1().MemcachedOpsRequests().Informer()}, nil
case opsv1alpha1.SchemeGroupVersion.WithResource("mongodbopsrequests"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Ops().V1alpha1().MongoDBOpsRequests().Informer()}, nil
case opsv1alpha1.SchemeGroupVersion.WithResource("mysqlopsrequests"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Ops().V1alpha1().MySQLOpsRequests().Informer()}, nil
case opsv1alpha1.SchemeGroupVersion.WithResource("perconaxtradbopsrequests"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Ops().V1alpha1().PerconaXtraDBOpsRequests().Informer()}, nil
case opsv1alpha1.SchemeGroupVersion.WithResource("pgbounceropsrequests"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Ops().V1alpha1().PgBouncerOpsRequests().Informer()}, nil
case opsv1alpha1.SchemeGroupVersion.WithResource("postgresopsrequests"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Ops().V1alpha1().PostgresOpsRequests().Informer()}, nil
case opsv1alpha1.SchemeGroupVersion.WithResource("proxysqlopsrequests"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Ops().V1alpha1().ProxySQLOpsRequests().Informer()}, nil
case opsv1alpha1.SchemeGroupVersion.WithResource("redisopsrequests"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Ops().V1alpha1().RedisOpsRequests().Informer()}, nil
}
return nil, fmt.Errorf("no informer found for %v", resource)
}