...

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

Documentation: github.com/openshift/client-go/console/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/console/v1"
     9  	v1alpha1 "github.com/openshift/api/console/v1alpha1"
    10  	schema "k8s.io/apimachinery/pkg/runtime/schema"
    11  	cache "k8s.io/client-go/tools/cache"
    12  )
    13  
    14  // GenericInformer is type of SharedIndexInformer which will locate and delegate to other
    15  // sharedInformers based on type
    16  type GenericInformer interface {
    17  	Informer() cache.SharedIndexInformer
    18  	Lister() cache.GenericLister
    19  }
    20  
    21  type genericInformer struct {
    22  	informer cache.SharedIndexInformer
    23  	resource schema.GroupResource
    24  }
    25  
    26  // Informer returns the SharedIndexInformer.
    27  func (f *genericInformer) Informer() cache.SharedIndexInformer {
    28  	return f.informer
    29  }
    30  
    31  // Lister returns the GenericLister.
    32  func (f *genericInformer) Lister() cache.GenericLister {
    33  	return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource)
    34  }
    35  
    36  // ForResource gives generic access to a shared informer of the matching type
    37  // TODO extend this to unknown resources with a client pool
    38  func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
    39  	switch resource {
    40  	// Group=console.openshift.io, Version=v1
    41  	case v1.SchemeGroupVersion.WithResource("consoleclidownloads"):
    42  		return &genericInformer{resource: resource.GroupResource(), informer: f.Console().V1().ConsoleCLIDownloads().Informer()}, nil
    43  	case v1.SchemeGroupVersion.WithResource("consoleexternalloglinks"):
    44  		return &genericInformer{resource: resource.GroupResource(), informer: f.Console().V1().ConsoleExternalLogLinks().Informer()}, nil
    45  	case v1.SchemeGroupVersion.WithResource("consolelinks"):
    46  		return &genericInformer{resource: resource.GroupResource(), informer: f.Console().V1().ConsoleLinks().Informer()}, nil
    47  	case v1.SchemeGroupVersion.WithResource("consolenotifications"):
    48  		return &genericInformer{resource: resource.GroupResource(), informer: f.Console().V1().ConsoleNotifications().Informer()}, nil
    49  	case v1.SchemeGroupVersion.WithResource("consolequickstarts"):
    50  		return &genericInformer{resource: resource.GroupResource(), informer: f.Console().V1().ConsoleQuickStarts().Informer()}, nil
    51  	case v1.SchemeGroupVersion.WithResource("consoleyamlsamples"):
    52  		return &genericInformer{resource: resource.GroupResource(), informer: f.Console().V1().ConsoleYAMLSamples().Informer()}, nil
    53  
    54  		// Group=console.openshift.io, Version=v1alpha1
    55  	case v1alpha1.SchemeGroupVersion.WithResource("consoleplugins"):
    56  		return &genericInformer{resource: resource.GroupResource(), informer: f.Console().V1alpha1().ConsolePlugins().Informer()}, nil
    57  
    58  	}
    59  
    60  	return nil, fmt.Errorf("no informer found for %v", resource)
    61  }
    62  

View as plain text