...

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

Documentation: github.com/openshift/client-go/config/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/config/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=config.openshift.io, Version=v1
    40  	case v1.SchemeGroupVersion.WithResource("apiservers"):
    41  		return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1().APIServers().Informer()}, nil
    42  	case v1.SchemeGroupVersion.WithResource("authentications"):
    43  		return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1().Authentications().Informer()}, nil
    44  	case v1.SchemeGroupVersion.WithResource("builds"):
    45  		return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1().Builds().Informer()}, nil
    46  	case v1.SchemeGroupVersion.WithResource("clusteroperators"):
    47  		return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1().ClusterOperators().Informer()}, nil
    48  	case v1.SchemeGroupVersion.WithResource("clusterversions"):
    49  		return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1().ClusterVersions().Informer()}, nil
    50  	case v1.SchemeGroupVersion.WithResource("consoles"):
    51  		return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1().Consoles().Informer()}, nil
    52  	case v1.SchemeGroupVersion.WithResource("dnses"):
    53  		return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1().DNSes().Informer()}, nil
    54  	case v1.SchemeGroupVersion.WithResource("featuregates"):
    55  		return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1().FeatureGates().Informer()}, nil
    56  	case v1.SchemeGroupVersion.WithResource("images"):
    57  		return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1().Images().Informer()}, nil
    58  	case v1.SchemeGroupVersion.WithResource("infrastructures"):
    59  		return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1().Infrastructures().Informer()}, nil
    60  	case v1.SchemeGroupVersion.WithResource("ingresses"):
    61  		return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1().Ingresses().Informer()}, nil
    62  	case v1.SchemeGroupVersion.WithResource("networks"):
    63  		return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1().Networks().Informer()}, nil
    64  	case v1.SchemeGroupVersion.WithResource("oauths"):
    65  		return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1().OAuths().Informer()}, nil
    66  	case v1.SchemeGroupVersion.WithResource("operatorhubs"):
    67  		return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1().OperatorHubs().Informer()}, nil
    68  	case v1.SchemeGroupVersion.WithResource("projects"):
    69  		return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1().Projects().Informer()}, nil
    70  	case v1.SchemeGroupVersion.WithResource("proxies"):
    71  		return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1().Proxies().Informer()}, nil
    72  	case v1.SchemeGroupVersion.WithResource("schedulers"):
    73  		return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1().Schedulers().Informer()}, nil
    74  
    75  	}
    76  
    77  	return nil, fmt.Errorf("no informer found for %v", resource)
    78  }
    79  

View as plain text