diff --git a/apis/storage.k8s.io/v1/fakes/zz_generated_storage_class_mock.go b/apis/storage.k8s.io/v1/fakes/zz_generated_storage_class_mock.go new file mode 100644 index 00000000..9b208c5e --- /dev/null +++ b/apis/storage.k8s.io/v1/fakes/zz_generated_storage_class_mock.go @@ -0,0 +1,1741 @@ +// Code generated by moq; DO NOT EDIT. +// github.com/matryer/moq + +package fakes + +import ( + context "context" + sync "sync" + + controller "github.com/rancher/norman/controller" + objectclient "github.com/rancher/norman/objectclient" + v1a "github.com/rancher/types/apis/storage.k8s.io/v1" + v1 "k8s.io/api/storage/v1" + v1b "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +var ( + lockStorageClassListerMockGet sync.RWMutex + lockStorageClassListerMockList sync.RWMutex +) + +// Ensure, that StorageClassListerMock does implement StorageClassLister. +// If this is not the case, regenerate this file with moq. +var _ v1a.StorageClassLister = &StorageClassListerMock{} + +// StorageClassListerMock is a mock implementation of StorageClassLister. +// +// func TestSomethingThatUsesStorageClassLister(t *testing.T) { +// +// // make and configure a mocked StorageClassLister +// mockedStorageClassLister := &StorageClassListerMock{ +// GetFunc: func(namespace string, name string) (*v1.StorageClass, error) { +// panic("mock out the Get method") +// }, +// ListFunc: func(namespace string, selector labels.Selector) ([]*v1.StorageClass, error) { +// panic("mock out the List method") +// }, +// } +// +// // use mockedStorageClassLister in code that requires StorageClassLister +// // and then make assertions. +// +// } +type StorageClassListerMock struct { + // GetFunc mocks the Get method. + GetFunc func(namespace string, name string) (*v1.StorageClass, error) + + // ListFunc mocks the List method. + ListFunc func(namespace string, selector labels.Selector) ([]*v1.StorageClass, error) + + // calls tracks calls to the methods. + calls struct { + // Get holds details about calls to the Get method. + Get []struct { + // Namespace is the namespace argument value. + Namespace string + // Name is the name argument value. + Name string + } + // List holds details about calls to the List method. + List []struct { + // Namespace is the namespace argument value. + Namespace string + // Selector is the selector argument value. + Selector labels.Selector + } + } +} + +// Get calls GetFunc. +func (mock *StorageClassListerMock) Get(namespace string, name string) (*v1.StorageClass, error) { + if mock.GetFunc == nil { + panic("StorageClassListerMock.GetFunc: method is nil but StorageClassLister.Get was just called") + } + callInfo := struct { + Namespace string + Name string + }{ + Namespace: namespace, + Name: name, + } + lockStorageClassListerMockGet.Lock() + mock.calls.Get = append(mock.calls.Get, callInfo) + lockStorageClassListerMockGet.Unlock() + return mock.GetFunc(namespace, name) +} + +// GetCalls gets all the calls that were made to Get. +// Check the length with: +// len(mockedStorageClassLister.GetCalls()) +func (mock *StorageClassListerMock) GetCalls() []struct { + Namespace string + Name string +} { + var calls []struct { + Namespace string + Name string + } + lockStorageClassListerMockGet.RLock() + calls = mock.calls.Get + lockStorageClassListerMockGet.RUnlock() + return calls +} + +// List calls ListFunc. +func (mock *StorageClassListerMock) List(namespace string, selector labels.Selector) ([]*v1.StorageClass, error) { + if mock.ListFunc == nil { + panic("StorageClassListerMock.ListFunc: method is nil but StorageClassLister.List was just called") + } + callInfo := struct { + Namespace string + Selector labels.Selector + }{ + Namespace: namespace, + Selector: selector, + } + lockStorageClassListerMockList.Lock() + mock.calls.List = append(mock.calls.List, callInfo) + lockStorageClassListerMockList.Unlock() + return mock.ListFunc(namespace, selector) +} + +// ListCalls gets all the calls that were made to List. +// Check the length with: +// len(mockedStorageClassLister.ListCalls()) +func (mock *StorageClassListerMock) ListCalls() []struct { + Namespace string + Selector labels.Selector +} { + var calls []struct { + Namespace string + Selector labels.Selector + } + lockStorageClassListerMockList.RLock() + calls = mock.calls.List + lockStorageClassListerMockList.RUnlock() + return calls +} + +var ( + lockStorageClassControllerMockAddClusterScopedFeatureHandler sync.RWMutex + lockStorageClassControllerMockAddClusterScopedHandler sync.RWMutex + lockStorageClassControllerMockAddFeatureHandler sync.RWMutex + lockStorageClassControllerMockAddHandler sync.RWMutex + lockStorageClassControllerMockEnqueue sync.RWMutex + lockStorageClassControllerMockGeneric sync.RWMutex + lockStorageClassControllerMockInformer sync.RWMutex + lockStorageClassControllerMockLister sync.RWMutex + lockStorageClassControllerMockStart sync.RWMutex + lockStorageClassControllerMockSync sync.RWMutex +) + +// Ensure, that StorageClassControllerMock does implement StorageClassController. +// If this is not the case, regenerate this file with moq. +var _ v1a.StorageClassController = &StorageClassControllerMock{} + +// StorageClassControllerMock is a mock implementation of StorageClassController. +// +// func TestSomethingThatUsesStorageClassController(t *testing.T) { +// +// // make and configure a mocked StorageClassController +// mockedStorageClassController := &StorageClassControllerMock{ +// AddClusterScopedFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, clusterName string, handler v1a.StorageClassHandlerFunc) { +// panic("mock out the AddClusterScopedFeatureHandler method") +// }, +// AddClusterScopedHandlerFunc: func(ctx context.Context, name string, clusterName string, handler v1a.StorageClassHandlerFunc) { +// panic("mock out the AddClusterScopedHandler method") +// }, +// AddFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, sync v1a.StorageClassHandlerFunc) { +// panic("mock out the AddFeatureHandler method") +// }, +// AddHandlerFunc: func(ctx context.Context, name string, handler v1a.StorageClassHandlerFunc) { +// panic("mock out the AddHandler method") +// }, +// EnqueueFunc: func(namespace string, name string) { +// panic("mock out the Enqueue method") +// }, +// GenericFunc: func() controller.GenericController { +// panic("mock out the Generic method") +// }, +// InformerFunc: func() cache.SharedIndexInformer { +// panic("mock out the Informer method") +// }, +// ListerFunc: func() v1a.StorageClassLister { +// panic("mock out the Lister method") +// }, +// StartFunc: func(ctx context.Context, threadiness int) error { +// panic("mock out the Start method") +// }, +// SyncFunc: func(ctx context.Context) error { +// panic("mock out the Sync method") +// }, +// } +// +// // use mockedStorageClassController in code that requires StorageClassController +// // and then make assertions. +// +// } +type StorageClassControllerMock struct { + // AddClusterScopedFeatureHandlerFunc mocks the AddClusterScopedFeatureHandler method. + AddClusterScopedFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, clusterName string, handler v1a.StorageClassHandlerFunc) + + // AddClusterScopedHandlerFunc mocks the AddClusterScopedHandler method. + AddClusterScopedHandlerFunc func(ctx context.Context, name string, clusterName string, handler v1a.StorageClassHandlerFunc) + + // AddFeatureHandlerFunc mocks the AddFeatureHandler method. + AddFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, sync v1a.StorageClassHandlerFunc) + + // AddHandlerFunc mocks the AddHandler method. + AddHandlerFunc func(ctx context.Context, name string, handler v1a.StorageClassHandlerFunc) + + // EnqueueFunc mocks the Enqueue method. + EnqueueFunc func(namespace string, name string) + + // GenericFunc mocks the Generic method. + GenericFunc func() controller.GenericController + + // InformerFunc mocks the Informer method. + InformerFunc func() cache.SharedIndexInformer + + // ListerFunc mocks the Lister method. + ListerFunc func() v1a.StorageClassLister + + // StartFunc mocks the Start method. + StartFunc func(ctx context.Context, threadiness int) error + + // SyncFunc mocks the Sync method. + SyncFunc func(ctx context.Context) error + + // calls tracks calls to the methods. + calls struct { + // AddClusterScopedFeatureHandler holds details about calls to the AddClusterScopedFeatureHandler method. + AddClusterScopedFeatureHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Enabled is the enabled argument value. + Enabled func() bool + // Name is the name argument value. + Name string + // ClusterName is the clusterName argument value. + ClusterName string + // Handler is the handler argument value. + Handler v1a.StorageClassHandlerFunc + } + // AddClusterScopedHandler holds details about calls to the AddClusterScopedHandler method. + AddClusterScopedHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Name is the name argument value. + Name string + // ClusterName is the clusterName argument value. + ClusterName string + // Handler is the handler argument value. + Handler v1a.StorageClassHandlerFunc + } + // AddFeatureHandler holds details about calls to the AddFeatureHandler method. + AddFeatureHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Enabled is the enabled argument value. + Enabled func() bool + // Name is the name argument value. + Name string + // Sync is the sync argument value. + Sync v1a.StorageClassHandlerFunc + } + // AddHandler holds details about calls to the AddHandler method. + AddHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Name is the name argument value. + Name string + // Handler is the handler argument value. + Handler v1a.StorageClassHandlerFunc + } + // Enqueue holds details about calls to the Enqueue method. + Enqueue []struct { + // Namespace is the namespace argument value. + Namespace string + // Name is the name argument value. + Name string + } + // Generic holds details about calls to the Generic method. + Generic []struct { + } + // Informer holds details about calls to the Informer method. + Informer []struct { + } + // Lister holds details about calls to the Lister method. + Lister []struct { + } + // Start holds details about calls to the Start method. + Start []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Threadiness is the threadiness argument value. + Threadiness int + } + // Sync holds details about calls to the Sync method. + Sync []struct { + // Ctx is the ctx argument value. + Ctx context.Context + } + } +} + +// AddClusterScopedFeatureHandler calls AddClusterScopedFeatureHandlerFunc. +func (mock *StorageClassControllerMock) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name string, clusterName string, handler v1a.StorageClassHandlerFunc) { + if mock.AddClusterScopedFeatureHandlerFunc == nil { + panic("StorageClassControllerMock.AddClusterScopedFeatureHandlerFunc: method is nil but StorageClassController.AddClusterScopedFeatureHandler was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Handler v1a.StorageClassHandlerFunc + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + ClusterName: clusterName, + Handler: handler, + } + lockStorageClassControllerMockAddClusterScopedFeatureHandler.Lock() + mock.calls.AddClusterScopedFeatureHandler = append(mock.calls.AddClusterScopedFeatureHandler, callInfo) + lockStorageClassControllerMockAddClusterScopedFeatureHandler.Unlock() + mock.AddClusterScopedFeatureHandlerFunc(ctx, enabled, name, clusterName, handler) +} + +// AddClusterScopedFeatureHandlerCalls gets all the calls that were made to AddClusterScopedFeatureHandler. +// Check the length with: +// len(mockedStorageClassController.AddClusterScopedFeatureHandlerCalls()) +func (mock *StorageClassControllerMock) AddClusterScopedFeatureHandlerCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Handler v1a.StorageClassHandlerFunc +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Handler v1a.StorageClassHandlerFunc + } + lockStorageClassControllerMockAddClusterScopedFeatureHandler.RLock() + calls = mock.calls.AddClusterScopedFeatureHandler + lockStorageClassControllerMockAddClusterScopedFeatureHandler.RUnlock() + return calls +} + +// AddClusterScopedHandler calls AddClusterScopedHandlerFunc. +func (mock *StorageClassControllerMock) AddClusterScopedHandler(ctx context.Context, name string, clusterName string, handler v1a.StorageClassHandlerFunc) { + if mock.AddClusterScopedHandlerFunc == nil { + panic("StorageClassControllerMock.AddClusterScopedHandlerFunc: method is nil but StorageClassController.AddClusterScopedHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + ClusterName string + Handler v1a.StorageClassHandlerFunc + }{ + Ctx: ctx, + Name: name, + ClusterName: clusterName, + Handler: handler, + } + lockStorageClassControllerMockAddClusterScopedHandler.Lock() + mock.calls.AddClusterScopedHandler = append(mock.calls.AddClusterScopedHandler, callInfo) + lockStorageClassControllerMockAddClusterScopedHandler.Unlock() + mock.AddClusterScopedHandlerFunc(ctx, name, clusterName, handler) +} + +// AddClusterScopedHandlerCalls gets all the calls that were made to AddClusterScopedHandler. +// Check the length with: +// len(mockedStorageClassController.AddClusterScopedHandlerCalls()) +func (mock *StorageClassControllerMock) AddClusterScopedHandlerCalls() []struct { + Ctx context.Context + Name string + ClusterName string + Handler v1a.StorageClassHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + ClusterName string + Handler v1a.StorageClassHandlerFunc + } + lockStorageClassControllerMockAddClusterScopedHandler.RLock() + calls = mock.calls.AddClusterScopedHandler + lockStorageClassControllerMockAddClusterScopedHandler.RUnlock() + return calls +} + +// AddFeatureHandler calls AddFeatureHandlerFunc. +func (mock *StorageClassControllerMock) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync v1a.StorageClassHandlerFunc) { + if mock.AddFeatureHandlerFunc == nil { + panic("StorageClassControllerMock.AddFeatureHandlerFunc: method is nil but StorageClassController.AddFeatureHandler was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v1a.StorageClassHandlerFunc + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + Sync: sync, + } + lockStorageClassControllerMockAddFeatureHandler.Lock() + mock.calls.AddFeatureHandler = append(mock.calls.AddFeatureHandler, callInfo) + lockStorageClassControllerMockAddFeatureHandler.Unlock() + mock.AddFeatureHandlerFunc(ctx, enabled, name, sync) +} + +// AddFeatureHandlerCalls gets all the calls that were made to AddFeatureHandler. +// Check the length with: +// len(mockedStorageClassController.AddFeatureHandlerCalls()) +func (mock *StorageClassControllerMock) AddFeatureHandlerCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v1a.StorageClassHandlerFunc +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v1a.StorageClassHandlerFunc + } + lockStorageClassControllerMockAddFeatureHandler.RLock() + calls = mock.calls.AddFeatureHandler + lockStorageClassControllerMockAddFeatureHandler.RUnlock() + return calls +} + +// AddHandler calls AddHandlerFunc. +func (mock *StorageClassControllerMock) AddHandler(ctx context.Context, name string, handler v1a.StorageClassHandlerFunc) { + if mock.AddHandlerFunc == nil { + panic("StorageClassControllerMock.AddHandlerFunc: method is nil but StorageClassController.AddHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + Handler v1a.StorageClassHandlerFunc + }{ + Ctx: ctx, + Name: name, + Handler: handler, + } + lockStorageClassControllerMockAddHandler.Lock() + mock.calls.AddHandler = append(mock.calls.AddHandler, callInfo) + lockStorageClassControllerMockAddHandler.Unlock() + mock.AddHandlerFunc(ctx, name, handler) +} + +// AddHandlerCalls gets all the calls that were made to AddHandler. +// Check the length with: +// len(mockedStorageClassController.AddHandlerCalls()) +func (mock *StorageClassControllerMock) AddHandlerCalls() []struct { + Ctx context.Context + Name string + Handler v1a.StorageClassHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + Handler v1a.StorageClassHandlerFunc + } + lockStorageClassControllerMockAddHandler.RLock() + calls = mock.calls.AddHandler + lockStorageClassControllerMockAddHandler.RUnlock() + return calls +} + +// Enqueue calls EnqueueFunc. +func (mock *StorageClassControllerMock) Enqueue(namespace string, name string) { + if mock.EnqueueFunc == nil { + panic("StorageClassControllerMock.EnqueueFunc: method is nil but StorageClassController.Enqueue was just called") + } + callInfo := struct { + Namespace string + Name string + }{ + Namespace: namespace, + Name: name, + } + lockStorageClassControllerMockEnqueue.Lock() + mock.calls.Enqueue = append(mock.calls.Enqueue, callInfo) + lockStorageClassControllerMockEnqueue.Unlock() + mock.EnqueueFunc(namespace, name) +} + +// EnqueueCalls gets all the calls that were made to Enqueue. +// Check the length with: +// len(mockedStorageClassController.EnqueueCalls()) +func (mock *StorageClassControllerMock) EnqueueCalls() []struct { + Namespace string + Name string +} { + var calls []struct { + Namespace string + Name string + } + lockStorageClassControllerMockEnqueue.RLock() + calls = mock.calls.Enqueue + lockStorageClassControllerMockEnqueue.RUnlock() + return calls +} + +// Generic calls GenericFunc. +func (mock *StorageClassControllerMock) Generic() controller.GenericController { + if mock.GenericFunc == nil { + panic("StorageClassControllerMock.GenericFunc: method is nil but StorageClassController.Generic was just called") + } + callInfo := struct { + }{} + lockStorageClassControllerMockGeneric.Lock() + mock.calls.Generic = append(mock.calls.Generic, callInfo) + lockStorageClassControllerMockGeneric.Unlock() + return mock.GenericFunc() +} + +// GenericCalls gets all the calls that were made to Generic. +// Check the length with: +// len(mockedStorageClassController.GenericCalls()) +func (mock *StorageClassControllerMock) GenericCalls() []struct { +} { + var calls []struct { + } + lockStorageClassControllerMockGeneric.RLock() + calls = mock.calls.Generic + lockStorageClassControllerMockGeneric.RUnlock() + return calls +} + +// Informer calls InformerFunc. +func (mock *StorageClassControllerMock) Informer() cache.SharedIndexInformer { + if mock.InformerFunc == nil { + panic("StorageClassControllerMock.InformerFunc: method is nil but StorageClassController.Informer was just called") + } + callInfo := struct { + }{} + lockStorageClassControllerMockInformer.Lock() + mock.calls.Informer = append(mock.calls.Informer, callInfo) + lockStorageClassControllerMockInformer.Unlock() + return mock.InformerFunc() +} + +// InformerCalls gets all the calls that were made to Informer. +// Check the length with: +// len(mockedStorageClassController.InformerCalls()) +func (mock *StorageClassControllerMock) InformerCalls() []struct { +} { + var calls []struct { + } + lockStorageClassControllerMockInformer.RLock() + calls = mock.calls.Informer + lockStorageClassControllerMockInformer.RUnlock() + return calls +} + +// Lister calls ListerFunc. +func (mock *StorageClassControllerMock) Lister() v1a.StorageClassLister { + if mock.ListerFunc == nil { + panic("StorageClassControllerMock.ListerFunc: method is nil but StorageClassController.Lister was just called") + } + callInfo := struct { + }{} + lockStorageClassControllerMockLister.Lock() + mock.calls.Lister = append(mock.calls.Lister, callInfo) + lockStorageClassControllerMockLister.Unlock() + return mock.ListerFunc() +} + +// ListerCalls gets all the calls that were made to Lister. +// Check the length with: +// len(mockedStorageClassController.ListerCalls()) +func (mock *StorageClassControllerMock) ListerCalls() []struct { +} { + var calls []struct { + } + lockStorageClassControllerMockLister.RLock() + calls = mock.calls.Lister + lockStorageClassControllerMockLister.RUnlock() + return calls +} + +// Start calls StartFunc. +func (mock *StorageClassControllerMock) Start(ctx context.Context, threadiness int) error { + if mock.StartFunc == nil { + panic("StorageClassControllerMock.StartFunc: method is nil but StorageClassController.Start was just called") + } + callInfo := struct { + Ctx context.Context + Threadiness int + }{ + Ctx: ctx, + Threadiness: threadiness, + } + lockStorageClassControllerMockStart.Lock() + mock.calls.Start = append(mock.calls.Start, callInfo) + lockStorageClassControllerMockStart.Unlock() + return mock.StartFunc(ctx, threadiness) +} + +// StartCalls gets all the calls that were made to Start. +// Check the length with: +// len(mockedStorageClassController.StartCalls()) +func (mock *StorageClassControllerMock) StartCalls() []struct { + Ctx context.Context + Threadiness int +} { + var calls []struct { + Ctx context.Context + Threadiness int + } + lockStorageClassControllerMockStart.RLock() + calls = mock.calls.Start + lockStorageClassControllerMockStart.RUnlock() + return calls +} + +// Sync calls SyncFunc. +func (mock *StorageClassControllerMock) Sync(ctx context.Context) error { + if mock.SyncFunc == nil { + panic("StorageClassControllerMock.SyncFunc: method is nil but StorageClassController.Sync was just called") + } + callInfo := struct { + Ctx context.Context + }{ + Ctx: ctx, + } + lockStorageClassControllerMockSync.Lock() + mock.calls.Sync = append(mock.calls.Sync, callInfo) + lockStorageClassControllerMockSync.Unlock() + return mock.SyncFunc(ctx) +} + +// SyncCalls gets all the calls that were made to Sync. +// Check the length with: +// len(mockedStorageClassController.SyncCalls()) +func (mock *StorageClassControllerMock) SyncCalls() []struct { + Ctx context.Context +} { + var calls []struct { + Ctx context.Context + } + lockStorageClassControllerMockSync.RLock() + calls = mock.calls.Sync + lockStorageClassControllerMockSync.RUnlock() + return calls +} + +var ( + lockStorageClassInterfaceMockAddClusterScopedFeatureHandler sync.RWMutex + lockStorageClassInterfaceMockAddClusterScopedFeatureLifecycle sync.RWMutex + lockStorageClassInterfaceMockAddClusterScopedHandler sync.RWMutex + lockStorageClassInterfaceMockAddClusterScopedLifecycle sync.RWMutex + lockStorageClassInterfaceMockAddFeatureHandler sync.RWMutex + lockStorageClassInterfaceMockAddFeatureLifecycle sync.RWMutex + lockStorageClassInterfaceMockAddHandler sync.RWMutex + lockStorageClassInterfaceMockAddLifecycle sync.RWMutex + lockStorageClassInterfaceMockController sync.RWMutex + lockStorageClassInterfaceMockCreate sync.RWMutex + lockStorageClassInterfaceMockDelete sync.RWMutex + lockStorageClassInterfaceMockDeleteCollection sync.RWMutex + lockStorageClassInterfaceMockDeleteNamespaced sync.RWMutex + lockStorageClassInterfaceMockGet sync.RWMutex + lockStorageClassInterfaceMockGetNamespaced sync.RWMutex + lockStorageClassInterfaceMockList sync.RWMutex + lockStorageClassInterfaceMockObjectClient sync.RWMutex + lockStorageClassInterfaceMockUpdate sync.RWMutex + lockStorageClassInterfaceMockWatch sync.RWMutex +) + +// Ensure, that StorageClassInterfaceMock does implement StorageClassInterface. +// If this is not the case, regenerate this file with moq. +var _ v1a.StorageClassInterface = &StorageClassInterfaceMock{} + +// StorageClassInterfaceMock is a mock implementation of StorageClassInterface. +// +// func TestSomethingThatUsesStorageClassInterface(t *testing.T) { +// +// // make and configure a mocked StorageClassInterface +// mockedStorageClassInterface := &StorageClassInterfaceMock{ +// AddClusterScopedFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, clusterName string, sync v1a.StorageClassHandlerFunc) { +// panic("mock out the AddClusterScopedFeatureHandler method") +// }, +// AddClusterScopedFeatureLifecycleFunc: func(ctx context.Context, enabled func() bool, name string, clusterName string, lifecycle v1a.StorageClassLifecycle) { +// panic("mock out the AddClusterScopedFeatureLifecycle method") +// }, +// AddClusterScopedHandlerFunc: func(ctx context.Context, name string, clusterName string, sync v1a.StorageClassHandlerFunc) { +// panic("mock out the AddClusterScopedHandler method") +// }, +// AddClusterScopedLifecycleFunc: func(ctx context.Context, name string, clusterName string, lifecycle v1a.StorageClassLifecycle) { +// panic("mock out the AddClusterScopedLifecycle method") +// }, +// AddFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, sync v1a.StorageClassHandlerFunc) { +// panic("mock out the AddFeatureHandler method") +// }, +// AddFeatureLifecycleFunc: func(ctx context.Context, enabled func() bool, name string, lifecycle v1a.StorageClassLifecycle) { +// panic("mock out the AddFeatureLifecycle method") +// }, +// AddHandlerFunc: func(ctx context.Context, name string, sync v1a.StorageClassHandlerFunc) { +// panic("mock out the AddHandler method") +// }, +// AddLifecycleFunc: func(ctx context.Context, name string, lifecycle v1a.StorageClassLifecycle) { +// panic("mock out the AddLifecycle method") +// }, +// ControllerFunc: func() v1a.StorageClassController { +// panic("mock out the Controller method") +// }, +// CreateFunc: func(in1 *v1.StorageClass) (*v1.StorageClass, error) { +// panic("mock out the Create method") +// }, +// DeleteFunc: func(name string, options *v1b.DeleteOptions) error { +// panic("mock out the Delete method") +// }, +// DeleteCollectionFunc: func(deleteOpts *v1b.DeleteOptions, listOpts v1b.ListOptions) error { +// panic("mock out the DeleteCollection method") +// }, +// DeleteNamespacedFunc: func(namespace string, name string, options *v1b.DeleteOptions) error { +// panic("mock out the DeleteNamespaced method") +// }, +// GetFunc: func(name string, opts v1b.GetOptions) (*v1.StorageClass, error) { +// panic("mock out the Get method") +// }, +// GetNamespacedFunc: func(namespace string, name string, opts v1b.GetOptions) (*v1.StorageClass, error) { +// panic("mock out the GetNamespaced method") +// }, +// ListFunc: func(opts v1b.ListOptions) (*v1a.StorageClassList, error) { +// panic("mock out the List method") +// }, +// ObjectClientFunc: func() *objectclient.ObjectClient { +// panic("mock out the ObjectClient method") +// }, +// UpdateFunc: func(in1 *v1.StorageClass) (*v1.StorageClass, error) { +// panic("mock out the Update method") +// }, +// WatchFunc: func(opts v1b.ListOptions) (watch.Interface, error) { +// panic("mock out the Watch method") +// }, +// } +// +// // use mockedStorageClassInterface in code that requires StorageClassInterface +// // and then make assertions. +// +// } +type StorageClassInterfaceMock struct { + // AddClusterScopedFeatureHandlerFunc mocks the AddClusterScopedFeatureHandler method. + AddClusterScopedFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, clusterName string, sync v1a.StorageClassHandlerFunc) + + // AddClusterScopedFeatureLifecycleFunc mocks the AddClusterScopedFeatureLifecycle method. + AddClusterScopedFeatureLifecycleFunc func(ctx context.Context, enabled func() bool, name string, clusterName string, lifecycle v1a.StorageClassLifecycle) + + // AddClusterScopedHandlerFunc mocks the AddClusterScopedHandler method. + AddClusterScopedHandlerFunc func(ctx context.Context, name string, clusterName string, sync v1a.StorageClassHandlerFunc) + + // AddClusterScopedLifecycleFunc mocks the AddClusterScopedLifecycle method. + AddClusterScopedLifecycleFunc func(ctx context.Context, name string, clusterName string, lifecycle v1a.StorageClassLifecycle) + + // AddFeatureHandlerFunc mocks the AddFeatureHandler method. + AddFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, sync v1a.StorageClassHandlerFunc) + + // AddFeatureLifecycleFunc mocks the AddFeatureLifecycle method. + AddFeatureLifecycleFunc func(ctx context.Context, enabled func() bool, name string, lifecycle v1a.StorageClassLifecycle) + + // AddHandlerFunc mocks the AddHandler method. + AddHandlerFunc func(ctx context.Context, name string, sync v1a.StorageClassHandlerFunc) + + // AddLifecycleFunc mocks the AddLifecycle method. + AddLifecycleFunc func(ctx context.Context, name string, lifecycle v1a.StorageClassLifecycle) + + // ControllerFunc mocks the Controller method. + ControllerFunc func() v1a.StorageClassController + + // CreateFunc mocks the Create method. + CreateFunc func(in1 *v1.StorageClass) (*v1.StorageClass, error) + + // DeleteFunc mocks the Delete method. + DeleteFunc func(name string, options *v1b.DeleteOptions) error + + // DeleteCollectionFunc mocks the DeleteCollection method. + DeleteCollectionFunc func(deleteOpts *v1b.DeleteOptions, listOpts v1b.ListOptions) error + + // DeleteNamespacedFunc mocks the DeleteNamespaced method. + DeleteNamespacedFunc func(namespace string, name string, options *v1b.DeleteOptions) error + + // GetFunc mocks the Get method. + GetFunc func(name string, opts v1b.GetOptions) (*v1.StorageClass, error) + + // GetNamespacedFunc mocks the GetNamespaced method. + GetNamespacedFunc func(namespace string, name string, opts v1b.GetOptions) (*v1.StorageClass, error) + + // ListFunc mocks the List method. + ListFunc func(opts v1b.ListOptions) (*v1a.StorageClassList, error) + + // ObjectClientFunc mocks the ObjectClient method. + ObjectClientFunc func() *objectclient.ObjectClient + + // UpdateFunc mocks the Update method. + UpdateFunc func(in1 *v1.StorageClass) (*v1.StorageClass, error) + + // WatchFunc mocks the Watch method. + WatchFunc func(opts v1b.ListOptions) (watch.Interface, error) + + // calls tracks calls to the methods. + calls struct { + // AddClusterScopedFeatureHandler holds details about calls to the AddClusterScopedFeatureHandler method. + AddClusterScopedFeatureHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Enabled is the enabled argument value. + Enabled func() bool + // Name is the name argument value. + Name string + // ClusterName is the clusterName argument value. + ClusterName string + // Sync is the sync argument value. + Sync v1a.StorageClassHandlerFunc + } + // AddClusterScopedFeatureLifecycle holds details about calls to the AddClusterScopedFeatureLifecycle method. + AddClusterScopedFeatureLifecycle []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Enabled is the enabled argument value. + Enabled func() bool + // Name is the name argument value. + Name string + // ClusterName is the clusterName argument value. + ClusterName string + // Lifecycle is the lifecycle argument value. + Lifecycle v1a.StorageClassLifecycle + } + // AddClusterScopedHandler holds details about calls to the AddClusterScopedHandler method. + AddClusterScopedHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Name is the name argument value. + Name string + // ClusterName is the clusterName argument value. + ClusterName string + // Sync is the sync argument value. + Sync v1a.StorageClassHandlerFunc + } + // AddClusterScopedLifecycle holds details about calls to the AddClusterScopedLifecycle method. + AddClusterScopedLifecycle []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Name is the name argument value. + Name string + // ClusterName is the clusterName argument value. + ClusterName string + // Lifecycle is the lifecycle argument value. + Lifecycle v1a.StorageClassLifecycle + } + // AddFeatureHandler holds details about calls to the AddFeatureHandler method. + AddFeatureHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Enabled is the enabled argument value. + Enabled func() bool + // Name is the name argument value. + Name string + // Sync is the sync argument value. + Sync v1a.StorageClassHandlerFunc + } + // AddFeatureLifecycle holds details about calls to the AddFeatureLifecycle method. + AddFeatureLifecycle []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Enabled is the enabled argument value. + Enabled func() bool + // Name is the name argument value. + Name string + // Lifecycle is the lifecycle argument value. + Lifecycle v1a.StorageClassLifecycle + } + // AddHandler holds details about calls to the AddHandler method. + AddHandler []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Name is the name argument value. + Name string + // Sync is the sync argument value. + Sync v1a.StorageClassHandlerFunc + } + // AddLifecycle holds details about calls to the AddLifecycle method. + AddLifecycle []struct { + // Ctx is the ctx argument value. + Ctx context.Context + // Name is the name argument value. + Name string + // Lifecycle is the lifecycle argument value. + Lifecycle v1a.StorageClassLifecycle + } + // Controller holds details about calls to the Controller method. + Controller []struct { + } + // Create holds details about calls to the Create method. + Create []struct { + // In1 is the in1 argument value. + In1 *v1.StorageClass + } + // Delete holds details about calls to the Delete method. + Delete []struct { + // Name is the name argument value. + Name string + // Options is the options argument value. + Options *v1b.DeleteOptions + } + // DeleteCollection holds details about calls to the DeleteCollection method. + DeleteCollection []struct { + // DeleteOpts is the deleteOpts argument value. + DeleteOpts *v1b.DeleteOptions + // ListOpts is the listOpts argument value. + ListOpts v1b.ListOptions + } + // DeleteNamespaced holds details about calls to the DeleteNamespaced method. + DeleteNamespaced []struct { + // Namespace is the namespace argument value. + Namespace string + // Name is the name argument value. + Name string + // Options is the options argument value. + Options *v1b.DeleteOptions + } + // Get holds details about calls to the Get method. + Get []struct { + // Name is the name argument value. + Name string + // Opts is the opts argument value. + Opts v1b.GetOptions + } + // GetNamespaced holds details about calls to the GetNamespaced method. + GetNamespaced []struct { + // Namespace is the namespace argument value. + Namespace string + // Name is the name argument value. + Name string + // Opts is the opts argument value. + Opts v1b.GetOptions + } + // List holds details about calls to the List method. + List []struct { + // Opts is the opts argument value. + Opts v1b.ListOptions + } + // ObjectClient holds details about calls to the ObjectClient method. + ObjectClient []struct { + } + // Update holds details about calls to the Update method. + Update []struct { + // In1 is the in1 argument value. + In1 *v1.StorageClass + } + // Watch holds details about calls to the Watch method. + Watch []struct { + // Opts is the opts argument value. + Opts v1b.ListOptions + } + } +} + +// AddClusterScopedFeatureHandler calls AddClusterScopedFeatureHandlerFunc. +func (mock *StorageClassInterfaceMock) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name string, clusterName string, sync v1a.StorageClassHandlerFunc) { + if mock.AddClusterScopedFeatureHandlerFunc == nil { + panic("StorageClassInterfaceMock.AddClusterScopedFeatureHandlerFunc: method is nil but StorageClassInterface.AddClusterScopedFeatureHandler was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Sync v1a.StorageClassHandlerFunc + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + ClusterName: clusterName, + Sync: sync, + } + lockStorageClassInterfaceMockAddClusterScopedFeatureHandler.Lock() + mock.calls.AddClusterScopedFeatureHandler = append(mock.calls.AddClusterScopedFeatureHandler, callInfo) + lockStorageClassInterfaceMockAddClusterScopedFeatureHandler.Unlock() + mock.AddClusterScopedFeatureHandlerFunc(ctx, enabled, name, clusterName, sync) +} + +// AddClusterScopedFeatureHandlerCalls gets all the calls that were made to AddClusterScopedFeatureHandler. +// Check the length with: +// len(mockedStorageClassInterface.AddClusterScopedFeatureHandlerCalls()) +func (mock *StorageClassInterfaceMock) AddClusterScopedFeatureHandlerCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Sync v1a.StorageClassHandlerFunc +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Sync v1a.StorageClassHandlerFunc + } + lockStorageClassInterfaceMockAddClusterScopedFeatureHandler.RLock() + calls = mock.calls.AddClusterScopedFeatureHandler + lockStorageClassInterfaceMockAddClusterScopedFeatureHandler.RUnlock() + return calls +} + +// AddClusterScopedFeatureLifecycle calls AddClusterScopedFeatureLifecycleFunc. +func (mock *StorageClassInterfaceMock) AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name string, clusterName string, lifecycle v1a.StorageClassLifecycle) { + if mock.AddClusterScopedFeatureLifecycleFunc == nil { + panic("StorageClassInterfaceMock.AddClusterScopedFeatureLifecycleFunc: method is nil but StorageClassInterface.AddClusterScopedFeatureLifecycle was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Lifecycle v1a.StorageClassLifecycle + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + ClusterName: clusterName, + Lifecycle: lifecycle, + } + lockStorageClassInterfaceMockAddClusterScopedFeatureLifecycle.Lock() + mock.calls.AddClusterScopedFeatureLifecycle = append(mock.calls.AddClusterScopedFeatureLifecycle, callInfo) + lockStorageClassInterfaceMockAddClusterScopedFeatureLifecycle.Unlock() + mock.AddClusterScopedFeatureLifecycleFunc(ctx, enabled, name, clusterName, lifecycle) +} + +// AddClusterScopedFeatureLifecycleCalls gets all the calls that were made to AddClusterScopedFeatureLifecycle. +// Check the length with: +// len(mockedStorageClassInterface.AddClusterScopedFeatureLifecycleCalls()) +func (mock *StorageClassInterfaceMock) AddClusterScopedFeatureLifecycleCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Lifecycle v1a.StorageClassLifecycle +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Lifecycle v1a.StorageClassLifecycle + } + lockStorageClassInterfaceMockAddClusterScopedFeatureLifecycle.RLock() + calls = mock.calls.AddClusterScopedFeatureLifecycle + lockStorageClassInterfaceMockAddClusterScopedFeatureLifecycle.RUnlock() + return calls +} + +// AddClusterScopedHandler calls AddClusterScopedHandlerFunc. +func (mock *StorageClassInterfaceMock) AddClusterScopedHandler(ctx context.Context, name string, clusterName string, sync v1a.StorageClassHandlerFunc) { + if mock.AddClusterScopedHandlerFunc == nil { + panic("StorageClassInterfaceMock.AddClusterScopedHandlerFunc: method is nil but StorageClassInterface.AddClusterScopedHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + ClusterName string + Sync v1a.StorageClassHandlerFunc + }{ + Ctx: ctx, + Name: name, + ClusterName: clusterName, + Sync: sync, + } + lockStorageClassInterfaceMockAddClusterScopedHandler.Lock() + mock.calls.AddClusterScopedHandler = append(mock.calls.AddClusterScopedHandler, callInfo) + lockStorageClassInterfaceMockAddClusterScopedHandler.Unlock() + mock.AddClusterScopedHandlerFunc(ctx, name, clusterName, sync) +} + +// AddClusterScopedHandlerCalls gets all the calls that were made to AddClusterScopedHandler. +// Check the length with: +// len(mockedStorageClassInterface.AddClusterScopedHandlerCalls()) +func (mock *StorageClassInterfaceMock) AddClusterScopedHandlerCalls() []struct { + Ctx context.Context + Name string + ClusterName string + Sync v1a.StorageClassHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + ClusterName string + Sync v1a.StorageClassHandlerFunc + } + lockStorageClassInterfaceMockAddClusterScopedHandler.RLock() + calls = mock.calls.AddClusterScopedHandler + lockStorageClassInterfaceMockAddClusterScopedHandler.RUnlock() + return calls +} + +// AddClusterScopedLifecycle calls AddClusterScopedLifecycleFunc. +func (mock *StorageClassInterfaceMock) AddClusterScopedLifecycle(ctx context.Context, name string, clusterName string, lifecycle v1a.StorageClassLifecycle) { + if mock.AddClusterScopedLifecycleFunc == nil { + panic("StorageClassInterfaceMock.AddClusterScopedLifecycleFunc: method is nil but StorageClassInterface.AddClusterScopedLifecycle was just called") + } + callInfo := struct { + Ctx context.Context + Name string + ClusterName string + Lifecycle v1a.StorageClassLifecycle + }{ + Ctx: ctx, + Name: name, + ClusterName: clusterName, + Lifecycle: lifecycle, + } + lockStorageClassInterfaceMockAddClusterScopedLifecycle.Lock() + mock.calls.AddClusterScopedLifecycle = append(mock.calls.AddClusterScopedLifecycle, callInfo) + lockStorageClassInterfaceMockAddClusterScopedLifecycle.Unlock() + mock.AddClusterScopedLifecycleFunc(ctx, name, clusterName, lifecycle) +} + +// AddClusterScopedLifecycleCalls gets all the calls that were made to AddClusterScopedLifecycle. +// Check the length with: +// len(mockedStorageClassInterface.AddClusterScopedLifecycleCalls()) +func (mock *StorageClassInterfaceMock) AddClusterScopedLifecycleCalls() []struct { + Ctx context.Context + Name string + ClusterName string + Lifecycle v1a.StorageClassLifecycle +} { + var calls []struct { + Ctx context.Context + Name string + ClusterName string + Lifecycle v1a.StorageClassLifecycle + } + lockStorageClassInterfaceMockAddClusterScopedLifecycle.RLock() + calls = mock.calls.AddClusterScopedLifecycle + lockStorageClassInterfaceMockAddClusterScopedLifecycle.RUnlock() + return calls +} + +// AddFeatureHandler calls AddFeatureHandlerFunc. +func (mock *StorageClassInterfaceMock) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync v1a.StorageClassHandlerFunc) { + if mock.AddFeatureHandlerFunc == nil { + panic("StorageClassInterfaceMock.AddFeatureHandlerFunc: method is nil but StorageClassInterface.AddFeatureHandler was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v1a.StorageClassHandlerFunc + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + Sync: sync, + } + lockStorageClassInterfaceMockAddFeatureHandler.Lock() + mock.calls.AddFeatureHandler = append(mock.calls.AddFeatureHandler, callInfo) + lockStorageClassInterfaceMockAddFeatureHandler.Unlock() + mock.AddFeatureHandlerFunc(ctx, enabled, name, sync) +} + +// AddFeatureHandlerCalls gets all the calls that were made to AddFeatureHandler. +// Check the length with: +// len(mockedStorageClassInterface.AddFeatureHandlerCalls()) +func (mock *StorageClassInterfaceMock) AddFeatureHandlerCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v1a.StorageClassHandlerFunc +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v1a.StorageClassHandlerFunc + } + lockStorageClassInterfaceMockAddFeatureHandler.RLock() + calls = mock.calls.AddFeatureHandler + lockStorageClassInterfaceMockAddFeatureHandler.RUnlock() + return calls +} + +// AddFeatureLifecycle calls AddFeatureLifecycleFunc. +func (mock *StorageClassInterfaceMock) AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle v1a.StorageClassLifecycle) { + if mock.AddFeatureLifecycleFunc == nil { + panic("StorageClassInterfaceMock.AddFeatureLifecycleFunc: method is nil but StorageClassInterface.AddFeatureLifecycle was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + Lifecycle v1a.StorageClassLifecycle + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + Lifecycle: lifecycle, + } + lockStorageClassInterfaceMockAddFeatureLifecycle.Lock() + mock.calls.AddFeatureLifecycle = append(mock.calls.AddFeatureLifecycle, callInfo) + lockStorageClassInterfaceMockAddFeatureLifecycle.Unlock() + mock.AddFeatureLifecycleFunc(ctx, enabled, name, lifecycle) +} + +// AddFeatureLifecycleCalls gets all the calls that were made to AddFeatureLifecycle. +// Check the length with: +// len(mockedStorageClassInterface.AddFeatureLifecycleCalls()) +func (mock *StorageClassInterfaceMock) AddFeatureLifecycleCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + Lifecycle v1a.StorageClassLifecycle +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + Lifecycle v1a.StorageClassLifecycle + } + lockStorageClassInterfaceMockAddFeatureLifecycle.RLock() + calls = mock.calls.AddFeatureLifecycle + lockStorageClassInterfaceMockAddFeatureLifecycle.RUnlock() + return calls +} + +// AddHandler calls AddHandlerFunc. +func (mock *StorageClassInterfaceMock) AddHandler(ctx context.Context, name string, sync v1a.StorageClassHandlerFunc) { + if mock.AddHandlerFunc == nil { + panic("StorageClassInterfaceMock.AddHandlerFunc: method is nil but StorageClassInterface.AddHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + Sync v1a.StorageClassHandlerFunc + }{ + Ctx: ctx, + Name: name, + Sync: sync, + } + lockStorageClassInterfaceMockAddHandler.Lock() + mock.calls.AddHandler = append(mock.calls.AddHandler, callInfo) + lockStorageClassInterfaceMockAddHandler.Unlock() + mock.AddHandlerFunc(ctx, name, sync) +} + +// AddHandlerCalls gets all the calls that were made to AddHandler. +// Check the length with: +// len(mockedStorageClassInterface.AddHandlerCalls()) +func (mock *StorageClassInterfaceMock) AddHandlerCalls() []struct { + Ctx context.Context + Name string + Sync v1a.StorageClassHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + Sync v1a.StorageClassHandlerFunc + } + lockStorageClassInterfaceMockAddHandler.RLock() + calls = mock.calls.AddHandler + lockStorageClassInterfaceMockAddHandler.RUnlock() + return calls +} + +// AddLifecycle calls AddLifecycleFunc. +func (mock *StorageClassInterfaceMock) AddLifecycle(ctx context.Context, name string, lifecycle v1a.StorageClassLifecycle) { + if mock.AddLifecycleFunc == nil { + panic("StorageClassInterfaceMock.AddLifecycleFunc: method is nil but StorageClassInterface.AddLifecycle was just called") + } + callInfo := struct { + Ctx context.Context + Name string + Lifecycle v1a.StorageClassLifecycle + }{ + Ctx: ctx, + Name: name, + Lifecycle: lifecycle, + } + lockStorageClassInterfaceMockAddLifecycle.Lock() + mock.calls.AddLifecycle = append(mock.calls.AddLifecycle, callInfo) + lockStorageClassInterfaceMockAddLifecycle.Unlock() + mock.AddLifecycleFunc(ctx, name, lifecycle) +} + +// AddLifecycleCalls gets all the calls that were made to AddLifecycle. +// Check the length with: +// len(mockedStorageClassInterface.AddLifecycleCalls()) +func (mock *StorageClassInterfaceMock) AddLifecycleCalls() []struct { + Ctx context.Context + Name string + Lifecycle v1a.StorageClassLifecycle +} { + var calls []struct { + Ctx context.Context + Name string + Lifecycle v1a.StorageClassLifecycle + } + lockStorageClassInterfaceMockAddLifecycle.RLock() + calls = mock.calls.AddLifecycle + lockStorageClassInterfaceMockAddLifecycle.RUnlock() + return calls +} + +// Controller calls ControllerFunc. +func (mock *StorageClassInterfaceMock) Controller() v1a.StorageClassController { + if mock.ControllerFunc == nil { + panic("StorageClassInterfaceMock.ControllerFunc: method is nil but StorageClassInterface.Controller was just called") + } + callInfo := struct { + }{} + lockStorageClassInterfaceMockController.Lock() + mock.calls.Controller = append(mock.calls.Controller, callInfo) + lockStorageClassInterfaceMockController.Unlock() + return mock.ControllerFunc() +} + +// ControllerCalls gets all the calls that were made to Controller. +// Check the length with: +// len(mockedStorageClassInterface.ControllerCalls()) +func (mock *StorageClassInterfaceMock) ControllerCalls() []struct { +} { + var calls []struct { + } + lockStorageClassInterfaceMockController.RLock() + calls = mock.calls.Controller + lockStorageClassInterfaceMockController.RUnlock() + return calls +} + +// Create calls CreateFunc. +func (mock *StorageClassInterfaceMock) Create(in1 *v1.StorageClass) (*v1.StorageClass, error) { + if mock.CreateFunc == nil { + panic("StorageClassInterfaceMock.CreateFunc: method is nil but StorageClassInterface.Create was just called") + } + callInfo := struct { + In1 *v1.StorageClass + }{ + In1: in1, + } + lockStorageClassInterfaceMockCreate.Lock() + mock.calls.Create = append(mock.calls.Create, callInfo) + lockStorageClassInterfaceMockCreate.Unlock() + return mock.CreateFunc(in1) +} + +// CreateCalls gets all the calls that were made to Create. +// Check the length with: +// len(mockedStorageClassInterface.CreateCalls()) +func (mock *StorageClassInterfaceMock) CreateCalls() []struct { + In1 *v1.StorageClass +} { + var calls []struct { + In1 *v1.StorageClass + } + lockStorageClassInterfaceMockCreate.RLock() + calls = mock.calls.Create + lockStorageClassInterfaceMockCreate.RUnlock() + return calls +} + +// Delete calls DeleteFunc. +func (mock *StorageClassInterfaceMock) Delete(name string, options *v1b.DeleteOptions) error { + if mock.DeleteFunc == nil { + panic("StorageClassInterfaceMock.DeleteFunc: method is nil but StorageClassInterface.Delete was just called") + } + callInfo := struct { + Name string + Options *v1b.DeleteOptions + }{ + Name: name, + Options: options, + } + lockStorageClassInterfaceMockDelete.Lock() + mock.calls.Delete = append(mock.calls.Delete, callInfo) + lockStorageClassInterfaceMockDelete.Unlock() + return mock.DeleteFunc(name, options) +} + +// DeleteCalls gets all the calls that were made to Delete. +// Check the length with: +// len(mockedStorageClassInterface.DeleteCalls()) +func (mock *StorageClassInterfaceMock) DeleteCalls() []struct { + Name string + Options *v1b.DeleteOptions +} { + var calls []struct { + Name string + Options *v1b.DeleteOptions + } + lockStorageClassInterfaceMockDelete.RLock() + calls = mock.calls.Delete + lockStorageClassInterfaceMockDelete.RUnlock() + return calls +} + +// DeleteCollection calls DeleteCollectionFunc. +func (mock *StorageClassInterfaceMock) DeleteCollection(deleteOpts *v1b.DeleteOptions, listOpts v1b.ListOptions) error { + if mock.DeleteCollectionFunc == nil { + panic("StorageClassInterfaceMock.DeleteCollectionFunc: method is nil but StorageClassInterface.DeleteCollection was just called") + } + callInfo := struct { + DeleteOpts *v1b.DeleteOptions + ListOpts v1b.ListOptions + }{ + DeleteOpts: deleteOpts, + ListOpts: listOpts, + } + lockStorageClassInterfaceMockDeleteCollection.Lock() + mock.calls.DeleteCollection = append(mock.calls.DeleteCollection, callInfo) + lockStorageClassInterfaceMockDeleteCollection.Unlock() + return mock.DeleteCollectionFunc(deleteOpts, listOpts) +} + +// DeleteCollectionCalls gets all the calls that were made to DeleteCollection. +// Check the length with: +// len(mockedStorageClassInterface.DeleteCollectionCalls()) +func (mock *StorageClassInterfaceMock) DeleteCollectionCalls() []struct { + DeleteOpts *v1b.DeleteOptions + ListOpts v1b.ListOptions +} { + var calls []struct { + DeleteOpts *v1b.DeleteOptions + ListOpts v1b.ListOptions + } + lockStorageClassInterfaceMockDeleteCollection.RLock() + calls = mock.calls.DeleteCollection + lockStorageClassInterfaceMockDeleteCollection.RUnlock() + return calls +} + +// DeleteNamespaced calls DeleteNamespacedFunc. +func (mock *StorageClassInterfaceMock) DeleteNamespaced(namespace string, name string, options *v1b.DeleteOptions) error { + if mock.DeleteNamespacedFunc == nil { + panic("StorageClassInterfaceMock.DeleteNamespacedFunc: method is nil but StorageClassInterface.DeleteNamespaced was just called") + } + callInfo := struct { + Namespace string + Name string + Options *v1b.DeleteOptions + }{ + Namespace: namespace, + Name: name, + Options: options, + } + lockStorageClassInterfaceMockDeleteNamespaced.Lock() + mock.calls.DeleteNamespaced = append(mock.calls.DeleteNamespaced, callInfo) + lockStorageClassInterfaceMockDeleteNamespaced.Unlock() + return mock.DeleteNamespacedFunc(namespace, name, options) +} + +// DeleteNamespacedCalls gets all the calls that were made to DeleteNamespaced. +// Check the length with: +// len(mockedStorageClassInterface.DeleteNamespacedCalls()) +func (mock *StorageClassInterfaceMock) DeleteNamespacedCalls() []struct { + Namespace string + Name string + Options *v1b.DeleteOptions +} { + var calls []struct { + Namespace string + Name string + Options *v1b.DeleteOptions + } + lockStorageClassInterfaceMockDeleteNamespaced.RLock() + calls = mock.calls.DeleteNamespaced + lockStorageClassInterfaceMockDeleteNamespaced.RUnlock() + return calls +} + +// Get calls GetFunc. +func (mock *StorageClassInterfaceMock) Get(name string, opts v1b.GetOptions) (*v1.StorageClass, error) { + if mock.GetFunc == nil { + panic("StorageClassInterfaceMock.GetFunc: method is nil but StorageClassInterface.Get was just called") + } + callInfo := struct { + Name string + Opts v1b.GetOptions + }{ + Name: name, + Opts: opts, + } + lockStorageClassInterfaceMockGet.Lock() + mock.calls.Get = append(mock.calls.Get, callInfo) + lockStorageClassInterfaceMockGet.Unlock() + return mock.GetFunc(name, opts) +} + +// GetCalls gets all the calls that were made to Get. +// Check the length with: +// len(mockedStorageClassInterface.GetCalls()) +func (mock *StorageClassInterfaceMock) GetCalls() []struct { + Name string + Opts v1b.GetOptions +} { + var calls []struct { + Name string + Opts v1b.GetOptions + } + lockStorageClassInterfaceMockGet.RLock() + calls = mock.calls.Get + lockStorageClassInterfaceMockGet.RUnlock() + return calls +} + +// GetNamespaced calls GetNamespacedFunc. +func (mock *StorageClassInterfaceMock) GetNamespaced(namespace string, name string, opts v1b.GetOptions) (*v1.StorageClass, error) { + if mock.GetNamespacedFunc == nil { + panic("StorageClassInterfaceMock.GetNamespacedFunc: method is nil but StorageClassInterface.GetNamespaced was just called") + } + callInfo := struct { + Namespace string + Name string + Opts v1b.GetOptions + }{ + Namespace: namespace, + Name: name, + Opts: opts, + } + lockStorageClassInterfaceMockGetNamespaced.Lock() + mock.calls.GetNamespaced = append(mock.calls.GetNamespaced, callInfo) + lockStorageClassInterfaceMockGetNamespaced.Unlock() + return mock.GetNamespacedFunc(namespace, name, opts) +} + +// GetNamespacedCalls gets all the calls that were made to GetNamespaced. +// Check the length with: +// len(mockedStorageClassInterface.GetNamespacedCalls()) +func (mock *StorageClassInterfaceMock) GetNamespacedCalls() []struct { + Namespace string + Name string + Opts v1b.GetOptions +} { + var calls []struct { + Namespace string + Name string + Opts v1b.GetOptions + } + lockStorageClassInterfaceMockGetNamespaced.RLock() + calls = mock.calls.GetNamespaced + lockStorageClassInterfaceMockGetNamespaced.RUnlock() + return calls +} + +// List calls ListFunc. +func (mock *StorageClassInterfaceMock) List(opts v1b.ListOptions) (*v1a.StorageClassList, error) { + if mock.ListFunc == nil { + panic("StorageClassInterfaceMock.ListFunc: method is nil but StorageClassInterface.List was just called") + } + callInfo := struct { + Opts v1b.ListOptions + }{ + Opts: opts, + } + lockStorageClassInterfaceMockList.Lock() + mock.calls.List = append(mock.calls.List, callInfo) + lockStorageClassInterfaceMockList.Unlock() + return mock.ListFunc(opts) +} + +// ListCalls gets all the calls that were made to List. +// Check the length with: +// len(mockedStorageClassInterface.ListCalls()) +func (mock *StorageClassInterfaceMock) ListCalls() []struct { + Opts v1b.ListOptions +} { + var calls []struct { + Opts v1b.ListOptions + } + lockStorageClassInterfaceMockList.RLock() + calls = mock.calls.List + lockStorageClassInterfaceMockList.RUnlock() + return calls +} + +// ObjectClient calls ObjectClientFunc. +func (mock *StorageClassInterfaceMock) ObjectClient() *objectclient.ObjectClient { + if mock.ObjectClientFunc == nil { + panic("StorageClassInterfaceMock.ObjectClientFunc: method is nil but StorageClassInterface.ObjectClient was just called") + } + callInfo := struct { + }{} + lockStorageClassInterfaceMockObjectClient.Lock() + mock.calls.ObjectClient = append(mock.calls.ObjectClient, callInfo) + lockStorageClassInterfaceMockObjectClient.Unlock() + return mock.ObjectClientFunc() +} + +// ObjectClientCalls gets all the calls that were made to ObjectClient. +// Check the length with: +// len(mockedStorageClassInterface.ObjectClientCalls()) +func (mock *StorageClassInterfaceMock) ObjectClientCalls() []struct { +} { + var calls []struct { + } + lockStorageClassInterfaceMockObjectClient.RLock() + calls = mock.calls.ObjectClient + lockStorageClassInterfaceMockObjectClient.RUnlock() + return calls +} + +// Update calls UpdateFunc. +func (mock *StorageClassInterfaceMock) Update(in1 *v1.StorageClass) (*v1.StorageClass, error) { + if mock.UpdateFunc == nil { + panic("StorageClassInterfaceMock.UpdateFunc: method is nil but StorageClassInterface.Update was just called") + } + callInfo := struct { + In1 *v1.StorageClass + }{ + In1: in1, + } + lockStorageClassInterfaceMockUpdate.Lock() + mock.calls.Update = append(mock.calls.Update, callInfo) + lockStorageClassInterfaceMockUpdate.Unlock() + return mock.UpdateFunc(in1) +} + +// UpdateCalls gets all the calls that were made to Update. +// Check the length with: +// len(mockedStorageClassInterface.UpdateCalls()) +func (mock *StorageClassInterfaceMock) UpdateCalls() []struct { + In1 *v1.StorageClass +} { + var calls []struct { + In1 *v1.StorageClass + } + lockStorageClassInterfaceMockUpdate.RLock() + calls = mock.calls.Update + lockStorageClassInterfaceMockUpdate.RUnlock() + return calls +} + +// Watch calls WatchFunc. +func (mock *StorageClassInterfaceMock) Watch(opts v1b.ListOptions) (watch.Interface, error) { + if mock.WatchFunc == nil { + panic("StorageClassInterfaceMock.WatchFunc: method is nil but StorageClassInterface.Watch was just called") + } + callInfo := struct { + Opts v1b.ListOptions + }{ + Opts: opts, + } + lockStorageClassInterfaceMockWatch.Lock() + mock.calls.Watch = append(mock.calls.Watch, callInfo) + lockStorageClassInterfaceMockWatch.Unlock() + return mock.WatchFunc(opts) +} + +// WatchCalls gets all the calls that were made to Watch. +// Check the length with: +// len(mockedStorageClassInterface.WatchCalls()) +func (mock *StorageClassInterfaceMock) WatchCalls() []struct { + Opts v1b.ListOptions +} { + var calls []struct { + Opts v1b.ListOptions + } + lockStorageClassInterfaceMockWatch.RLock() + calls = mock.calls.Watch + lockStorageClassInterfaceMockWatch.RUnlock() + return calls +} + +var ( + lockStorageClassesGetterMockStorageClasses sync.RWMutex +) + +// Ensure, that StorageClassesGetterMock does implement StorageClassesGetter. +// If this is not the case, regenerate this file with moq. +var _ v1a.StorageClassesGetter = &StorageClassesGetterMock{} + +// StorageClassesGetterMock is a mock implementation of StorageClassesGetter. +// +// func TestSomethingThatUsesStorageClassesGetter(t *testing.T) { +// +// // make and configure a mocked StorageClassesGetter +// mockedStorageClassesGetter := &StorageClassesGetterMock{ +// StorageClassesFunc: func(namespace string) v1a.StorageClassInterface { +// panic("mock out the StorageClasses method") +// }, +// } +// +// // use mockedStorageClassesGetter in code that requires StorageClassesGetter +// // and then make assertions. +// +// } +type StorageClassesGetterMock struct { + // StorageClassesFunc mocks the StorageClasses method. + StorageClassesFunc func(namespace string) v1a.StorageClassInterface + + // calls tracks calls to the methods. + calls struct { + // StorageClasses holds details about calls to the StorageClasses method. + StorageClasses []struct { + // Namespace is the namespace argument value. + Namespace string + } + } +} + +// StorageClasses calls StorageClassesFunc. +func (mock *StorageClassesGetterMock) StorageClasses(namespace string) v1a.StorageClassInterface { + if mock.StorageClassesFunc == nil { + panic("StorageClassesGetterMock.StorageClassesFunc: method is nil but StorageClassesGetter.StorageClasses was just called") + } + callInfo := struct { + Namespace string + }{ + Namespace: namespace, + } + lockStorageClassesGetterMockStorageClasses.Lock() + mock.calls.StorageClasses = append(mock.calls.StorageClasses, callInfo) + lockStorageClassesGetterMockStorageClasses.Unlock() + return mock.StorageClassesFunc(namespace) +} + +// StorageClassesCalls gets all the calls that were made to StorageClasses. +// Check the length with: +// len(mockedStorageClassesGetter.StorageClassesCalls()) +func (mock *StorageClassesGetterMock) StorageClassesCalls() []struct { + Namespace string +} { + var calls []struct { + Namespace string + } + lockStorageClassesGetterMockStorageClasses.RLock() + calls = mock.calls.StorageClasses + lockStorageClassesGetterMockStorageClasses.RUnlock() + return calls +} diff --git a/apis/storage.k8s.io/v1/zz_generated_deepcopy.go b/apis/storage.k8s.io/v1/zz_generated_deepcopy.go new file mode 100644 index 00000000..9ced69ee --- /dev/null +++ b/apis/storage.k8s.io/v1/zz_generated_deepcopy.go @@ -0,0 +1,39 @@ +package v1 + +import ( + storagev1 "k8s.io/api/storage/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageClassList) DeepCopyInto(out *StorageClassList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]storagev1.StorageClass, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageClassList. +func (in *StorageClassList) DeepCopy() *StorageClassList { + if in == nil { + return nil + } + out := new(StorageClassList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *StorageClassList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} diff --git a/apis/storage.k8s.io/v1/zz_generated_k8s_client.go b/apis/storage.k8s.io/v1/zz_generated_k8s_client.go new file mode 100644 index 00000000..36746ff3 --- /dev/null +++ b/apis/storage.k8s.io/v1/zz_generated_k8s_client.go @@ -0,0 +1,119 @@ +package v1 + +import ( + "context" + "sync" + + "github.com/rancher/norman/controller" + "github.com/rancher/norman/objectclient" + "github.com/rancher/norman/objectclient/dynamic" + "github.com/rancher/norman/restwatch" + "k8s.io/client-go/rest" +) + +type ( + contextKeyType struct{} + contextClientsKeyType struct{} +) + +type Interface interface { + RESTClient() rest.Interface + controller.Starter + + StorageClassesGetter +} + +type Clients struct { + Interface Interface + + StorageClass StorageClassClient +} + +type Client struct { + sync.Mutex + restClient rest.Interface + starters []controller.Starter + + storageClassControllers map[string]StorageClassController +} + +func Factory(ctx context.Context, config rest.Config) (context.Context, controller.Starter, error) { + c, err := NewForConfig(config) + if err != nil { + return ctx, nil, err + } + + cs := NewClientsFromInterface(c) + + ctx = context.WithValue(ctx, contextKeyType{}, c) + ctx = context.WithValue(ctx, contextClientsKeyType{}, cs) + return ctx, c, nil +} + +func ClientsFrom(ctx context.Context) *Clients { + return ctx.Value(contextClientsKeyType{}).(*Clients) +} + +func From(ctx context.Context) Interface { + return ctx.Value(contextKeyType{}).(Interface) +} + +func NewClients(config rest.Config) (*Clients, error) { + iface, err := NewForConfig(config) + if err != nil { + return nil, err + } + return NewClientsFromInterface(iface), nil +} + +func NewClientsFromInterface(iface Interface) *Clients { + return &Clients{ + Interface: iface, + + StorageClass: &storageClassClient2{ + iface: iface.StorageClasses(""), + }, + } +} + +func NewForConfig(config rest.Config) (Interface, error) { + if config.NegotiatedSerializer == nil { + config.NegotiatedSerializer = dynamic.NegotiatedSerializer + } + + restClient, err := restwatch.UnversionedRESTClientFor(&config) + if err != nil { + return nil, err + } + + return &Client{ + restClient: restClient, + + storageClassControllers: map[string]StorageClassController{}, + }, nil +} + +func (c *Client) RESTClient() rest.Interface { + return c.restClient +} + +func (c *Client) Sync(ctx context.Context) error { + return controller.Sync(ctx, c.starters...) +} + +func (c *Client) Start(ctx context.Context, threadiness int) error { + return controller.Start(ctx, threadiness, c.starters...) +} + +type StorageClassesGetter interface { + StorageClasses(namespace string) StorageClassInterface +} + +func (c *Client) StorageClasses(namespace string) StorageClassInterface { + objectClient := objectclient.NewObjectClient(namespace, c.restClient, &StorageClassResource, StorageClassGroupVersionKind, storageClassFactory{}) + return &storageClassClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} diff --git a/apis/storage.k8s.io/v1/zz_generated_scheme.go b/apis/storage.k8s.io/v1/zz_generated_scheme.go new file mode 100644 index 00000000..3ab02617 --- /dev/null +++ b/apis/storage.k8s.io/v1/zz_generated_scheme.go @@ -0,0 +1,41 @@ +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const ( + GroupName = "storage.k8s.io" + Version = "v1" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version} + +// Kind takes an unqualified kind and returns a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + // TODO this gets cleaned up when the types are fixed + scheme.AddKnownTypes(SchemeGroupVersion, + + &StorageClassList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/apis/storage.k8s.io/v1/zz_generated_storage_class_controller.go b/apis/storage.k8s.io/v1/zz_generated_storage_class_controller.go new file mode 100644 index 00000000..69032624 --- /dev/null +++ b/apis/storage.k8s.io/v1/zz_generated_storage_class_controller.go @@ -0,0 +1,505 @@ +package v1 + +import ( + "context" + + "github.com/rancher/norman/controller" + "github.com/rancher/norman/objectclient" + "github.com/rancher/norman/resource" + v1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + StorageClassGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "StorageClass", + } + StorageClassResource = metav1.APIResource{ + Name: "storageclasses", + SingularName: "storageclass", + Namespaced: false, + Kind: StorageClassGroupVersionKind.Kind, + } + + StorageClassGroupVersionResource = schema.GroupVersionResource{ + Group: GroupName, + Version: Version, + Resource: "storageclasses", + } +) + +func init() { + resource.Put(StorageClassGroupVersionResource) +} + +func NewStorageClass(namespace, name string, obj v1.StorageClass) *v1.StorageClass { + obj.APIVersion, obj.Kind = StorageClassGroupVersionKind.ToAPIVersionAndKind() + obj.Name = name + obj.Namespace = namespace + return &obj +} + +type StorageClassList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []v1.StorageClass `json:"items"` +} + +type StorageClassHandlerFunc func(key string, obj *v1.StorageClass) (runtime.Object, error) + +type StorageClassChangeHandlerFunc func(obj *v1.StorageClass) (runtime.Object, error) + +type StorageClassLister interface { + List(namespace string, selector labels.Selector) (ret []*v1.StorageClass, err error) + Get(namespace, name string) (*v1.StorageClass, error) +} + +type StorageClassController interface { + Generic() controller.GenericController + Informer() cache.SharedIndexInformer + Lister() StorageClassLister + AddHandler(ctx context.Context, name string, handler StorageClassHandlerFunc) + AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync StorageClassHandlerFunc) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler StorageClassHandlerFunc) + AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, handler StorageClassHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type StorageClassInterface interface { + ObjectClient() *objectclient.ObjectClient + Create(*v1.StorageClass) (*v1.StorageClass, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.StorageClass, error) + Get(name string, opts metav1.GetOptions) (*v1.StorageClass, error) + Update(*v1.StorageClass) (*v1.StorageClass, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*StorageClassList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() StorageClassController + AddHandler(ctx context.Context, name string, sync StorageClassHandlerFunc) + AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync StorageClassHandlerFunc) + AddLifecycle(ctx context.Context, name string, lifecycle StorageClassLifecycle) + AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle StorageClassLifecycle) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync StorageClassHandlerFunc) + AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, sync StorageClassHandlerFunc) + AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle StorageClassLifecycle) + AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name, clusterName string, lifecycle StorageClassLifecycle) +} + +type storageClassLister struct { + controller *storageClassController +} + +func (l *storageClassLister) List(namespace string, selector labels.Selector) (ret []*v1.StorageClass, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*v1.StorageClass)) + }) + return +} + +func (l *storageClassLister) Get(namespace, name string) (*v1.StorageClass, error) { + var key string + if namespace != "" { + key = namespace + "/" + name + } else { + key = name + } + obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(schema.GroupResource{ + Group: StorageClassGroupVersionKind.Group, + Resource: "storageClass", + }, key) + } + return obj.(*v1.StorageClass), nil +} + +type storageClassController struct { + controller.GenericController +} + +func (c *storageClassController) Generic() controller.GenericController { + return c.GenericController +} + +func (c *storageClassController) Lister() StorageClassLister { + return &storageClassLister{ + controller: c, + } +} + +func (c *storageClassController) AddHandler(ctx context.Context, name string, handler StorageClassHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1.StorageClass); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *storageClassController) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, handler StorageClassHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if !enabled() { + return nil, nil + } else if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1.StorageClass); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *storageClassController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler StorageClassHandlerFunc) { + resource.PutClusterScoped(StorageClassGroupVersionResource) + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1.StorageClass); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *storageClassController) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, cluster string, handler StorageClassHandlerFunc) { + resource.PutClusterScoped(StorageClassGroupVersionResource) + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if !enabled() { + return nil, nil + } else if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1.StorageClass); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +type storageClassFactory struct { +} + +func (c storageClassFactory) Object() runtime.Object { + return &v1.StorageClass{} +} + +func (c storageClassFactory) List() runtime.Object { + return &StorageClassList{} +} + +func (s *storageClassClient) Controller() StorageClassController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.storageClassControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(StorageClassGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &storageClassController{ + GenericController: genericController, + } + + s.client.storageClassControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type storageClassClient struct { + client *Client + ns string + objectClient *objectclient.ObjectClient + controller StorageClassController +} + +func (s *storageClassClient) ObjectClient() *objectclient.ObjectClient { + return s.objectClient +} + +func (s *storageClassClient) Create(o *v1.StorageClass) (*v1.StorageClass, error) { + obj, err := s.objectClient.Create(o) + return obj.(*v1.StorageClass), err +} + +func (s *storageClassClient) Get(name string, opts metav1.GetOptions) (*v1.StorageClass, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*v1.StorageClass), err +} + +func (s *storageClassClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.StorageClass, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*v1.StorageClass), err +} + +func (s *storageClassClient) Update(o *v1.StorageClass) (*v1.StorageClass, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*v1.StorageClass), err +} + +func (s *storageClassClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *storageClassClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *storageClassClient) List(opts metav1.ListOptions) (*StorageClassList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*StorageClassList), err +} + +func (s *storageClassClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *storageClassClient) Patch(o *v1.StorageClass, patchType types.PatchType, data []byte, subresources ...string) (*v1.StorageClass, error) { + obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...) + return obj.(*v1.StorageClass), err +} + +func (s *storageClassClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *storageClassClient) AddHandler(ctx context.Context, name string, sync StorageClassHandlerFunc) { + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *storageClassClient) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync StorageClassHandlerFunc) { + s.Controller().AddFeatureHandler(ctx, enabled, name, sync) +} + +func (s *storageClassClient) AddLifecycle(ctx context.Context, name string, lifecycle StorageClassLifecycle) { + sync := NewStorageClassLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *storageClassClient) AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle StorageClassLifecycle) { + sync := NewStorageClassLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddFeatureHandler(ctx, enabled, name, sync) +} + +func (s *storageClassClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync StorageClassHandlerFunc) { + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *storageClassClient) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, sync StorageClassHandlerFunc) { + s.Controller().AddClusterScopedFeatureHandler(ctx, enabled, name, clusterName, sync) +} + +func (s *storageClassClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle StorageClassLifecycle) { + sync := NewStorageClassLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *storageClassClient) AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name, clusterName string, lifecycle StorageClassLifecycle) { + sync := NewStorageClassLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedFeatureHandler(ctx, enabled, name, clusterName, sync) +} + +type StorageClassIndexer func(obj *v1.StorageClass) ([]string, error) + +type StorageClassClientCache interface { + Get(namespace, name string) (*v1.StorageClass, error) + List(namespace string, selector labels.Selector) ([]*v1.StorageClass, error) + + Index(name string, indexer StorageClassIndexer) + GetIndexed(name, key string) ([]*v1.StorageClass, error) +} + +type StorageClassClient interface { + Create(*v1.StorageClass) (*v1.StorageClass, error) + Get(namespace, name string, opts metav1.GetOptions) (*v1.StorageClass, error) + Update(*v1.StorageClass) (*v1.StorageClass, error) + Delete(namespace, name string, options *metav1.DeleteOptions) error + List(namespace string, opts metav1.ListOptions) (*StorageClassList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + + Cache() StorageClassClientCache + + OnCreate(ctx context.Context, name string, sync StorageClassChangeHandlerFunc) + OnChange(ctx context.Context, name string, sync StorageClassChangeHandlerFunc) + OnRemove(ctx context.Context, name string, sync StorageClassChangeHandlerFunc) + Enqueue(namespace, name string) + + Generic() controller.GenericController + ObjectClient() *objectclient.ObjectClient + Interface() StorageClassInterface +} + +type storageClassClientCache struct { + client *storageClassClient2 +} + +type storageClassClient2 struct { + iface StorageClassInterface + controller StorageClassController +} + +func (n *storageClassClient2) Interface() StorageClassInterface { + return n.iface +} + +func (n *storageClassClient2) Generic() controller.GenericController { + return n.iface.Controller().Generic() +} + +func (n *storageClassClient2) ObjectClient() *objectclient.ObjectClient { + return n.Interface().ObjectClient() +} + +func (n *storageClassClient2) Enqueue(namespace, name string) { + n.iface.Controller().Enqueue(namespace, name) +} + +func (n *storageClassClient2) Create(obj *v1.StorageClass) (*v1.StorageClass, error) { + return n.iface.Create(obj) +} + +func (n *storageClassClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1.StorageClass, error) { + return n.iface.GetNamespaced(namespace, name, opts) +} + +func (n *storageClassClient2) Update(obj *v1.StorageClass) (*v1.StorageClass, error) { + return n.iface.Update(obj) +} + +func (n *storageClassClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error { + return n.iface.DeleteNamespaced(namespace, name, options) +} + +func (n *storageClassClient2) List(namespace string, opts metav1.ListOptions) (*StorageClassList, error) { + return n.iface.List(opts) +} + +func (n *storageClassClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return n.iface.Watch(opts) +} + +func (n *storageClassClientCache) Get(namespace, name string) (*v1.StorageClass, error) { + return n.client.controller.Lister().Get(namespace, name) +} + +func (n *storageClassClientCache) List(namespace string, selector labels.Selector) ([]*v1.StorageClass, error) { + return n.client.controller.Lister().List(namespace, selector) +} + +func (n *storageClassClient2) Cache() StorageClassClientCache { + n.loadController() + return &storageClassClientCache{ + client: n, + } +} + +func (n *storageClassClient2) OnCreate(ctx context.Context, name string, sync StorageClassChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-create", &storageClassLifecycleDelegate{create: sync}) +} + +func (n *storageClassClient2) OnChange(ctx context.Context, name string, sync StorageClassChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-change", &storageClassLifecycleDelegate{update: sync}) +} + +func (n *storageClassClient2) OnRemove(ctx context.Context, name string, sync StorageClassChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name, &storageClassLifecycleDelegate{remove: sync}) +} + +func (n *storageClassClientCache) Index(name string, indexer StorageClassIndexer) { + err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{ + name: func(obj interface{}) ([]string, error) { + if v, ok := obj.(*v1.StorageClass); ok { + return indexer(v) + } + return nil, nil + }, + }) + + if err != nil { + panic(err) + } +} + +func (n *storageClassClientCache) GetIndexed(name, key string) ([]*v1.StorageClass, error) { + var result []*v1.StorageClass + objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key) + if err != nil { + return nil, err + } + for _, obj := range objs { + if v, ok := obj.(*v1.StorageClass); ok { + result = append(result, v) + } + } + + return result, nil +} + +func (n *storageClassClient2) loadController() { + if n.controller == nil { + n.controller = n.iface.Controller() + } +} + +type storageClassLifecycleDelegate struct { + create StorageClassChangeHandlerFunc + update StorageClassChangeHandlerFunc + remove StorageClassChangeHandlerFunc +} + +func (n *storageClassLifecycleDelegate) HasCreate() bool { + return n.create != nil +} + +func (n *storageClassLifecycleDelegate) Create(obj *v1.StorageClass) (runtime.Object, error) { + if n.create == nil { + return obj, nil + } + return n.create(obj) +} + +func (n *storageClassLifecycleDelegate) HasFinalize() bool { + return n.remove != nil +} + +func (n *storageClassLifecycleDelegate) Remove(obj *v1.StorageClass) (runtime.Object, error) { + if n.remove == nil { + return obj, nil + } + return n.remove(obj) +} + +func (n *storageClassLifecycleDelegate) Updated(obj *v1.StorageClass) (runtime.Object, error) { + if n.update == nil { + return obj, nil + } + return n.update(obj) +} diff --git a/apis/storage.k8s.io/v1/zz_generated_storage_class_lifecycle_adapter.go b/apis/storage.k8s.io/v1/zz_generated_storage_class_lifecycle_adapter.go new file mode 100644 index 00000000..976b17c4 --- /dev/null +++ b/apis/storage.k8s.io/v1/zz_generated_storage_class_lifecycle_adapter.go @@ -0,0 +1,63 @@ +package v1 + +import ( + "github.com/rancher/norman/lifecycle" + v1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +type StorageClassLifecycle interface { + Create(obj *v1.StorageClass) (runtime.Object, error) + Remove(obj *v1.StorageClass) (runtime.Object, error) + Updated(obj *v1.StorageClass) (runtime.Object, error) +} + +type storageClassLifecycleAdapter struct { + lifecycle StorageClassLifecycle +} + +func (w *storageClassLifecycleAdapter) HasCreate() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasCreate() +} + +func (w *storageClassLifecycleAdapter) HasFinalize() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasFinalize() +} + +func (w *storageClassLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*v1.StorageClass)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *storageClassLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*v1.StorageClass)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *storageClassLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*v1.StorageClass)) + if o == nil { + return nil, err + } + return o, err +} + +func NewStorageClassLifecycleAdapter(name string, clusterScoped bool, client StorageClassInterface, l StorageClassLifecycle) StorageClassHandlerFunc { + adapter := &storageClassLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *v1.StorageClass) (runtime.Object, error) { + newObj, err := syncFn(key, obj) + if o, ok := newObj.(runtime.Object); ok { + return o, err + } + return nil, err + } +}