76 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			Go
		
	
	
	
			
		
		
	
	
			76 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			Go
		
	
	
	
| /*
 | |
| Copyright 2024 Compose, Zalando SE
 | |
| 
 | |
| Permission is hereby granted, free of charge, to any person obtaining a copy
 | |
| of this software and associated documentation files (the "Software"), to deal
 | |
| in the Software without restriction, including without limitation the rights
 | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | |
| copies of the Software, and to permit persons to whom the Software is
 | |
| furnished to do so, subject to the following conditions:
 | |
| 
 | |
| The above copyright notice and this permission notice shall be included in all
 | |
| copies or substantial portions of the Software.
 | |
| 
 | |
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | |
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | |
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | |
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | |
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | |
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | |
| SOFTWARE.
 | |
| */
 | |
| 
 | |
| // Code generated by informer-gen. DO NOT EDIT.
 | |
| 
 | |
| package externalversions
 | |
| 
 | |
| import (
 | |
| 	"fmt"
 | |
| 
 | |
| 	v1 "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1"
 | |
| 	zalandoorgv1 "github.com/zalando/postgres-operator/pkg/apis/zalando.org/v1"
 | |
| 	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=acid.zalan.do, Version=v1
 | |
| 	case v1.SchemeGroupVersion.WithResource("postgresteams"):
 | |
| 		return &genericInformer{resource: resource.GroupResource(), informer: f.Acid().V1().PostgresTeams().Informer()}, nil
 | |
| 	case v1.SchemeGroupVersion.WithResource("postgresqls"):
 | |
| 		return &genericInformer{resource: resource.GroupResource(), informer: f.Acid().V1().Postgresqls().Informer()}, nil
 | |
| 
 | |
| 		// Group=zalando.org, Version=v1
 | |
| 	case zalandoorgv1.SchemeGroupVersion.WithResource("fabriceventstreams"):
 | |
| 		return &genericInformer{resource: resource.GroupResource(), informer: f.Zalando().V1().FabricEventStreams().Informer()}, nil
 | |
| 
 | |
| 	}
 | |
| 
 | |
| 	return nil, fmt.Errorf("no informer found for %v", resource)
 | |
| }
 |