...

Source file src/github.com/openshift/client-go/template/informers/externalversions/generic.go

Documentation: github.com/openshift/client-go/template/informers/externalversions

     1  // Code generated by informer-gen. DO NOT EDIT.
     2  
     3  package externalversions
     4  
     5  import (
     6  	"fmt"
     7  
     8  	v1 "github.com/openshift/api/template/v1"
     9  	schema "k8s.io/apimachinery/pkg/runtime/schema"
    10  	cache "k8s.io/client-go/tools/cache"
    11  )
    12  
    13  // GenericInformer is type of SharedIndexInformer which will locate and delegate to other
    14  // sharedInformers based on type
    15  type GenericInformer interface {
    16  	Informer() cache.SharedIndexInformer
    17  	Lister() cache.GenericLister
    18  }
    19  
    20  type genericInformer struct {
    21  	informer cache.SharedIndexInformer
    22  	resource schema.GroupResource
    23  }
    24  
    25  // Informer returns the SharedIndexInformer.
    26  func (f *genericInformer) Informer() cache.SharedIndexInformer {
    27  	return f.informer
    28  }
    29  
    30  // Lister returns the GenericLister.
    31  func (f *genericInformer) Lister() cache.GenericLister {
    32  	return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource)
    33  }
    34  
    35  // ForResource gives generic access to a shared informer of the matching type
    36  // TODO extend this to unknown resources with a client pool
    37  func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
    38  	switch resource {
    39  	// Group=template.openshift.io, Version=v1
    40  	case v1.SchemeGroupVersion.WithResource("brokertemplateinstances"):
    41  		return &genericInformer{resource: resource.GroupResource(), informer: f.Template().V1().BrokerTemplateInstances().Informer()}, nil
    42  	case v1.SchemeGroupVersion.WithResource("templates"):
    43  		return &genericInformer{resource: resource.GroupResource(), informer: f.Template().V1().Templates().Informer()}, nil
    44  	case v1.SchemeGroupVersion.WithResource("templateinstances"):
    45  		return &genericInformer{resource: resource.GroupResource(), informer: f.Template().V1().TemplateInstances().Informer()}, nil
    46  
    47  	}
    48  
    49  	return nil, fmt.Errorf("no informer found for %v", resource)
    50  }
    51  

View as plain text