1
0
mirror of https://github.com/rancher/types.git synced 2025-09-15 22:39:05 +00:00

go generate

This commit is contained in:
rmweir
2019-06-24 15:31:32 -07:00
parent 5cd54f9c21
commit 46ed3c5443
226 changed files with 51980 additions and 2599 deletions

View File

@@ -141,14 +141,16 @@ func (mock *CronJobListerMock) ListCalls() []struct {
}
var (
lockCronJobControllerMockAddClusterScopedHandler sync.RWMutex
lockCronJobControllerMockAddHandler sync.RWMutex
lockCronJobControllerMockEnqueue sync.RWMutex
lockCronJobControllerMockGeneric sync.RWMutex
lockCronJobControllerMockInformer sync.RWMutex
lockCronJobControllerMockLister sync.RWMutex
lockCronJobControllerMockStart sync.RWMutex
lockCronJobControllerMockSync sync.RWMutex
lockCronJobControllerMockAddClusterScopedFeatureHandler sync.RWMutex
lockCronJobControllerMockAddClusterScopedHandler sync.RWMutex
lockCronJobControllerMockAddFeatureHandler sync.RWMutex
lockCronJobControllerMockAddHandler sync.RWMutex
lockCronJobControllerMockEnqueue sync.RWMutex
lockCronJobControllerMockGeneric sync.RWMutex
lockCronJobControllerMockInformer sync.RWMutex
lockCronJobControllerMockLister sync.RWMutex
lockCronJobControllerMockStart sync.RWMutex
lockCronJobControllerMockSync sync.RWMutex
)
// Ensure, that CronJobControllerMock does implement CronJobController.
@@ -161,9 +163,15 @@ var _ v1beta1a.CronJobController = &CronJobControllerMock{}
//
// // make and configure a mocked CronJobController
// mockedCronJobController := &CronJobControllerMock{
// AddClusterScopedFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, clusterName string, handler v1beta1a.CronJobHandlerFunc) {
// panic("mock out the AddClusterScopedFeatureHandler method")
// },
// AddClusterScopedHandlerFunc: func(ctx context.Context, name string, clusterName string, handler v1beta1a.CronJobHandlerFunc) {
// panic("mock out the AddClusterScopedHandler method")
// },
// AddFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, sync v1beta1a.CronJobHandlerFunc) {
// panic("mock out the AddFeatureHandler method")
// },
// AddHandlerFunc: func(ctx context.Context, name string, handler v1beta1a.CronJobHandlerFunc) {
// panic("mock out the AddHandler method")
// },
@@ -192,9 +200,15 @@ var _ v1beta1a.CronJobController = &CronJobControllerMock{}
//
// }
type CronJobControllerMock struct {
// AddClusterScopedFeatureHandlerFunc mocks the AddClusterScopedFeatureHandler method.
AddClusterScopedFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, clusterName string, handler v1beta1a.CronJobHandlerFunc)
// AddClusterScopedHandlerFunc mocks the AddClusterScopedHandler method.
AddClusterScopedHandlerFunc func(ctx context.Context, name string, clusterName string, handler v1beta1a.CronJobHandlerFunc)
// AddFeatureHandlerFunc mocks the AddFeatureHandler method.
AddFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, sync v1beta1a.CronJobHandlerFunc)
// AddHandlerFunc mocks the AddHandler method.
AddHandlerFunc func(ctx context.Context, name string, handler v1beta1a.CronJobHandlerFunc)
@@ -218,6 +232,19 @@ type CronJobControllerMock struct {
// 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 v1beta1a.CronJobHandlerFunc
}
// AddClusterScopedHandler holds details about calls to the AddClusterScopedHandler method.
AddClusterScopedHandler []struct {
// Ctx is the ctx argument value.
@@ -229,6 +256,17 @@ type CronJobControllerMock struct {
// Handler is the handler argument value.
Handler v1beta1a.CronJobHandlerFunc
}
// 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 v1beta1a.CronJobHandlerFunc
}
// AddHandler holds details about calls to the AddHandler method.
AddHandler []struct {
// Ctx is the ctx argument value.
@@ -269,6 +307,53 @@ type CronJobControllerMock struct {
}
}
// AddClusterScopedFeatureHandler calls AddClusterScopedFeatureHandlerFunc.
func (mock *CronJobControllerMock) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name string, clusterName string, handler v1beta1a.CronJobHandlerFunc) {
if mock.AddClusterScopedFeatureHandlerFunc == nil {
panic("CronJobControllerMock.AddClusterScopedFeatureHandlerFunc: method is nil but CronJobController.AddClusterScopedFeatureHandler was just called")
}
callInfo := struct {
Ctx context.Context
Enabled func() bool
Name string
ClusterName string
Handler v1beta1a.CronJobHandlerFunc
}{
Ctx: ctx,
Enabled: enabled,
Name: name,
ClusterName: clusterName,
Handler: handler,
}
lockCronJobControllerMockAddClusterScopedFeatureHandler.Lock()
mock.calls.AddClusterScopedFeatureHandler = append(mock.calls.AddClusterScopedFeatureHandler, callInfo)
lockCronJobControllerMockAddClusterScopedFeatureHandler.Unlock()
mock.AddClusterScopedFeatureHandlerFunc(ctx, enabled, name, clusterName, handler)
}
// AddClusterScopedFeatureHandlerCalls gets all the calls that were made to AddClusterScopedFeatureHandler.
// Check the length with:
// len(mockedCronJobController.AddClusterScopedFeatureHandlerCalls())
func (mock *CronJobControllerMock) AddClusterScopedFeatureHandlerCalls() []struct {
Ctx context.Context
Enabled func() bool
Name string
ClusterName string
Handler v1beta1a.CronJobHandlerFunc
} {
var calls []struct {
Ctx context.Context
Enabled func() bool
Name string
ClusterName string
Handler v1beta1a.CronJobHandlerFunc
}
lockCronJobControllerMockAddClusterScopedFeatureHandler.RLock()
calls = mock.calls.AddClusterScopedFeatureHandler
lockCronJobControllerMockAddClusterScopedFeatureHandler.RUnlock()
return calls
}
// AddClusterScopedHandler calls AddClusterScopedHandlerFunc.
func (mock *CronJobControllerMock) AddClusterScopedHandler(ctx context.Context, name string, clusterName string, handler v1beta1a.CronJobHandlerFunc) {
if mock.AddClusterScopedHandlerFunc == nil {
@@ -312,6 +397,49 @@ func (mock *CronJobControllerMock) AddClusterScopedHandlerCalls() []struct {
return calls
}
// AddFeatureHandler calls AddFeatureHandlerFunc.
func (mock *CronJobControllerMock) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync v1beta1a.CronJobHandlerFunc) {
if mock.AddFeatureHandlerFunc == nil {
panic("CronJobControllerMock.AddFeatureHandlerFunc: method is nil but CronJobController.AddFeatureHandler was just called")
}
callInfo := struct {
Ctx context.Context
Enabled func() bool
Name string
Sync v1beta1a.CronJobHandlerFunc
}{
Ctx: ctx,
Enabled: enabled,
Name: name,
Sync: sync,
}
lockCronJobControllerMockAddFeatureHandler.Lock()
mock.calls.AddFeatureHandler = append(mock.calls.AddFeatureHandler, callInfo)
lockCronJobControllerMockAddFeatureHandler.Unlock()
mock.AddFeatureHandlerFunc(ctx, enabled, name, sync)
}
// AddFeatureHandlerCalls gets all the calls that were made to AddFeatureHandler.
// Check the length with:
// len(mockedCronJobController.AddFeatureHandlerCalls())
func (mock *CronJobControllerMock) AddFeatureHandlerCalls() []struct {
Ctx context.Context
Enabled func() bool
Name string
Sync v1beta1a.CronJobHandlerFunc
} {
var calls []struct {
Ctx context.Context
Enabled func() bool
Name string
Sync v1beta1a.CronJobHandlerFunc
}
lockCronJobControllerMockAddFeatureHandler.RLock()
calls = mock.calls.AddFeatureHandler
lockCronJobControllerMockAddFeatureHandler.RUnlock()
return calls
}
// AddHandler calls AddHandlerFunc.
func (mock *CronJobControllerMock) AddHandler(ctx context.Context, name string, handler v1beta1a.CronJobHandlerFunc) {
if mock.AddHandlerFunc == nil {
@@ -531,21 +659,25 @@ func (mock *CronJobControllerMock) SyncCalls() []struct {
}
var (
lockCronJobInterfaceMockAddClusterScopedHandler sync.RWMutex
lockCronJobInterfaceMockAddClusterScopedLifecycle sync.RWMutex
lockCronJobInterfaceMockAddHandler sync.RWMutex
lockCronJobInterfaceMockAddLifecycle sync.RWMutex
lockCronJobInterfaceMockController sync.RWMutex
lockCronJobInterfaceMockCreate sync.RWMutex
lockCronJobInterfaceMockDelete sync.RWMutex
lockCronJobInterfaceMockDeleteCollection sync.RWMutex
lockCronJobInterfaceMockDeleteNamespaced sync.RWMutex
lockCronJobInterfaceMockGet sync.RWMutex
lockCronJobInterfaceMockGetNamespaced sync.RWMutex
lockCronJobInterfaceMockList sync.RWMutex
lockCronJobInterfaceMockObjectClient sync.RWMutex
lockCronJobInterfaceMockUpdate sync.RWMutex
lockCronJobInterfaceMockWatch sync.RWMutex
lockCronJobInterfaceMockAddClusterScopedFeatureHandler sync.RWMutex
lockCronJobInterfaceMockAddClusterScopedFeatureLifecycle sync.RWMutex
lockCronJobInterfaceMockAddClusterScopedHandler sync.RWMutex
lockCronJobInterfaceMockAddClusterScopedLifecycle sync.RWMutex
lockCronJobInterfaceMockAddFeatureHandler sync.RWMutex
lockCronJobInterfaceMockAddFeatureLifecycle sync.RWMutex
lockCronJobInterfaceMockAddHandler sync.RWMutex
lockCronJobInterfaceMockAddLifecycle sync.RWMutex
lockCronJobInterfaceMockController sync.RWMutex
lockCronJobInterfaceMockCreate sync.RWMutex
lockCronJobInterfaceMockDelete sync.RWMutex
lockCronJobInterfaceMockDeleteCollection sync.RWMutex
lockCronJobInterfaceMockDeleteNamespaced sync.RWMutex
lockCronJobInterfaceMockGet sync.RWMutex
lockCronJobInterfaceMockGetNamespaced sync.RWMutex
lockCronJobInterfaceMockList sync.RWMutex
lockCronJobInterfaceMockObjectClient sync.RWMutex
lockCronJobInterfaceMockUpdate sync.RWMutex
lockCronJobInterfaceMockWatch sync.RWMutex
)
// Ensure, that CronJobInterfaceMock does implement CronJobInterface.
@@ -558,12 +690,24 @@ var _ v1beta1a.CronJobInterface = &CronJobInterfaceMock{}
//
// // make and configure a mocked CronJobInterface
// mockedCronJobInterface := &CronJobInterfaceMock{
// AddClusterScopedFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, clusterName string, sync v1beta1a.CronJobHandlerFunc) {
// panic("mock out the AddClusterScopedFeatureHandler method")
// },
// AddClusterScopedFeatureLifecycleFunc: func(ctx context.Context, enabled func() bool, name string, clusterName string, lifecycle v1beta1a.CronJobLifecycle) {
// panic("mock out the AddClusterScopedFeatureLifecycle method")
// },
// AddClusterScopedHandlerFunc: func(ctx context.Context, name string, clusterName string, sync v1beta1a.CronJobHandlerFunc) {
// panic("mock out the AddClusterScopedHandler method")
// },
// AddClusterScopedLifecycleFunc: func(ctx context.Context, name string, clusterName string, lifecycle v1beta1a.CronJobLifecycle) {
// panic("mock out the AddClusterScopedLifecycle method")
// },
// AddFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, sync v1beta1a.CronJobHandlerFunc) {
// panic("mock out the AddFeatureHandler method")
// },
// AddFeatureLifecycleFunc: func(ctx context.Context, enabled func() bool, name string, lifecycle v1beta1a.CronJobLifecycle) {
// panic("mock out the AddFeatureLifecycle method")
// },
// AddHandlerFunc: func(ctx context.Context, name string, sync v1beta1a.CronJobHandlerFunc) {
// panic("mock out the AddHandler method")
// },
@@ -610,12 +754,24 @@ var _ v1beta1a.CronJobInterface = &CronJobInterfaceMock{}
//
// }
type CronJobInterfaceMock struct {
// AddClusterScopedFeatureHandlerFunc mocks the AddClusterScopedFeatureHandler method.
AddClusterScopedFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, clusterName string, sync v1beta1a.CronJobHandlerFunc)
// AddClusterScopedFeatureLifecycleFunc mocks the AddClusterScopedFeatureLifecycle method.
AddClusterScopedFeatureLifecycleFunc func(ctx context.Context, enabled func() bool, name string, clusterName string, lifecycle v1beta1a.CronJobLifecycle)
// AddClusterScopedHandlerFunc mocks the AddClusterScopedHandler method.
AddClusterScopedHandlerFunc func(ctx context.Context, name string, clusterName string, sync v1beta1a.CronJobHandlerFunc)
// AddClusterScopedLifecycleFunc mocks the AddClusterScopedLifecycle method.
AddClusterScopedLifecycleFunc func(ctx context.Context, name string, clusterName string, lifecycle v1beta1a.CronJobLifecycle)
// AddFeatureHandlerFunc mocks the AddFeatureHandler method.
AddFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, sync v1beta1a.CronJobHandlerFunc)
// AddFeatureLifecycleFunc mocks the AddFeatureLifecycle method.
AddFeatureLifecycleFunc func(ctx context.Context, enabled func() bool, name string, lifecycle v1beta1a.CronJobLifecycle)
// AddHandlerFunc mocks the AddHandler method.
AddHandlerFunc func(ctx context.Context, name string, sync v1beta1a.CronJobHandlerFunc)
@@ -657,6 +813,32 @@ type CronJobInterfaceMock struct {
// 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 v1beta1a.CronJobHandlerFunc
}
// 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 v1beta1a.CronJobLifecycle
}
// AddClusterScopedHandler holds details about calls to the AddClusterScopedHandler method.
AddClusterScopedHandler []struct {
// Ctx is the ctx argument value.
@@ -679,6 +861,28 @@ type CronJobInterfaceMock struct {
// Lifecycle is the lifecycle argument value.
Lifecycle v1beta1a.CronJobLifecycle
}
// 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 v1beta1a.CronJobHandlerFunc
}
// 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 v1beta1a.CronJobLifecycle
}
// AddHandler holds details about calls to the AddHandler method.
AddHandler []struct {
// Ctx is the ctx argument value.
@@ -765,6 +969,100 @@ type CronJobInterfaceMock struct {
}
}
// AddClusterScopedFeatureHandler calls AddClusterScopedFeatureHandlerFunc.
func (mock *CronJobInterfaceMock) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name string, clusterName string, sync v1beta1a.CronJobHandlerFunc) {
if mock.AddClusterScopedFeatureHandlerFunc == nil {
panic("CronJobInterfaceMock.AddClusterScopedFeatureHandlerFunc: method is nil but CronJobInterface.AddClusterScopedFeatureHandler was just called")
}
callInfo := struct {
Ctx context.Context
Enabled func() bool
Name string
ClusterName string
Sync v1beta1a.CronJobHandlerFunc
}{
Ctx: ctx,
Enabled: enabled,
Name: name,
ClusterName: clusterName,
Sync: sync,
}
lockCronJobInterfaceMockAddClusterScopedFeatureHandler.Lock()
mock.calls.AddClusterScopedFeatureHandler = append(mock.calls.AddClusterScopedFeatureHandler, callInfo)
lockCronJobInterfaceMockAddClusterScopedFeatureHandler.Unlock()
mock.AddClusterScopedFeatureHandlerFunc(ctx, enabled, name, clusterName, sync)
}
// AddClusterScopedFeatureHandlerCalls gets all the calls that were made to AddClusterScopedFeatureHandler.
// Check the length with:
// len(mockedCronJobInterface.AddClusterScopedFeatureHandlerCalls())
func (mock *CronJobInterfaceMock) AddClusterScopedFeatureHandlerCalls() []struct {
Ctx context.Context
Enabled func() bool
Name string
ClusterName string
Sync v1beta1a.CronJobHandlerFunc
} {
var calls []struct {
Ctx context.Context
Enabled func() bool
Name string
ClusterName string
Sync v1beta1a.CronJobHandlerFunc
}
lockCronJobInterfaceMockAddClusterScopedFeatureHandler.RLock()
calls = mock.calls.AddClusterScopedFeatureHandler
lockCronJobInterfaceMockAddClusterScopedFeatureHandler.RUnlock()
return calls
}
// AddClusterScopedFeatureLifecycle calls AddClusterScopedFeatureLifecycleFunc.
func (mock *CronJobInterfaceMock) AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name string, clusterName string, lifecycle v1beta1a.CronJobLifecycle) {
if mock.AddClusterScopedFeatureLifecycleFunc == nil {
panic("CronJobInterfaceMock.AddClusterScopedFeatureLifecycleFunc: method is nil but CronJobInterface.AddClusterScopedFeatureLifecycle was just called")
}
callInfo := struct {
Ctx context.Context
Enabled func() bool
Name string
ClusterName string
Lifecycle v1beta1a.CronJobLifecycle
}{
Ctx: ctx,
Enabled: enabled,
Name: name,
ClusterName: clusterName,
Lifecycle: lifecycle,
}
lockCronJobInterfaceMockAddClusterScopedFeatureLifecycle.Lock()
mock.calls.AddClusterScopedFeatureLifecycle = append(mock.calls.AddClusterScopedFeatureLifecycle, callInfo)
lockCronJobInterfaceMockAddClusterScopedFeatureLifecycle.Unlock()
mock.AddClusterScopedFeatureLifecycleFunc(ctx, enabled, name, clusterName, lifecycle)
}
// AddClusterScopedFeatureLifecycleCalls gets all the calls that were made to AddClusterScopedFeatureLifecycle.
// Check the length with:
// len(mockedCronJobInterface.AddClusterScopedFeatureLifecycleCalls())
func (mock *CronJobInterfaceMock) AddClusterScopedFeatureLifecycleCalls() []struct {
Ctx context.Context
Enabled func() bool
Name string
ClusterName string
Lifecycle v1beta1a.CronJobLifecycle
} {
var calls []struct {
Ctx context.Context
Enabled func() bool
Name string
ClusterName string
Lifecycle v1beta1a.CronJobLifecycle
}
lockCronJobInterfaceMockAddClusterScopedFeatureLifecycle.RLock()
calls = mock.calls.AddClusterScopedFeatureLifecycle
lockCronJobInterfaceMockAddClusterScopedFeatureLifecycle.RUnlock()
return calls
}
// AddClusterScopedHandler calls AddClusterScopedHandlerFunc.
func (mock *CronJobInterfaceMock) AddClusterScopedHandler(ctx context.Context, name string, clusterName string, sync v1beta1a.CronJobHandlerFunc) {
if mock.AddClusterScopedHandlerFunc == nil {
@@ -851,6 +1149,92 @@ func (mock *CronJobInterfaceMock) AddClusterScopedLifecycleCalls() []struct {
return calls
}
// AddFeatureHandler calls AddFeatureHandlerFunc.
func (mock *CronJobInterfaceMock) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync v1beta1a.CronJobHandlerFunc) {
if mock.AddFeatureHandlerFunc == nil {
panic("CronJobInterfaceMock.AddFeatureHandlerFunc: method is nil but CronJobInterface.AddFeatureHandler was just called")
}
callInfo := struct {
Ctx context.Context
Enabled func() bool
Name string
Sync v1beta1a.CronJobHandlerFunc
}{
Ctx: ctx,
Enabled: enabled,
Name: name,
Sync: sync,
}
lockCronJobInterfaceMockAddFeatureHandler.Lock()
mock.calls.AddFeatureHandler = append(mock.calls.AddFeatureHandler, callInfo)
lockCronJobInterfaceMockAddFeatureHandler.Unlock()
mock.AddFeatureHandlerFunc(ctx, enabled, name, sync)
}
// AddFeatureHandlerCalls gets all the calls that were made to AddFeatureHandler.
// Check the length with:
// len(mockedCronJobInterface.AddFeatureHandlerCalls())
func (mock *CronJobInterfaceMock) AddFeatureHandlerCalls() []struct {
Ctx context.Context
Enabled func() bool
Name string
Sync v1beta1a.CronJobHandlerFunc
} {
var calls []struct {
Ctx context.Context
Enabled func() bool
Name string
Sync v1beta1a.CronJobHandlerFunc
}
lockCronJobInterfaceMockAddFeatureHandler.RLock()
calls = mock.calls.AddFeatureHandler
lockCronJobInterfaceMockAddFeatureHandler.RUnlock()
return calls
}
// AddFeatureLifecycle calls AddFeatureLifecycleFunc.
func (mock *CronJobInterfaceMock) AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle v1beta1a.CronJobLifecycle) {
if mock.AddFeatureLifecycleFunc == nil {
panic("CronJobInterfaceMock.AddFeatureLifecycleFunc: method is nil but CronJobInterface.AddFeatureLifecycle was just called")
}
callInfo := struct {
Ctx context.Context
Enabled func() bool
Name string
Lifecycle v1beta1a.CronJobLifecycle
}{
Ctx: ctx,
Enabled: enabled,
Name: name,
Lifecycle: lifecycle,
}
lockCronJobInterfaceMockAddFeatureLifecycle.Lock()
mock.calls.AddFeatureLifecycle = append(mock.calls.AddFeatureLifecycle, callInfo)
lockCronJobInterfaceMockAddFeatureLifecycle.Unlock()
mock.AddFeatureLifecycleFunc(ctx, enabled, name, lifecycle)
}
// AddFeatureLifecycleCalls gets all the calls that were made to AddFeatureLifecycle.
// Check the length with:
// len(mockedCronJobInterface.AddFeatureLifecycleCalls())
func (mock *CronJobInterfaceMock) AddFeatureLifecycleCalls() []struct {
Ctx context.Context
Enabled func() bool
Name string
Lifecycle v1beta1a.CronJobLifecycle
} {
var calls []struct {
Ctx context.Context
Enabled func() bool
Name string
Lifecycle v1beta1a.CronJobLifecycle
}
lockCronJobInterfaceMockAddFeatureLifecycle.RLock()
calls = mock.calls.AddFeatureLifecycle
lockCronJobInterfaceMockAddFeatureLifecycle.RUnlock()
return calls
}
// AddHandler calls AddHandlerFunc.
func (mock *CronJobInterfaceMock) AddHandler(ctx context.Context, name string, sync v1beta1a.CronJobHandlerFunc) {
if mock.AddHandlerFunc == nil {

View File

@@ -69,7 +69,9 @@ type CronJobController interface {
Informer() cache.SharedIndexInformer
Lister() CronJobLister
AddHandler(ctx context.Context, name string, handler CronJobHandlerFunc)
AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync CronJobHandlerFunc)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler CronJobHandlerFunc)
AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, handler CronJobHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@@ -88,9 +90,13 @@ type CronJobInterface interface {
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() CronJobController
AddHandler(ctx context.Context, name string, sync CronJobHandlerFunc)
AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync CronJobHandlerFunc)
AddLifecycle(ctx context.Context, name string, lifecycle CronJobLifecycle)
AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle CronJobLifecycle)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync CronJobHandlerFunc)
AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, sync CronJobHandlerFunc)
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle CronJobLifecycle)
AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name, clusterName string, lifecycle CronJobLifecycle)
}
type cronJobLister struct {
@@ -150,6 +156,20 @@ func (c *cronJobController) AddHandler(ctx context.Context, name string, handler
})
}
func (c *cronJobController) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, handler CronJobHandlerFunc) {
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.(*v1beta1.CronJob); ok {
return handler(key, v)
} else {
return nil, nil
}
})
}
func (c *cronJobController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler CronJobHandlerFunc) {
resource.PutClusterScoped(CronJobGroupVersionResource)
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
@@ -163,6 +183,21 @@ func (c *cronJobController) AddClusterScopedHandler(ctx context.Context, name, c
})
}
func (c *cronJobController) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, cluster string, handler CronJobHandlerFunc) {
resource.PutClusterScoped(CronJobGroupVersionResource)
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.(*v1beta1.CronJob); ok && controller.ObjectInCluster(cluster, obj) {
return handler(key, v)
} else {
return nil, nil
}
})
}
type cronJobFactory struct {
}
@@ -258,20 +293,38 @@ func (s *cronJobClient) AddHandler(ctx context.Context, name string, sync CronJo
s.Controller().AddHandler(ctx, name, sync)
}
func (s *cronJobClient) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync CronJobHandlerFunc) {
s.Controller().AddFeatureHandler(ctx, enabled, name, sync)
}
func (s *cronJobClient) AddLifecycle(ctx context.Context, name string, lifecycle CronJobLifecycle) {
sync := NewCronJobLifecycleAdapter(name, false, s, lifecycle)
s.Controller().AddHandler(ctx, name, sync)
}
func (s *cronJobClient) AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle CronJobLifecycle) {
sync := NewCronJobLifecycleAdapter(name, false, s, lifecycle)
s.Controller().AddFeatureHandler(ctx, enabled, name, sync)
}
func (s *cronJobClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync CronJobHandlerFunc) {
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *cronJobClient) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, sync CronJobHandlerFunc) {
s.Controller().AddClusterScopedFeatureHandler(ctx, enabled, name, clusterName, sync)
}
func (s *cronJobClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle CronJobLifecycle) {
sync := NewCronJobLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *cronJobClient) AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name, clusterName string, lifecycle CronJobLifecycle) {
sync := NewCronJobLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedFeatureHandler(ctx, enabled, name, clusterName, sync)
}
type CronJobIndexer func(obj *v1beta1.CronJob) ([]string, error)
type CronJobClientCache interface {