1
0
mirror of https://github.com/rancher/types.git synced 2025-09-01 05:09:10 +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 *JobListerMock) ListCalls() []struct {
}
var (
lockJobControllerMockAddClusterScopedHandler sync.RWMutex
lockJobControllerMockAddHandler sync.RWMutex
lockJobControllerMockEnqueue sync.RWMutex
lockJobControllerMockGeneric sync.RWMutex
lockJobControllerMockInformer sync.RWMutex
lockJobControllerMockLister sync.RWMutex
lockJobControllerMockStart sync.RWMutex
lockJobControllerMockSync sync.RWMutex
lockJobControllerMockAddClusterScopedFeatureHandler sync.RWMutex
lockJobControllerMockAddClusterScopedHandler sync.RWMutex
lockJobControllerMockAddFeatureHandler sync.RWMutex
lockJobControllerMockAddHandler sync.RWMutex
lockJobControllerMockEnqueue sync.RWMutex
lockJobControllerMockGeneric sync.RWMutex
lockJobControllerMockInformer sync.RWMutex
lockJobControllerMockLister sync.RWMutex
lockJobControllerMockStart sync.RWMutex
lockJobControllerMockSync sync.RWMutex
)
// Ensure, that JobControllerMock does implement JobController.
@@ -161,9 +163,15 @@ var _ v1a.JobController = &JobControllerMock{}
//
// // make and configure a mocked JobController
// mockedJobController := &JobControllerMock{
// AddClusterScopedFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, clusterName string, handler v1a.JobHandlerFunc) {
// panic("mock out the AddClusterScopedFeatureHandler method")
// },
// AddClusterScopedHandlerFunc: func(ctx context.Context, name string, clusterName string, handler v1a.JobHandlerFunc) {
// panic("mock out the AddClusterScopedHandler method")
// },
// AddFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, sync v1a.JobHandlerFunc) {
// panic("mock out the AddFeatureHandler method")
// },
// AddHandlerFunc: func(ctx context.Context, name string, handler v1a.JobHandlerFunc) {
// panic("mock out the AddHandler method")
// },
@@ -192,9 +200,15 @@ var _ v1a.JobController = &JobControllerMock{}
//
// }
type JobControllerMock struct {
// AddClusterScopedFeatureHandlerFunc mocks the AddClusterScopedFeatureHandler method.
AddClusterScopedFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, clusterName string, handler v1a.JobHandlerFunc)
// AddClusterScopedHandlerFunc mocks the AddClusterScopedHandler method.
AddClusterScopedHandlerFunc func(ctx context.Context, name string, clusterName string, handler v1a.JobHandlerFunc)
// AddFeatureHandlerFunc mocks the AddFeatureHandler method.
AddFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, sync v1a.JobHandlerFunc)
// AddHandlerFunc mocks the AddHandler method.
AddHandlerFunc func(ctx context.Context, name string, handler v1a.JobHandlerFunc)
@@ -218,6 +232,19 @@ type JobControllerMock 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 v1a.JobHandlerFunc
}
// AddClusterScopedHandler holds details about calls to the AddClusterScopedHandler method.
AddClusterScopedHandler []struct {
// Ctx is the ctx argument value.
@@ -229,6 +256,17 @@ type JobControllerMock struct {
// Handler is the handler argument value.
Handler v1a.JobHandlerFunc
}
// AddFeatureHandler holds details about calls to the AddFeatureHandler method.
AddFeatureHandler []struct {
// Ctx is the ctx argument value.
Ctx context.Context
// Enabled is the enabled argument value.
Enabled func() bool
// Name is the name argument value.
Name string
// Sync is the sync argument value.
Sync v1a.JobHandlerFunc
}
// AddHandler holds details about calls to the AddHandler method.
AddHandler []struct {
// Ctx is the ctx argument value.
@@ -269,6 +307,53 @@ type JobControllerMock struct {
}
}
// AddClusterScopedFeatureHandler calls AddClusterScopedFeatureHandlerFunc.
func (mock *JobControllerMock) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name string, clusterName string, handler v1a.JobHandlerFunc) {
if mock.AddClusterScopedFeatureHandlerFunc == nil {
panic("JobControllerMock.AddClusterScopedFeatureHandlerFunc: method is nil but JobController.AddClusterScopedFeatureHandler was just called")
}
callInfo := struct {
Ctx context.Context
Enabled func() bool
Name string
ClusterName string
Handler v1a.JobHandlerFunc
}{
Ctx: ctx,
Enabled: enabled,
Name: name,
ClusterName: clusterName,
Handler: handler,
}
lockJobControllerMockAddClusterScopedFeatureHandler.Lock()
mock.calls.AddClusterScopedFeatureHandler = append(mock.calls.AddClusterScopedFeatureHandler, callInfo)
lockJobControllerMockAddClusterScopedFeatureHandler.Unlock()
mock.AddClusterScopedFeatureHandlerFunc(ctx, enabled, name, clusterName, handler)
}
// AddClusterScopedFeatureHandlerCalls gets all the calls that were made to AddClusterScopedFeatureHandler.
// Check the length with:
// len(mockedJobController.AddClusterScopedFeatureHandlerCalls())
func (mock *JobControllerMock) AddClusterScopedFeatureHandlerCalls() []struct {
Ctx context.Context
Enabled func() bool
Name string
ClusterName string
Handler v1a.JobHandlerFunc
} {
var calls []struct {
Ctx context.Context
Enabled func() bool
Name string
ClusterName string
Handler v1a.JobHandlerFunc
}
lockJobControllerMockAddClusterScopedFeatureHandler.RLock()
calls = mock.calls.AddClusterScopedFeatureHandler
lockJobControllerMockAddClusterScopedFeatureHandler.RUnlock()
return calls
}
// AddClusterScopedHandler calls AddClusterScopedHandlerFunc.
func (mock *JobControllerMock) AddClusterScopedHandler(ctx context.Context, name string, clusterName string, handler v1a.JobHandlerFunc) {
if mock.AddClusterScopedHandlerFunc == nil {
@@ -312,6 +397,49 @@ func (mock *JobControllerMock) AddClusterScopedHandlerCalls() []struct {
return calls
}
// AddFeatureHandler calls AddFeatureHandlerFunc.
func (mock *JobControllerMock) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync v1a.JobHandlerFunc) {
if mock.AddFeatureHandlerFunc == nil {
panic("JobControllerMock.AddFeatureHandlerFunc: method is nil but JobController.AddFeatureHandler was just called")
}
callInfo := struct {
Ctx context.Context
Enabled func() bool
Name string
Sync v1a.JobHandlerFunc
}{
Ctx: ctx,
Enabled: enabled,
Name: name,
Sync: sync,
}
lockJobControllerMockAddFeatureHandler.Lock()
mock.calls.AddFeatureHandler = append(mock.calls.AddFeatureHandler, callInfo)
lockJobControllerMockAddFeatureHandler.Unlock()
mock.AddFeatureHandlerFunc(ctx, enabled, name, sync)
}
// AddFeatureHandlerCalls gets all the calls that were made to AddFeatureHandler.
// Check the length with:
// len(mockedJobController.AddFeatureHandlerCalls())
func (mock *JobControllerMock) AddFeatureHandlerCalls() []struct {
Ctx context.Context
Enabled func() bool
Name string
Sync v1a.JobHandlerFunc
} {
var calls []struct {
Ctx context.Context
Enabled func() bool
Name string
Sync v1a.JobHandlerFunc
}
lockJobControllerMockAddFeatureHandler.RLock()
calls = mock.calls.AddFeatureHandler
lockJobControllerMockAddFeatureHandler.RUnlock()
return calls
}
// AddHandler calls AddHandlerFunc.
func (mock *JobControllerMock) AddHandler(ctx context.Context, name string, handler v1a.JobHandlerFunc) {
if mock.AddHandlerFunc == nil {
@@ -531,21 +659,25 @@ func (mock *JobControllerMock) SyncCalls() []struct {
}
var (
lockJobInterfaceMockAddClusterScopedHandler sync.RWMutex
lockJobInterfaceMockAddClusterScopedLifecycle sync.RWMutex
lockJobInterfaceMockAddHandler sync.RWMutex
lockJobInterfaceMockAddLifecycle sync.RWMutex
lockJobInterfaceMockController sync.RWMutex
lockJobInterfaceMockCreate sync.RWMutex
lockJobInterfaceMockDelete sync.RWMutex
lockJobInterfaceMockDeleteCollection sync.RWMutex
lockJobInterfaceMockDeleteNamespaced sync.RWMutex
lockJobInterfaceMockGet sync.RWMutex
lockJobInterfaceMockGetNamespaced sync.RWMutex
lockJobInterfaceMockList sync.RWMutex
lockJobInterfaceMockObjectClient sync.RWMutex
lockJobInterfaceMockUpdate sync.RWMutex
lockJobInterfaceMockWatch sync.RWMutex
lockJobInterfaceMockAddClusterScopedFeatureHandler sync.RWMutex
lockJobInterfaceMockAddClusterScopedFeatureLifecycle sync.RWMutex
lockJobInterfaceMockAddClusterScopedHandler sync.RWMutex
lockJobInterfaceMockAddClusterScopedLifecycle sync.RWMutex
lockJobInterfaceMockAddFeatureHandler sync.RWMutex
lockJobInterfaceMockAddFeatureLifecycle sync.RWMutex
lockJobInterfaceMockAddHandler sync.RWMutex
lockJobInterfaceMockAddLifecycle sync.RWMutex
lockJobInterfaceMockController sync.RWMutex
lockJobInterfaceMockCreate sync.RWMutex
lockJobInterfaceMockDelete sync.RWMutex
lockJobInterfaceMockDeleteCollection sync.RWMutex
lockJobInterfaceMockDeleteNamespaced sync.RWMutex
lockJobInterfaceMockGet sync.RWMutex
lockJobInterfaceMockGetNamespaced sync.RWMutex
lockJobInterfaceMockList sync.RWMutex
lockJobInterfaceMockObjectClient sync.RWMutex
lockJobInterfaceMockUpdate sync.RWMutex
lockJobInterfaceMockWatch sync.RWMutex
)
// Ensure, that JobInterfaceMock does implement JobInterface.
@@ -558,12 +690,24 @@ var _ v1a.JobInterface = &JobInterfaceMock{}
//
// // make and configure a mocked JobInterface
// mockedJobInterface := &JobInterfaceMock{
// AddClusterScopedFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, clusterName string, sync v1a.JobHandlerFunc) {
// panic("mock out the AddClusterScopedFeatureHandler method")
// },
// AddClusterScopedFeatureLifecycleFunc: func(ctx context.Context, enabled func() bool, name string, clusterName string, lifecycle v1a.JobLifecycle) {
// panic("mock out the AddClusterScopedFeatureLifecycle method")
// },
// AddClusterScopedHandlerFunc: func(ctx context.Context, name string, clusterName string, sync v1a.JobHandlerFunc) {
// panic("mock out the AddClusterScopedHandler method")
// },
// AddClusterScopedLifecycleFunc: func(ctx context.Context, name string, clusterName string, lifecycle v1a.JobLifecycle) {
// panic("mock out the AddClusterScopedLifecycle method")
// },
// AddFeatureHandlerFunc: func(ctx context.Context, enabled func() bool, name string, sync v1a.JobHandlerFunc) {
// panic("mock out the AddFeatureHandler method")
// },
// AddFeatureLifecycleFunc: func(ctx context.Context, enabled func() bool, name string, lifecycle v1a.JobLifecycle) {
// panic("mock out the AddFeatureLifecycle method")
// },
// AddHandlerFunc: func(ctx context.Context, name string, sync v1a.JobHandlerFunc) {
// panic("mock out the AddHandler method")
// },
@@ -610,12 +754,24 @@ var _ v1a.JobInterface = &JobInterfaceMock{}
//
// }
type JobInterfaceMock struct {
// AddClusterScopedFeatureHandlerFunc mocks the AddClusterScopedFeatureHandler method.
AddClusterScopedFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, clusterName string, sync v1a.JobHandlerFunc)
// AddClusterScopedFeatureLifecycleFunc mocks the AddClusterScopedFeatureLifecycle method.
AddClusterScopedFeatureLifecycleFunc func(ctx context.Context, enabled func() bool, name string, clusterName string, lifecycle v1a.JobLifecycle)
// AddClusterScopedHandlerFunc mocks the AddClusterScopedHandler method.
AddClusterScopedHandlerFunc func(ctx context.Context, name string, clusterName string, sync v1a.JobHandlerFunc)
// AddClusterScopedLifecycleFunc mocks the AddClusterScopedLifecycle method.
AddClusterScopedLifecycleFunc func(ctx context.Context, name string, clusterName string, lifecycle v1a.JobLifecycle)
// AddFeatureHandlerFunc mocks the AddFeatureHandler method.
AddFeatureHandlerFunc func(ctx context.Context, enabled func() bool, name string, sync v1a.JobHandlerFunc)
// AddFeatureLifecycleFunc mocks the AddFeatureLifecycle method.
AddFeatureLifecycleFunc func(ctx context.Context, enabled func() bool, name string, lifecycle v1a.JobLifecycle)
// AddHandlerFunc mocks the AddHandler method.
AddHandlerFunc func(ctx context.Context, name string, sync v1a.JobHandlerFunc)
@@ -657,6 +813,32 @@ type JobInterfaceMock 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 v1a.JobHandlerFunc
}
// AddClusterScopedFeatureLifecycle holds details about calls to the AddClusterScopedFeatureLifecycle method.
AddClusterScopedFeatureLifecycle []struct {
// Ctx is the ctx argument value.
Ctx context.Context
// Enabled is the enabled argument value.
Enabled func() bool
// Name is the name argument value.
Name string
// ClusterName is the clusterName argument value.
ClusterName string
// Lifecycle is the lifecycle argument value.
Lifecycle v1a.JobLifecycle
}
// AddClusterScopedHandler holds details about calls to the AddClusterScopedHandler method.
AddClusterScopedHandler []struct {
// Ctx is the ctx argument value.
@@ -679,6 +861,28 @@ type JobInterfaceMock struct {
// Lifecycle is the lifecycle argument value.
Lifecycle v1a.JobLifecycle
}
// AddFeatureHandler holds details about calls to the AddFeatureHandler method.
AddFeatureHandler []struct {
// Ctx is the ctx argument value.
Ctx context.Context
// Enabled is the enabled argument value.
Enabled func() bool
// Name is the name argument value.
Name string
// Sync is the sync argument value.
Sync v1a.JobHandlerFunc
}
// AddFeatureLifecycle holds details about calls to the AddFeatureLifecycle method.
AddFeatureLifecycle []struct {
// Ctx is the ctx argument value.
Ctx context.Context
// Enabled is the enabled argument value.
Enabled func() bool
// Name is the name argument value.
Name string
// Lifecycle is the lifecycle argument value.
Lifecycle v1a.JobLifecycle
}
// AddHandler holds details about calls to the AddHandler method.
AddHandler []struct {
// Ctx is the ctx argument value.
@@ -765,6 +969,100 @@ type JobInterfaceMock struct {
}
}
// AddClusterScopedFeatureHandler calls AddClusterScopedFeatureHandlerFunc.
func (mock *JobInterfaceMock) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name string, clusterName string, sync v1a.JobHandlerFunc) {
if mock.AddClusterScopedFeatureHandlerFunc == nil {
panic("JobInterfaceMock.AddClusterScopedFeatureHandlerFunc: method is nil but JobInterface.AddClusterScopedFeatureHandler was just called")
}
callInfo := struct {
Ctx context.Context
Enabled func() bool
Name string
ClusterName string
Sync v1a.JobHandlerFunc
}{
Ctx: ctx,
Enabled: enabled,
Name: name,
ClusterName: clusterName,
Sync: sync,
}
lockJobInterfaceMockAddClusterScopedFeatureHandler.Lock()
mock.calls.AddClusterScopedFeatureHandler = append(mock.calls.AddClusterScopedFeatureHandler, callInfo)
lockJobInterfaceMockAddClusterScopedFeatureHandler.Unlock()
mock.AddClusterScopedFeatureHandlerFunc(ctx, enabled, name, clusterName, sync)
}
// AddClusterScopedFeatureHandlerCalls gets all the calls that were made to AddClusterScopedFeatureHandler.
// Check the length with:
// len(mockedJobInterface.AddClusterScopedFeatureHandlerCalls())
func (mock *JobInterfaceMock) AddClusterScopedFeatureHandlerCalls() []struct {
Ctx context.Context
Enabled func() bool
Name string
ClusterName string
Sync v1a.JobHandlerFunc
} {
var calls []struct {
Ctx context.Context
Enabled func() bool
Name string
ClusterName string
Sync v1a.JobHandlerFunc
}
lockJobInterfaceMockAddClusterScopedFeatureHandler.RLock()
calls = mock.calls.AddClusterScopedFeatureHandler
lockJobInterfaceMockAddClusterScopedFeatureHandler.RUnlock()
return calls
}
// AddClusterScopedFeatureLifecycle calls AddClusterScopedFeatureLifecycleFunc.
func (mock *JobInterfaceMock) AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name string, clusterName string, lifecycle v1a.JobLifecycle) {
if mock.AddClusterScopedFeatureLifecycleFunc == nil {
panic("JobInterfaceMock.AddClusterScopedFeatureLifecycleFunc: method is nil but JobInterface.AddClusterScopedFeatureLifecycle was just called")
}
callInfo := struct {
Ctx context.Context
Enabled func() bool
Name string
ClusterName string
Lifecycle v1a.JobLifecycle
}{
Ctx: ctx,
Enabled: enabled,
Name: name,
ClusterName: clusterName,
Lifecycle: lifecycle,
}
lockJobInterfaceMockAddClusterScopedFeatureLifecycle.Lock()
mock.calls.AddClusterScopedFeatureLifecycle = append(mock.calls.AddClusterScopedFeatureLifecycle, callInfo)
lockJobInterfaceMockAddClusterScopedFeatureLifecycle.Unlock()
mock.AddClusterScopedFeatureLifecycleFunc(ctx, enabled, name, clusterName, lifecycle)
}
// AddClusterScopedFeatureLifecycleCalls gets all the calls that were made to AddClusterScopedFeatureLifecycle.
// Check the length with:
// len(mockedJobInterface.AddClusterScopedFeatureLifecycleCalls())
func (mock *JobInterfaceMock) AddClusterScopedFeatureLifecycleCalls() []struct {
Ctx context.Context
Enabled func() bool
Name string
ClusterName string
Lifecycle v1a.JobLifecycle
} {
var calls []struct {
Ctx context.Context
Enabled func() bool
Name string
ClusterName string
Lifecycle v1a.JobLifecycle
}
lockJobInterfaceMockAddClusterScopedFeatureLifecycle.RLock()
calls = mock.calls.AddClusterScopedFeatureLifecycle
lockJobInterfaceMockAddClusterScopedFeatureLifecycle.RUnlock()
return calls
}
// AddClusterScopedHandler calls AddClusterScopedHandlerFunc.
func (mock *JobInterfaceMock) AddClusterScopedHandler(ctx context.Context, name string, clusterName string, sync v1a.JobHandlerFunc) {
if mock.AddClusterScopedHandlerFunc == nil {
@@ -851,6 +1149,92 @@ func (mock *JobInterfaceMock) AddClusterScopedLifecycleCalls() []struct {
return calls
}
// AddFeatureHandler calls AddFeatureHandlerFunc.
func (mock *JobInterfaceMock) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync v1a.JobHandlerFunc) {
if mock.AddFeatureHandlerFunc == nil {
panic("JobInterfaceMock.AddFeatureHandlerFunc: method is nil but JobInterface.AddFeatureHandler was just called")
}
callInfo := struct {
Ctx context.Context
Enabled func() bool
Name string
Sync v1a.JobHandlerFunc
}{
Ctx: ctx,
Enabled: enabled,
Name: name,
Sync: sync,
}
lockJobInterfaceMockAddFeatureHandler.Lock()
mock.calls.AddFeatureHandler = append(mock.calls.AddFeatureHandler, callInfo)
lockJobInterfaceMockAddFeatureHandler.Unlock()
mock.AddFeatureHandlerFunc(ctx, enabled, name, sync)
}
// AddFeatureHandlerCalls gets all the calls that were made to AddFeatureHandler.
// Check the length with:
// len(mockedJobInterface.AddFeatureHandlerCalls())
func (mock *JobInterfaceMock) AddFeatureHandlerCalls() []struct {
Ctx context.Context
Enabled func() bool
Name string
Sync v1a.JobHandlerFunc
} {
var calls []struct {
Ctx context.Context
Enabled func() bool
Name string
Sync v1a.JobHandlerFunc
}
lockJobInterfaceMockAddFeatureHandler.RLock()
calls = mock.calls.AddFeatureHandler
lockJobInterfaceMockAddFeatureHandler.RUnlock()
return calls
}
// AddFeatureLifecycle calls AddFeatureLifecycleFunc.
func (mock *JobInterfaceMock) AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle v1a.JobLifecycle) {
if mock.AddFeatureLifecycleFunc == nil {
panic("JobInterfaceMock.AddFeatureLifecycleFunc: method is nil but JobInterface.AddFeatureLifecycle was just called")
}
callInfo := struct {
Ctx context.Context
Enabled func() bool
Name string
Lifecycle v1a.JobLifecycle
}{
Ctx: ctx,
Enabled: enabled,
Name: name,
Lifecycle: lifecycle,
}
lockJobInterfaceMockAddFeatureLifecycle.Lock()
mock.calls.AddFeatureLifecycle = append(mock.calls.AddFeatureLifecycle, callInfo)
lockJobInterfaceMockAddFeatureLifecycle.Unlock()
mock.AddFeatureLifecycleFunc(ctx, enabled, name, lifecycle)
}
// AddFeatureLifecycleCalls gets all the calls that were made to AddFeatureLifecycle.
// Check the length with:
// len(mockedJobInterface.AddFeatureLifecycleCalls())
func (mock *JobInterfaceMock) AddFeatureLifecycleCalls() []struct {
Ctx context.Context
Enabled func() bool
Name string
Lifecycle v1a.JobLifecycle
} {
var calls []struct {
Ctx context.Context
Enabled func() bool
Name string
Lifecycle v1a.JobLifecycle
}
lockJobInterfaceMockAddFeatureLifecycle.RLock()
calls = mock.calls.AddFeatureLifecycle
lockJobInterfaceMockAddFeatureLifecycle.RUnlock()
return calls
}
// AddHandler calls AddHandlerFunc.
func (mock *JobInterfaceMock) AddHandler(ctx context.Context, name string, sync v1a.JobHandlerFunc) {
if mock.AddHandlerFunc == nil {

View File

@@ -69,7 +69,9 @@ type JobController interface {
Informer() cache.SharedIndexInformer
Lister() JobLister
AddHandler(ctx context.Context, name string, handler JobHandlerFunc)
AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync JobHandlerFunc)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler JobHandlerFunc)
AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, handler JobHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@@ -88,9 +90,13 @@ type JobInterface interface {
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() JobController
AddHandler(ctx context.Context, name string, sync JobHandlerFunc)
AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync JobHandlerFunc)
AddLifecycle(ctx context.Context, name string, lifecycle JobLifecycle)
AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle JobLifecycle)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync JobHandlerFunc)
AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, sync JobHandlerFunc)
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle JobLifecycle)
AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name, clusterName string, lifecycle JobLifecycle)
}
type jobLister struct {
@@ -150,6 +156,20 @@ func (c *jobController) AddHandler(ctx context.Context, name string, handler Job
})
}
func (c *jobController) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, handler JobHandlerFunc) {
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if !enabled() {
return nil, nil
} else if obj == nil {
return handler(key, nil)
} else if v, ok := obj.(*v1.Job); ok {
return handler(key, v)
} else {
return nil, nil
}
})
}
func (c *jobController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler JobHandlerFunc) {
resource.PutClusterScoped(JobGroupVersionResource)
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
@@ -163,6 +183,21 @@ func (c *jobController) AddClusterScopedHandler(ctx context.Context, name, clust
})
}
func (c *jobController) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, cluster string, handler JobHandlerFunc) {
resource.PutClusterScoped(JobGroupVersionResource)
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if !enabled() {
return nil, nil
} else if obj == nil {
return handler(key, nil)
} else if v, ok := obj.(*v1.Job); ok && controller.ObjectInCluster(cluster, obj) {
return handler(key, v)
} else {
return nil, nil
}
})
}
type jobFactory struct {
}
@@ -258,20 +293,38 @@ func (s *jobClient) AddHandler(ctx context.Context, name string, sync JobHandler
s.Controller().AddHandler(ctx, name, sync)
}
func (s *jobClient) AddFeatureHandler(ctx context.Context, enabled func() bool, name string, sync JobHandlerFunc) {
s.Controller().AddFeatureHandler(ctx, enabled, name, sync)
}
func (s *jobClient) AddLifecycle(ctx context.Context, name string, lifecycle JobLifecycle) {
sync := NewJobLifecycleAdapter(name, false, s, lifecycle)
s.Controller().AddHandler(ctx, name, sync)
}
func (s *jobClient) AddFeatureLifecycle(ctx context.Context, enabled func() bool, name string, lifecycle JobLifecycle) {
sync := NewJobLifecycleAdapter(name, false, s, lifecycle)
s.Controller().AddFeatureHandler(ctx, enabled, name, sync)
}
func (s *jobClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync JobHandlerFunc) {
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *jobClient) AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, sync JobHandlerFunc) {
s.Controller().AddClusterScopedFeatureHandler(ctx, enabled, name, clusterName, sync)
}
func (s *jobClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle JobLifecycle) {
sync := NewJobLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *jobClient) AddClusterScopedFeatureLifecycle(ctx context.Context, enabled func() bool, name, clusterName string, lifecycle JobLifecycle) {
sync := NewJobLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedFeatureHandler(ctx, enabled, name, clusterName, sync)
}
type JobIndexer func(obj *v1.Job) ([]string, error)
type JobClientCache interface {

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 {