github.com/tigera/api@v0.0.0-20240320170621-278e89a8c5fb/pkg/client/informers_generated/externalversions/projectcalico/v3/egressgatewaypolicy.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 // EgressGatewayPolicyInformer provides access to a shared informer and lister for 22 // EgressGatewayPolicies. 23 type EgressGatewayPolicyInformer interface { 24 Informer() cache.SharedIndexInformer 25 Lister() v3.EgressGatewayPolicyLister 26 } 27 28 type egressGatewayPolicyInformer struct { 29 factory internalinterfaces.SharedInformerFactory 30 tweakListOptions internalinterfaces.TweakListOptionsFunc 31 } 32 33 // NewEgressGatewayPolicyInformer constructs a new informer for EgressGatewayPolicy type. 34 // Always prefer using an informer factory to get a shared informer instead of getting an independent 35 // one. This reduces memory footprint and number of connections to the server. 36 func NewEgressGatewayPolicyInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 37 return NewFilteredEgressGatewayPolicyInformer(client, resyncPeriod, indexers, nil) 38 } 39 40 // NewFilteredEgressGatewayPolicyInformer constructs a new informer for EgressGatewayPolicy type. 41 // Always prefer using an informer factory to get a shared informer instead of getting an independent 42 // one. This reduces memory footprint and number of connections to the server. 43 func NewFilteredEgressGatewayPolicyInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 44 return cache.NewSharedIndexInformer( 45 &cache.ListWatch{ 46 ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 47 if tweakListOptions != nil { 48 tweakListOptions(&options) 49 } 50 return client.ProjectcalicoV3().EgressGatewayPolicies().List(context.TODO(), options) 51 }, 52 WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 53 if tweakListOptions != nil { 54 tweakListOptions(&options) 55 } 56 return client.ProjectcalicoV3().EgressGatewayPolicies().Watch(context.TODO(), options) 57 }, 58 }, 59 &projectcalicov3.EgressGatewayPolicy{}, 60 resyncPeriod, 61 indexers, 62 ) 63 } 64 65 func (f *egressGatewayPolicyInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 66 return NewFilteredEgressGatewayPolicyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 67 } 68 69 func (f *egressGatewayPolicyInformer) Informer() cache.SharedIndexInformer { 70 return f.factory.InformerFor(&projectcalicov3.EgressGatewayPolicy{}, f.defaultInformer) 71 } 72 73 func (f *egressGatewayPolicyInformer) Lister() v3.EgressGatewayPolicyLister { 74 return v3.NewEgressGatewayPolicyLister(f.Informer().GetIndexer()) 75 }