diff --git a/Makefile b/Makefile index c737e88e9..45360e704 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust .PHONY: generate generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. - $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." + $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./pkg/apis/..." .PHONY: fmt fmt: ## Run go fmt against code. diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 55e5bbf36..7522374b4 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -5,7 +5,7 @@ set -o nounset set -o pipefail set -o xtrace -APIS_PKG=github.com/vmware-tanzu/nsx-operator/pkg/apis/ +APIS_PKG=github.com/vmware-tanzu/nsx-operator/pkg/apis OUTPUT_PKG=github.com/vmware-tanzu/nsx-operator/pkg/client GROUP=vpc diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go new file mode 100644 index 000000000..4bf4d3bf6 --- /dev/null +++ b/pkg/client/informers/externalversions/factory.go @@ -0,0 +1,238 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + reflect "reflect" + sync "sync" + time "time" + + versioned "github.com/vmware-tanzu/nsx-operator/pkg/client/clientset/versioned" + internalinterfaces "github.com/vmware-tanzu/nsx-operator/pkg/client/informers/externalversions/internalinterfaces" + vpc "github.com/vmware-tanzu/nsx-operator/pkg/client/informers/externalversions/vpc" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// SharedInformerOption defines the functional option type for SharedInformerFactory. +type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory + +type sharedInformerFactory struct { + client versioned.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool + // wg tracks how many goroutines were started. + wg sync.WaitGroup + // shuttingDown is true when Shutdown has been called. It may still be running + // because it needs to wait for goroutines. + shuttingDown bool +} + +// WithCustomResyncConfig sets a custom resync period for the specified informer types. +func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + for k, v := range resyncConfig { + factory.customResync[reflect.TypeOf(k)] = v + } + return factory + } +} + +// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. +func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.tweakListOptions = tweakListOptions + return factory + } +} + +// WithNamespace limits the SharedInformerFactory to the specified namespace. +func WithNamespace(namespace string) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.namespace = namespace + return factory + } +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync) +} + +// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. +// Listers obtained via this SharedInformerFactory will be subject to the same filters +// as specified here. +// Deprecated: Please use NewSharedInformerFactoryWithOptions instead +func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) +} + +// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. +func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { + factory := &sharedInformerFactory{ + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), + } + + // Apply all options + for _, opt := range options { + factory = opt(factory) + } + + return factory +} + +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + if f.shuttingDown { + return + } + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + f.wg.Add(1) + // We need a new variable in each loop iteration, + // otherwise the goroutine would use the loop variable + // and that keeps changing. + informer := informer + go func() { + defer f.wg.Done() + informer.Run(stopCh) + }() + f.startedInformers[informerType] = true + } + } +} + +func (f *sharedInformerFactory) Shutdown() { + f.lock.Lock() + f.shuttingDown = true + f.lock.Unlock() + + // Will return immediately if there is nothing to wait for. + f.wg.Wait() +} + +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + resyncPeriod, exists := f.customResync[informerType] + if !exists { + resyncPeriod = f.defaultResync + } + + informer = newFunc(f.client, resyncPeriod) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +// +// It is typically used like this: +// +// ctx, cancel := context.Background() +// defer cancel() +// factory := NewSharedInformerFactory(client, resyncPeriod) +// defer factory.WaitForStop() // Returns immediately if nothing was started. +// genericInformer := factory.ForResource(resource) +// typedInformer := factory.SomeAPIGroup().V1().SomeType() +// factory.Start(ctx.Done()) // Start processing these informers. +// synced := factory.WaitForCacheSync(ctx.Done()) +// for v, ok := range synced { +// if !ok { +// fmt.Fprintf(os.Stderr, "caches failed to sync: %v", v) +// return +// } +// } +// +// // Creating informers can also be created after Start, but then +// // Start must be called again: +// anotherGenericInformer := factory.ForResource(resource) +// factory.Start(ctx.Done()) +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + + // Start initializes all requested informers. They are handled in goroutines + // which run until the stop channel gets closed. + Start(stopCh <-chan struct{}) + + // Shutdown marks a factory as shutting down. At that point no new + // informers can be started anymore and Start will return without + // doing anything. + // + // In addition, Shutdown blocks until all goroutines have terminated. For that + // to happen, the close channel(s) that they were started with must be closed, + // either before Shutdown gets called or while it is waiting. + // + // Shutdown may be called multiple times, even concurrently. All such calls will + // block until all goroutines have terminated. + Shutdown() + + // WaitForCacheSync blocks until all started informers' caches were synced + // or the stop channel gets closed. + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + // ForResource gives generic access to a shared informer of the matching type. + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + + // InternalInformerFor returns the SharedIndexInformer for obj using an internal + // client. + InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer + + Crd() vpc.Interface +} + +func (f *sharedInformerFactory) Crd() vpc.Interface { + return vpc.New(f, f.namespace, f.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go new file mode 100644 index 000000000..4cc4a7192 --- /dev/null +++ b/pkg/client/informers/externalversions/generic.go @@ -0,0 +1,67 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by informer-gen. DO NOT EDIT. + +package externalversions + +import ( + "fmt" + + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=crd.nsx.vmware.com, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("addressbindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha1().AddressBindings().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("ipaddressallocations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha1().IPAddressAllocations().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("ipblocksinfos"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha1().IPBlocksInfos().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("networkinfos"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha1().NetworkInfos().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("securitypolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha1().SecurityPolicies().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("staticroutes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha1().StaticRoutes().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("subnets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha1().Subnets().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("subnetports"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha1().SubnetPorts().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("subnetsets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha1().SubnetSets().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("vpcnetworkconfigurations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha1().VPCNetworkConfigurations().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 000000000..b0856fd71 --- /dev/null +++ b/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,27 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by informer-gen. DO NOT EDIT. + +package internalinterfaces + +import ( + time "time" + + versioned "github.com/vmware-tanzu/nsx-operator/pkg/client/clientset/versioned" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" +) + +// NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} + +// TweakListOptionsFunc is a function that transforms a v1.ListOptions. +type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/pkg/client/informers/externalversions/vpc/interface.go b/pkg/client/informers/externalversions/vpc/interface.go new file mode 100644 index 000000000..8bc643c31 --- /dev/null +++ b/pkg/client/informers/externalversions/vpc/interface.go @@ -0,0 +1,33 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by informer-gen. DO NOT EDIT. + +package vpc + +import ( + internalinterfaces "github.com/vmware-tanzu/nsx-operator/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/client/informers/externalversions/vpc/v1alpha1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/vpc/v1alpha1/addressbinding.go b/pkg/client/informers/externalversions/vpc/v1alpha1/addressbinding.go new file mode 100644 index 000000000..5b69842d6 --- /dev/null +++ b/pkg/client/informers/externalversions/vpc/v1alpha1/addressbinding.go @@ -0,0 +1,77 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + vpcv1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + versioned "github.com/vmware-tanzu/nsx-operator/pkg/client/clientset/versioned" + internalinterfaces "github.com/vmware-tanzu/nsx-operator/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/client/listers/vpc/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// AddressBindingInformer provides access to a shared informer and lister for +// AddressBindings. +type AddressBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.AddressBindingLister +} + +type addressBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewAddressBindingInformer constructs a new informer for AddressBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewAddressBindingInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredAddressBindingInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredAddressBindingInformer constructs a new informer for AddressBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredAddressBindingInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().AddressBindings(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().AddressBindings(namespace).Watch(context.TODO(), options) + }, + }, + &vpcv1alpha1.AddressBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f *addressBindingInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredAddressBindingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *addressBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&vpcv1alpha1.AddressBinding{}, f.defaultInformer) +} + +func (f *addressBindingInformer) Lister() v1alpha1.AddressBindingLister { + return v1alpha1.NewAddressBindingLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/vpc/v1alpha1/interface.go b/pkg/client/informers/externalversions/vpc/v1alpha1/interface.go new file mode 100644 index 000000000..296d61738 --- /dev/null +++ b/pkg/client/informers/externalversions/vpc/v1alpha1/interface.go @@ -0,0 +1,95 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "github.com/vmware-tanzu/nsx-operator/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // AddressBindings returns a AddressBindingInformer. + AddressBindings() AddressBindingInformer + // IPAddressAllocations returns a IPAddressAllocationInformer. + IPAddressAllocations() IPAddressAllocationInformer + // IPBlocksInfos returns a IPBlocksInfoInformer. + IPBlocksInfos() IPBlocksInfoInformer + // NetworkInfos returns a NetworkInfoInformer. + NetworkInfos() NetworkInfoInformer + // SecurityPolicies returns a SecurityPolicyInformer. + SecurityPolicies() SecurityPolicyInformer + // StaticRoutes returns a StaticRouteInformer. + StaticRoutes() StaticRouteInformer + // Subnets returns a SubnetInformer. + Subnets() SubnetInformer + // SubnetPorts returns a SubnetPortInformer. + SubnetPorts() SubnetPortInformer + // SubnetSets returns a SubnetSetInformer. + SubnetSets() SubnetSetInformer + // VPCNetworkConfigurations returns a VPCNetworkConfigurationInformer. + VPCNetworkConfigurations() VPCNetworkConfigurationInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// AddressBindings returns a AddressBindingInformer. +func (v *version) AddressBindings() AddressBindingInformer { + return &addressBindingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// IPAddressAllocations returns a IPAddressAllocationInformer. +func (v *version) IPAddressAllocations() IPAddressAllocationInformer { + return &iPAddressAllocationInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// IPBlocksInfos returns a IPBlocksInfoInformer. +func (v *version) IPBlocksInfos() IPBlocksInfoInformer { + return &iPBlocksInfoInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// NetworkInfos returns a NetworkInfoInformer. +func (v *version) NetworkInfos() NetworkInfoInformer { + return &networkInfoInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// SecurityPolicies returns a SecurityPolicyInformer. +func (v *version) SecurityPolicies() SecurityPolicyInformer { + return &securityPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// StaticRoutes returns a StaticRouteInformer. +func (v *version) StaticRoutes() StaticRouteInformer { + return &staticRouteInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Subnets returns a SubnetInformer. +func (v *version) Subnets() SubnetInformer { + return &subnetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// SubnetPorts returns a SubnetPortInformer. +func (v *version) SubnetPorts() SubnetPortInformer { + return &subnetPortInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// SubnetSets returns a SubnetSetInformer. +func (v *version) SubnetSets() SubnetSetInformer { + return &subnetSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// VPCNetworkConfigurations returns a VPCNetworkConfigurationInformer. +func (v *version) VPCNetworkConfigurations() VPCNetworkConfigurationInformer { + return &vPCNetworkConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/vpc/v1alpha1/ipaddressallocation.go b/pkg/client/informers/externalversions/vpc/v1alpha1/ipaddressallocation.go new file mode 100644 index 000000000..6621cb674 --- /dev/null +++ b/pkg/client/informers/externalversions/vpc/v1alpha1/ipaddressallocation.go @@ -0,0 +1,77 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + vpcv1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + versioned "github.com/vmware-tanzu/nsx-operator/pkg/client/clientset/versioned" + internalinterfaces "github.com/vmware-tanzu/nsx-operator/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/client/listers/vpc/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// IPAddressAllocationInformer provides access to a shared informer and lister for +// IPAddressAllocations. +type IPAddressAllocationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.IPAddressAllocationLister +} + +type iPAddressAllocationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewIPAddressAllocationInformer constructs a new informer for IPAddressAllocation type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIPAddressAllocationInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIPAddressAllocationInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredIPAddressAllocationInformer constructs a new informer for IPAddressAllocation type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredIPAddressAllocationInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().IPAddressAllocations(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().IPAddressAllocations(namespace).Watch(context.TODO(), options) + }, + }, + &vpcv1alpha1.IPAddressAllocation{}, + resyncPeriod, + indexers, + ) +} + +func (f *iPAddressAllocationInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIPAddressAllocationInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *iPAddressAllocationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&vpcv1alpha1.IPAddressAllocation{}, f.defaultInformer) +} + +func (f *iPAddressAllocationInformer) Lister() v1alpha1.IPAddressAllocationLister { + return v1alpha1.NewIPAddressAllocationLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/vpc/v1alpha1/ipblocksinfo.go b/pkg/client/informers/externalversions/vpc/v1alpha1/ipblocksinfo.go new file mode 100644 index 000000000..85e31e728 --- /dev/null +++ b/pkg/client/informers/externalversions/vpc/v1alpha1/ipblocksinfo.go @@ -0,0 +1,77 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + vpcv1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + versioned "github.com/vmware-tanzu/nsx-operator/pkg/client/clientset/versioned" + internalinterfaces "github.com/vmware-tanzu/nsx-operator/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/client/listers/vpc/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// IPBlocksInfoInformer provides access to a shared informer and lister for +// IPBlocksInfos. +type IPBlocksInfoInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.IPBlocksInfoLister +} + +type iPBlocksInfoInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewIPBlocksInfoInformer constructs a new informer for IPBlocksInfo type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIPBlocksInfoInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIPBlocksInfoInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredIPBlocksInfoInformer constructs a new informer for IPBlocksInfo type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredIPBlocksInfoInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().IPBlocksInfos(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().IPBlocksInfos(namespace).Watch(context.TODO(), options) + }, + }, + &vpcv1alpha1.IPBlocksInfo{}, + resyncPeriod, + indexers, + ) +} + +func (f *iPBlocksInfoInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIPBlocksInfoInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *iPBlocksInfoInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&vpcv1alpha1.IPBlocksInfo{}, f.defaultInformer) +} + +func (f *iPBlocksInfoInformer) Lister() v1alpha1.IPBlocksInfoLister { + return v1alpha1.NewIPBlocksInfoLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/vpc/v1alpha1/networkinfo.go b/pkg/client/informers/externalversions/vpc/v1alpha1/networkinfo.go new file mode 100644 index 000000000..33444f66c --- /dev/null +++ b/pkg/client/informers/externalversions/vpc/v1alpha1/networkinfo.go @@ -0,0 +1,77 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + vpcv1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + versioned "github.com/vmware-tanzu/nsx-operator/pkg/client/clientset/versioned" + internalinterfaces "github.com/vmware-tanzu/nsx-operator/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/client/listers/vpc/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// NetworkInfoInformer provides access to a shared informer and lister for +// NetworkInfos. +type NetworkInfoInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.NetworkInfoLister +} + +type networkInfoInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewNetworkInfoInformer constructs a new informer for NetworkInfo type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNetworkInfoInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNetworkInfoInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredNetworkInfoInformer constructs a new informer for NetworkInfo type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredNetworkInfoInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().NetworkInfos(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().NetworkInfos(namespace).Watch(context.TODO(), options) + }, + }, + &vpcv1alpha1.NetworkInfo{}, + resyncPeriod, + indexers, + ) +} + +func (f *networkInfoInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNetworkInfoInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *networkInfoInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&vpcv1alpha1.NetworkInfo{}, f.defaultInformer) +} + +func (f *networkInfoInformer) Lister() v1alpha1.NetworkInfoLister { + return v1alpha1.NewNetworkInfoLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/vpc/v1alpha1/securitypolicy.go b/pkg/client/informers/externalversions/vpc/v1alpha1/securitypolicy.go new file mode 100644 index 000000000..1f057228d --- /dev/null +++ b/pkg/client/informers/externalversions/vpc/v1alpha1/securitypolicy.go @@ -0,0 +1,77 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + vpcv1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + versioned "github.com/vmware-tanzu/nsx-operator/pkg/client/clientset/versioned" + internalinterfaces "github.com/vmware-tanzu/nsx-operator/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/client/listers/vpc/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// SecurityPolicyInformer provides access to a shared informer and lister for +// SecurityPolicies. +type SecurityPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.SecurityPolicyLister +} + +type securityPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewSecurityPolicyInformer constructs a new informer for SecurityPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewSecurityPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSecurityPolicyInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredSecurityPolicyInformer constructs a new informer for SecurityPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredSecurityPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().SecurityPolicies(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().SecurityPolicies(namespace).Watch(context.TODO(), options) + }, + }, + &vpcv1alpha1.SecurityPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f *securityPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSecurityPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *securityPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&vpcv1alpha1.SecurityPolicy{}, f.defaultInformer) +} + +func (f *securityPolicyInformer) Lister() v1alpha1.SecurityPolicyLister { + return v1alpha1.NewSecurityPolicyLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/vpc/v1alpha1/staticroute.go b/pkg/client/informers/externalversions/vpc/v1alpha1/staticroute.go new file mode 100644 index 000000000..f904f45fa --- /dev/null +++ b/pkg/client/informers/externalversions/vpc/v1alpha1/staticroute.go @@ -0,0 +1,77 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + vpcv1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + versioned "github.com/vmware-tanzu/nsx-operator/pkg/client/clientset/versioned" + internalinterfaces "github.com/vmware-tanzu/nsx-operator/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/client/listers/vpc/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// StaticRouteInformer provides access to a shared informer and lister for +// StaticRoutes. +type StaticRouteInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.StaticRouteLister +} + +type staticRouteInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewStaticRouteInformer constructs a new informer for StaticRoute type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStaticRouteInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStaticRouteInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredStaticRouteInformer constructs a new informer for StaticRoute type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStaticRouteInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().StaticRoutes(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().StaticRoutes(namespace).Watch(context.TODO(), options) + }, + }, + &vpcv1alpha1.StaticRoute{}, + resyncPeriod, + indexers, + ) +} + +func (f *staticRouteInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStaticRouteInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *staticRouteInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&vpcv1alpha1.StaticRoute{}, f.defaultInformer) +} + +func (f *staticRouteInformer) Lister() v1alpha1.StaticRouteLister { + return v1alpha1.NewStaticRouteLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/vpc/v1alpha1/subnet.go b/pkg/client/informers/externalversions/vpc/v1alpha1/subnet.go new file mode 100644 index 000000000..a0f3f4ca4 --- /dev/null +++ b/pkg/client/informers/externalversions/vpc/v1alpha1/subnet.go @@ -0,0 +1,77 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + vpcv1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + versioned "github.com/vmware-tanzu/nsx-operator/pkg/client/clientset/versioned" + internalinterfaces "github.com/vmware-tanzu/nsx-operator/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/client/listers/vpc/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// SubnetInformer provides access to a shared informer and lister for +// Subnets. +type SubnetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.SubnetLister +} + +type subnetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewSubnetInformer constructs a new informer for Subnet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewSubnetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSubnetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredSubnetInformer constructs a new informer for Subnet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredSubnetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().Subnets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().Subnets(namespace).Watch(context.TODO(), options) + }, + }, + &vpcv1alpha1.Subnet{}, + resyncPeriod, + indexers, + ) +} + +func (f *subnetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSubnetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *subnetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&vpcv1alpha1.Subnet{}, f.defaultInformer) +} + +func (f *subnetInformer) Lister() v1alpha1.SubnetLister { + return v1alpha1.NewSubnetLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/vpc/v1alpha1/subnetport.go b/pkg/client/informers/externalversions/vpc/v1alpha1/subnetport.go new file mode 100644 index 000000000..457cc3141 --- /dev/null +++ b/pkg/client/informers/externalversions/vpc/v1alpha1/subnetport.go @@ -0,0 +1,77 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + vpcv1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + versioned "github.com/vmware-tanzu/nsx-operator/pkg/client/clientset/versioned" + internalinterfaces "github.com/vmware-tanzu/nsx-operator/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/client/listers/vpc/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// SubnetPortInformer provides access to a shared informer and lister for +// SubnetPorts. +type SubnetPortInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.SubnetPortLister +} + +type subnetPortInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewSubnetPortInformer constructs a new informer for SubnetPort type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewSubnetPortInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSubnetPortInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredSubnetPortInformer constructs a new informer for SubnetPort type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredSubnetPortInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().SubnetPorts(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().SubnetPorts(namespace).Watch(context.TODO(), options) + }, + }, + &vpcv1alpha1.SubnetPort{}, + resyncPeriod, + indexers, + ) +} + +func (f *subnetPortInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSubnetPortInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *subnetPortInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&vpcv1alpha1.SubnetPort{}, f.defaultInformer) +} + +func (f *subnetPortInformer) Lister() v1alpha1.SubnetPortLister { + return v1alpha1.NewSubnetPortLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/vpc/v1alpha1/subnetset.go b/pkg/client/informers/externalversions/vpc/v1alpha1/subnetset.go new file mode 100644 index 000000000..847e8c792 --- /dev/null +++ b/pkg/client/informers/externalversions/vpc/v1alpha1/subnetset.go @@ -0,0 +1,77 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + vpcv1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + versioned "github.com/vmware-tanzu/nsx-operator/pkg/client/clientset/versioned" + internalinterfaces "github.com/vmware-tanzu/nsx-operator/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/client/listers/vpc/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// SubnetSetInformer provides access to a shared informer and lister for +// SubnetSets. +type SubnetSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.SubnetSetLister +} + +type subnetSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewSubnetSetInformer constructs a new informer for SubnetSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewSubnetSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSubnetSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredSubnetSetInformer constructs a new informer for SubnetSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredSubnetSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().SubnetSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().SubnetSets(namespace).Watch(context.TODO(), options) + }, + }, + &vpcv1alpha1.SubnetSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *subnetSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSubnetSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *subnetSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&vpcv1alpha1.SubnetSet{}, f.defaultInformer) +} + +func (f *subnetSetInformer) Lister() v1alpha1.SubnetSetLister { + return v1alpha1.NewSubnetSetLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/vpc/v1alpha1/vpcnetworkconfiguration.go b/pkg/client/informers/externalversions/vpc/v1alpha1/vpcnetworkconfiguration.go new file mode 100644 index 000000000..12b4ffb34 --- /dev/null +++ b/pkg/client/informers/externalversions/vpc/v1alpha1/vpcnetworkconfiguration.go @@ -0,0 +1,76 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + vpcv1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + versioned "github.com/vmware-tanzu/nsx-operator/pkg/client/clientset/versioned" + internalinterfaces "github.com/vmware-tanzu/nsx-operator/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/client/listers/vpc/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// VPCNetworkConfigurationInformer provides access to a shared informer and lister for +// VPCNetworkConfigurations. +type VPCNetworkConfigurationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.VPCNetworkConfigurationLister +} + +type vPCNetworkConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewVPCNetworkConfigurationInformer constructs a new informer for VPCNetworkConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVPCNetworkConfigurationInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVPCNetworkConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredVPCNetworkConfigurationInformer constructs a new informer for VPCNetworkConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredVPCNetworkConfigurationInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().VPCNetworkConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CrdV1alpha1().VPCNetworkConfigurations().Watch(context.TODO(), options) + }, + }, + &vpcv1alpha1.VPCNetworkConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f *vPCNetworkConfigurationInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVPCNetworkConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *vPCNetworkConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&vpcv1alpha1.VPCNetworkConfiguration{}, f.defaultInformer) +} + +func (f *vPCNetworkConfigurationInformer) Lister() v1alpha1.VPCNetworkConfigurationLister { + return v1alpha1.NewVPCNetworkConfigurationLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/listers/vpc/v1alpha1/addressbinding.go b/pkg/client/listers/vpc/v1alpha1/addressbinding.go new file mode 100644 index 000000000..3810c375e --- /dev/null +++ b/pkg/client/listers/vpc/v1alpha1/addressbinding.go @@ -0,0 +1,86 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// AddressBindingLister helps list AddressBindings. +// All objects returned here must be treated as read-only. +type AddressBindingLister interface { + // List lists all AddressBindings in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.AddressBinding, err error) + // AddressBindings returns an object that can list and get AddressBindings. + AddressBindings(namespace string) AddressBindingNamespaceLister + AddressBindingListerExpansion +} + +// addressBindingLister implements the AddressBindingLister interface. +type addressBindingLister struct { + indexer cache.Indexer +} + +// NewAddressBindingLister returns a new AddressBindingLister. +func NewAddressBindingLister(indexer cache.Indexer) AddressBindingLister { + return &addressBindingLister{indexer: indexer} +} + +// List lists all AddressBindings in the indexer. +func (s *addressBindingLister) List(selector labels.Selector) (ret []*v1alpha1.AddressBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.AddressBinding)) + }) + return ret, err +} + +// AddressBindings returns an object that can list and get AddressBindings. +func (s *addressBindingLister) AddressBindings(namespace string) AddressBindingNamespaceLister { + return addressBindingNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// AddressBindingNamespaceLister helps list and get AddressBindings. +// All objects returned here must be treated as read-only. +type AddressBindingNamespaceLister interface { + // List lists all AddressBindings in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.AddressBinding, err error) + // Get retrieves the AddressBinding from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.AddressBinding, error) + AddressBindingNamespaceListerExpansion +} + +// addressBindingNamespaceLister implements the AddressBindingNamespaceLister +// interface. +type addressBindingNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all AddressBindings in the indexer for a given namespace. +func (s addressBindingNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.AddressBinding, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.AddressBinding)) + }) + return ret, err +} + +// Get retrieves the AddressBinding from the indexer for a given namespace and name. +func (s addressBindingNamespaceLister) Get(name string) (*v1alpha1.AddressBinding, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("addressbinding"), name) + } + return obj.(*v1alpha1.AddressBinding), nil +} diff --git a/pkg/client/listers/vpc/v1alpha1/expansion_generated.go b/pkg/client/listers/vpc/v1alpha1/expansion_generated.go new file mode 100644 index 000000000..3b5ef6f01 --- /dev/null +++ b/pkg/client/listers/vpc/v1alpha1/expansion_generated.go @@ -0,0 +1,82 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// AddressBindingListerExpansion allows custom methods to be added to +// AddressBindingLister. +type AddressBindingListerExpansion interface{} + +// AddressBindingNamespaceListerExpansion allows custom methods to be added to +// AddressBindingNamespaceLister. +type AddressBindingNamespaceListerExpansion interface{} + +// IPAddressAllocationListerExpansion allows custom methods to be added to +// IPAddressAllocationLister. +type IPAddressAllocationListerExpansion interface{} + +// IPAddressAllocationNamespaceListerExpansion allows custom methods to be added to +// IPAddressAllocationNamespaceLister. +type IPAddressAllocationNamespaceListerExpansion interface{} + +// IPBlocksInfoListerExpansion allows custom methods to be added to +// IPBlocksInfoLister. +type IPBlocksInfoListerExpansion interface{} + +// IPBlocksInfoNamespaceListerExpansion allows custom methods to be added to +// IPBlocksInfoNamespaceLister. +type IPBlocksInfoNamespaceListerExpansion interface{} + +// NetworkInfoListerExpansion allows custom methods to be added to +// NetworkInfoLister. +type NetworkInfoListerExpansion interface{} + +// NetworkInfoNamespaceListerExpansion allows custom methods to be added to +// NetworkInfoNamespaceLister. +type NetworkInfoNamespaceListerExpansion interface{} + +// SecurityPolicyListerExpansion allows custom methods to be added to +// SecurityPolicyLister. +type SecurityPolicyListerExpansion interface{} + +// SecurityPolicyNamespaceListerExpansion allows custom methods to be added to +// SecurityPolicyNamespaceLister. +type SecurityPolicyNamespaceListerExpansion interface{} + +// StaticRouteListerExpansion allows custom methods to be added to +// StaticRouteLister. +type StaticRouteListerExpansion interface{} + +// StaticRouteNamespaceListerExpansion allows custom methods to be added to +// StaticRouteNamespaceLister. +type StaticRouteNamespaceListerExpansion interface{} + +// SubnetListerExpansion allows custom methods to be added to +// SubnetLister. +type SubnetListerExpansion interface{} + +// SubnetNamespaceListerExpansion allows custom methods to be added to +// SubnetNamespaceLister. +type SubnetNamespaceListerExpansion interface{} + +// SubnetPortListerExpansion allows custom methods to be added to +// SubnetPortLister. +type SubnetPortListerExpansion interface{} + +// SubnetPortNamespaceListerExpansion allows custom methods to be added to +// SubnetPortNamespaceLister. +type SubnetPortNamespaceListerExpansion interface{} + +// SubnetSetListerExpansion allows custom methods to be added to +// SubnetSetLister. +type SubnetSetListerExpansion interface{} + +// SubnetSetNamespaceListerExpansion allows custom methods to be added to +// SubnetSetNamespaceLister. +type SubnetSetNamespaceListerExpansion interface{} + +// VPCNetworkConfigurationListerExpansion allows custom methods to be added to +// VPCNetworkConfigurationLister. +type VPCNetworkConfigurationListerExpansion interface{} diff --git a/pkg/client/listers/vpc/v1alpha1/ipaddressallocation.go b/pkg/client/listers/vpc/v1alpha1/ipaddressallocation.go new file mode 100644 index 000000000..e5e708585 --- /dev/null +++ b/pkg/client/listers/vpc/v1alpha1/ipaddressallocation.go @@ -0,0 +1,86 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// IPAddressAllocationLister helps list IPAddressAllocations. +// All objects returned here must be treated as read-only. +type IPAddressAllocationLister interface { + // List lists all IPAddressAllocations in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.IPAddressAllocation, err error) + // IPAddressAllocations returns an object that can list and get IPAddressAllocations. + IPAddressAllocations(namespace string) IPAddressAllocationNamespaceLister + IPAddressAllocationListerExpansion +} + +// iPAddressAllocationLister implements the IPAddressAllocationLister interface. +type iPAddressAllocationLister struct { + indexer cache.Indexer +} + +// NewIPAddressAllocationLister returns a new IPAddressAllocationLister. +func NewIPAddressAllocationLister(indexer cache.Indexer) IPAddressAllocationLister { + return &iPAddressAllocationLister{indexer: indexer} +} + +// List lists all IPAddressAllocations in the indexer. +func (s *iPAddressAllocationLister) List(selector labels.Selector) (ret []*v1alpha1.IPAddressAllocation, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.IPAddressAllocation)) + }) + return ret, err +} + +// IPAddressAllocations returns an object that can list and get IPAddressAllocations. +func (s *iPAddressAllocationLister) IPAddressAllocations(namespace string) IPAddressAllocationNamespaceLister { + return iPAddressAllocationNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// IPAddressAllocationNamespaceLister helps list and get IPAddressAllocations. +// All objects returned here must be treated as read-only. +type IPAddressAllocationNamespaceLister interface { + // List lists all IPAddressAllocations in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.IPAddressAllocation, err error) + // Get retrieves the IPAddressAllocation from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.IPAddressAllocation, error) + IPAddressAllocationNamespaceListerExpansion +} + +// iPAddressAllocationNamespaceLister implements the IPAddressAllocationNamespaceLister +// interface. +type iPAddressAllocationNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all IPAddressAllocations in the indexer for a given namespace. +func (s iPAddressAllocationNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.IPAddressAllocation, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.IPAddressAllocation)) + }) + return ret, err +} + +// Get retrieves the IPAddressAllocation from the indexer for a given namespace and name. +func (s iPAddressAllocationNamespaceLister) Get(name string) (*v1alpha1.IPAddressAllocation, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("ipaddressallocation"), name) + } + return obj.(*v1alpha1.IPAddressAllocation), nil +} diff --git a/pkg/client/listers/vpc/v1alpha1/ipblocksinfo.go b/pkg/client/listers/vpc/v1alpha1/ipblocksinfo.go new file mode 100644 index 000000000..ea1e283ac --- /dev/null +++ b/pkg/client/listers/vpc/v1alpha1/ipblocksinfo.go @@ -0,0 +1,86 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// IPBlocksInfoLister helps list IPBlocksInfos. +// All objects returned here must be treated as read-only. +type IPBlocksInfoLister interface { + // List lists all IPBlocksInfos in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.IPBlocksInfo, err error) + // IPBlocksInfos returns an object that can list and get IPBlocksInfos. + IPBlocksInfos(namespace string) IPBlocksInfoNamespaceLister + IPBlocksInfoListerExpansion +} + +// iPBlocksInfoLister implements the IPBlocksInfoLister interface. +type iPBlocksInfoLister struct { + indexer cache.Indexer +} + +// NewIPBlocksInfoLister returns a new IPBlocksInfoLister. +func NewIPBlocksInfoLister(indexer cache.Indexer) IPBlocksInfoLister { + return &iPBlocksInfoLister{indexer: indexer} +} + +// List lists all IPBlocksInfos in the indexer. +func (s *iPBlocksInfoLister) List(selector labels.Selector) (ret []*v1alpha1.IPBlocksInfo, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.IPBlocksInfo)) + }) + return ret, err +} + +// IPBlocksInfos returns an object that can list and get IPBlocksInfos. +func (s *iPBlocksInfoLister) IPBlocksInfos(namespace string) IPBlocksInfoNamespaceLister { + return iPBlocksInfoNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// IPBlocksInfoNamespaceLister helps list and get IPBlocksInfos. +// All objects returned here must be treated as read-only. +type IPBlocksInfoNamespaceLister interface { + // List lists all IPBlocksInfos in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.IPBlocksInfo, err error) + // Get retrieves the IPBlocksInfo from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.IPBlocksInfo, error) + IPBlocksInfoNamespaceListerExpansion +} + +// iPBlocksInfoNamespaceLister implements the IPBlocksInfoNamespaceLister +// interface. +type iPBlocksInfoNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all IPBlocksInfos in the indexer for a given namespace. +func (s iPBlocksInfoNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.IPBlocksInfo, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.IPBlocksInfo)) + }) + return ret, err +} + +// Get retrieves the IPBlocksInfo from the indexer for a given namespace and name. +func (s iPBlocksInfoNamespaceLister) Get(name string) (*v1alpha1.IPBlocksInfo, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("ipblocksinfo"), name) + } + return obj.(*v1alpha1.IPBlocksInfo), nil +} diff --git a/pkg/client/listers/vpc/v1alpha1/networkinfo.go b/pkg/client/listers/vpc/v1alpha1/networkinfo.go new file mode 100644 index 000000000..af90f6cae --- /dev/null +++ b/pkg/client/listers/vpc/v1alpha1/networkinfo.go @@ -0,0 +1,86 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// NetworkInfoLister helps list NetworkInfos. +// All objects returned here must be treated as read-only. +type NetworkInfoLister interface { + // List lists all NetworkInfos in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.NetworkInfo, err error) + // NetworkInfos returns an object that can list and get NetworkInfos. + NetworkInfos(namespace string) NetworkInfoNamespaceLister + NetworkInfoListerExpansion +} + +// networkInfoLister implements the NetworkInfoLister interface. +type networkInfoLister struct { + indexer cache.Indexer +} + +// NewNetworkInfoLister returns a new NetworkInfoLister. +func NewNetworkInfoLister(indexer cache.Indexer) NetworkInfoLister { + return &networkInfoLister{indexer: indexer} +} + +// List lists all NetworkInfos in the indexer. +func (s *networkInfoLister) List(selector labels.Selector) (ret []*v1alpha1.NetworkInfo, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.NetworkInfo)) + }) + return ret, err +} + +// NetworkInfos returns an object that can list and get NetworkInfos. +func (s *networkInfoLister) NetworkInfos(namespace string) NetworkInfoNamespaceLister { + return networkInfoNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// NetworkInfoNamespaceLister helps list and get NetworkInfos. +// All objects returned here must be treated as read-only. +type NetworkInfoNamespaceLister interface { + // List lists all NetworkInfos in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.NetworkInfo, err error) + // Get retrieves the NetworkInfo from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.NetworkInfo, error) + NetworkInfoNamespaceListerExpansion +} + +// networkInfoNamespaceLister implements the NetworkInfoNamespaceLister +// interface. +type networkInfoNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all NetworkInfos in the indexer for a given namespace. +func (s networkInfoNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.NetworkInfo, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.NetworkInfo)) + }) + return ret, err +} + +// Get retrieves the NetworkInfo from the indexer for a given namespace and name. +func (s networkInfoNamespaceLister) Get(name string) (*v1alpha1.NetworkInfo, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("networkinfo"), name) + } + return obj.(*v1alpha1.NetworkInfo), nil +} diff --git a/pkg/client/listers/vpc/v1alpha1/securitypolicy.go b/pkg/client/listers/vpc/v1alpha1/securitypolicy.go new file mode 100644 index 000000000..90dad634e --- /dev/null +++ b/pkg/client/listers/vpc/v1alpha1/securitypolicy.go @@ -0,0 +1,86 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// SecurityPolicyLister helps list SecurityPolicies. +// All objects returned here must be treated as read-only. +type SecurityPolicyLister interface { + // List lists all SecurityPolicies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.SecurityPolicy, err error) + // SecurityPolicies returns an object that can list and get SecurityPolicies. + SecurityPolicies(namespace string) SecurityPolicyNamespaceLister + SecurityPolicyListerExpansion +} + +// securityPolicyLister implements the SecurityPolicyLister interface. +type securityPolicyLister struct { + indexer cache.Indexer +} + +// NewSecurityPolicyLister returns a new SecurityPolicyLister. +func NewSecurityPolicyLister(indexer cache.Indexer) SecurityPolicyLister { + return &securityPolicyLister{indexer: indexer} +} + +// List lists all SecurityPolicies in the indexer. +func (s *securityPolicyLister) List(selector labels.Selector) (ret []*v1alpha1.SecurityPolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.SecurityPolicy)) + }) + return ret, err +} + +// SecurityPolicies returns an object that can list and get SecurityPolicies. +func (s *securityPolicyLister) SecurityPolicies(namespace string) SecurityPolicyNamespaceLister { + return securityPolicyNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// SecurityPolicyNamespaceLister helps list and get SecurityPolicies. +// All objects returned here must be treated as read-only. +type SecurityPolicyNamespaceLister interface { + // List lists all SecurityPolicies in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.SecurityPolicy, err error) + // Get retrieves the SecurityPolicy from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.SecurityPolicy, error) + SecurityPolicyNamespaceListerExpansion +} + +// securityPolicyNamespaceLister implements the SecurityPolicyNamespaceLister +// interface. +type securityPolicyNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all SecurityPolicies in the indexer for a given namespace. +func (s securityPolicyNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.SecurityPolicy, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.SecurityPolicy)) + }) + return ret, err +} + +// Get retrieves the SecurityPolicy from the indexer for a given namespace and name. +func (s securityPolicyNamespaceLister) Get(name string) (*v1alpha1.SecurityPolicy, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("securitypolicy"), name) + } + return obj.(*v1alpha1.SecurityPolicy), nil +} diff --git a/pkg/client/listers/vpc/v1alpha1/staticroute.go b/pkg/client/listers/vpc/v1alpha1/staticroute.go new file mode 100644 index 000000000..a607e815e --- /dev/null +++ b/pkg/client/listers/vpc/v1alpha1/staticroute.go @@ -0,0 +1,86 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// StaticRouteLister helps list StaticRoutes. +// All objects returned here must be treated as read-only. +type StaticRouteLister interface { + // List lists all StaticRoutes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.StaticRoute, err error) + // StaticRoutes returns an object that can list and get StaticRoutes. + StaticRoutes(namespace string) StaticRouteNamespaceLister + StaticRouteListerExpansion +} + +// staticRouteLister implements the StaticRouteLister interface. +type staticRouteLister struct { + indexer cache.Indexer +} + +// NewStaticRouteLister returns a new StaticRouteLister. +func NewStaticRouteLister(indexer cache.Indexer) StaticRouteLister { + return &staticRouteLister{indexer: indexer} +} + +// List lists all StaticRoutes in the indexer. +func (s *staticRouteLister) List(selector labels.Selector) (ret []*v1alpha1.StaticRoute, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.StaticRoute)) + }) + return ret, err +} + +// StaticRoutes returns an object that can list and get StaticRoutes. +func (s *staticRouteLister) StaticRoutes(namespace string) StaticRouteNamespaceLister { + return staticRouteNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// StaticRouteNamespaceLister helps list and get StaticRoutes. +// All objects returned here must be treated as read-only. +type StaticRouteNamespaceLister interface { + // List lists all StaticRoutes in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.StaticRoute, err error) + // Get retrieves the StaticRoute from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.StaticRoute, error) + StaticRouteNamespaceListerExpansion +} + +// staticRouteNamespaceLister implements the StaticRouteNamespaceLister +// interface. +type staticRouteNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all StaticRoutes in the indexer for a given namespace. +func (s staticRouteNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.StaticRoute, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.StaticRoute)) + }) + return ret, err +} + +// Get retrieves the StaticRoute from the indexer for a given namespace and name. +func (s staticRouteNamespaceLister) Get(name string) (*v1alpha1.StaticRoute, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("staticroute"), name) + } + return obj.(*v1alpha1.StaticRoute), nil +} diff --git a/pkg/client/listers/vpc/v1alpha1/subnet.go b/pkg/client/listers/vpc/v1alpha1/subnet.go new file mode 100644 index 000000000..ef18873a2 --- /dev/null +++ b/pkg/client/listers/vpc/v1alpha1/subnet.go @@ -0,0 +1,86 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// SubnetLister helps list Subnets. +// All objects returned here must be treated as read-only. +type SubnetLister interface { + // List lists all Subnets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Subnet, err error) + // Subnets returns an object that can list and get Subnets. + Subnets(namespace string) SubnetNamespaceLister + SubnetListerExpansion +} + +// subnetLister implements the SubnetLister interface. +type subnetLister struct { + indexer cache.Indexer +} + +// NewSubnetLister returns a new SubnetLister. +func NewSubnetLister(indexer cache.Indexer) SubnetLister { + return &subnetLister{indexer: indexer} +} + +// List lists all Subnets in the indexer. +func (s *subnetLister) List(selector labels.Selector) (ret []*v1alpha1.Subnet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Subnet)) + }) + return ret, err +} + +// Subnets returns an object that can list and get Subnets. +func (s *subnetLister) Subnets(namespace string) SubnetNamespaceLister { + return subnetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// SubnetNamespaceLister helps list and get Subnets. +// All objects returned here must be treated as read-only. +type SubnetNamespaceLister interface { + // List lists all Subnets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Subnet, err error) + // Get retrieves the Subnet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.Subnet, error) + SubnetNamespaceListerExpansion +} + +// subnetNamespaceLister implements the SubnetNamespaceLister +// interface. +type subnetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Subnets in the indexer for a given namespace. +func (s subnetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Subnet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Subnet)) + }) + return ret, err +} + +// Get retrieves the Subnet from the indexer for a given namespace and name. +func (s subnetNamespaceLister) Get(name string) (*v1alpha1.Subnet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("subnet"), name) + } + return obj.(*v1alpha1.Subnet), nil +} diff --git a/pkg/client/listers/vpc/v1alpha1/subnetport.go b/pkg/client/listers/vpc/v1alpha1/subnetport.go new file mode 100644 index 000000000..db1c47ba9 --- /dev/null +++ b/pkg/client/listers/vpc/v1alpha1/subnetport.go @@ -0,0 +1,86 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// SubnetPortLister helps list SubnetPorts. +// All objects returned here must be treated as read-only. +type SubnetPortLister interface { + // List lists all SubnetPorts in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.SubnetPort, err error) + // SubnetPorts returns an object that can list and get SubnetPorts. + SubnetPorts(namespace string) SubnetPortNamespaceLister + SubnetPortListerExpansion +} + +// subnetPortLister implements the SubnetPortLister interface. +type subnetPortLister struct { + indexer cache.Indexer +} + +// NewSubnetPortLister returns a new SubnetPortLister. +func NewSubnetPortLister(indexer cache.Indexer) SubnetPortLister { + return &subnetPortLister{indexer: indexer} +} + +// List lists all SubnetPorts in the indexer. +func (s *subnetPortLister) List(selector labels.Selector) (ret []*v1alpha1.SubnetPort, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.SubnetPort)) + }) + return ret, err +} + +// SubnetPorts returns an object that can list and get SubnetPorts. +func (s *subnetPortLister) SubnetPorts(namespace string) SubnetPortNamespaceLister { + return subnetPortNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// SubnetPortNamespaceLister helps list and get SubnetPorts. +// All objects returned here must be treated as read-only. +type SubnetPortNamespaceLister interface { + // List lists all SubnetPorts in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.SubnetPort, err error) + // Get retrieves the SubnetPort from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.SubnetPort, error) + SubnetPortNamespaceListerExpansion +} + +// subnetPortNamespaceLister implements the SubnetPortNamespaceLister +// interface. +type subnetPortNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all SubnetPorts in the indexer for a given namespace. +func (s subnetPortNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.SubnetPort, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.SubnetPort)) + }) + return ret, err +} + +// Get retrieves the SubnetPort from the indexer for a given namespace and name. +func (s subnetPortNamespaceLister) Get(name string) (*v1alpha1.SubnetPort, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("subnetport"), name) + } + return obj.(*v1alpha1.SubnetPort), nil +} diff --git a/pkg/client/listers/vpc/v1alpha1/subnetset.go b/pkg/client/listers/vpc/v1alpha1/subnetset.go new file mode 100644 index 000000000..72cb995e6 --- /dev/null +++ b/pkg/client/listers/vpc/v1alpha1/subnetset.go @@ -0,0 +1,86 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// SubnetSetLister helps list SubnetSets. +// All objects returned here must be treated as read-only. +type SubnetSetLister interface { + // List lists all SubnetSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.SubnetSet, err error) + // SubnetSets returns an object that can list and get SubnetSets. + SubnetSets(namespace string) SubnetSetNamespaceLister + SubnetSetListerExpansion +} + +// subnetSetLister implements the SubnetSetLister interface. +type subnetSetLister struct { + indexer cache.Indexer +} + +// NewSubnetSetLister returns a new SubnetSetLister. +func NewSubnetSetLister(indexer cache.Indexer) SubnetSetLister { + return &subnetSetLister{indexer: indexer} +} + +// List lists all SubnetSets in the indexer. +func (s *subnetSetLister) List(selector labels.Selector) (ret []*v1alpha1.SubnetSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.SubnetSet)) + }) + return ret, err +} + +// SubnetSets returns an object that can list and get SubnetSets. +func (s *subnetSetLister) SubnetSets(namespace string) SubnetSetNamespaceLister { + return subnetSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// SubnetSetNamespaceLister helps list and get SubnetSets. +// All objects returned here must be treated as read-only. +type SubnetSetNamespaceLister interface { + // List lists all SubnetSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.SubnetSet, err error) + // Get retrieves the SubnetSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.SubnetSet, error) + SubnetSetNamespaceListerExpansion +} + +// subnetSetNamespaceLister implements the SubnetSetNamespaceLister +// interface. +type subnetSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all SubnetSets in the indexer for a given namespace. +func (s subnetSetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.SubnetSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.SubnetSet)) + }) + return ret, err +} + +// Get retrieves the SubnetSet from the indexer for a given namespace and name. +func (s subnetSetNamespaceLister) Get(name string) (*v1alpha1.SubnetSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("subnetset"), name) + } + return obj.(*v1alpha1.SubnetSet), nil +} diff --git a/pkg/client/listers/vpc/v1alpha1/vpcnetworkconfiguration.go b/pkg/client/listers/vpc/v1alpha1/vpcnetworkconfiguration.go new file mode 100644 index 000000000..e85374e52 --- /dev/null +++ b/pkg/client/listers/vpc/v1alpha1/vpcnetworkconfiguration.go @@ -0,0 +1,55 @@ +/* Copyright © 2024 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: Apache-2.0 */ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/vmware-tanzu/nsx-operator/pkg/apis/vpc/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// VPCNetworkConfigurationLister helps list VPCNetworkConfigurations. +// All objects returned here must be treated as read-only. +type VPCNetworkConfigurationLister interface { + // List lists all VPCNetworkConfigurations in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VPCNetworkConfiguration, err error) + // Get retrieves the VPCNetworkConfiguration from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.VPCNetworkConfiguration, error) + VPCNetworkConfigurationListerExpansion +} + +// vPCNetworkConfigurationLister implements the VPCNetworkConfigurationLister interface. +type vPCNetworkConfigurationLister struct { + indexer cache.Indexer +} + +// NewVPCNetworkConfigurationLister returns a new VPCNetworkConfigurationLister. +func NewVPCNetworkConfigurationLister(indexer cache.Indexer) VPCNetworkConfigurationLister { + return &vPCNetworkConfigurationLister{indexer: indexer} +} + +// List lists all VPCNetworkConfigurations in the indexer. +func (s *vPCNetworkConfigurationLister) List(selector labels.Selector) (ret []*v1alpha1.VPCNetworkConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.VPCNetworkConfiguration)) + }) + return ret, err +} + +// Get retrieves the VPCNetworkConfiguration from the index for a given name. +func (s *vPCNetworkConfigurationLister) Get(name string) (*v1alpha1.VPCNetworkConfiguration, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("vpcnetworkconfiguration"), name) + } + return obj.(*v1alpha1.VPCNetworkConfiguration), nil +}