github.com/tigera/api@v0.0.0-20240320170621-278e89a8c5fb/pkg/client/informers_generated/externalversions/projectcalico/v3/deeppacketinspection.go (about) 1 // Copyright (c) 2024 Tigera, Inc. All rights reserved. 2 3 // Code generated by informer-gen. DO NOT EDIT. 4 5 package v3 6 7 import ( 8 "context" 9 time "time" 10 11 projectcalicov3 "github.com/tigera/api/pkg/apis/projectcalico/v3" 12 clientset "github.com/tigera/api/pkg/client/clientset_generated/clientset" 13 internalinterfaces "github.com/tigera/api/pkg/client/informers_generated/externalversions/internalinterfaces" 14 v3 "github.com/tigera/api/pkg/client/listers_generated/projectcalico/v3" 15 v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 16 runtime "k8s.io/apimachinery/pkg/runtime" 17 watch "k8s.io/apimachinery/pkg/watch" 18 cache "k8s.io/client-go/tools/cache" 19 ) 20 21 // DeepPacketInspectionInformer provides access to a shared informer and lister for 22 // DeepPacketInspections. 23 type DeepPacketInspectionInformer interface { 24 Informer() cache.SharedIndexInformer 25 Lister() v3.DeepPacketInspectionLister 26 } 27 28 type deepPacketInspectionInformer struct { 29 factory internalinterfaces.SharedInformerFactory 30 tweakListOptions internalinterfaces.TweakListOptionsFunc 31 namespace string 32 } 33 34 // NewDeepPacketInspectionInformer constructs a new informer for DeepPacketInspection type. 35 // Always prefer using an informer factory to get a shared informer instead of getting an independent 36 // one. This reduces memory footprint and number of connections to the server. 37 func NewDeepPacketInspectionInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 38 return NewFilteredDeepPacketInspectionInformer(client, namespace, resyncPeriod, indexers, nil) 39 } 40 41 // NewFilteredDeepPacketInspectionInformer constructs a new informer for DeepPacketInspection type. 42 // Always prefer using an informer factory to get a shared informer instead of getting an independent 43 // one. This reduces memory footprint and number of connections to the server. 44 func NewFilteredDeepPacketInspectionInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 45 return cache.NewSharedIndexInformer( 46 &cache.ListWatch{ 47 ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 48 if tweakListOptions != nil { 49 tweakListOptions(&options) 50 } 51 return client.ProjectcalicoV3().DeepPacketInspections(namespace).List(context.TODO(), options) 52 }, 53 WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 54 if tweakListOptions != nil { 55 tweakListOptions(&options) 56 } 57 return client.ProjectcalicoV3().DeepPacketInspections(namespace).Watch(context.TODO(), options) 58 }, 59 }, 60 &projectcalicov3.DeepPacketInspection{}, 61 resyncPeriod, 62 indexers, 63 ) 64 } 65 66 func (f *deepPacketInspectionInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 67 return NewFilteredDeepPacketInspectionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 68 } 69 70 func (f *deepPacketInspectionInformer) Informer() cache.SharedIndexInformer { 71 return f.factory.InformerFor(&projectcalicov3.DeepPacketInspection{}, f.defaultInformer) 72 } 73 74 func (f *deepPacketInspectionInformer) Lister() v3.DeepPacketInspectionLister { 75 return v3.NewDeepPacketInspectionLister(f.Informer().GetIndexer()) 76 }