github.com/verrazzano/verrazzano-monitoring-operator@v0.0.30/pkg/client/informers/externalversions/vmcontroller/v1/verrazzanomonitoringinstance.go (about)

     1  // Copyright (c) 2020, 2022, Oracle and/or its affiliates.
     2  // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
     3  
     4  // Code generated by informer-gen. DO NOT EDIT.
     5  
     6  package v1
     7  
     8  import (
     9  	"context"
    10  	time "time"
    11  
    12  	vmcontrollerv1 "github.com/verrazzano/verrazzano-monitoring-operator/pkg/apis/vmcontroller/v1"
    13  	versioned "github.com/verrazzano/verrazzano-monitoring-operator/pkg/client/clientset/versioned"
    14  	internalinterfaces "github.com/verrazzano/verrazzano-monitoring-operator/pkg/client/informers/externalversions/internalinterfaces"
    15  	v1 "github.com/verrazzano/verrazzano-monitoring-operator/pkg/client/listers/vmcontroller/v1"
    16  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    17  	runtime "k8s.io/apimachinery/pkg/runtime"
    18  	watch "k8s.io/apimachinery/pkg/watch"
    19  	cache "k8s.io/client-go/tools/cache"
    20  )
    21  
    22  // VerrazzanoMonitoringInstanceInformer provides access to a shared informer and lister for
    23  // VerrazzanoMonitoringInstances.
    24  type VerrazzanoMonitoringInstanceInformer interface {
    25  	Informer() cache.SharedIndexInformer
    26  	Lister() v1.VerrazzanoMonitoringInstanceLister
    27  }
    28  
    29  type verrazzanoMonitoringInstanceInformer struct {
    30  	factory          internalinterfaces.SharedInformerFactory
    31  	tweakListOptions internalinterfaces.TweakListOptionsFunc
    32  	namespace        string
    33  }
    34  
    35  // NewVerrazzanoMonitoringInstanceInformer constructs a new informer for VerrazzanoMonitoringInstance type.
    36  // Always prefer using an informer factory to get a shared informer instead of getting an independent
    37  // one. This reduces memory footprint and number of connections to the server.
    38  func NewVerrazzanoMonitoringInstanceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
    39  	return NewFilteredVerrazzanoMonitoringInstanceInformer(client, namespace, resyncPeriod, indexers, nil)
    40  }
    41  
    42  // NewFilteredVerrazzanoMonitoringInstanceInformer constructs a new informer for VerrazzanoMonitoringInstance type.
    43  // Always prefer using an informer factory to get a shared informer instead of getting an independent
    44  // one. This reduces memory footprint and number of connections to the server.
    45  func NewFilteredVerrazzanoMonitoringInstanceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
    46  	return cache.NewSharedIndexInformer(
    47  		&cache.ListWatch{
    48  			ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
    49  				if tweakListOptions != nil {
    50  					tweakListOptions(&options)
    51  				}
    52  				return client.VerrazzanoV1().VerrazzanoMonitoringInstances(namespace).List(context.TODO(), options)
    53  			},
    54  			WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
    55  				if tweakListOptions != nil {
    56  					tweakListOptions(&options)
    57  				}
    58  				return client.VerrazzanoV1().VerrazzanoMonitoringInstances(namespace).Watch(context.TODO(), options)
    59  			},
    60  		},
    61  		&vmcontrollerv1.VerrazzanoMonitoringInstance{},
    62  		resyncPeriod,
    63  		indexers,
    64  	)
    65  }
    66  
    67  func (f *verrazzanoMonitoringInstanceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
    68  	return NewFilteredVerrazzanoMonitoringInstanceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
    69  }
    70  
    71  func (f *verrazzanoMonitoringInstanceInformer) Informer() cache.SharedIndexInformer {
    72  	return f.factory.InformerFor(&vmcontrollerv1.VerrazzanoMonitoringInstance{}, f.defaultInformer)
    73  }
    74  
    75  func (f *verrazzanoMonitoringInstanceInformer) Lister() v1.VerrazzanoMonitoringInstanceLister {
    76  	return v1.NewVerrazzanoMonitoringInstanceLister(f.Informer().GetIndexer())
    77  }