diff --git a/apis/management.cattle.io/v3/fakes/zz_generated_cluster_scan_mock.go b/apis/management.cattle.io/v3/fakes/zz_generated_cluster_scan_mock.go new file mode 100644 index 00000000..f3c040ee --- /dev/null +++ b/apis/management.cattle.io/v3/fakes/zz_generated_cluster_scan_mock.go @@ -0,0 +1,1356 @@ +// 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 ( + lockClusterScanListerMockGet sync.RWMutex + lockClusterScanListerMockList sync.RWMutex +) + +// Ensure, that ClusterScanListerMock does implement ClusterScanLister. +// If this is not the case, regenerate this file with moq. +var _ v3.ClusterScanLister = &ClusterScanListerMock{} + +// ClusterScanListerMock is a mock implementation of ClusterScanLister. +// +// func TestSomethingThatUsesClusterScanLister(t *testing.T) { +// +// // make and configure a mocked ClusterScanLister +// mockedClusterScanLister := &ClusterScanListerMock{ +// GetFunc: func(namespace string, name string) (*v3.ClusterScan, error) { +// panic("mock out the Get method") +// }, +// ListFunc: func(namespace string, selector labels.Selector) ([]*v3.ClusterScan, error) { +// panic("mock out the List method") +// }, +// } +// +// // use mockedClusterScanLister in code that requires ClusterScanLister +// // and then make assertions. +// +// } +type ClusterScanListerMock struct { + // GetFunc mocks the Get method. + GetFunc func(namespace string, name string) (*v3.ClusterScan, error) + + // ListFunc mocks the List method. + ListFunc func(namespace string, selector labels.Selector) ([]*v3.ClusterScan, 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 *ClusterScanListerMock) Get(namespace string, name string) (*v3.ClusterScan, error) { + if mock.GetFunc == nil { + panic("ClusterScanListerMock.GetFunc: method is nil but ClusterScanLister.Get was just called") + } + callInfo := struct { + Namespace string + Name string + }{ + Namespace: namespace, + Name: name, + } + lockClusterScanListerMockGet.Lock() + mock.calls.Get = append(mock.calls.Get, callInfo) + lockClusterScanListerMockGet.Unlock() + return mock.GetFunc(namespace, name) +} + +// GetCalls gets all the calls that were made to Get. +// Check the length with: +// len(mockedClusterScanLister.GetCalls()) +func (mock *ClusterScanListerMock) GetCalls() []struct { + Namespace string + Name string +} { + var calls []struct { + Namespace string + Name string + } + lockClusterScanListerMockGet.RLock() + calls = mock.calls.Get + lockClusterScanListerMockGet.RUnlock() + return calls +} + +// List calls ListFunc. +func (mock *ClusterScanListerMock) List(namespace string, selector labels.Selector) ([]*v3.ClusterScan, error) { + if mock.ListFunc == nil { + panic("ClusterScanListerMock.ListFunc: method is nil but ClusterScanLister.List was just called") + } + callInfo := struct { + Namespace string + Selector labels.Selector + }{ + Namespace: namespace, + Selector: selector, + } + lockClusterScanListerMockList.Lock() + mock.calls.List = append(mock.calls.List, callInfo) + lockClusterScanListerMockList.Unlock() + return mock.ListFunc(namespace, selector) +} + +// ListCalls gets all the calls that were made to List. +// Check the length with: +// len(mockedClusterScanLister.ListCalls()) +func (mock *ClusterScanListerMock) ListCalls() []struct { + Namespace string + Selector labels.Selector +} { + var calls []struct { + Namespace string + Selector labels.Selector + } + lockClusterScanListerMockList.RLock() + calls = mock.calls.List + lockClusterScanListerMockList.RUnlock() + return calls +} + +var ( + lockClusterScanControllerMockAddClusterScopedHandler sync.RWMutex + lockClusterScanControllerMockAddHandler sync.RWMutex + lockClusterScanControllerMockEnqueue sync.RWMutex + lockClusterScanControllerMockGeneric sync.RWMutex + lockClusterScanControllerMockInformer sync.RWMutex + lockClusterScanControllerMockLister sync.RWMutex + lockClusterScanControllerMockStart sync.RWMutex + lockClusterScanControllerMockSync sync.RWMutex +) + +// Ensure, that ClusterScanControllerMock does implement ClusterScanController. +// If this is not the case, regenerate this file with moq. +var _ v3.ClusterScanController = &ClusterScanControllerMock{} + +// ClusterScanControllerMock is a mock implementation of ClusterScanController. +// +// func TestSomethingThatUsesClusterScanController(t *testing.T) { +// +// // make and configure a mocked ClusterScanController +// mockedClusterScanController := &ClusterScanControllerMock{ +// AddClusterScopedHandlerFunc: func(ctx context.Context, name string, clusterName string, handler v3.ClusterScanHandlerFunc) { +// panic("mock out the AddClusterScopedHandler method") +// }, +// AddHandlerFunc: func(ctx context.Context, name string, handler v3.ClusterScanHandlerFunc) { +// 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.ClusterScanLister { +// 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 mockedClusterScanController in code that requires ClusterScanController +// // and then make assertions. +// +// } +type ClusterScanControllerMock struct { + // AddClusterScopedHandlerFunc mocks the AddClusterScopedHandler method. + AddClusterScopedHandlerFunc func(ctx context.Context, name string, clusterName string, handler v3.ClusterScanHandlerFunc) + + // AddHandlerFunc mocks the AddHandler method. + AddHandlerFunc func(ctx context.Context, name string, handler v3.ClusterScanHandlerFunc) + + // 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.ClusterScanLister + + // 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 { + // 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.ClusterScanHandlerFunc + } + // 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.ClusterScanHandlerFunc + } + // 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 + } + } +} + +// AddClusterScopedHandler calls AddClusterScopedHandlerFunc. +func (mock *ClusterScanControllerMock) AddClusterScopedHandler(ctx context.Context, name string, clusterName string, handler v3.ClusterScanHandlerFunc) { + if mock.AddClusterScopedHandlerFunc == nil { + panic("ClusterScanControllerMock.AddClusterScopedHandlerFunc: method is nil but ClusterScanController.AddClusterScopedHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + ClusterName string + Handler v3.ClusterScanHandlerFunc + }{ + Ctx: ctx, + Name: name, + ClusterName: clusterName, + Handler: handler, + } + lockClusterScanControllerMockAddClusterScopedHandler.Lock() + mock.calls.AddClusterScopedHandler = append(mock.calls.AddClusterScopedHandler, callInfo) + lockClusterScanControllerMockAddClusterScopedHandler.Unlock() + mock.AddClusterScopedHandlerFunc(ctx, name, clusterName, handler) +} + +// AddClusterScopedHandlerCalls gets all the calls that were made to AddClusterScopedHandler. +// Check the length with: +// len(mockedClusterScanController.AddClusterScopedHandlerCalls()) +func (mock *ClusterScanControllerMock) AddClusterScopedHandlerCalls() []struct { + Ctx context.Context + Name string + ClusterName string + Handler v3.ClusterScanHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + ClusterName string + Handler v3.ClusterScanHandlerFunc + } + lockClusterScanControllerMockAddClusterScopedHandler.RLock() + calls = mock.calls.AddClusterScopedHandler + lockClusterScanControllerMockAddClusterScopedHandler.RUnlock() + return calls +} + +// AddHandler calls AddHandlerFunc. +func (mock *ClusterScanControllerMock) AddHandler(ctx context.Context, name string, handler v3.ClusterScanHandlerFunc) { + if mock.AddHandlerFunc == nil { + panic("ClusterScanControllerMock.AddHandlerFunc: method is nil but ClusterScanController.AddHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + Handler v3.ClusterScanHandlerFunc + }{ + Ctx: ctx, + Name: name, + Handler: handler, + } + lockClusterScanControllerMockAddHandler.Lock() + mock.calls.AddHandler = append(mock.calls.AddHandler, callInfo) + lockClusterScanControllerMockAddHandler.Unlock() + mock.AddHandlerFunc(ctx, name, handler) +} + +// AddHandlerCalls gets all the calls that were made to AddHandler. +// Check the length with: +// len(mockedClusterScanController.AddHandlerCalls()) +func (mock *ClusterScanControllerMock) AddHandlerCalls() []struct { + Ctx context.Context + Name string + Handler v3.ClusterScanHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + Handler v3.ClusterScanHandlerFunc + } + lockClusterScanControllerMockAddHandler.RLock() + calls = mock.calls.AddHandler + lockClusterScanControllerMockAddHandler.RUnlock() + return calls +} + +// Enqueue calls EnqueueFunc. +func (mock *ClusterScanControllerMock) Enqueue(namespace string, name string) { + if mock.EnqueueFunc == nil { + panic("ClusterScanControllerMock.EnqueueFunc: method is nil but ClusterScanController.Enqueue was just called") + } + callInfo := struct { + Namespace string + Name string + }{ + Namespace: namespace, + Name: name, + } + lockClusterScanControllerMockEnqueue.Lock() + mock.calls.Enqueue = append(mock.calls.Enqueue, callInfo) + lockClusterScanControllerMockEnqueue.Unlock() + mock.EnqueueFunc(namespace, name) +} + +// EnqueueCalls gets all the calls that were made to Enqueue. +// Check the length with: +// len(mockedClusterScanController.EnqueueCalls()) +func (mock *ClusterScanControllerMock) EnqueueCalls() []struct { + Namespace string + Name string +} { + var calls []struct { + Namespace string + Name string + } + lockClusterScanControllerMockEnqueue.RLock() + calls = mock.calls.Enqueue + lockClusterScanControllerMockEnqueue.RUnlock() + return calls +} + +// Generic calls GenericFunc. +func (mock *ClusterScanControllerMock) Generic() controller.GenericController { + if mock.GenericFunc == nil { + panic("ClusterScanControllerMock.GenericFunc: method is nil but ClusterScanController.Generic was just called") + } + callInfo := struct { + }{} + lockClusterScanControllerMockGeneric.Lock() + mock.calls.Generic = append(mock.calls.Generic, callInfo) + lockClusterScanControllerMockGeneric.Unlock() + return mock.GenericFunc() +} + +// GenericCalls gets all the calls that were made to Generic. +// Check the length with: +// len(mockedClusterScanController.GenericCalls()) +func (mock *ClusterScanControllerMock) GenericCalls() []struct { +} { + var calls []struct { + } + lockClusterScanControllerMockGeneric.RLock() + calls = mock.calls.Generic + lockClusterScanControllerMockGeneric.RUnlock() + return calls +} + +// Informer calls InformerFunc. +func (mock *ClusterScanControllerMock) Informer() cache.SharedIndexInformer { + if mock.InformerFunc == nil { + panic("ClusterScanControllerMock.InformerFunc: method is nil but ClusterScanController.Informer was just called") + } + callInfo := struct { + }{} + lockClusterScanControllerMockInformer.Lock() + mock.calls.Informer = append(mock.calls.Informer, callInfo) + lockClusterScanControllerMockInformer.Unlock() + return mock.InformerFunc() +} + +// InformerCalls gets all the calls that were made to Informer. +// Check the length with: +// len(mockedClusterScanController.InformerCalls()) +func (mock *ClusterScanControllerMock) InformerCalls() []struct { +} { + var calls []struct { + } + lockClusterScanControllerMockInformer.RLock() + calls = mock.calls.Informer + lockClusterScanControllerMockInformer.RUnlock() + return calls +} + +// Lister calls ListerFunc. +func (mock *ClusterScanControllerMock) Lister() v3.ClusterScanLister { + if mock.ListerFunc == nil { + panic("ClusterScanControllerMock.ListerFunc: method is nil but ClusterScanController.Lister was just called") + } + callInfo := struct { + }{} + lockClusterScanControllerMockLister.Lock() + mock.calls.Lister = append(mock.calls.Lister, callInfo) + lockClusterScanControllerMockLister.Unlock() + return mock.ListerFunc() +} + +// ListerCalls gets all the calls that were made to Lister. +// Check the length with: +// len(mockedClusterScanController.ListerCalls()) +func (mock *ClusterScanControllerMock) ListerCalls() []struct { +} { + var calls []struct { + } + lockClusterScanControllerMockLister.RLock() + calls = mock.calls.Lister + lockClusterScanControllerMockLister.RUnlock() + return calls +} + +// Start calls StartFunc. +func (mock *ClusterScanControllerMock) Start(ctx context.Context, threadiness int) error { + if mock.StartFunc == nil { + panic("ClusterScanControllerMock.StartFunc: method is nil but ClusterScanController.Start was just called") + } + callInfo := struct { + Ctx context.Context + Threadiness int + }{ + Ctx: ctx, + Threadiness: threadiness, + } + lockClusterScanControllerMockStart.Lock() + mock.calls.Start = append(mock.calls.Start, callInfo) + lockClusterScanControllerMockStart.Unlock() + return mock.StartFunc(ctx, threadiness) +} + +// StartCalls gets all the calls that were made to Start. +// Check the length with: +// len(mockedClusterScanController.StartCalls()) +func (mock *ClusterScanControllerMock) StartCalls() []struct { + Ctx context.Context + Threadiness int +} { + var calls []struct { + Ctx context.Context + Threadiness int + } + lockClusterScanControllerMockStart.RLock() + calls = mock.calls.Start + lockClusterScanControllerMockStart.RUnlock() + return calls +} + +// Sync calls SyncFunc. +func (mock *ClusterScanControllerMock) Sync(ctx context.Context) error { + if mock.SyncFunc == nil { + panic("ClusterScanControllerMock.SyncFunc: method is nil but ClusterScanController.Sync was just called") + } + callInfo := struct { + Ctx context.Context + }{ + Ctx: ctx, + } + lockClusterScanControllerMockSync.Lock() + mock.calls.Sync = append(mock.calls.Sync, callInfo) + lockClusterScanControllerMockSync.Unlock() + return mock.SyncFunc(ctx) +} + +// SyncCalls gets all the calls that were made to Sync. +// Check the length with: +// len(mockedClusterScanController.SyncCalls()) +func (mock *ClusterScanControllerMock) SyncCalls() []struct { + Ctx context.Context +} { + var calls []struct { + Ctx context.Context + } + lockClusterScanControllerMockSync.RLock() + calls = mock.calls.Sync + lockClusterScanControllerMockSync.RUnlock() + return calls +} + +var ( + lockClusterScanInterfaceMockAddClusterScopedHandler sync.RWMutex + lockClusterScanInterfaceMockAddClusterScopedLifecycle sync.RWMutex + lockClusterScanInterfaceMockAddHandler sync.RWMutex + lockClusterScanInterfaceMockAddLifecycle sync.RWMutex + lockClusterScanInterfaceMockController sync.RWMutex + lockClusterScanInterfaceMockCreate sync.RWMutex + lockClusterScanInterfaceMockDelete sync.RWMutex + lockClusterScanInterfaceMockDeleteCollection sync.RWMutex + lockClusterScanInterfaceMockDeleteNamespaced sync.RWMutex + lockClusterScanInterfaceMockGet sync.RWMutex + lockClusterScanInterfaceMockGetNamespaced sync.RWMutex + lockClusterScanInterfaceMockList sync.RWMutex + lockClusterScanInterfaceMockObjectClient sync.RWMutex + lockClusterScanInterfaceMockUpdate sync.RWMutex + lockClusterScanInterfaceMockWatch sync.RWMutex +) + +// Ensure, that ClusterScanInterfaceMock does implement ClusterScanInterface. +// If this is not the case, regenerate this file with moq. +var _ v3.ClusterScanInterface = &ClusterScanInterfaceMock{} + +// ClusterScanInterfaceMock is a mock implementation of ClusterScanInterface. +// +// func TestSomethingThatUsesClusterScanInterface(t *testing.T) { +// +// // make and configure a mocked ClusterScanInterface +// mockedClusterScanInterface := &ClusterScanInterfaceMock{ +// AddClusterScopedHandlerFunc: func(ctx context.Context, name string, clusterName string, sync v3.ClusterScanHandlerFunc) { +// panic("mock out the AddClusterScopedHandler method") +// }, +// AddClusterScopedLifecycleFunc: func(ctx context.Context, name string, clusterName string, lifecycle v3.ClusterScanLifecycle) { +// panic("mock out the AddClusterScopedLifecycle method") +// }, +// AddHandlerFunc: func(ctx context.Context, name string, sync v3.ClusterScanHandlerFunc) { +// panic("mock out the AddHandler method") +// }, +// AddLifecycleFunc: func(ctx context.Context, name string, lifecycle v3.ClusterScanLifecycle) { +// panic("mock out the AddLifecycle method") +// }, +// ControllerFunc: func() v3.ClusterScanController { +// panic("mock out the Controller method") +// }, +// CreateFunc: func(in1 *v3.ClusterScan) (*v3.ClusterScan, 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.ClusterScan, error) { +// panic("mock out the Get method") +// }, +// GetNamespacedFunc: func(namespace string, name string, opts v1.GetOptions) (*v3.ClusterScan, error) { +// panic("mock out the GetNamespaced method") +// }, +// ListFunc: func(opts v1.ListOptions) (*v3.ClusterScanList, error) { +// panic("mock out the List method") +// }, +// ObjectClientFunc: func() *objectclient.ObjectClient { +// panic("mock out the ObjectClient method") +// }, +// UpdateFunc: func(in1 *v3.ClusterScan) (*v3.ClusterScan, error) { +// panic("mock out the Update method") +// }, +// WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { +// panic("mock out the Watch method") +// }, +// } +// +// // use mockedClusterScanInterface in code that requires ClusterScanInterface +// // and then make assertions. +// +// } +type ClusterScanInterfaceMock struct { + // AddClusterScopedHandlerFunc mocks the AddClusterScopedHandler method. + AddClusterScopedHandlerFunc func(ctx context.Context, name string, clusterName string, sync v3.ClusterScanHandlerFunc) + + // AddClusterScopedLifecycleFunc mocks the AddClusterScopedLifecycle method. + AddClusterScopedLifecycleFunc func(ctx context.Context, name string, clusterName string, lifecycle v3.ClusterScanLifecycle) + + // AddHandlerFunc mocks the AddHandler method. + AddHandlerFunc func(ctx context.Context, name string, sync v3.ClusterScanHandlerFunc) + + // AddLifecycleFunc mocks the AddLifecycle method. + AddLifecycleFunc func(ctx context.Context, name string, lifecycle v3.ClusterScanLifecycle) + + // ControllerFunc mocks the Controller method. + ControllerFunc func() v3.ClusterScanController + + // CreateFunc mocks the Create method. + CreateFunc func(in1 *v3.ClusterScan) (*v3.ClusterScan, 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.ClusterScan, error) + + // GetNamespacedFunc mocks the GetNamespaced method. + GetNamespacedFunc func(namespace string, name string, opts v1.GetOptions) (*v3.ClusterScan, error) + + // ListFunc mocks the List method. + ListFunc func(opts v1.ListOptions) (*v3.ClusterScanList, error) + + // ObjectClientFunc mocks the ObjectClient method. + ObjectClientFunc func() *objectclient.ObjectClient + + // UpdateFunc mocks the Update method. + UpdateFunc func(in1 *v3.ClusterScan) (*v3.ClusterScan, error) + + // WatchFunc mocks the Watch method. + WatchFunc func(opts v1.ListOptions) (watch.Interface, error) + + // calls tracks calls to the methods. + calls struct { + // 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.ClusterScanHandlerFunc + } + // 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.ClusterScanLifecycle + } + // 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.ClusterScanHandlerFunc + } + // 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.ClusterScanLifecycle + } + // 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.ClusterScan + } + // 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.ClusterScan + } + // Watch holds details about calls to the Watch method. + Watch []struct { + // Opts is the opts argument value. + Opts v1.ListOptions + } + } +} + +// AddClusterScopedHandler calls AddClusterScopedHandlerFunc. +func (mock *ClusterScanInterfaceMock) AddClusterScopedHandler(ctx context.Context, name string, clusterName string, sync v3.ClusterScanHandlerFunc) { + if mock.AddClusterScopedHandlerFunc == nil { + panic("ClusterScanInterfaceMock.AddClusterScopedHandlerFunc: method is nil but ClusterScanInterface.AddClusterScopedHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + ClusterName string + Sync v3.ClusterScanHandlerFunc + }{ + Ctx: ctx, + Name: name, + ClusterName: clusterName, + Sync: sync, + } + lockClusterScanInterfaceMockAddClusterScopedHandler.Lock() + mock.calls.AddClusterScopedHandler = append(mock.calls.AddClusterScopedHandler, callInfo) + lockClusterScanInterfaceMockAddClusterScopedHandler.Unlock() + mock.AddClusterScopedHandlerFunc(ctx, name, clusterName, sync) +} + +// AddClusterScopedHandlerCalls gets all the calls that were made to AddClusterScopedHandler. +// Check the length with: +// len(mockedClusterScanInterface.AddClusterScopedHandlerCalls()) +func (mock *ClusterScanInterfaceMock) AddClusterScopedHandlerCalls() []struct { + Ctx context.Context + Name string + ClusterName string + Sync v3.ClusterScanHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + ClusterName string + Sync v3.ClusterScanHandlerFunc + } + lockClusterScanInterfaceMockAddClusterScopedHandler.RLock() + calls = mock.calls.AddClusterScopedHandler + lockClusterScanInterfaceMockAddClusterScopedHandler.RUnlock() + return calls +} + +// AddClusterScopedLifecycle calls AddClusterScopedLifecycleFunc. +func (mock *ClusterScanInterfaceMock) AddClusterScopedLifecycle(ctx context.Context, name string, clusterName string, lifecycle v3.ClusterScanLifecycle) { + if mock.AddClusterScopedLifecycleFunc == nil { + panic("ClusterScanInterfaceMock.AddClusterScopedLifecycleFunc: method is nil but ClusterScanInterface.AddClusterScopedLifecycle was just called") + } + callInfo := struct { + Ctx context.Context + Name string + ClusterName string + Lifecycle v3.ClusterScanLifecycle + }{ + Ctx: ctx, + Name: name, + ClusterName: clusterName, + Lifecycle: lifecycle, + } + lockClusterScanInterfaceMockAddClusterScopedLifecycle.Lock() + mock.calls.AddClusterScopedLifecycle = append(mock.calls.AddClusterScopedLifecycle, callInfo) + lockClusterScanInterfaceMockAddClusterScopedLifecycle.Unlock() + mock.AddClusterScopedLifecycleFunc(ctx, name, clusterName, lifecycle) +} + +// AddClusterScopedLifecycleCalls gets all the calls that were made to AddClusterScopedLifecycle. +// Check the length with: +// len(mockedClusterScanInterface.AddClusterScopedLifecycleCalls()) +func (mock *ClusterScanInterfaceMock) AddClusterScopedLifecycleCalls() []struct { + Ctx context.Context + Name string + ClusterName string + Lifecycle v3.ClusterScanLifecycle +} { + var calls []struct { + Ctx context.Context + Name string + ClusterName string + Lifecycle v3.ClusterScanLifecycle + } + lockClusterScanInterfaceMockAddClusterScopedLifecycle.RLock() + calls = mock.calls.AddClusterScopedLifecycle + lockClusterScanInterfaceMockAddClusterScopedLifecycle.RUnlock() + return calls +} + +// AddHandler calls AddHandlerFunc. +func (mock *ClusterScanInterfaceMock) AddHandler(ctx context.Context, name string, sync v3.ClusterScanHandlerFunc) { + if mock.AddHandlerFunc == nil { + panic("ClusterScanInterfaceMock.AddHandlerFunc: method is nil but ClusterScanInterface.AddHandler was just called") + } + callInfo := struct { + Ctx context.Context + Name string + Sync v3.ClusterScanHandlerFunc + }{ + Ctx: ctx, + Name: name, + Sync: sync, + } + lockClusterScanInterfaceMockAddHandler.Lock() + mock.calls.AddHandler = append(mock.calls.AddHandler, callInfo) + lockClusterScanInterfaceMockAddHandler.Unlock() + mock.AddHandlerFunc(ctx, name, sync) +} + +// AddHandlerCalls gets all the calls that were made to AddHandler. +// Check the length with: +// len(mockedClusterScanInterface.AddHandlerCalls()) +func (mock *ClusterScanInterfaceMock) AddHandlerCalls() []struct { + Ctx context.Context + Name string + Sync v3.ClusterScanHandlerFunc +} { + var calls []struct { + Ctx context.Context + Name string + Sync v3.ClusterScanHandlerFunc + } + lockClusterScanInterfaceMockAddHandler.RLock() + calls = mock.calls.AddHandler + lockClusterScanInterfaceMockAddHandler.RUnlock() + return calls +} + +// AddLifecycle calls AddLifecycleFunc. +func (mock *ClusterScanInterfaceMock) AddLifecycle(ctx context.Context, name string, lifecycle v3.ClusterScanLifecycle) { + if mock.AddLifecycleFunc == nil { + panic("ClusterScanInterfaceMock.AddLifecycleFunc: method is nil but ClusterScanInterface.AddLifecycle was just called") + } + callInfo := struct { + Ctx context.Context + Name string + Lifecycle v3.ClusterScanLifecycle + }{ + Ctx: ctx, + Name: name, + Lifecycle: lifecycle, + } + lockClusterScanInterfaceMockAddLifecycle.Lock() + mock.calls.AddLifecycle = append(mock.calls.AddLifecycle, callInfo) + lockClusterScanInterfaceMockAddLifecycle.Unlock() + mock.AddLifecycleFunc(ctx, name, lifecycle) +} + +// AddLifecycleCalls gets all the calls that were made to AddLifecycle. +// Check the length with: +// len(mockedClusterScanInterface.AddLifecycleCalls()) +func (mock *ClusterScanInterfaceMock) AddLifecycleCalls() []struct { + Ctx context.Context + Name string + Lifecycle v3.ClusterScanLifecycle +} { + var calls []struct { + Ctx context.Context + Name string + Lifecycle v3.ClusterScanLifecycle + } + lockClusterScanInterfaceMockAddLifecycle.RLock() + calls = mock.calls.AddLifecycle + lockClusterScanInterfaceMockAddLifecycle.RUnlock() + return calls +} + +// Controller calls ControllerFunc. +func (mock *ClusterScanInterfaceMock) Controller() v3.ClusterScanController { + if mock.ControllerFunc == nil { + panic("ClusterScanInterfaceMock.ControllerFunc: method is nil but ClusterScanInterface.Controller was just called") + } + callInfo := struct { + }{} + lockClusterScanInterfaceMockController.Lock() + mock.calls.Controller = append(mock.calls.Controller, callInfo) + lockClusterScanInterfaceMockController.Unlock() + return mock.ControllerFunc() +} + +// ControllerCalls gets all the calls that were made to Controller. +// Check the length with: +// len(mockedClusterScanInterface.ControllerCalls()) +func (mock *ClusterScanInterfaceMock) ControllerCalls() []struct { +} { + var calls []struct { + } + lockClusterScanInterfaceMockController.RLock() + calls = mock.calls.Controller + lockClusterScanInterfaceMockController.RUnlock() + return calls +} + +// Create calls CreateFunc. +func (mock *ClusterScanInterfaceMock) Create(in1 *v3.ClusterScan) (*v3.ClusterScan, error) { + if mock.CreateFunc == nil { + panic("ClusterScanInterfaceMock.CreateFunc: method is nil but ClusterScanInterface.Create was just called") + } + callInfo := struct { + In1 *v3.ClusterScan + }{ + In1: in1, + } + lockClusterScanInterfaceMockCreate.Lock() + mock.calls.Create = append(mock.calls.Create, callInfo) + lockClusterScanInterfaceMockCreate.Unlock() + return mock.CreateFunc(in1) +} + +// CreateCalls gets all the calls that were made to Create. +// Check the length with: +// len(mockedClusterScanInterface.CreateCalls()) +func (mock *ClusterScanInterfaceMock) CreateCalls() []struct { + In1 *v3.ClusterScan +} { + var calls []struct { + In1 *v3.ClusterScan + } + lockClusterScanInterfaceMockCreate.RLock() + calls = mock.calls.Create + lockClusterScanInterfaceMockCreate.RUnlock() + return calls +} + +// Delete calls DeleteFunc. +func (mock *ClusterScanInterfaceMock) Delete(name string, options *v1.DeleteOptions) error { + if mock.DeleteFunc == nil { + panic("ClusterScanInterfaceMock.DeleteFunc: method is nil but ClusterScanInterface.Delete was just called") + } + callInfo := struct { + Name string + Options *v1.DeleteOptions + }{ + Name: name, + Options: options, + } + lockClusterScanInterfaceMockDelete.Lock() + mock.calls.Delete = append(mock.calls.Delete, callInfo) + lockClusterScanInterfaceMockDelete.Unlock() + return mock.DeleteFunc(name, options) +} + +// DeleteCalls gets all the calls that were made to Delete. +// Check the length with: +// len(mockedClusterScanInterface.DeleteCalls()) +func (mock *ClusterScanInterfaceMock) DeleteCalls() []struct { + Name string + Options *v1.DeleteOptions +} { + var calls []struct { + Name string + Options *v1.DeleteOptions + } + lockClusterScanInterfaceMockDelete.RLock() + calls = mock.calls.Delete + lockClusterScanInterfaceMockDelete.RUnlock() + return calls +} + +// DeleteCollection calls DeleteCollectionFunc. +func (mock *ClusterScanInterfaceMock) DeleteCollection(deleteOpts *v1.DeleteOptions, listOpts v1.ListOptions) error { + if mock.DeleteCollectionFunc == nil { + panic("ClusterScanInterfaceMock.DeleteCollectionFunc: method is nil but ClusterScanInterface.DeleteCollection was just called") + } + callInfo := struct { + DeleteOpts *v1.DeleteOptions + ListOpts v1.ListOptions + }{ + DeleteOpts: deleteOpts, + ListOpts: listOpts, + } + lockClusterScanInterfaceMockDeleteCollection.Lock() + mock.calls.DeleteCollection = append(mock.calls.DeleteCollection, callInfo) + lockClusterScanInterfaceMockDeleteCollection.Unlock() + return mock.DeleteCollectionFunc(deleteOpts, listOpts) +} + +// DeleteCollectionCalls gets all the calls that were made to DeleteCollection. +// Check the length with: +// len(mockedClusterScanInterface.DeleteCollectionCalls()) +func (mock *ClusterScanInterfaceMock) DeleteCollectionCalls() []struct { + DeleteOpts *v1.DeleteOptions + ListOpts v1.ListOptions +} { + var calls []struct { + DeleteOpts *v1.DeleteOptions + ListOpts v1.ListOptions + } + lockClusterScanInterfaceMockDeleteCollection.RLock() + calls = mock.calls.DeleteCollection + lockClusterScanInterfaceMockDeleteCollection.RUnlock() + return calls +} + +// DeleteNamespaced calls DeleteNamespacedFunc. +func (mock *ClusterScanInterfaceMock) DeleteNamespaced(namespace string, name string, options *v1.DeleteOptions) error { + if mock.DeleteNamespacedFunc == nil { + panic("ClusterScanInterfaceMock.DeleteNamespacedFunc: method is nil but ClusterScanInterface.DeleteNamespaced was just called") + } + callInfo := struct { + Namespace string + Name string + Options *v1.DeleteOptions + }{ + Namespace: namespace, + Name: name, + Options: options, + } + lockClusterScanInterfaceMockDeleteNamespaced.Lock() + mock.calls.DeleteNamespaced = append(mock.calls.DeleteNamespaced, callInfo) + lockClusterScanInterfaceMockDeleteNamespaced.Unlock() + return mock.DeleteNamespacedFunc(namespace, name, options) +} + +// DeleteNamespacedCalls gets all the calls that were made to DeleteNamespaced. +// Check the length with: +// len(mockedClusterScanInterface.DeleteNamespacedCalls()) +func (mock *ClusterScanInterfaceMock) DeleteNamespacedCalls() []struct { + Namespace string + Name string + Options *v1.DeleteOptions +} { + var calls []struct { + Namespace string + Name string + Options *v1.DeleteOptions + } + lockClusterScanInterfaceMockDeleteNamespaced.RLock() + calls = mock.calls.DeleteNamespaced + lockClusterScanInterfaceMockDeleteNamespaced.RUnlock() + return calls +} + +// Get calls GetFunc. +func (mock *ClusterScanInterfaceMock) Get(name string, opts v1.GetOptions) (*v3.ClusterScan, error) { + if mock.GetFunc == nil { + panic("ClusterScanInterfaceMock.GetFunc: method is nil but ClusterScanInterface.Get was just called") + } + callInfo := struct { + Name string + Opts v1.GetOptions + }{ + Name: name, + Opts: opts, + } + lockClusterScanInterfaceMockGet.Lock() + mock.calls.Get = append(mock.calls.Get, callInfo) + lockClusterScanInterfaceMockGet.Unlock() + return mock.GetFunc(name, opts) +} + +// GetCalls gets all the calls that were made to Get. +// Check the length with: +// len(mockedClusterScanInterface.GetCalls()) +func (mock *ClusterScanInterfaceMock) GetCalls() []struct { + Name string + Opts v1.GetOptions +} { + var calls []struct { + Name string + Opts v1.GetOptions + } + lockClusterScanInterfaceMockGet.RLock() + calls = mock.calls.Get + lockClusterScanInterfaceMockGet.RUnlock() + return calls +} + +// GetNamespaced calls GetNamespacedFunc. +func (mock *ClusterScanInterfaceMock) GetNamespaced(namespace string, name string, opts v1.GetOptions) (*v3.ClusterScan, error) { + if mock.GetNamespacedFunc == nil { + panic("ClusterScanInterfaceMock.GetNamespacedFunc: method is nil but ClusterScanInterface.GetNamespaced was just called") + } + callInfo := struct { + Namespace string + Name string + Opts v1.GetOptions + }{ + Namespace: namespace, + Name: name, + Opts: opts, + } + lockClusterScanInterfaceMockGetNamespaced.Lock() + mock.calls.GetNamespaced = append(mock.calls.GetNamespaced, callInfo) + lockClusterScanInterfaceMockGetNamespaced.Unlock() + return mock.GetNamespacedFunc(namespace, name, opts) +} + +// GetNamespacedCalls gets all the calls that were made to GetNamespaced. +// Check the length with: +// len(mockedClusterScanInterface.GetNamespacedCalls()) +func (mock *ClusterScanInterfaceMock) GetNamespacedCalls() []struct { + Namespace string + Name string + Opts v1.GetOptions +} { + var calls []struct { + Namespace string + Name string + Opts v1.GetOptions + } + lockClusterScanInterfaceMockGetNamespaced.RLock() + calls = mock.calls.GetNamespaced + lockClusterScanInterfaceMockGetNamespaced.RUnlock() + return calls +} + +// List calls ListFunc. +func (mock *ClusterScanInterfaceMock) List(opts v1.ListOptions) (*v3.ClusterScanList, error) { + if mock.ListFunc == nil { + panic("ClusterScanInterfaceMock.ListFunc: method is nil but ClusterScanInterface.List was just called") + } + callInfo := struct { + Opts v1.ListOptions + }{ + Opts: opts, + } + lockClusterScanInterfaceMockList.Lock() + mock.calls.List = append(mock.calls.List, callInfo) + lockClusterScanInterfaceMockList.Unlock() + return mock.ListFunc(opts) +} + +// ListCalls gets all the calls that were made to List. +// Check the length with: +// len(mockedClusterScanInterface.ListCalls()) +func (mock *ClusterScanInterfaceMock) ListCalls() []struct { + Opts v1.ListOptions +} { + var calls []struct { + Opts v1.ListOptions + } + lockClusterScanInterfaceMockList.RLock() + calls = mock.calls.List + lockClusterScanInterfaceMockList.RUnlock() + return calls +} + +// ObjectClient calls ObjectClientFunc. +func (mock *ClusterScanInterfaceMock) ObjectClient() *objectclient.ObjectClient { + if mock.ObjectClientFunc == nil { + panic("ClusterScanInterfaceMock.ObjectClientFunc: method is nil but ClusterScanInterface.ObjectClient was just called") + } + callInfo := struct { + }{} + lockClusterScanInterfaceMockObjectClient.Lock() + mock.calls.ObjectClient = append(mock.calls.ObjectClient, callInfo) + lockClusterScanInterfaceMockObjectClient.Unlock() + return mock.ObjectClientFunc() +} + +// ObjectClientCalls gets all the calls that were made to ObjectClient. +// Check the length with: +// len(mockedClusterScanInterface.ObjectClientCalls()) +func (mock *ClusterScanInterfaceMock) ObjectClientCalls() []struct { +} { + var calls []struct { + } + lockClusterScanInterfaceMockObjectClient.RLock() + calls = mock.calls.ObjectClient + lockClusterScanInterfaceMockObjectClient.RUnlock() + return calls +} + +// Update calls UpdateFunc. +func (mock *ClusterScanInterfaceMock) Update(in1 *v3.ClusterScan) (*v3.ClusterScan, error) { + if mock.UpdateFunc == nil { + panic("ClusterScanInterfaceMock.UpdateFunc: method is nil but ClusterScanInterface.Update was just called") + } + callInfo := struct { + In1 *v3.ClusterScan + }{ + In1: in1, + } + lockClusterScanInterfaceMockUpdate.Lock() + mock.calls.Update = append(mock.calls.Update, callInfo) + lockClusterScanInterfaceMockUpdate.Unlock() + return mock.UpdateFunc(in1) +} + +// UpdateCalls gets all the calls that were made to Update. +// Check the length with: +// len(mockedClusterScanInterface.UpdateCalls()) +func (mock *ClusterScanInterfaceMock) UpdateCalls() []struct { + In1 *v3.ClusterScan +} { + var calls []struct { + In1 *v3.ClusterScan + } + lockClusterScanInterfaceMockUpdate.RLock() + calls = mock.calls.Update + lockClusterScanInterfaceMockUpdate.RUnlock() + return calls +} + +// Watch calls WatchFunc. +func (mock *ClusterScanInterfaceMock) Watch(opts v1.ListOptions) (watch.Interface, error) { + if mock.WatchFunc == nil { + panic("ClusterScanInterfaceMock.WatchFunc: method is nil but ClusterScanInterface.Watch was just called") + } + callInfo := struct { + Opts v1.ListOptions + }{ + Opts: opts, + } + lockClusterScanInterfaceMockWatch.Lock() + mock.calls.Watch = append(mock.calls.Watch, callInfo) + lockClusterScanInterfaceMockWatch.Unlock() + return mock.WatchFunc(opts) +} + +// WatchCalls gets all the calls that were made to Watch. +// Check the length with: +// len(mockedClusterScanInterface.WatchCalls()) +func (mock *ClusterScanInterfaceMock) WatchCalls() []struct { + Opts v1.ListOptions +} { + var calls []struct { + Opts v1.ListOptions + } + lockClusterScanInterfaceMockWatch.RLock() + calls = mock.calls.Watch + lockClusterScanInterfaceMockWatch.RUnlock() + return calls +} + +var ( + lockClusterScansGetterMockClusterScans sync.RWMutex +) + +// Ensure, that ClusterScansGetterMock does implement ClusterScansGetter. +// If this is not the case, regenerate this file with moq. +var _ v3.ClusterScansGetter = &ClusterScansGetterMock{} + +// ClusterScansGetterMock is a mock implementation of ClusterScansGetter. +// +// func TestSomethingThatUsesClusterScansGetter(t *testing.T) { +// +// // make and configure a mocked ClusterScansGetter +// mockedClusterScansGetter := &ClusterScansGetterMock{ +// ClusterScansFunc: func(namespace string) v3.ClusterScanInterface { +// panic("mock out the ClusterScans method") +// }, +// } +// +// // use mockedClusterScansGetter in code that requires ClusterScansGetter +// // and then make assertions. +// +// } +type ClusterScansGetterMock struct { + // ClusterScansFunc mocks the ClusterScans method. + ClusterScansFunc func(namespace string) v3.ClusterScanInterface + + // calls tracks calls to the methods. + calls struct { + // ClusterScans holds details about calls to the ClusterScans method. + ClusterScans []struct { + // Namespace is the namespace argument value. + Namespace string + } + } +} + +// ClusterScans calls ClusterScansFunc. +func (mock *ClusterScansGetterMock) ClusterScans(namespace string) v3.ClusterScanInterface { + if mock.ClusterScansFunc == nil { + panic("ClusterScansGetterMock.ClusterScansFunc: method is nil but ClusterScansGetter.ClusterScans was just called") + } + callInfo := struct { + Namespace string + }{ + Namespace: namespace, + } + lockClusterScansGetterMockClusterScans.Lock() + mock.calls.ClusterScans = append(mock.calls.ClusterScans, callInfo) + lockClusterScansGetterMockClusterScans.Unlock() + return mock.ClusterScansFunc(namespace) +} + +// ClusterScansCalls gets all the calls that were made to ClusterScans. +// Check the length with: +// len(mockedClusterScansGetter.ClusterScansCalls()) +func (mock *ClusterScansGetterMock) ClusterScansCalls() []struct { + Namespace string +} { + var calls []struct { + Namespace string + } + lockClusterScansGetterMockClusterScans.RLock() + calls = mock.calls.ClusterScans + lockClusterScansGetterMockClusterScans.RUnlock() + return calls +} diff --git a/apis/management.cattle.io/v3/zz_generated_cluster_scan_controller.go b/apis/management.cattle.io/v3/zz_generated_cluster_scan_controller.go new file mode 100644 index 00000000..2552553c --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_cluster_scan_controller.go @@ -0,0 +1,452 @@ +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 ( + ClusterScanGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "ClusterScan", + } + ClusterScanResource = metav1.APIResource{ + Name: "clusterscans", + SingularName: "clusterscan", + Namespaced: true, + + Kind: ClusterScanGroupVersionKind.Kind, + } + + ClusterScanGroupVersionResource = schema.GroupVersionResource{ + Group: GroupName, + Version: Version, + Resource: "clusterscans", + } +) + +func init() { + resource.Put(ClusterScanGroupVersionResource) +} + +func NewClusterScan(namespace, name string, obj ClusterScan) *ClusterScan { + obj.APIVersion, obj.Kind = ClusterScanGroupVersionKind.ToAPIVersionAndKind() + obj.Name = name + obj.Namespace = namespace + return &obj +} + +type ClusterScanList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ClusterScan `json:"items"` +} + +type ClusterScanHandlerFunc func(key string, obj *ClusterScan) (runtime.Object, error) + +type ClusterScanChangeHandlerFunc func(obj *ClusterScan) (runtime.Object, error) + +type ClusterScanLister interface { + List(namespace string, selector labels.Selector) (ret []*ClusterScan, err error) + Get(namespace, name string) (*ClusterScan, error) +} + +type ClusterScanController interface { + Generic() controller.GenericController + Informer() cache.SharedIndexInformer + Lister() ClusterScanLister + AddHandler(ctx context.Context, name string, handler ClusterScanHandlerFunc) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler ClusterScanHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type ClusterScanInterface interface { + ObjectClient() *objectclient.ObjectClient + Create(*ClusterScan) (*ClusterScan, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ClusterScan, error) + Get(name string, opts metav1.GetOptions) (*ClusterScan, error) + Update(*ClusterScan) (*ClusterScan, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*ClusterScanList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() ClusterScanController + AddHandler(ctx context.Context, name string, sync ClusterScanHandlerFunc) + AddLifecycle(ctx context.Context, name string, lifecycle ClusterScanLifecycle) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ClusterScanHandlerFunc) + AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ClusterScanLifecycle) +} + +type clusterScanLister struct { + controller *clusterScanController +} + +func (l *clusterScanLister) List(namespace string, selector labels.Selector) (ret []*ClusterScan, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*ClusterScan)) + }) + return +} + +func (l *clusterScanLister) Get(namespace, name string) (*ClusterScan, 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: ClusterScanGroupVersionKind.Group, + Resource: "clusterScan", + }, key) + } + return obj.(*ClusterScan), nil +} + +type clusterScanController struct { + controller.GenericController +} + +func (c *clusterScanController) Generic() controller.GenericController { + return c.GenericController +} + +func (c *clusterScanController) Lister() ClusterScanLister { + return &clusterScanLister{ + controller: c, + } +} + +func (c *clusterScanController) AddHandler(ctx context.Context, name string, handler ClusterScanHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*ClusterScan); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *clusterScanController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler ClusterScanHandlerFunc) { + resource.PutClusterScoped(ClusterScanGroupVersionResource) + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*ClusterScan); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +type clusterScanFactory struct { +} + +func (c clusterScanFactory) Object() runtime.Object { + return &ClusterScan{} +} + +func (c clusterScanFactory) List() runtime.Object { + return &ClusterScanList{} +} + +func (s *clusterScanClient) Controller() ClusterScanController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.clusterScanControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(ClusterScanGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &clusterScanController{ + GenericController: genericController, + } + + s.client.clusterScanControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type clusterScanClient struct { + client *Client + ns string + objectClient *objectclient.ObjectClient + controller ClusterScanController +} + +func (s *clusterScanClient) ObjectClient() *objectclient.ObjectClient { + return s.objectClient +} + +func (s *clusterScanClient) Create(o *ClusterScan) (*ClusterScan, error) { + obj, err := s.objectClient.Create(o) + return obj.(*ClusterScan), err +} + +func (s *clusterScanClient) Get(name string, opts metav1.GetOptions) (*ClusterScan, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*ClusterScan), err +} + +func (s *clusterScanClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ClusterScan, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*ClusterScan), err +} + +func (s *clusterScanClient) Update(o *ClusterScan) (*ClusterScan, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*ClusterScan), err +} + +func (s *clusterScanClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *clusterScanClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *clusterScanClient) List(opts metav1.ListOptions) (*ClusterScanList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*ClusterScanList), err +} + +func (s *clusterScanClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *clusterScanClient) Patch(o *ClusterScan, patchType types.PatchType, data []byte, subresources ...string) (*ClusterScan, error) { + obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...) + return obj.(*ClusterScan), err +} + +func (s *clusterScanClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *clusterScanClient) AddHandler(ctx context.Context, name string, sync ClusterScanHandlerFunc) { + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *clusterScanClient) AddLifecycle(ctx context.Context, name string, lifecycle ClusterScanLifecycle) { + sync := NewClusterScanLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *clusterScanClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ClusterScanHandlerFunc) { + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *clusterScanClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ClusterScanLifecycle) { + sync := NewClusterScanLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +type ClusterScanIndexer func(obj *ClusterScan) ([]string, error) + +type ClusterScanClientCache interface { + Get(namespace, name string) (*ClusterScan, error) + List(namespace string, selector labels.Selector) ([]*ClusterScan, error) + + Index(name string, indexer ClusterScanIndexer) + GetIndexed(name, key string) ([]*ClusterScan, error) +} + +type ClusterScanClient interface { + Create(*ClusterScan) (*ClusterScan, error) + Get(namespace, name string, opts metav1.GetOptions) (*ClusterScan, error) + Update(*ClusterScan) (*ClusterScan, error) + Delete(namespace, name string, options *metav1.DeleteOptions) error + List(namespace string, opts metav1.ListOptions) (*ClusterScanList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + + Cache() ClusterScanClientCache + + OnCreate(ctx context.Context, name string, sync ClusterScanChangeHandlerFunc) + OnChange(ctx context.Context, name string, sync ClusterScanChangeHandlerFunc) + OnRemove(ctx context.Context, name string, sync ClusterScanChangeHandlerFunc) + Enqueue(namespace, name string) + + Generic() controller.GenericController + ObjectClient() *objectclient.ObjectClient + Interface() ClusterScanInterface +} + +type clusterScanClientCache struct { + client *clusterScanClient2 +} + +type clusterScanClient2 struct { + iface ClusterScanInterface + controller ClusterScanController +} + +func (n *clusterScanClient2) Interface() ClusterScanInterface { + return n.iface +} + +func (n *clusterScanClient2) Generic() controller.GenericController { + return n.iface.Controller().Generic() +} + +func (n *clusterScanClient2) ObjectClient() *objectclient.ObjectClient { + return n.Interface().ObjectClient() +} + +func (n *clusterScanClient2) Enqueue(namespace, name string) { + n.iface.Controller().Enqueue(namespace, name) +} + +func (n *clusterScanClient2) Create(obj *ClusterScan) (*ClusterScan, error) { + return n.iface.Create(obj) +} + +func (n *clusterScanClient2) Get(namespace, name string, opts metav1.GetOptions) (*ClusterScan, error) { + return n.iface.GetNamespaced(namespace, name, opts) +} + +func (n *clusterScanClient2) Update(obj *ClusterScan) (*ClusterScan, error) { + return n.iface.Update(obj) +} + +func (n *clusterScanClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error { + return n.iface.DeleteNamespaced(namespace, name, options) +} + +func (n *clusterScanClient2) List(namespace string, opts metav1.ListOptions) (*ClusterScanList, error) { + return n.iface.List(opts) +} + +func (n *clusterScanClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return n.iface.Watch(opts) +} + +func (n *clusterScanClientCache) Get(namespace, name string) (*ClusterScan, error) { + return n.client.controller.Lister().Get(namespace, name) +} + +func (n *clusterScanClientCache) List(namespace string, selector labels.Selector) ([]*ClusterScan, error) { + return n.client.controller.Lister().List(namespace, selector) +} + +func (n *clusterScanClient2) Cache() ClusterScanClientCache { + n.loadController() + return &clusterScanClientCache{ + client: n, + } +} + +func (n *clusterScanClient2) OnCreate(ctx context.Context, name string, sync ClusterScanChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-create", &clusterScanLifecycleDelegate{create: sync}) +} + +func (n *clusterScanClient2) OnChange(ctx context.Context, name string, sync ClusterScanChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-change", &clusterScanLifecycleDelegate{update: sync}) +} + +func (n *clusterScanClient2) OnRemove(ctx context.Context, name string, sync ClusterScanChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name, &clusterScanLifecycleDelegate{remove: sync}) +} + +func (n *clusterScanClientCache) Index(name string, indexer ClusterScanIndexer) { + err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{ + name: func(obj interface{}) ([]string, error) { + if v, ok := obj.(*ClusterScan); ok { + return indexer(v) + } + return nil, nil + }, + }) + + if err != nil { + panic(err) + } +} + +func (n *clusterScanClientCache) GetIndexed(name, key string) ([]*ClusterScan, error) { + var result []*ClusterScan + objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key) + if err != nil { + return nil, err + } + for _, obj := range objs { + if v, ok := obj.(*ClusterScan); ok { + result = append(result, v) + } + } + + return result, nil +} + +func (n *clusterScanClient2) loadController() { + if n.controller == nil { + n.controller = n.iface.Controller() + } +} + +type clusterScanLifecycleDelegate struct { + create ClusterScanChangeHandlerFunc + update ClusterScanChangeHandlerFunc + remove ClusterScanChangeHandlerFunc +} + +func (n *clusterScanLifecycleDelegate) HasCreate() bool { + return n.create != nil +} + +func (n *clusterScanLifecycleDelegate) Create(obj *ClusterScan) (runtime.Object, error) { + if n.create == nil { + return obj, nil + } + return n.create(obj) +} + +func (n *clusterScanLifecycleDelegate) HasFinalize() bool { + return n.remove != nil +} + +func (n *clusterScanLifecycleDelegate) Remove(obj *ClusterScan) (runtime.Object, error) { + if n.remove == nil { + return obj, nil + } + return n.remove(obj) +} + +func (n *clusterScanLifecycleDelegate) Updated(obj *ClusterScan) (runtime.Object, error) { + if n.update == nil { + return obj, nil + } + return n.update(obj) +} diff --git a/apis/management.cattle.io/v3/zz_generated_cluster_scan_lifecycle_adapter.go b/apis/management.cattle.io/v3/zz_generated_cluster_scan_lifecycle_adapter.go new file mode 100644 index 00000000..67db4bf9 --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_cluster_scan_lifecycle_adapter.go @@ -0,0 +1,62 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type ClusterScanLifecycle interface { + Create(obj *ClusterScan) (runtime.Object, error) + Remove(obj *ClusterScan) (runtime.Object, error) + Updated(obj *ClusterScan) (runtime.Object, error) +} + +type clusterScanLifecycleAdapter struct { + lifecycle ClusterScanLifecycle +} + +func (w *clusterScanLifecycleAdapter) HasCreate() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasCreate() +} + +func (w *clusterScanLifecycleAdapter) HasFinalize() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasFinalize() +} + +func (w *clusterScanLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*ClusterScan)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *clusterScanLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*ClusterScan)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *clusterScanLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*ClusterScan)) + if o == nil { + return nil, err + } + return o, err +} + +func NewClusterScanLifecycleAdapter(name string, clusterScoped bool, client ClusterScanInterface, l ClusterScanLifecycle) ClusterScanHandlerFunc { + adapter := &clusterScanLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *ClusterScan) (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_deepcopy.go b/apis/management.cattle.io/v3/zz_generated_deepcopy.go index dc0a79b2..34adaa20 100644 --- a/apis/management.cattle.io/v3/zz_generated_deepcopy.go +++ b/apis/management.cattle.io/v3/zz_generated_deepcopy.go @@ -1794,6 +1794,138 @@ func (in *ClusterRoleTemplateBindingList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterScan) DeepCopyInto(out *ClusterScan) { + *out = *in + out.Namespaced = in.Namespaced + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterScan. +func (in *ClusterScan) DeepCopy() *ClusterScan { + if in == nil { + return nil + } + out := new(ClusterScan) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterScan) 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 *ClusterScanCondition) DeepCopyInto(out *ClusterScanCondition) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterScanCondition. +func (in *ClusterScanCondition) DeepCopy() *ClusterScanCondition { + if in == nil { + return nil + } + out := new(ClusterScanCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterScanConfig) DeepCopyInto(out *ClusterScanConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterScanConfig. +func (in *ClusterScanConfig) DeepCopy() *ClusterScanConfig { + if in == nil { + return nil + } + out := new(ClusterScanConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterScanList) DeepCopyInto(out *ClusterScanList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterScan, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterScanList. +func (in *ClusterScanList) DeepCopy() *ClusterScanList { + if in == nil { + return nil + } + out := new(ClusterScanList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterScanList) 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 *ClusterScanSpec) DeepCopyInto(out *ClusterScanSpec) { + *out = *in + out.ScanConfig = in.ScanConfig + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterScanSpec. +func (in *ClusterScanSpec) DeepCopy() *ClusterScanSpec { + if in == nil { + return nil + } + out := new(ClusterScanSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterScanStatus) DeepCopyInto(out *ClusterScanStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]ClusterScanCondition, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterScanStatus. +func (in *ClusterScanStatus) DeepCopy() *ClusterScanStatus { + if in == nil { + return nil + } + out := new(ClusterScanStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) { *out = *in 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 fbd4911e..ba576969 100644 --- a/apis/management.cattle.io/v3/zz_generated_k8s_client.go +++ b/apis/management.cattle.io/v3/zz_generated_k8s_client.go @@ -71,6 +71,7 @@ type Interface interface { GlobalDNSProvidersGetter KontainerDriversGetter EtcdBackupsGetter + ClusterScansGetter MonitorMetricsGetter ClusterMonitorGraphsGetter ProjectMonitorGraphsGetter @@ -133,6 +134,7 @@ type Clients struct { GlobalDNSProvider GlobalDNSProviderClient KontainerDriver KontainerDriverClient EtcdBackup EtcdBackupClient + ClusterScan ClusterScanClient MonitorMetric MonitorMetricClient ClusterMonitorGraph ClusterMonitorGraphClient ProjectMonitorGraph ProjectMonitorGraphClient @@ -197,6 +199,7 @@ type Client struct { globalDnsProviderControllers map[string]GlobalDNSProviderController kontainerDriverControllers map[string]KontainerDriverController etcdBackupControllers map[string]EtcdBackupController + clusterScanControllers map[string]ClusterScanController monitorMetricControllers map[string]MonitorMetricController clusterMonitorGraphControllers map[string]ClusterMonitorGraphController projectMonitorGraphControllers map[string]ProjectMonitorGraphController @@ -391,6 +394,9 @@ func NewClientsFromInterface(iface Interface) *Clients { EtcdBackup: &etcdBackupClient2{ iface: iface.EtcdBackups(""), }, + ClusterScan: &clusterScanClient2{ + iface: iface.ClusterScans(""), + }, MonitorMetric: &monitorMetricClient2{ iface: iface.MonitorMetrics(""), }, @@ -476,6 +482,7 @@ func NewForConfig(config rest.Config) (Interface, error) { globalDnsProviderControllers: map[string]GlobalDNSProviderController{}, kontainerDriverControllers: map[string]KontainerDriverController{}, etcdBackupControllers: map[string]EtcdBackupController{}, + clusterScanControllers: map[string]ClusterScanController{}, monitorMetricControllers: map[string]MonitorMetricController{}, clusterMonitorGraphControllers: map[string]ClusterMonitorGraphController{}, projectMonitorGraphControllers: map[string]ProjectMonitorGraphController{}, @@ -1160,6 +1167,19 @@ func (c *Client) EtcdBackups(namespace string) EtcdBackupInterface { } } +type ClusterScansGetter interface { + ClusterScans(namespace string) ClusterScanInterface +} + +func (c *Client) ClusterScans(namespace string) ClusterScanInterface { + objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ClusterScanResource, ClusterScanGroupVersionKind, clusterScanFactory{}) + return &clusterScanClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + type MonitorMetricsGetter interface { MonitorMetrics(namespace string) MonitorMetricInterface } diff --git a/apis/management.cattle.io/v3/zz_generated_scheme.go b/apis/management.cattle.io/v3/zz_generated_scheme.go index 45edeb1f..f7604600 100644 --- a/apis/management.cattle.io/v3/zz_generated_scheme.go +++ b/apis/management.cattle.io/v3/zz_generated_scheme.go @@ -135,6 +135,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &KontainerDriverList{}, &EtcdBackup{}, &EtcdBackupList{}, + &ClusterScan{}, + &ClusterScanList{}, &MonitorMetric{}, &MonitorMetricList{}, &ClusterMonitorGraph{}, diff --git a/client/management/v3/zz_generated_client.go b/client/management/v3/zz_generated_client.go index 7ff4bbd4..ca57ae32 100644 --- a/client/management/v3/zz_generated_client.go +++ b/client/management/v3/zz_generated_client.go @@ -57,6 +57,7 @@ type Client struct { GlobalDNSProvider GlobalDNSProviderOperations KontainerDriver KontainerDriverOperations EtcdBackup EtcdBackupOperations + ClusterScan ClusterScanOperations MonitorMetric MonitorMetricOperations ClusterMonitorGraph ClusterMonitorGraphOperations ProjectMonitorGraph ProjectMonitorGraphOperations @@ -126,6 +127,7 @@ func NewClient(opts *clientbase.ClientOpts) (*Client, error) { client.GlobalDNSProvider = newGlobalDNSProviderClient(client) client.KontainerDriver = newKontainerDriverClient(client) client.EtcdBackup = newEtcdBackupClient(client) + client.ClusterScan = newClusterScanClient(client) client.MonitorMetric = newMonitorMetricClient(client) client.ClusterMonitorGraph = newClusterMonitorGraphClient(client) client.ProjectMonitorGraph = newProjectMonitorGraphClient(client) diff --git a/client/management/v3/zz_generated_cluster.go b/client/management/v3/zz_generated_cluster.go index d5e08e26..c26e1765 100644 --- a/client/management/v3/zz_generated_cluster.go +++ b/client/management/v3/zz_generated_cluster.go @@ -142,6 +142,8 @@ type ClusterOperations interface { ActionRotateCertificates(resource *Cluster, input *RotateCertificateInput) (*RotateCertificateOutput, error) + ActionRunSecurityScan(resource *Cluster) error + ActionViewMonitoring(resource *Cluster) (*MonitoringOutput, error) } @@ -245,6 +247,11 @@ func (c *ClusterClient) ActionRotateCertificates(resource *Cluster, input *Rotat return resp, err } +func (c *ClusterClient) ActionRunSecurityScan(resource *Cluster) error { + err := c.apiClient.Ops.DoAction(ClusterType, "runSecurityScan", &resource.Resource, nil, nil) + return err +} + func (c *ClusterClient) ActionViewMonitoring(resource *Cluster) (*MonitoringOutput, error) { resp := &MonitoringOutput{} err := c.apiClient.Ops.DoAction(ClusterType, "viewMonitoring", &resource.Resource, nil, resp) diff --git a/client/management/v3/zz_generated_cluster_scan.go b/client/management/v3/zz_generated_cluster_scan.go new file mode 100644 index 00000000..f95de692 --- /dev/null +++ b/client/management/v3/zz_generated_cluster_scan.go @@ -0,0 +1,117 @@ +package client + +import ( + "github.com/rancher/norman/types" +) + +const ( + ClusterScanType = "clusterScan" + ClusterScanFieldAnnotations = "annotations" + ClusterScanFieldClusterID = "clusterId" + ClusterScanFieldCreated = "created" + ClusterScanFieldCreatorID = "creatorId" + ClusterScanFieldLabels = "labels" + ClusterScanFieldManual = "manual" + ClusterScanFieldName = "name" + ClusterScanFieldNamespaceId = "namespaceId" + ClusterScanFieldOwnerReferences = "ownerReferences" + ClusterScanFieldRemoved = "removed" + ClusterScanFieldScanConfig = "scanConfig" + ClusterScanFieldScanType = "scanType" + ClusterScanFieldState = "state" + ClusterScanFieldStatus = "status" + ClusterScanFieldTransitioning = "transitioning" + ClusterScanFieldTransitioningMessage = "transitioningMessage" + ClusterScanFieldUUID = "uuid" +) + +type ClusterScan struct { + types.Resource + Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` + ClusterID string `json:"clusterId,omitempty" yaml:"clusterId,omitempty"` + Created string `json:"created,omitempty" yaml:"created,omitempty"` + CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"` + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + Manual bool `json:"manual,omitempty" yaml:"manual,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"` + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + ScanConfig *ClusterScanConfig `json:"scanConfig,omitempty" yaml:"scanConfig,omitempty"` + ScanType string `json:"scanType,omitempty" yaml:"scanType,omitempty"` + State string `json:"state,omitempty" yaml:"state,omitempty"` + Status *ClusterScanStatus `json:"status,omitempty" yaml:"status,omitempty"` + Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` + TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioningMessage,omitempty"` + UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ClusterScanCollection struct { + types.Collection + Data []ClusterScan `json:"data,omitempty"` + client *ClusterScanClient +} + +type ClusterScanClient struct { + apiClient *Client +} + +type ClusterScanOperations interface { + List(opts *types.ListOpts) (*ClusterScanCollection, error) + Create(opts *ClusterScan) (*ClusterScan, error) + Update(existing *ClusterScan, updates interface{}) (*ClusterScan, error) + Replace(existing *ClusterScan) (*ClusterScan, error) + ByID(id string) (*ClusterScan, error) + Delete(container *ClusterScan) error +} + +func newClusterScanClient(apiClient *Client) *ClusterScanClient { + return &ClusterScanClient{ + apiClient: apiClient, + } +} + +func (c *ClusterScanClient) Create(container *ClusterScan) (*ClusterScan, error) { + resp := &ClusterScan{} + err := c.apiClient.Ops.DoCreate(ClusterScanType, container, resp) + return resp, err +} + +func (c *ClusterScanClient) Update(existing *ClusterScan, updates interface{}) (*ClusterScan, error) { + resp := &ClusterScan{} + err := c.apiClient.Ops.DoUpdate(ClusterScanType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ClusterScanClient) Replace(obj *ClusterScan) (*ClusterScan, error) { + resp := &ClusterScan{} + err := c.apiClient.Ops.DoReplace(ClusterScanType, &obj.Resource, obj, resp) + return resp, err +} + +func (c *ClusterScanClient) List(opts *types.ListOpts) (*ClusterScanCollection, error) { + resp := &ClusterScanCollection{} + err := c.apiClient.Ops.DoList(ClusterScanType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ClusterScanCollection) Next() (*ClusterScanCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ClusterScanCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ClusterScanClient) ByID(id string) (*ClusterScan, error) { + resp := &ClusterScan{} + err := c.apiClient.Ops.DoByID(ClusterScanType, id, resp) + return resp, err +} + +func (c *ClusterScanClient) Delete(container *ClusterScan) error { + return c.apiClient.Ops.DoResourceDelete(ClusterScanType, &container.Resource) +} diff --git a/client/management/v3/zz_generated_cluster_scan_condition.go b/client/management/v3/zz_generated_cluster_scan_condition.go new file mode 100644 index 00000000..86252023 --- /dev/null +++ b/client/management/v3/zz_generated_cluster_scan_condition.go @@ -0,0 +1,20 @@ +package client + +const ( + ClusterScanConditionType = "clusterScanCondition" + ClusterScanConditionFieldLastTransitionTime = "lastTransitionTime" + ClusterScanConditionFieldLastUpdateTime = "lastUpdateTime" + ClusterScanConditionFieldMessage = "message" + ClusterScanConditionFieldReason = "reason" + ClusterScanConditionFieldStatus = "status" + ClusterScanConditionFieldType = "type" +) + +type ClusterScanCondition struct { + LastTransitionTime string `json:"lastTransitionTime,omitempty" yaml:"lastTransitionTime,omitempty"` + LastUpdateTime string `json:"lastUpdateTime,omitempty" yaml:"lastUpdateTime,omitempty"` + Message string `json:"message,omitempty" yaml:"message,omitempty"` + Reason string `json:"reason,omitempty" yaml:"reason,omitempty"` + Status string `json:"status,omitempty" yaml:"status,omitempty"` + Type string `json:"type,omitempty" yaml:"type,omitempty"` +} diff --git a/client/management/v3/zz_generated_cluster_scan_config.go b/client/management/v3/zz_generated_cluster_scan_config.go new file mode 100644 index 00000000..ca0af044 --- /dev/null +++ b/client/management/v3/zz_generated_cluster_scan_config.go @@ -0,0 +1,8 @@ +package client + +const ( + ClusterScanConfigType = "clusterScanConfig" +) + +type ClusterScanConfig struct { +} diff --git a/client/management/v3/zz_generated_cluster_scan_spec.go b/client/management/v3/zz_generated_cluster_scan_spec.go new file mode 100644 index 00000000..19ce3811 --- /dev/null +++ b/client/management/v3/zz_generated_cluster_scan_spec.go @@ -0,0 +1,16 @@ +package client + +const ( + ClusterScanSpecType = "clusterScanSpec" + ClusterScanSpecFieldClusterID = "clusterId" + ClusterScanSpecFieldManual = "manual" + ClusterScanSpecFieldScanConfig = "scanConfig" + ClusterScanSpecFieldScanType = "scanType" +) + +type ClusterScanSpec struct { + ClusterID string `json:"clusterId,omitempty" yaml:"clusterId,omitempty"` + Manual bool `json:"manual,omitempty" yaml:"manual,omitempty"` + ScanConfig *ClusterScanConfig `json:"scanConfig,omitempty" yaml:"scanConfig,omitempty"` + ScanType string `json:"scanType,omitempty" yaml:"scanType,omitempty"` +} diff --git a/client/management/v3/zz_generated_cluster_scan_status.go b/client/management/v3/zz_generated_cluster_scan_status.go new file mode 100644 index 00000000..4356c48f --- /dev/null +++ b/client/management/v3/zz_generated_cluster_scan_status.go @@ -0,0 +1,10 @@ +package client + +const ( + ClusterScanStatusType = "clusterScanStatus" + ClusterScanStatusFieldConditions = "conditions" +) + +type ClusterScanStatus struct { + Conditions []ClusterScanCondition `json:"conditions,omitempty" yaml:"conditions,omitempty"` +}