diff --git a/apis/management.cattle.io/v3/fakes/zz_generated_feature_mock.go b/apis/management.cattle.io/v3/fakes/zz_generated_feature_mock.go new file mode 100644 index 00000000..6e01d8d4 --- /dev/null +++ b/apis/management.cattle.io/v3/fakes/zz_generated_feature_mock.go @@ -0,0 +1,1740 @@ +// 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" + v3 "github.com/rancher/types/apis/management.cattle.io/v3" + v1 "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 ( + lockFeatureListerMockGet sync.RWMutex + lockFeatureListerMockList sync.RWMutex +) + +// Ensure, that FeatureListerMock does implement FeatureLister. +// If this is not the case, regenerate this file with moq. +var _ v3.FeatureLister = &FeatureListerMock{} + +// FeatureListerMock is a mock implementation of FeatureLister. +// +// func TestSomethingThatUsesFeatureLister(t *testing.T) { +// +// // make and configure a mocked FeatureLister +// mockedFeatureLister := &FeatureListerMock{ +// GetFunc: func(namespace string, name string) (*v3.Feature, error) { +// panic("mock out the Get method") +// }, +// ListFunc: func(namespace string, selector labels.Selector) ([]*v3.Feature, error) { +// panic("mock out the List method") +// }, +// } +// +// // use mockedFeatureLister in code that requires FeatureLister +// // and then make assertions. +// +// } +type FeatureListerMock struct { + // GetFunc mocks the Get method. + GetFunc func(namespace string, name string) (*v3.Feature, error) + + // ListFunc mocks the List method. + ListFunc func(namespace string, selector labels.Selector) ([]*v3.Feature, 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 *FeatureListerMock) Get(namespace string, name string) (*v3.Feature, error) { + if mock.GetFunc == nil { + panic("FeatureListerMock.GetFunc: method is nil but FeatureLister.Get was just called") + } + callInfo := struct { + Namespace string + Name string + }{ + Namespace: namespace, + Name: name, + } + lockFeatureListerMockGet.Lock() + mock.calls.Get = append(mock.calls.Get, callInfo) + lockFeatureListerMockGet.Unlock() + return mock.GetFunc(namespace, name) +} + +// GetCalls gets all the calls that were made to Get. +// Check the length with: +// len(mockedFeatureLister.GetCalls()) +func (mock *FeatureListerMock) GetCalls() []struct { + Namespace string + Name string +} { + var calls []struct { + Namespace string + Name string + } + lockFeatureListerMockGet.RLock() + calls = mock.calls.Get + lockFeatureListerMockGet.RUnlock() + return calls +} + +// List calls ListFunc. +func (mock *FeatureListerMock) List(namespace string, selector labels.Selector) ([]*v3.Feature, error) { + if mock.ListFunc == nil { + panic("FeatureListerMock.ListFunc: method is nil but FeatureLister.List was just called") + } + callInfo := struct { + Namespace string + Selector labels.Selector + }{ + Namespace: namespace, + Selector: selector, + } + lockFeatureListerMockList.Lock() + mock.calls.List = append(mock.calls.List, callInfo) + lockFeatureListerMockList.Unlock() + return mock.ListFunc(namespace, selector) +} + +// ListCalls gets all the calls that were made to List. +// Check the length with: +// len(mockedFeatureLister.ListCalls()) +func (mock *FeatureListerMock) ListCalls() []struct { + Namespace string + Selector labels.Selector +} { + var calls []struct { + Namespace string + Selector labels.Selector + } + lockFeatureListerMockList.RLock() + calls = mock.calls.List + lockFeatureListerMockList.RUnlock() + return calls +} + +var ( + lockFeatureControllerMockAddClusterScopedFeatureHandler sync.RWMutex + lockFeatureControllerMockAddClusterScopedHandler sync.RWMutex + lockFeatureControllerMockAddFeatureHandler sync.RWMutex + lockFeatureControllerMockAddHandler sync.RWMutex + lockFeatureControllerMockEnqueue sync.RWMutex + lockFeatureControllerMockGeneric sync.RWMutex + lockFeatureControllerMockInformer sync.RWMutex + lockFeatureControllerMockLister sync.RWMutex + lockFeatureControllerMockStart sync.RWMutex + lockFeatureControllerMockSync sync.RWMutex +) + +// Ensure, that FeatureControllerMock does implement FeatureController. +// If this is not the case, regenerate this file with moq. +var _ v3.FeatureController = &FeatureControllerMock{} + +// FeatureControllerMock is a mock implementation of FeatureController. +// +// func TestSomethingThatUsesFeatureController(t *testing.T) { +// +// // make and configure a mocked FeatureController +// mockedFeatureController := &FeatureControllerMock{ +// AddClusterScopedFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, clusterName string, handler v3.FeatureHandlerFunc) { +// panic("mock out the AddClusterScopedFeatureHandler method") +// }, +// AddClusterScopedHandlerFunc: func(ctx context.Context, name string, clusterName string, handler v3.FeatureHandlerFunc) { +// panic("mock out the AddClusterScopedHandler method") +// }, +// AddFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, sync v3.FeatureHandlerFunc) { +// panic("mock out the AddFeatureHandler method") +// }, +// AddHandlerFunc: func(ctx context.Context, name string, handler v3.FeatureHandlerFunc) { +// 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() v3.FeatureLister { +// 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 mockedFeatureController in code that requires FeatureController +// // and then make assertions. +// +// } +type FeatureControllerMock struct { + // AddClusterScopedFeatureHandlerFunc mocks the AddClusterScopedFeatureHandler method. + AddClusterScopedFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, clusterName string, handler v3.FeatureHandlerFunc) + + // AddClusterScopedHandlerFunc mocks the AddClusterScopedHandler method. + AddClusterScopedHandlerFunc func(ctx context.Context, name string, clusterName string, handler v3.FeatureHandlerFunc) + + // AddFeatureHandlerFunc mocks the AddFeatureHandler method. + AddFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, sync v3.FeatureHandlerFunc) + + // AddHandlerFunc mocks the AddHandler method. + AddHandlerFunc func(ctx context.Context, name string, handler v3.FeatureHandlerFunc) + + // 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() v3.FeatureLister + + // 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 v3.FeatureHandlerFunc + } + // 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 v3.FeatureHandlerFunc + } + // 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 v3.FeatureHandlerFunc + } + // 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 v3.FeatureHandlerFunc + } + // 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 *FeatureControllerMock) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name string, clusterName string, handler v3.FeatureHandlerFunc) { + if mock.AddClusterScopedFeatureHandlerFunc == nil { + panic("FeatureControllerMock.AddClusterScopedFeatureHandlerFunc: method is nil but FeatureController.AddClusterScopedFeatureHandler was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Handler v3.FeatureHandlerFunc + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + ClusterName: clusterName, + Handler: handler, + } + lockFeatureControllerMockAddClusterScopedFeatureHandler.Lock() + mock.calls.AddClusterScopedFeatureHandler = append(mock.calls.AddClusterScopedFeatureHandler, callInfo) + lockFeatureControllerMockAddClusterScopedFeatureHandler.Unlock() + mock.AddClusterScopedFeatureHandlerFunc(ctx, enabled, name, clusterName, handler) +} + +// AddClusterScopedFeatureHandlerCalls gets all the calls that were made to AddClusterScopedFeatureHandler. +// Check the length with: +// len(mockedFeatureController.AddClusterScopedFeatureHandlerCalls()) +func (mock *FeatureControllerMock) AddClusterScopedFeatureHandlerCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Handler v3.FeatureHandlerFunc +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Handler v3.FeatureHandlerFunc + } + lockFeatureControllerMockAddClusterScopedFeatureHandler.RLock() + calls = mock.calls.AddClusterScopedFeatureHandler + lockFeatureControllerMockAddClusterScopedFeatureHandler.RUnlock() + return calls +} + +// AddClusterScopedHandler calls AddClusterScopedHandlerFunc. +func (mock *FeatureControllerMock) AddClusterScopedHandler(ctx context.Context, name string, clusterName string, handler v3.FeatureHandlerFunc) { + if mock.AddClusterScopedHandlerFunc == nil { + panic("FeatureControllerMock.AddClusterScopedHandlerFunc: method is nil but FeatureController.AddClusterScopedHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + ClusterName string + Handler v3.FeatureHandlerFunc + }{ + Ctx: ctx, + Name: name, + ClusterName: clusterName, + Handler: handler, + } + lockFeatureControllerMockAddClusterScopedHandler.Lock() + mock.calls.AddClusterScopedHandler = append(mock.calls.AddClusterScopedHandler, callInfo) + lockFeatureControllerMockAddClusterScopedHandler.Unlock() + mock.AddClusterScopedHandlerFunc(ctx, name, clusterName, handler) +} + +// AddClusterScopedHandlerCalls gets all the calls that were made to AddClusterScopedHandler. +// Check the length with: +// len(mockedFeatureController.AddClusterScopedHandlerCalls()) +func (mock *FeatureControllerMock) AddClusterScopedHandlerCalls() []struct { + Ctx context.Context + Name string + ClusterName string + Handler v3.FeatureHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + ClusterName string + Handler v3.FeatureHandlerFunc + } + lockFeatureControllerMockAddClusterScopedHandler.RLock() + calls = mock.calls.AddClusterScopedHandler + lockFeatureControllerMockAddClusterScopedHandler.RUnlock() + return calls +} + +// AddFeatureHandler calls AddFeatureHandlerFunc. +func (mock *FeatureControllerMock) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync v3.FeatureHandlerFunc) { + if mock.AddFeatureHandlerFunc == nil { + panic("FeatureControllerMock.AddFeatureHandlerFunc: method is nil but FeatureController.AddFeatureHandler was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v3.FeatureHandlerFunc + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + Sync: sync, + } + lockFeatureControllerMockAddFeatureHandler.Lock() + mock.calls.AddFeatureHandler = append(mock.calls.AddFeatureHandler, callInfo) + lockFeatureControllerMockAddFeatureHandler.Unlock() + mock.AddFeatureHandlerFunc(ctx, enabled, name, sync) +} + +// AddFeatureHandlerCalls gets all the calls that were made to AddFeatureHandler. +// Check the length with: +// len(mockedFeatureController.AddFeatureHandlerCalls()) +func (mock *FeatureControllerMock) AddFeatureHandlerCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v3.FeatureHandlerFunc +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v3.FeatureHandlerFunc + } + lockFeatureControllerMockAddFeatureHandler.RLock() + calls = mock.calls.AddFeatureHandler + lockFeatureControllerMockAddFeatureHandler.RUnlock() + return calls +} + +// AddHandler calls AddHandlerFunc. +func (mock *FeatureControllerMock) AddHandler(ctx context.Context, name string, handler v3.FeatureHandlerFunc) { + if mock.AddHandlerFunc == nil { + panic("FeatureControllerMock.AddHandlerFunc: method is nil but FeatureController.AddHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + Handler v3.FeatureHandlerFunc + }{ + Ctx: ctx, + Name: name, + Handler: handler, + } + lockFeatureControllerMockAddHandler.Lock() + mock.calls.AddHandler = append(mock.calls.AddHandler, callInfo) + lockFeatureControllerMockAddHandler.Unlock() + mock.AddHandlerFunc(ctx, name, handler) +} + +// AddHandlerCalls gets all the calls that were made to AddHandler. +// Check the length with: +// len(mockedFeatureController.AddHandlerCalls()) +func (mock *FeatureControllerMock) AddHandlerCalls() []struct { + Ctx context.Context + Name string + Handler v3.FeatureHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + Handler v3.FeatureHandlerFunc + } + lockFeatureControllerMockAddHandler.RLock() + calls = mock.calls.AddHandler + lockFeatureControllerMockAddHandler.RUnlock() + return calls +} + +// Enqueue calls EnqueueFunc. +func (mock *FeatureControllerMock) Enqueue(namespace string, name string) { + if mock.EnqueueFunc == nil { + panic("FeatureControllerMock.EnqueueFunc: method is nil but FeatureController.Enqueue was just called") + } + callInfo := struct { + Namespace string + Name string + }{ + Namespace: namespace, + Name: name, + } + lockFeatureControllerMockEnqueue.Lock() + mock.calls.Enqueue = append(mock.calls.Enqueue, callInfo) + lockFeatureControllerMockEnqueue.Unlock() + mock.EnqueueFunc(namespace, name) +} + +// EnqueueCalls gets all the calls that were made to Enqueue. +// Check the length with: +// len(mockedFeatureController.EnqueueCalls()) +func (mock *FeatureControllerMock) EnqueueCalls() []struct { + Namespace string + Name string +} { + var calls []struct { + Namespace string + Name string + } + lockFeatureControllerMockEnqueue.RLock() + calls = mock.calls.Enqueue + lockFeatureControllerMockEnqueue.RUnlock() + return calls +} + +// Generic calls GenericFunc. +func (mock *FeatureControllerMock) Generic() controller.GenericController { + if mock.GenericFunc == nil { + panic("FeatureControllerMock.GenericFunc: method is nil but FeatureController.Generic was just called") + } + callInfo := struct { + }{} + lockFeatureControllerMockGeneric.Lock() + mock.calls.Generic = append(mock.calls.Generic, callInfo) + lockFeatureControllerMockGeneric.Unlock() + return mock.GenericFunc() +} + +// GenericCalls gets all the calls that were made to Generic. +// Check the length with: +// len(mockedFeatureController.GenericCalls()) +func (mock *FeatureControllerMock) GenericCalls() []struct { +} { + var calls []struct { + } + lockFeatureControllerMockGeneric.RLock() + calls = mock.calls.Generic + lockFeatureControllerMockGeneric.RUnlock() + return calls +} + +// Informer calls InformerFunc. +func (mock *FeatureControllerMock) Informer() cache.SharedIndexInformer { + if mock.InformerFunc == nil { + panic("FeatureControllerMock.InformerFunc: method is nil but FeatureController.Informer was just called") + } + callInfo := struct { + }{} + lockFeatureControllerMockInformer.Lock() + mock.calls.Informer = append(mock.calls.Informer, callInfo) + lockFeatureControllerMockInformer.Unlock() + return mock.InformerFunc() +} + +// InformerCalls gets all the calls that were made to Informer. +// Check the length with: +// len(mockedFeatureController.InformerCalls()) +func (mock *FeatureControllerMock) InformerCalls() []struct { +} { + var calls []struct { + } + lockFeatureControllerMockInformer.RLock() + calls = mock.calls.Informer + lockFeatureControllerMockInformer.RUnlock() + return calls +} + +// Lister calls ListerFunc. +func (mock *FeatureControllerMock) Lister() v3.FeatureLister { + if mock.ListerFunc == nil { + panic("FeatureControllerMock.ListerFunc: method is nil but FeatureController.Lister was just called") + } + callInfo := struct { + }{} + lockFeatureControllerMockLister.Lock() + mock.calls.Lister = append(mock.calls.Lister, callInfo) + lockFeatureControllerMockLister.Unlock() + return mock.ListerFunc() +} + +// ListerCalls gets all the calls that were made to Lister. +// Check the length with: +// len(mockedFeatureController.ListerCalls()) +func (mock *FeatureControllerMock) ListerCalls() []struct { +} { + var calls []struct { + } + lockFeatureControllerMockLister.RLock() + calls = mock.calls.Lister + lockFeatureControllerMockLister.RUnlock() + return calls +} + +// Start calls StartFunc. +func (mock *FeatureControllerMock) Start(ctx context.Context, threadiness int) error { + if mock.StartFunc == nil { + panic("FeatureControllerMock.StartFunc: method is nil but FeatureController.Start was just called") + } + callInfo := struct { + Ctx context.Context + Threadiness int + }{ + Ctx: ctx, + Threadiness: threadiness, + } + lockFeatureControllerMockStart.Lock() + mock.calls.Start = append(mock.calls.Start, callInfo) + lockFeatureControllerMockStart.Unlock() + return mock.StartFunc(ctx, threadiness) +} + +// StartCalls gets all the calls that were made to Start. +// Check the length with: +// len(mockedFeatureController.StartCalls()) +func (mock *FeatureControllerMock) StartCalls() []struct { + Ctx context.Context + Threadiness int +} { + var calls []struct { + Ctx context.Context + Threadiness int + } + lockFeatureControllerMockStart.RLock() + calls = mock.calls.Start + lockFeatureControllerMockStart.RUnlock() + return calls +} + +// Sync calls SyncFunc. +func (mock *FeatureControllerMock) Sync(ctx context.Context) error { + if mock.SyncFunc == nil { + panic("FeatureControllerMock.SyncFunc: method is nil but FeatureController.Sync was just called") + } + callInfo := struct { + Ctx context.Context + }{ + Ctx: ctx, + } + lockFeatureControllerMockSync.Lock() + mock.calls.Sync = append(mock.calls.Sync, callInfo) + lockFeatureControllerMockSync.Unlock() + return mock.SyncFunc(ctx) +} + +// SyncCalls gets all the calls that were made to Sync. +// Check the length with: +// len(mockedFeatureController.SyncCalls()) +func (mock *FeatureControllerMock) SyncCalls() []struct { + Ctx context.Context +} { + var calls []struct { + Ctx context.Context + } + lockFeatureControllerMockSync.RLock() + calls = mock.calls.Sync + lockFeatureControllerMockSync.RUnlock() + return calls +} + +var ( + lockFeatureInterfaceMockAddClusterScopedFeatureHandler sync.RWMutex + lockFeatureInterfaceMockAddClusterScopedFeatureLifecycle sync.RWMutex + lockFeatureInterfaceMockAddClusterScopedHandler sync.RWMutex + lockFeatureInterfaceMockAddClusterScopedLifecycle sync.RWMutex + lockFeatureInterfaceMockAddFeatureHandler sync.RWMutex + lockFeatureInterfaceMockAddFeatureLifecycle sync.RWMutex + lockFeatureInterfaceMockAddHandler sync.RWMutex + lockFeatureInterfaceMockAddLifecycle sync.RWMutex + lockFeatureInterfaceMockController sync.RWMutex + lockFeatureInterfaceMockCreate sync.RWMutex + lockFeatureInterfaceMockDelete sync.RWMutex + lockFeatureInterfaceMockDeleteCollection sync.RWMutex + lockFeatureInterfaceMockDeleteNamespaced sync.RWMutex + lockFeatureInterfaceMockGet sync.RWMutex + lockFeatureInterfaceMockGetNamespaced sync.RWMutex + lockFeatureInterfaceMockList sync.RWMutex + lockFeatureInterfaceMockObjectClient sync.RWMutex + lockFeatureInterfaceMockUpdate sync.RWMutex + lockFeatureInterfaceMockWatch sync.RWMutex +) + +// Ensure, that FeatureInterfaceMock does implement FeatureInterface. +// If this is not the case, regenerate this file with moq. +var _ v3.FeatureInterface = &FeatureInterfaceMock{} + +// FeatureInterfaceMock is a mock implementation of FeatureInterface. +// +// func TestSomethingThatUsesFeatureInterface(t *testing.T) { +// +// // make and configure a mocked FeatureInterface +// mockedFeatureInterface := &FeatureInterfaceMock{ +// AddClusterScopedFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, clusterName string, sync v3.FeatureHandlerFunc) { +// panic("mock out the AddClusterScopedFeatureHandler method") +// }, +// AddClusterScopedFeatureLifecycleFunc: func(ctx context.Context, enabled func() bool, name string, clusterName string, lifecycle v3.FeatureLifecycle) { +// panic("mock out the AddClusterScopedFeatureLifecycle method") +// }, +// AddClusterScopedHandlerFunc: func(ctx context.Context, name string, clusterName string, sync v3.FeatureHandlerFunc) { +// panic("mock out the AddClusterScopedHandler method") +// }, +// AddClusterScopedLifecycleFunc: func(ctx context.Context, name string, clusterName string, lifecycle v3.FeatureLifecycle) { +// panic("mock out the AddClusterScopedLifecycle method") +// }, +// AddFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, sync v3.FeatureHandlerFunc) { +// panic("mock out the AddFeatureHandler method") +// }, +// AddFeatureLifecycleFunc: func(ctx context.Context, enabled func() bool, name string, lifecycle v3.FeatureLifecycle) { +// panic("mock out the AddFeatureLifecycle method") +// }, +// AddHandlerFunc: func(ctx context.Context, name string, sync v3.FeatureHandlerFunc) { +// panic("mock out the AddHandler method") +// }, +// AddLifecycleFunc: func(ctx context.Context, name string, lifecycle v3.FeatureLifecycle) { +// panic("mock out the AddLifecycle method") +// }, +// ControllerFunc: func() v3.FeatureController { +// panic("mock out the Controller method") +// }, +// CreateFunc: func(in1 *v3.Feature) (*v3.Feature, error) { +// panic("mock out the Create method") +// }, +// DeleteFunc: func(name string, options *v1.DeleteOptions) error { +// panic("mock out the Delete method") +// }, +// DeleteCollectionFunc: func(deleteOpts *v1.DeleteOptions, listOpts v1.ListOptions) error { +// panic("mock out the DeleteCollection method") +// }, +// DeleteNamespacedFunc: func(namespace string, name string, options *v1.DeleteOptions) error { +// panic("mock out the DeleteNamespaced method") +// }, +// GetFunc: func(name string, opts v1.GetOptions) (*v3.Feature, error) { +// panic("mock out the Get method") +// }, +// GetNamespacedFunc: func(namespace string, name string, opts v1.GetOptions) (*v3.Feature, error) { +// panic("mock out the GetNamespaced method") +// }, +// ListFunc: func(opts v1.ListOptions) (*v3.FeatureList, error) { +// panic("mock out the List method") +// }, +// ObjectClientFunc: func() *objectclient.ObjectClient { +// panic("mock out the ObjectClient method") +// }, +// UpdateFunc: func(in1 *v3.Feature) (*v3.Feature, error) { +// panic("mock out the Update method") +// }, +// WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { +// panic("mock out the Watch method") +// }, +// } +// +// // use mockedFeatureInterface in code that requires FeatureInterface +// // and then make assertions. +// +// } +type FeatureInterfaceMock struct { + // AddClusterScopedFeatureHandlerFunc mocks the AddClusterScopedFeatureHandler method. + AddClusterScopedFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, clusterName string, sync v3.FeatureHandlerFunc) + + // AddClusterScopedFeatureLifecycleFunc mocks the AddClusterScopedFeatureLifecycle method. + AddClusterScopedFeatureLifecycleFunc func(ctx context.Context, enabled func() bool, name string, clusterName string, lifecycle v3.FeatureLifecycle) + + // AddClusterScopedHandlerFunc mocks the AddClusterScopedHandler method. + AddClusterScopedHandlerFunc func(ctx context.Context, name string, clusterName string, sync v3.FeatureHandlerFunc) + + // AddClusterScopedLifecycleFunc mocks the AddClusterScopedLifecycle method. + AddClusterScopedLifecycleFunc func(ctx context.Context, name string, clusterName string, lifecycle v3.FeatureLifecycle) + + // AddFeatureHandlerFunc mocks the AddFeatureHandler method. + AddFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, sync v3.FeatureHandlerFunc) + + // AddFeatureLifecycleFunc mocks the AddFeatureLifecycle method. + AddFeatureLifecycleFunc func(ctx context.Context, enabled func() bool, name string, lifecycle v3.FeatureLifecycle) + + // AddHandlerFunc mocks the AddHandler method. + AddHandlerFunc func(ctx context.Context, name string, sync v3.FeatureHandlerFunc) + + // AddLifecycleFunc mocks the AddLifecycle method. + AddLifecycleFunc func(ctx context.Context, name string, lifecycle v3.FeatureLifecycle) + + // ControllerFunc mocks the Controller method. + ControllerFunc func() v3.FeatureController + + // CreateFunc mocks the Create method. + CreateFunc func(in1 *v3.Feature) (*v3.Feature, error) + + // DeleteFunc mocks the Delete method. + DeleteFunc func(name string, options *v1.DeleteOptions) error + + // DeleteCollectionFunc mocks the DeleteCollection method. + DeleteCollectionFunc func(deleteOpts *v1.DeleteOptions, listOpts v1.ListOptions) error + + // DeleteNamespacedFunc mocks the DeleteNamespaced method. + DeleteNamespacedFunc func(namespace string, name string, options *v1.DeleteOptions) error + + // GetFunc mocks the Get method. + GetFunc func(name string, opts v1.GetOptions) (*v3.Feature, error) + + // GetNamespacedFunc mocks the GetNamespaced method. + GetNamespacedFunc func(namespace string, name string, opts v1.GetOptions) (*v3.Feature, error) + + // ListFunc mocks the List method. + ListFunc func(opts v1.ListOptions) (*v3.FeatureList, error) + + // ObjectClientFunc mocks the ObjectClient method. + ObjectClientFunc func() *objectclient.ObjectClient + + // UpdateFunc mocks the Update method. + UpdateFunc func(in1 *v3.Feature) (*v3.Feature, error) + + // WatchFunc mocks the Watch method. + WatchFunc func(opts v1.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 v3.FeatureHandlerFunc + } + // 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 v3.FeatureLifecycle + } + // 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 v3.FeatureHandlerFunc + } + // 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 v3.FeatureLifecycle + } + // 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 v3.FeatureHandlerFunc + } + // 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 v3.FeatureLifecycle + } + // 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 v3.FeatureHandlerFunc + } + // 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 v3.FeatureLifecycle + } + // 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 *v3.Feature + } + // 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 *v1.DeleteOptions + } + // DeleteCollection holds details about calls to the DeleteCollection method. + DeleteCollection []struct { + // DeleteOpts is the deleteOpts argument value. + DeleteOpts *v1.DeleteOptions + // ListOpts is the listOpts argument value. + ListOpts v1.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 *v1.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 v1.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 v1.GetOptions + } + // List holds details about calls to the List method. + List []struct { + // Opts is the opts argument value. + Opts v1.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 *v3.Feature + } + // Watch holds details about calls to the Watch method. + Watch []struct { + // Opts is the opts argument value. + Opts v1.ListOptions + } + } +} + +// AddClusterScopedFeatureHandler calls AddClusterScopedFeatureHandlerFunc. +func (mock *FeatureInterfaceMock) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name string, clusterName string, sync v3.FeatureHandlerFunc) { + if mock.AddClusterScopedFeatureHandlerFunc == nil { + panic("FeatureInterfaceMock.AddClusterScopedFeatureHandlerFunc: method is nil but FeatureInterface.AddClusterScopedFeatureHandler was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Sync v3.FeatureHandlerFunc + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + ClusterName: clusterName, + Sync: sync, + } + lockFeatureInterfaceMockAddClusterScopedFeatureHandler.Lock() + mock.calls.AddClusterScopedFeatureHandler = append(mock.calls.AddClusterScopedFeatureHandler, callInfo) + lockFeatureInterfaceMockAddClusterScopedFeatureHandler.Unlock() + mock.AddClusterScopedFeatureHandlerFunc(ctx, enabled, name, clusterName, sync) +} + +// AddClusterScopedFeatureHandlerCalls gets all the calls that were made to AddClusterScopedFeatureHandler. +// Check the length with: +// len(mockedFeatureInterface.AddClusterScopedFeatureHandlerCalls()) +func (mock *FeatureInterfaceMock) AddClusterScopedFeatureHandlerCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Sync v3.FeatureHandlerFunc +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Sync v3.FeatureHandlerFunc + } + lockFeatureInterfaceMockAddClusterScopedFeatureHandler.RLock() + calls = mock.calls.AddClusterScopedFeatureHandler + lockFeatureInterfaceMockAddClusterScopedFeatureHandler.RUnlock() + return calls +} + +// AddClusterScopedFeatureLifecycle calls AddClusterScopedFeatureLifecycleFunc. +func (mock *FeatureInterfaceMock) AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name string, clusterName string, lifecycle v3.FeatureLifecycle) { + if mock.AddClusterScopedFeatureLifecycleFunc == nil { + panic("FeatureInterfaceMock.AddClusterScopedFeatureLifecycleFunc: method is nil but FeatureInterface.AddClusterScopedFeatureLifecycle was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Lifecycle v3.FeatureLifecycle + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + ClusterName: clusterName, + Lifecycle: lifecycle, + } + lockFeatureInterfaceMockAddClusterScopedFeatureLifecycle.Lock() + mock.calls.AddClusterScopedFeatureLifecycle = append(mock.calls.AddClusterScopedFeatureLifecycle, callInfo) + lockFeatureInterfaceMockAddClusterScopedFeatureLifecycle.Unlock() + mock.AddClusterScopedFeatureLifecycleFunc(ctx, enabled, name, clusterName, lifecycle) +} + +// AddClusterScopedFeatureLifecycleCalls gets all the calls that were made to AddClusterScopedFeatureLifecycle. +// Check the length with: +// len(mockedFeatureInterface.AddClusterScopedFeatureLifecycleCalls()) +func (mock *FeatureInterfaceMock) AddClusterScopedFeatureLifecycleCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Lifecycle v3.FeatureLifecycle +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + ClusterName string + Lifecycle v3.FeatureLifecycle + } + lockFeatureInterfaceMockAddClusterScopedFeatureLifecycle.RLock() + calls = mock.calls.AddClusterScopedFeatureLifecycle + lockFeatureInterfaceMockAddClusterScopedFeatureLifecycle.RUnlock() + return calls +} + +// AddClusterScopedHandler calls AddClusterScopedHandlerFunc. +func (mock *FeatureInterfaceMock) AddClusterScopedHandler(ctx context.Context, name string, clusterName string, sync v3.FeatureHandlerFunc) { + if mock.AddClusterScopedHandlerFunc == nil { + panic("FeatureInterfaceMock.AddClusterScopedHandlerFunc: method is nil but FeatureInterface.AddClusterScopedHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + ClusterName string + Sync v3.FeatureHandlerFunc + }{ + Ctx: ctx, + Name: name, + ClusterName: clusterName, + Sync: sync, + } + lockFeatureInterfaceMockAddClusterScopedHandler.Lock() + mock.calls.AddClusterScopedHandler = append(mock.calls.AddClusterScopedHandler, callInfo) + lockFeatureInterfaceMockAddClusterScopedHandler.Unlock() + mock.AddClusterScopedHandlerFunc(ctx, name, clusterName, sync) +} + +// AddClusterScopedHandlerCalls gets all the calls that were made to AddClusterScopedHandler. +// Check the length with: +// len(mockedFeatureInterface.AddClusterScopedHandlerCalls()) +func (mock *FeatureInterfaceMock) AddClusterScopedHandlerCalls() []struct { + Ctx context.Context + Name string + ClusterName string + Sync v3.FeatureHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + ClusterName string + Sync v3.FeatureHandlerFunc + } + lockFeatureInterfaceMockAddClusterScopedHandler.RLock() + calls = mock.calls.AddClusterScopedHandler + lockFeatureInterfaceMockAddClusterScopedHandler.RUnlock() + return calls +} + +// AddClusterScopedLifecycle calls AddClusterScopedLifecycleFunc. +func (mock *FeatureInterfaceMock) AddClusterScopedLifecycle(ctx context.Context, name string, clusterName string, lifecycle v3.FeatureLifecycle) { + if mock.AddClusterScopedLifecycleFunc == nil { + panic("FeatureInterfaceMock.AddClusterScopedLifecycleFunc: method is nil but FeatureInterface.AddClusterScopedLifecycle was just called") + } + callInfo := struct { + Ctx context.Context + Name string + ClusterName string + Lifecycle v3.FeatureLifecycle + }{ + Ctx: ctx, + Name: name, + ClusterName: clusterName, + Lifecycle: lifecycle, + } + lockFeatureInterfaceMockAddClusterScopedLifecycle.Lock() + mock.calls.AddClusterScopedLifecycle = append(mock.calls.AddClusterScopedLifecycle, callInfo) + lockFeatureInterfaceMockAddClusterScopedLifecycle.Unlock() + mock.AddClusterScopedLifecycleFunc(ctx, name, clusterName, lifecycle) +} + +// AddClusterScopedLifecycleCalls gets all the calls that were made to AddClusterScopedLifecycle. +// Check the length with: +// len(mockedFeatureInterface.AddClusterScopedLifecycleCalls()) +func (mock *FeatureInterfaceMock) AddClusterScopedLifecycleCalls() []struct { + Ctx context.Context + Name string + ClusterName string + Lifecycle v3.FeatureLifecycle +} { + var calls []struct { + Ctx context.Context + Name string + ClusterName string + Lifecycle v3.FeatureLifecycle + } + lockFeatureInterfaceMockAddClusterScopedLifecycle.RLock() + calls = mock.calls.AddClusterScopedLifecycle + lockFeatureInterfaceMockAddClusterScopedLifecycle.RUnlock() + return calls +} + +// AddFeatureHandler calls AddFeatureHandlerFunc. +func (mock *FeatureInterfaceMock) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync v3.FeatureHandlerFunc) { + if mock.AddFeatureHandlerFunc == nil { + panic("FeatureInterfaceMock.AddFeatureHandlerFunc: method is nil but FeatureInterface.AddFeatureHandler was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v3.FeatureHandlerFunc + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + Sync: sync, + } + lockFeatureInterfaceMockAddFeatureHandler.Lock() + mock.calls.AddFeatureHandler = append(mock.calls.AddFeatureHandler, callInfo) + lockFeatureInterfaceMockAddFeatureHandler.Unlock() + mock.AddFeatureHandlerFunc(ctx, enabled, name, sync) +} + +// AddFeatureHandlerCalls gets all the calls that were made to AddFeatureHandler. +// Check the length with: +// len(mockedFeatureInterface.AddFeatureHandlerCalls()) +func (mock *FeatureInterfaceMock) AddFeatureHandlerCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v3.FeatureHandlerFunc +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + Sync v3.FeatureHandlerFunc + } + lockFeatureInterfaceMockAddFeatureHandler.RLock() + calls = mock.calls.AddFeatureHandler + lockFeatureInterfaceMockAddFeatureHandler.RUnlock() + return calls +} + +// AddFeatureLifecycle calls AddFeatureLifecycleFunc. +func (mock *FeatureInterfaceMock) AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle v3.FeatureLifecycle) { + if mock.AddFeatureLifecycleFunc == nil { + panic("FeatureInterfaceMock.AddFeatureLifecycleFunc: method is nil but FeatureInterface.AddFeatureLifecycle was just called") + } + callInfo := struct { + Ctx context.Context + Enabled func() bool + Name string + Lifecycle v3.FeatureLifecycle + }{ + Ctx: ctx, + Enabled: enabled, + Name: name, + Lifecycle: lifecycle, + } + lockFeatureInterfaceMockAddFeatureLifecycle.Lock() + mock.calls.AddFeatureLifecycle = append(mock.calls.AddFeatureLifecycle, callInfo) + lockFeatureInterfaceMockAddFeatureLifecycle.Unlock() + mock.AddFeatureLifecycleFunc(ctx, enabled, name, lifecycle) +} + +// AddFeatureLifecycleCalls gets all the calls that were made to AddFeatureLifecycle. +// Check the length with: +// len(mockedFeatureInterface.AddFeatureLifecycleCalls()) +func (mock *FeatureInterfaceMock) AddFeatureLifecycleCalls() []struct { + Ctx context.Context + Enabled func() bool + Name string + Lifecycle v3.FeatureLifecycle +} { + var calls []struct { + Ctx context.Context + Enabled func() bool + Name string + Lifecycle v3.FeatureLifecycle + } + lockFeatureInterfaceMockAddFeatureLifecycle.RLock() + calls = mock.calls.AddFeatureLifecycle + lockFeatureInterfaceMockAddFeatureLifecycle.RUnlock() + return calls +} + +// AddHandler calls AddHandlerFunc. +func (mock *FeatureInterfaceMock) AddHandler(ctx context.Context, name string, sync v3.FeatureHandlerFunc) { + if mock.AddHandlerFunc == nil { + panic("FeatureInterfaceMock.AddHandlerFunc: method is nil but FeatureInterface.AddHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + Sync v3.FeatureHandlerFunc + }{ + Ctx: ctx, + Name: name, + Sync: sync, + } + lockFeatureInterfaceMockAddHandler.Lock() + mock.calls.AddHandler = append(mock.calls.AddHandler, callInfo) + lockFeatureInterfaceMockAddHandler.Unlock() + mock.AddHandlerFunc(ctx, name, sync) +} + +// AddHandlerCalls gets all the calls that were made to AddHandler. +// Check the length with: +// len(mockedFeatureInterface.AddHandlerCalls()) +func (mock *FeatureInterfaceMock) AddHandlerCalls() []struct { + Ctx context.Context + Name string + Sync v3.FeatureHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + Sync v3.FeatureHandlerFunc + } + lockFeatureInterfaceMockAddHandler.RLock() + calls = mock.calls.AddHandler + lockFeatureInterfaceMockAddHandler.RUnlock() + return calls +} + +// AddLifecycle calls AddLifecycleFunc. +func (mock *FeatureInterfaceMock) AddLifecycle(ctx context.Context, name string, lifecycle v3.FeatureLifecycle) { + if mock.AddLifecycleFunc == nil { + panic("FeatureInterfaceMock.AddLifecycleFunc: method is nil but FeatureInterface.AddLifecycle was just called") + } + callInfo := struct { + Ctx context.Context + Name string + Lifecycle v3.FeatureLifecycle + }{ + Ctx: ctx, + Name: name, + Lifecycle: lifecycle, + } + lockFeatureInterfaceMockAddLifecycle.Lock() + mock.calls.AddLifecycle = append(mock.calls.AddLifecycle, callInfo) + lockFeatureInterfaceMockAddLifecycle.Unlock() + mock.AddLifecycleFunc(ctx, name, lifecycle) +} + +// AddLifecycleCalls gets all the calls that were made to AddLifecycle. +// Check the length with: +// len(mockedFeatureInterface.AddLifecycleCalls()) +func (mock *FeatureInterfaceMock) AddLifecycleCalls() []struct { + Ctx context.Context + Name string + Lifecycle v3.FeatureLifecycle +} { + var calls []struct { + Ctx context.Context + Name string + Lifecycle v3.FeatureLifecycle + } + lockFeatureInterfaceMockAddLifecycle.RLock() + calls = mock.calls.AddLifecycle + lockFeatureInterfaceMockAddLifecycle.RUnlock() + return calls +} + +// Controller calls ControllerFunc. +func (mock *FeatureInterfaceMock) Controller() v3.FeatureController { + if mock.ControllerFunc == nil { + panic("FeatureInterfaceMock.ControllerFunc: method is nil but FeatureInterface.Controller was just called") + } + callInfo := struct { + }{} + lockFeatureInterfaceMockController.Lock() + mock.calls.Controller = append(mock.calls.Controller, callInfo) + lockFeatureInterfaceMockController.Unlock() + return mock.ControllerFunc() +} + +// ControllerCalls gets all the calls that were made to Controller. +// Check the length with: +// len(mockedFeatureInterface.ControllerCalls()) +func (mock *FeatureInterfaceMock) ControllerCalls() []struct { +} { + var calls []struct { + } + lockFeatureInterfaceMockController.RLock() + calls = mock.calls.Controller + lockFeatureInterfaceMockController.RUnlock() + return calls +} + +// Create calls CreateFunc. +func (mock *FeatureInterfaceMock) Create(in1 *v3.Feature) (*v3.Feature, error) { + if mock.CreateFunc == nil { + panic("FeatureInterfaceMock.CreateFunc: method is nil but FeatureInterface.Create was just called") + } + callInfo := struct { + In1 *v3.Feature + }{ + In1: in1, + } + lockFeatureInterfaceMockCreate.Lock() + mock.calls.Create = append(mock.calls.Create, callInfo) + lockFeatureInterfaceMockCreate.Unlock() + return mock.CreateFunc(in1) +} + +// CreateCalls gets all the calls that were made to Create. +// Check the length with: +// len(mockedFeatureInterface.CreateCalls()) +func (mock *FeatureInterfaceMock) CreateCalls() []struct { + In1 *v3.Feature +} { + var calls []struct { + In1 *v3.Feature + } + lockFeatureInterfaceMockCreate.RLock() + calls = mock.calls.Create + lockFeatureInterfaceMockCreate.RUnlock() + return calls +} + +// Delete calls DeleteFunc. +func (mock *FeatureInterfaceMock) Delete(name string, options *v1.DeleteOptions) error { + if mock.DeleteFunc == nil { + panic("FeatureInterfaceMock.DeleteFunc: method is nil but FeatureInterface.Delete was just called") + } + callInfo := struct { + Name string + Options *v1.DeleteOptions + }{ + Name: name, + Options: options, + } + lockFeatureInterfaceMockDelete.Lock() + mock.calls.Delete = append(mock.calls.Delete, callInfo) + lockFeatureInterfaceMockDelete.Unlock() + return mock.DeleteFunc(name, options) +} + +// DeleteCalls gets all the calls that were made to Delete. +// Check the length with: +// len(mockedFeatureInterface.DeleteCalls()) +func (mock *FeatureInterfaceMock) DeleteCalls() []struct { + Name string + Options *v1.DeleteOptions +} { + var calls []struct { + Name string + Options *v1.DeleteOptions + } + lockFeatureInterfaceMockDelete.RLock() + calls = mock.calls.Delete + lockFeatureInterfaceMockDelete.RUnlock() + return calls +} + +// DeleteCollection calls DeleteCollectionFunc. +func (mock *FeatureInterfaceMock) DeleteCollection(deleteOpts *v1.DeleteOptions, listOpts v1.ListOptions) error { + if mock.DeleteCollectionFunc == nil { + panic("FeatureInterfaceMock.DeleteCollectionFunc: method is nil but FeatureInterface.DeleteCollection was just called") + } + callInfo := struct { + DeleteOpts *v1.DeleteOptions + ListOpts v1.ListOptions + }{ + DeleteOpts: deleteOpts, + ListOpts: listOpts, + } + lockFeatureInterfaceMockDeleteCollection.Lock() + mock.calls.DeleteCollection = append(mock.calls.DeleteCollection, callInfo) + lockFeatureInterfaceMockDeleteCollection.Unlock() + return mock.DeleteCollectionFunc(deleteOpts, listOpts) +} + +// DeleteCollectionCalls gets all the calls that were made to DeleteCollection. +// Check the length with: +// len(mockedFeatureInterface.DeleteCollectionCalls()) +func (mock *FeatureInterfaceMock) DeleteCollectionCalls() []struct { + DeleteOpts *v1.DeleteOptions + ListOpts v1.ListOptions +} { + var calls []struct { + DeleteOpts *v1.DeleteOptions + ListOpts v1.ListOptions + } + lockFeatureInterfaceMockDeleteCollection.RLock() + calls = mock.calls.DeleteCollection + lockFeatureInterfaceMockDeleteCollection.RUnlock() + return calls +} + +// DeleteNamespaced calls DeleteNamespacedFunc. +func (mock *FeatureInterfaceMock) DeleteNamespaced(namespace string, name string, options *v1.DeleteOptions) error { + if mock.DeleteNamespacedFunc == nil { + panic("FeatureInterfaceMock.DeleteNamespacedFunc: method is nil but FeatureInterface.DeleteNamespaced was just called") + } + callInfo := struct { + Namespace string + Name string + Options *v1.DeleteOptions + }{ + Namespace: namespace, + Name: name, + Options: options, + } + lockFeatureInterfaceMockDeleteNamespaced.Lock() + mock.calls.DeleteNamespaced = append(mock.calls.DeleteNamespaced, callInfo) + lockFeatureInterfaceMockDeleteNamespaced.Unlock() + return mock.DeleteNamespacedFunc(namespace, name, options) +} + +// DeleteNamespacedCalls gets all the calls that were made to DeleteNamespaced. +// Check the length with: +// len(mockedFeatureInterface.DeleteNamespacedCalls()) +func (mock *FeatureInterfaceMock) DeleteNamespacedCalls() []struct { + Namespace string + Name string + Options *v1.DeleteOptions +} { + var calls []struct { + Namespace string + Name string + Options *v1.DeleteOptions + } + lockFeatureInterfaceMockDeleteNamespaced.RLock() + calls = mock.calls.DeleteNamespaced + lockFeatureInterfaceMockDeleteNamespaced.RUnlock() + return calls +} + +// Get calls GetFunc. +func (mock *FeatureInterfaceMock) Get(name string, opts v1.GetOptions) (*v3.Feature, error) { + if mock.GetFunc == nil { + panic("FeatureInterfaceMock.GetFunc: method is nil but FeatureInterface.Get was just called") + } + callInfo := struct { + Name string + Opts v1.GetOptions + }{ + Name: name, + Opts: opts, + } + lockFeatureInterfaceMockGet.Lock() + mock.calls.Get = append(mock.calls.Get, callInfo) + lockFeatureInterfaceMockGet.Unlock() + return mock.GetFunc(name, opts) +} + +// GetCalls gets all the calls that were made to Get. +// Check the length with: +// len(mockedFeatureInterface.GetCalls()) +func (mock *FeatureInterfaceMock) GetCalls() []struct { + Name string + Opts v1.GetOptions +} { + var calls []struct { + Name string + Opts v1.GetOptions + } + lockFeatureInterfaceMockGet.RLock() + calls = mock.calls.Get + lockFeatureInterfaceMockGet.RUnlock() + return calls +} + +// GetNamespaced calls GetNamespacedFunc. +func (mock *FeatureInterfaceMock) GetNamespaced(namespace string, name string, opts v1.GetOptions) (*v3.Feature, error) { + if mock.GetNamespacedFunc == nil { + panic("FeatureInterfaceMock.GetNamespacedFunc: method is nil but FeatureInterface.GetNamespaced was just called") + } + callInfo := struct { + Namespace string + Name string + Opts v1.GetOptions + }{ + Namespace: namespace, + Name: name, + Opts: opts, + } + lockFeatureInterfaceMockGetNamespaced.Lock() + mock.calls.GetNamespaced = append(mock.calls.GetNamespaced, callInfo) + lockFeatureInterfaceMockGetNamespaced.Unlock() + return mock.GetNamespacedFunc(namespace, name, opts) +} + +// GetNamespacedCalls gets all the calls that were made to GetNamespaced. +// Check the length with: +// len(mockedFeatureInterface.GetNamespacedCalls()) +func (mock *FeatureInterfaceMock) GetNamespacedCalls() []struct { + Namespace string + Name string + Opts v1.GetOptions +} { + var calls []struct { + Namespace string + Name string + Opts v1.GetOptions + } + lockFeatureInterfaceMockGetNamespaced.RLock() + calls = mock.calls.GetNamespaced + lockFeatureInterfaceMockGetNamespaced.RUnlock() + return calls +} + +// List calls ListFunc. +func (mock *FeatureInterfaceMock) List(opts v1.ListOptions) (*v3.FeatureList, error) { + if mock.ListFunc == nil { + panic("FeatureInterfaceMock.ListFunc: method is nil but FeatureInterface.List was just called") + } + callInfo := struct { + Opts v1.ListOptions + }{ + Opts: opts, + } + lockFeatureInterfaceMockList.Lock() + mock.calls.List = append(mock.calls.List, callInfo) + lockFeatureInterfaceMockList.Unlock() + return mock.ListFunc(opts) +} + +// ListCalls gets all the calls that were made to List. +// Check the length with: +// len(mockedFeatureInterface.ListCalls()) +func (mock *FeatureInterfaceMock) ListCalls() []struct { + Opts v1.ListOptions +} { + var calls []struct { + Opts v1.ListOptions + } + lockFeatureInterfaceMockList.RLock() + calls = mock.calls.List + lockFeatureInterfaceMockList.RUnlock() + return calls +} + +// ObjectClient calls ObjectClientFunc. +func (mock *FeatureInterfaceMock) ObjectClient() *objectclient.ObjectClient { + if mock.ObjectClientFunc == nil { + panic("FeatureInterfaceMock.ObjectClientFunc: method is nil but FeatureInterface.ObjectClient was just called") + } + callInfo := struct { + }{} + lockFeatureInterfaceMockObjectClient.Lock() + mock.calls.ObjectClient = append(mock.calls.ObjectClient, callInfo) + lockFeatureInterfaceMockObjectClient.Unlock() + return mock.ObjectClientFunc() +} + +// ObjectClientCalls gets all the calls that were made to ObjectClient. +// Check the length with: +// len(mockedFeatureInterface.ObjectClientCalls()) +func (mock *FeatureInterfaceMock) ObjectClientCalls() []struct { +} { + var calls []struct { + } + lockFeatureInterfaceMockObjectClient.RLock() + calls = mock.calls.ObjectClient + lockFeatureInterfaceMockObjectClient.RUnlock() + return calls +} + +// Update calls UpdateFunc. +func (mock *FeatureInterfaceMock) Update(in1 *v3.Feature) (*v3.Feature, error) { + if mock.UpdateFunc == nil { + panic("FeatureInterfaceMock.UpdateFunc: method is nil but FeatureInterface.Update was just called") + } + callInfo := struct { + In1 *v3.Feature + }{ + In1: in1, + } + lockFeatureInterfaceMockUpdate.Lock() + mock.calls.Update = append(mock.calls.Update, callInfo) + lockFeatureInterfaceMockUpdate.Unlock() + return mock.UpdateFunc(in1) +} + +// UpdateCalls gets all the calls that were made to Update. +// Check the length with: +// len(mockedFeatureInterface.UpdateCalls()) +func (mock *FeatureInterfaceMock) UpdateCalls() []struct { + In1 *v3.Feature +} { + var calls []struct { + In1 *v3.Feature + } + lockFeatureInterfaceMockUpdate.RLock() + calls = mock.calls.Update + lockFeatureInterfaceMockUpdate.RUnlock() + return calls +} + +// Watch calls WatchFunc. +func (mock *FeatureInterfaceMock) Watch(opts v1.ListOptions) (watch.Interface, error) { + if mock.WatchFunc == nil { + panic("FeatureInterfaceMock.WatchFunc: method is nil but FeatureInterface.Watch was just called") + } + callInfo := struct { + Opts v1.ListOptions + }{ + Opts: opts, + } + lockFeatureInterfaceMockWatch.Lock() + mock.calls.Watch = append(mock.calls.Watch, callInfo) + lockFeatureInterfaceMockWatch.Unlock() + return mock.WatchFunc(opts) +} + +// WatchCalls gets all the calls that were made to Watch. +// Check the length with: +// len(mockedFeatureInterface.WatchCalls()) +func (mock *FeatureInterfaceMock) WatchCalls() []struct { + Opts v1.ListOptions +} { + var calls []struct { + Opts v1.ListOptions + } + lockFeatureInterfaceMockWatch.RLock() + calls = mock.calls.Watch + lockFeatureInterfaceMockWatch.RUnlock() + return calls +} + +var ( + lockFeaturesGetterMockFeatures sync.RWMutex +) + +// Ensure, that FeaturesGetterMock does implement FeaturesGetter. +// If this is not the case, regenerate this file with moq. +var _ v3.FeaturesGetter = &FeaturesGetterMock{} + +// FeaturesGetterMock is a mock implementation of FeaturesGetter. +// +// func TestSomethingThatUsesFeaturesGetter(t *testing.T) { +// +// // make and configure a mocked FeaturesGetter +// mockedFeaturesGetter := &FeaturesGetterMock{ +// FeaturesFunc: func(namespace string) v3.FeatureInterface { +// panic("mock out the Features method") +// }, +// } +// +// // use mockedFeaturesGetter in code that requires FeaturesGetter +// // and then make assertions. +// +// } +type FeaturesGetterMock struct { + // FeaturesFunc mocks the Features method. + FeaturesFunc func(namespace string) v3.FeatureInterface + + // calls tracks calls to the methods. + calls struct { + // Features holds details about calls to the Features method. + Features []struct { + // Namespace is the namespace argument value. + Namespace string + } + } +} + +// Features calls FeaturesFunc. +func (mock *FeaturesGetterMock) Features(namespace string) v3.FeatureInterface { + if mock.FeaturesFunc == nil { + panic("FeaturesGetterMock.FeaturesFunc: method is nil but FeaturesGetter.Features was just called") + } + callInfo := struct { + Namespace string + }{ + Namespace: namespace, + } + lockFeaturesGetterMockFeatures.Lock() + mock.calls.Features = append(mock.calls.Features, callInfo) + lockFeaturesGetterMockFeatures.Unlock() + return mock.FeaturesFunc(namespace) +} + +// FeaturesCalls gets all the calls that were made to Features. +// Check the length with: +// len(mockedFeaturesGetter.FeaturesCalls()) +func (mock *FeaturesGetterMock) FeaturesCalls() []struct { + Namespace string +} { + var calls []struct { + Namespace string + } + lockFeaturesGetterMockFeatures.RLock() + calls = mock.calls.Features + lockFeaturesGetterMockFeatures.RUnlock() + return calls +} diff --git a/apis/management.cattle.io/v3/zz_generated_deepcopy.go b/apis/management.cattle.io/v3/zz_generated_deepcopy.go index 50ed6e8d..0bed2773 100644 --- a/apis/management.cattle.io/v3/zz_generated_deepcopy.go +++ b/apis/management.cattle.io/v3/zz_generated_deepcopy.go @@ -2995,6 +2995,70 @@ func (in *ExportOutput) DeepCopy() *ExportOutput { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Feature) DeepCopyInto(out *Feature) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(bool) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Feature. +func (in *Feature) DeepCopy() *Feature { + if in == nil { + return nil + } + out := new(Feature) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Feature) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FeatureList) DeepCopyInto(out *FeatureList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Feature, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FeatureList. +func (in *FeatureList) DeepCopy() *FeatureList { + if in == nil { + return nil + } + out := new(FeatureList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FeatureList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Field) DeepCopyInto(out *Field) { *out = *in diff --git a/apis/management.cattle.io/v3/zz_generated_feature_controller.go b/apis/management.cattle.io/v3/zz_generated_feature_controller.go new file mode 100644 index 00000000..83b9e703 --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_feature_controller.go @@ -0,0 +1,504 @@ +package v3 + +import ( + "context" + + "github.com/rancher/norman/controller" + "github.com/rancher/norman/objectclient" + "github.com/rancher/norman/resource" + "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 ( + FeatureGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "Feature", + } + FeatureResource = metav1.APIResource{ + Name: "features", + SingularName: "feature", + Namespaced: false, + Kind: FeatureGroupVersionKind.Kind, + } + + FeatureGroupVersionResource = schema.GroupVersionResource{ + Group: GroupName, + Version: Version, + Resource: "features", + } +) + +func init() { + resource.Put(FeatureGroupVersionResource) +} + +func NewFeature(namespace, name string, obj Feature) *Feature { + obj.APIVersion, obj.Kind = FeatureGroupVersionKind.ToAPIVersionAndKind() + obj.Name = name + obj.Namespace = namespace + return &obj +} + +type FeatureList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Feature `json:"items"` +} + +type FeatureHandlerFunc func(key string, obj *Feature) (runtime.Object, error) + +type FeatureChangeHandlerFunc func(obj *Feature) (runtime.Object, error) + +type FeatureLister interface { + List(namespace string, selector labels.Selector) (ret []*Feature, err error) + Get(namespace, name string) (*Feature, error) +} + +type FeatureController interface { + Generic() controller.GenericController + Informer() cache.SharedIndexInformer + Lister() FeatureLister + AddHandler(ctx context.Context, name string, handler FeatureHandlerFunc) + AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync FeatureHandlerFunc) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler FeatureHandlerFunc) + AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, handler FeatureHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type FeatureInterface interface { + ObjectClient() *objectclient.ObjectClient + Create(*Feature) (*Feature, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*Feature, error) + Get(name string, opts metav1.GetOptions) (*Feature, error) + Update(*Feature) (*Feature, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*FeatureList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() FeatureController + AddHandler(ctx context.Context, name string, sync FeatureHandlerFunc) + AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync FeatureHandlerFunc) + AddLifecycle(ctx context.Context, name string, lifecycle FeatureLifecycle) + AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle FeatureLifecycle) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync FeatureHandlerFunc) + AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, sync FeatureHandlerFunc) + AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle FeatureLifecycle) + AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name, clusterName string, lifecycle FeatureLifecycle) +} + +type featureLister struct { + controller *featureController +} + +func (l *featureLister) List(namespace string, selector labels.Selector) (ret []*Feature, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*Feature)) + }) + return +} + +func (l *featureLister) Get(namespace, name string) (*Feature, 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: FeatureGroupVersionKind.Group, + Resource: "feature", + }, key) + } + return obj.(*Feature), nil +} + +type featureController struct { + controller.GenericController +} + +func (c *featureController) Generic() controller.GenericController { + return c.GenericController +} + +func (c *featureController) Lister() FeatureLister { + return &featureLister{ + controller: c, + } +} + +func (c *featureController) AddHandler(ctx context.Context, name string, handler FeatureHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*Feature); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *featureController) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, handler FeatureHandlerFunc) { + 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.(*Feature); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *featureController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler FeatureHandlerFunc) { + resource.PutClusterScoped(FeatureGroupVersionResource) + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*Feature); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *featureController) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, cluster string, handler FeatureHandlerFunc) { + resource.PutClusterScoped(FeatureGroupVersionResource) + 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.(*Feature); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +type featureFactory struct { +} + +func (c featureFactory) Object() runtime.Object { + return &Feature{} +} + +func (c featureFactory) List() runtime.Object { + return &FeatureList{} +} + +func (s *featureClient) Controller() FeatureController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.featureControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(FeatureGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &featureController{ + GenericController: genericController, + } + + s.client.featureControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type featureClient struct { + client *Client + ns string + objectClient *objectclient.ObjectClient + controller FeatureController +} + +func (s *featureClient) ObjectClient() *objectclient.ObjectClient { + return s.objectClient +} + +func (s *featureClient) Create(o *Feature) (*Feature, error) { + obj, err := s.objectClient.Create(o) + return obj.(*Feature), err +} + +func (s *featureClient) Get(name string, opts metav1.GetOptions) (*Feature, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*Feature), err +} + +func (s *featureClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*Feature, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*Feature), err +} + +func (s *featureClient) Update(o *Feature) (*Feature, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*Feature), err +} + +func (s *featureClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *featureClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *featureClient) List(opts metav1.ListOptions) (*FeatureList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*FeatureList), err +} + +func (s *featureClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *featureClient) Patch(o *Feature, patchType types.PatchType, data []byte, subresources ...string) (*Feature, error) { + obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...) + return obj.(*Feature), err +} + +func (s *featureClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *featureClient) AddHandler(ctx context.Context, name string, sync FeatureHandlerFunc) { + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *featureClient) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync FeatureHandlerFunc) { + s.Controller().AddFeatureHandler(ctx, enabled, name, sync) +} + +func (s *featureClient) AddLifecycle(ctx context.Context, name string, lifecycle FeatureLifecycle) { + sync := NewFeatureLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *featureClient) AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle FeatureLifecycle) { + sync := NewFeatureLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddFeatureHandler(ctx, enabled, name, sync) +} + +func (s *featureClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync FeatureHandlerFunc) { + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *featureClient) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, sync FeatureHandlerFunc) { + s.Controller().AddClusterScopedFeatureHandler(ctx, enabled, name, clusterName, sync) +} + +func (s *featureClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle FeatureLifecycle) { + sync := NewFeatureLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *featureClient) AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name, clusterName string, lifecycle FeatureLifecycle) { + sync := NewFeatureLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedFeatureHandler(ctx, enabled, name, clusterName, sync) +} + +type FeatureIndexer func(obj *Feature) ([]string, error) + +type FeatureClientCache interface { + Get(namespace, name string) (*Feature, error) + List(namespace string, selector labels.Selector) ([]*Feature, error) + + Index(name string, indexer FeatureIndexer) + GetIndexed(name, key string) ([]*Feature, error) +} + +type FeatureClient interface { + Create(*Feature) (*Feature, error) + Get(namespace, name string, opts metav1.GetOptions) (*Feature, error) + Update(*Feature) (*Feature, error) + Delete(namespace, name string, options *metav1.DeleteOptions) error + List(namespace string, opts metav1.ListOptions) (*FeatureList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + + Cache() FeatureClientCache + + OnCreate(ctx context.Context, name string, sync FeatureChangeHandlerFunc) + OnChange(ctx context.Context, name string, sync FeatureChangeHandlerFunc) + OnRemove(ctx context.Context, name string, sync FeatureChangeHandlerFunc) + Enqueue(namespace, name string) + + Generic() controller.GenericController + ObjectClient() *objectclient.ObjectClient + Interface() FeatureInterface +} + +type featureClientCache struct { + client *featureClient2 +} + +type featureClient2 struct { + iface FeatureInterface + controller FeatureController +} + +func (n *featureClient2) Interface() FeatureInterface { + return n.iface +} + +func (n *featureClient2) Generic() controller.GenericController { + return n.iface.Controller().Generic() +} + +func (n *featureClient2) ObjectClient() *objectclient.ObjectClient { + return n.Interface().ObjectClient() +} + +func (n *featureClient2) Enqueue(namespace, name string) { + n.iface.Controller().Enqueue(namespace, name) +} + +func (n *featureClient2) Create(obj *Feature) (*Feature, error) { + return n.iface.Create(obj) +} + +func (n *featureClient2) Get(namespace, name string, opts metav1.GetOptions) (*Feature, error) { + return n.iface.GetNamespaced(namespace, name, opts) +} + +func (n *featureClient2) Update(obj *Feature) (*Feature, error) { + return n.iface.Update(obj) +} + +func (n *featureClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error { + return n.iface.DeleteNamespaced(namespace, name, options) +} + +func (n *featureClient2) List(namespace string, opts metav1.ListOptions) (*FeatureList, error) { + return n.iface.List(opts) +} + +func (n *featureClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return n.iface.Watch(opts) +} + +func (n *featureClientCache) Get(namespace, name string) (*Feature, error) { + return n.client.controller.Lister().Get(namespace, name) +} + +func (n *featureClientCache) List(namespace string, selector labels.Selector) ([]*Feature, error) { + return n.client.controller.Lister().List(namespace, selector) +} + +func (n *featureClient2) Cache() FeatureClientCache { + n.loadController() + return &featureClientCache{ + client: n, + } +} + +func (n *featureClient2) OnCreate(ctx context.Context, name string, sync FeatureChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-create", &featureLifecycleDelegate{create: sync}) +} + +func (n *featureClient2) OnChange(ctx context.Context, name string, sync FeatureChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-change", &featureLifecycleDelegate{update: sync}) +} + +func (n *featureClient2) OnRemove(ctx context.Context, name string, sync FeatureChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name, &featureLifecycleDelegate{remove: sync}) +} + +func (n *featureClientCache) Index(name string, indexer FeatureIndexer) { + err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{ + name: func(obj interface{}) ([]string, error) { + if v, ok := obj.(*Feature); ok { + return indexer(v) + } + return nil, nil + }, + }) + + if err != nil { + panic(err) + } +} + +func (n *featureClientCache) GetIndexed(name, key string) ([]*Feature, error) { + var result []*Feature + objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key) + if err != nil { + return nil, err + } + for _, obj := range objs { + if v, ok := obj.(*Feature); ok { + result = append(result, v) + } + } + + return result, nil +} + +func (n *featureClient2) loadController() { + if n.controller == nil { + n.controller = n.iface.Controller() + } +} + +type featureLifecycleDelegate struct { + create FeatureChangeHandlerFunc + update FeatureChangeHandlerFunc + remove FeatureChangeHandlerFunc +} + +func (n *featureLifecycleDelegate) HasCreate() bool { + return n.create != nil +} + +func (n *featureLifecycleDelegate) Create(obj *Feature) (runtime.Object, error) { + if n.create == nil { + return obj, nil + } + return n.create(obj) +} + +func (n *featureLifecycleDelegate) HasFinalize() bool { + return n.remove != nil +} + +func (n *featureLifecycleDelegate) Remove(obj *Feature) (runtime.Object, error) { + if n.remove == nil { + return obj, nil + } + return n.remove(obj) +} + +func (n *featureLifecycleDelegate) Updated(obj *Feature) (runtime.Object, error) { + if n.update == nil { + return obj, nil + } + return n.update(obj) +} diff --git a/apis/management.cattle.io/v3/zz_generated_feature_lifecycle_adapter.go b/apis/management.cattle.io/v3/zz_generated_feature_lifecycle_adapter.go new file mode 100644 index 00000000..07339e23 --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_feature_lifecycle_adapter.go @@ -0,0 +1,62 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type FeatureLifecycle interface { + Create(obj *Feature) (runtime.Object, error) + Remove(obj *Feature) (runtime.Object, error) + Updated(obj *Feature) (runtime.Object, error) +} + +type featureLifecycleAdapter struct { + lifecycle FeatureLifecycle +} + +func (w *featureLifecycleAdapter) HasCreate() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasCreate() +} + +func (w *featureLifecycleAdapter) HasFinalize() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasFinalize() +} + +func (w *featureLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*Feature)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *featureLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*Feature)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *featureLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*Feature)) + if o == nil { + return nil, err + } + return o, err +} + +func NewFeatureLifecycleAdapter(name string, clusterScoped bool, client FeatureInterface, l FeatureLifecycle) FeatureHandlerFunc { + adapter := &featureLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *Feature) (runtime.Object, error) { + newObj, err := syncFn(key, obj) + if o, ok := newObj.(runtime.Object); ok { + return o, err + } + return nil, err + } +} diff --git a/apis/management.cattle.io/v3/zz_generated_k8s_client.go b/apis/management.cattle.io/v3/zz_generated_k8s_client.go index ba576969..ef92288c 100644 --- a/apis/management.cattle.io/v3/zz_generated_k8s_client.go +++ b/apis/management.cattle.io/v3/zz_generated_k8s_client.go @@ -55,6 +55,7 @@ type Interface interface { ProjectLoggingsGetter ListenConfigsGetter SettingsGetter + FeaturesGetter ClusterAlertsGetter ProjectAlertsGetter NotifiersGetter @@ -118,6 +119,7 @@ type Clients struct { ProjectLogging ProjectLoggingClient ListenConfig ListenConfigClient Setting SettingClient + Feature FeatureClient ClusterAlert ClusterAlertClient ProjectAlert ProjectAlertClient Notifier NotifierClient @@ -183,6 +185,7 @@ type Client struct { projectLoggingControllers map[string]ProjectLoggingController listenConfigControllers map[string]ListenConfigController settingControllers map[string]SettingController + featureControllers map[string]FeatureController clusterAlertControllers map[string]ClusterAlertController projectAlertControllers map[string]ProjectAlertController notifierControllers map[string]NotifierController @@ -346,6 +349,9 @@ func NewClientsFromInterface(iface Interface) *Clients { Setting: &settingClient2{ iface: iface.Settings(""), }, + Feature: &featureClient2{ + iface: iface.Features(""), + }, ClusterAlert: &clusterAlertClient2{ iface: iface.ClusterAlerts(""), }, @@ -466,6 +472,7 @@ func NewForConfig(config rest.Config) (Interface, error) { projectLoggingControllers: map[string]ProjectLoggingController{}, listenConfigControllers: map[string]ListenConfigController{}, settingControllers: map[string]SettingController{}, + featureControllers: map[string]FeatureController{}, clusterAlertControllers: map[string]ClusterAlertController{}, projectAlertControllers: map[string]ProjectAlertController{}, notifierControllers: map[string]NotifierController{}, @@ -959,6 +966,19 @@ func (c *Client) Settings(namespace string) SettingInterface { } } +type FeaturesGetter interface { + Features(namespace string) FeatureInterface +} + +func (c *Client) Features(namespace string) FeatureInterface { + objectClient := objectclient.NewObjectClient(namespace, c.restClient, &FeatureResource, FeatureGroupVersionKind, featureFactory{}) + return &featureClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + type ClusterAlertsGetter interface { ClusterAlerts(namespace string) ClusterAlertInterface } diff --git a/apis/management.cattle.io/v3/zz_generated_scheme.go b/apis/management.cattle.io/v3/zz_generated_scheme.go index f7604600..fe5c9eff 100644 --- a/apis/management.cattle.io/v3/zz_generated_scheme.go +++ b/apis/management.cattle.io/v3/zz_generated_scheme.go @@ -103,6 +103,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &ListenConfigList{}, &Setting{}, &SettingList{}, + &Feature{}, + &FeatureList{}, &ClusterAlert{}, &ClusterAlertList{}, &ProjectAlert{}, diff --git a/client/management/v3/zz_generated_client.go b/client/management/v3/zz_generated_client.go index ca57ae32..ef0a91e8 100644 --- a/client/management/v3/zz_generated_client.go +++ b/client/management/v3/zz_generated_client.go @@ -41,6 +41,7 @@ type Client struct { ProjectLogging ProjectLoggingOperations ListenConfig ListenConfigOperations Setting SettingOperations + Feature FeatureOperations ClusterAlert ClusterAlertOperations ProjectAlert ProjectAlertOperations Notifier NotifierOperations @@ -111,6 +112,7 @@ func NewClient(opts *clientbase.ClientOpts) (*Client, error) { client.ProjectLogging = newProjectLoggingClient(client) client.ListenConfig = newListenConfigClient(client) client.Setting = newSettingClient(client) + client.Feature = newFeatureClient(client) client.ClusterAlert = newClusterAlertClient(client) client.ProjectAlert = newProjectAlertClient(client) client.Notifier = newNotifierClient(client) diff --git a/client/management/v3/zz_generated_feature.go b/client/management/v3/zz_generated_feature.go new file mode 100644 index 00000000..4d4c6c35 --- /dev/null +++ b/client/management/v3/zz_generated_feature.go @@ -0,0 +1,103 @@ +package client + +import ( + "github.com/rancher/norman/types" +) + +const ( + FeatureType = "feature" + FeatureFieldAnnotations = "annotations" + FeatureFieldCreated = "created" + FeatureFieldCreatorID = "creatorId" + FeatureFieldDefault = "default" + FeatureFieldLabels = "labels" + FeatureFieldName = "name" + FeatureFieldOwnerReferences = "ownerReferences" + FeatureFieldRemoved = "removed" + FeatureFieldUUID = "uuid" + FeatureFieldValue = "value" +) + +type Feature struct { + types.Resource + Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` + Created string `json:"created,omitempty" yaml:"created,omitempty"` + CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"` + Default bool `json:"default,omitempty" yaml:"default,omitempty"` + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"` + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + Value *bool `json:"value,omitempty" yaml:"value,omitempty"` +} + +type FeatureCollection struct { + types.Collection + Data []Feature `json:"data,omitempty"` + client *FeatureClient +} + +type FeatureClient struct { + apiClient *Client +} + +type FeatureOperations interface { + List(opts *types.ListOpts) (*FeatureCollection, error) + Create(opts *Feature) (*Feature, error) + Update(existing *Feature, updates interface{}) (*Feature, error) + Replace(existing *Feature) (*Feature, error) + ByID(id string) (*Feature, error) + Delete(container *Feature) error +} + +func newFeatureClient(apiClient *Client) *FeatureClient { + return &FeatureClient{ + apiClient: apiClient, + } +} + +func (c *FeatureClient) Create(container *Feature) (*Feature, error) { + resp := &Feature{} + err := c.apiClient.Ops.DoCreate(FeatureType, container, resp) + return resp, err +} + +func (c *FeatureClient) Update(existing *Feature, updates interface{}) (*Feature, error) { + resp := &Feature{} + err := c.apiClient.Ops.DoUpdate(FeatureType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *FeatureClient) Replace(obj *Feature) (*Feature, error) { + resp := &Feature{} + err := c.apiClient.Ops.DoReplace(FeatureType, &obj.Resource, obj, resp) + return resp, err +} + +func (c *FeatureClient) List(opts *types.ListOpts) (*FeatureCollection, error) { + resp := &FeatureCollection{} + err := c.apiClient.Ops.DoList(FeatureType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *FeatureCollection) Next() (*FeatureCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &FeatureCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *FeatureClient) ByID(id string) (*Feature, error) { + resp := &Feature{} + err := c.apiClient.Ops.DoByID(FeatureType, id, resp) + return resp, err +} + +func (c *FeatureClient) Delete(container *Feature) error { + return c.apiClient.Ops.DoResourceDelete(FeatureType, &container.Resource) +} diff --git a/compose/zz_generated_compose.go b/compose/zz_generated_compose.go index 417f99b1..c7363a20 100644 --- a/compose/zz_generated_compose.go +++ b/compose/zz_generated_compose.go @@ -40,6 +40,7 @@ type Config struct { ProjectLoggings map[string]managementClient.ProjectLogging `json:"projectLoggings,omitempty" yaml:"projectLoggings,omitempty"` ListenConfigs map[string]managementClient.ListenConfig `json:"listenConfigs,omitempty" yaml:"listenConfigs,omitempty"` Settings map[string]managementClient.Setting `json:"settings,omitempty" yaml:"settings,omitempty"` + Features map[string]managementClient.Feature `json:"features,omitempty" yaml:"features,omitempty"` ClusterAlerts map[string]managementClient.ClusterAlert `json:"clusterAlerts,omitempty" yaml:"clusterAlerts,omitempty"` ProjectAlerts map[string]managementClient.ProjectAlert `json:"projectAlerts,omitempty" yaml:"projectAlerts,omitempty"` Notifiers map[string]managementClient.Notifier `json:"notifiers,omitempty" yaml:"notifiers,omitempty"`