mirror of
https://github.com/rancher/types.git
synced 2025-09-04 06:34:44 +00:00
Update generated code
This commit is contained in:
@@ -151,8 +151,6 @@ var (
|
||||
lockCronJobControllerMockGeneric sync.RWMutex
|
||||
lockCronJobControllerMockInformer sync.RWMutex
|
||||
lockCronJobControllerMockLister sync.RWMutex
|
||||
lockCronJobControllerMockStart sync.RWMutex
|
||||
lockCronJobControllerMockSync sync.RWMutex
|
||||
)
|
||||
|
||||
// Ensure, that CronJobControllerMock does implement CronJobController.
|
||||
@@ -192,12 +190,6 @@ var _ v1beta1a.CronJobController = &CronJobControllerMock{}
|
||||
// ListerFunc: func() v1beta1a.CronJobLister {
|
||||
// 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 mockedCronJobController in code that requires CronJobController
|
||||
@@ -232,12 +224,6 @@ type CronJobControllerMock struct {
|
||||
// ListerFunc mocks the Lister method.
|
||||
ListerFunc func() v1beta1a.CronJobLister
|
||||
|
||||
// StartFunc mocks the Start method.
|
||||
StartFunc func(ctx context.Context, threadiness int) error
|
||||
|
||||
// SyncFunc mocks the Sync method.
|
||||
SyncFunc func(ctx context.Context) error
|
||||
|
||||
// calls tracks calls to the methods.
|
||||
calls struct {
|
||||
// AddClusterScopedFeatureHandler holds details about calls to the AddClusterScopedFeatureHandler method.
|
||||
@@ -309,18 +295,6 @@ type CronJobControllerMock 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -648,72 +622,6 @@ func (mock *CronJobControllerMock) ListerCalls() []struct {
|
||||
return calls
|
||||
}
|
||||
|
||||
// Start calls StartFunc.
|
||||
func (mock *CronJobControllerMock) Start(ctx context.Context, threadiness int) error {
|
||||
if mock.StartFunc == nil {
|
||||
panic("CronJobControllerMock.StartFunc: method is nil but CronJobController.Start was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
Ctx context.Context
|
||||
Threadiness int
|
||||
}{
|
||||
Ctx: ctx,
|
||||
Threadiness: threadiness,
|
||||
}
|
||||
lockCronJobControllerMockStart.Lock()
|
||||
mock.calls.Start = append(mock.calls.Start, callInfo)
|
||||
lockCronJobControllerMockStart.Unlock()
|
||||
return mock.StartFunc(ctx, threadiness)
|
||||
}
|
||||
|
||||
// StartCalls gets all the calls that were made to Start.
|
||||
// Check the length with:
|
||||
// len(mockedCronJobController.StartCalls())
|
||||
func (mock *CronJobControllerMock) StartCalls() []struct {
|
||||
Ctx context.Context
|
||||
Threadiness int
|
||||
} {
|
||||
var calls []struct {
|
||||
Ctx context.Context
|
||||
Threadiness int
|
||||
}
|
||||
lockCronJobControllerMockStart.RLock()
|
||||
calls = mock.calls.Start
|
||||
lockCronJobControllerMockStart.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// Sync calls SyncFunc.
|
||||
func (mock *CronJobControllerMock) Sync(ctx context.Context) error {
|
||||
if mock.SyncFunc == nil {
|
||||
panic("CronJobControllerMock.SyncFunc: method is nil but CronJobController.Sync was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
Ctx context.Context
|
||||
}{
|
||||
Ctx: ctx,
|
||||
}
|
||||
lockCronJobControllerMockSync.Lock()
|
||||
mock.calls.Sync = append(mock.calls.Sync, callInfo)
|
||||
lockCronJobControllerMockSync.Unlock()
|
||||
return mock.SyncFunc(ctx)
|
||||
}
|
||||
|
||||
// SyncCalls gets all the calls that were made to Sync.
|
||||
// Check the length with:
|
||||
// len(mockedCronJobController.SyncCalls())
|
||||
func (mock *CronJobControllerMock) SyncCalls() []struct {
|
||||
Ctx context.Context
|
||||
} {
|
||||
var calls []struct {
|
||||
Ctx context.Context
|
||||
}
|
||||
lockCronJobControllerMockSync.RLock()
|
||||
calls = mock.calls.Sync
|
||||
lockCronJobControllerMockSync.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
var (
|
||||
lockCronJobInterfaceMockAddClusterScopedFeatureHandler sync.RWMutex
|
||||
lockCronJobInterfaceMockAddClusterScopedFeatureLifecycle sync.RWMutex
|
||||
@@ -792,10 +700,10 @@ var _ v1beta1a.CronJobInterface = &CronJobInterfaceMock{}
|
||||
// GetNamespacedFunc: func(namespace string, name string, opts v1.GetOptions) (*v1beta1.CronJob, error) {
|
||||
// panic("mock out the GetNamespaced method")
|
||||
// },
|
||||
// ListFunc: func(opts v1.ListOptions) (*v1beta1a.CronJobList, error) {
|
||||
// ListFunc: func(opts v1.ListOptions) (*v1beta1.CronJobList, error) {
|
||||
// panic("mock out the List method")
|
||||
// },
|
||||
// ListNamespacedFunc: func(namespace string, opts v1.ListOptions) (*v1beta1a.CronJobList, error) {
|
||||
// ListNamespacedFunc: func(namespace string, opts v1.ListOptions) (*v1beta1.CronJobList, error) {
|
||||
// panic("mock out the ListNamespaced method")
|
||||
// },
|
||||
// ObjectClientFunc: func() *objectclient.ObjectClient {
|
||||
@@ -860,10 +768,10 @@ type CronJobInterfaceMock struct {
|
||||
GetNamespacedFunc func(namespace string, name string, opts v1.GetOptions) (*v1beta1.CronJob, error)
|
||||
|
||||
// ListFunc mocks the List method.
|
||||
ListFunc func(opts v1.ListOptions) (*v1beta1a.CronJobList, error)
|
||||
ListFunc func(opts v1.ListOptions) (*v1beta1.CronJobList, error)
|
||||
|
||||
// ListNamespacedFunc mocks the ListNamespaced method.
|
||||
ListNamespacedFunc func(namespace string, opts v1.ListOptions) (*v1beta1a.CronJobList, error)
|
||||
ListNamespacedFunc func(namespace string, opts v1.ListOptions) (*v1beta1.CronJobList, error)
|
||||
|
||||
// ObjectClientFunc mocks the ObjectClient method.
|
||||
ObjectClientFunc func() *objectclient.ObjectClient
|
||||
@@ -1624,7 +1532,7 @@ func (mock *CronJobInterfaceMock) GetNamespacedCalls() []struct {
|
||||
}
|
||||
|
||||
// List calls ListFunc.
|
||||
func (mock *CronJobInterfaceMock) List(opts v1.ListOptions) (*v1beta1a.CronJobList, error) {
|
||||
func (mock *CronJobInterfaceMock) List(opts v1.ListOptions) (*v1beta1.CronJobList, error) {
|
||||
if mock.ListFunc == nil {
|
||||
panic("CronJobInterfaceMock.ListFunc: method is nil but CronJobInterface.List was just called")
|
||||
}
|
||||
@@ -1655,7 +1563,7 @@ func (mock *CronJobInterfaceMock) ListCalls() []struct {
|
||||
}
|
||||
|
||||
// ListNamespaced calls ListNamespacedFunc.
|
||||
func (mock *CronJobInterfaceMock) ListNamespaced(namespace string, opts v1.ListOptions) (*v1beta1a.CronJobList, error) {
|
||||
func (mock *CronJobInterfaceMock) ListNamespaced(namespace string, opts v1.ListOptions) (*v1beta1.CronJobList, error) {
|
||||
if mock.ListNamespacedFunc == nil {
|
||||
panic("CronJobInterfaceMock.ListNamespacedFunc: method is nil but CronJobInterface.ListNamespaced was just called")
|
||||
}
|
||||
|
@@ -50,12 +50,6 @@ func NewCronJob(namespace, name string, obj v1beta1.CronJob) *v1beta1.CronJob {
|
||||
return &obj
|
||||
}
|
||||
|
||||
type CronJobList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []v1beta1.CronJob `json:"items"`
|
||||
}
|
||||
|
||||
type CronJobHandlerFunc func(key string, obj *v1beta1.CronJob) (runtime.Object, error)
|
||||
|
||||
type CronJobChangeHandlerFunc func(obj *v1beta1.CronJob) (runtime.Object, error)
|
||||
@@ -75,8 +69,6 @@ type CronJobController interface {
|
||||
AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, handler CronJobHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
EnqueueAfter(namespace, name string, after time.Duration)
|
||||
Sync(ctx context.Context) error
|
||||
Start(ctx context.Context, threadiness int) error
|
||||
}
|
||||
|
||||
type CronJobInterface interface {
|
||||
@@ -87,8 +79,8 @@ type CronJobInterface interface {
|
||||
Update(*v1beta1.CronJob) (*v1beta1.CronJob, error)
|
||||
Delete(name string, options *metav1.DeleteOptions) error
|
||||
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (*CronJobList, error)
|
||||
ListNamespaced(namespace string, opts metav1.ListOptions) (*CronJobList, error)
|
||||
List(opts metav1.ListOptions) (*v1beta1.CronJobList, error)
|
||||
ListNamespaced(namespace string, opts metav1.ListOptions) (*v1beta1.CronJobList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Controller() CronJobController
|
||||
@@ -127,7 +119,7 @@ func (l *cronJobLister) Get(namespace, name string) (*v1beta1.CronJob, error) {
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(schema.GroupResource{
|
||||
Group: CronJobGroupVersionKind.Group,
|
||||
Resource: "cronJob",
|
||||
Resource: CronJobGroupVersionResource.Resource,
|
||||
}, key)
|
||||
}
|
||||
return obj.(*v1beta1.CronJob), nil
|
||||
@@ -207,29 +199,16 @@ func (c cronJobFactory) Object() runtime.Object {
|
||||
}
|
||||
|
||||
func (c cronJobFactory) List() runtime.Object {
|
||||
return &CronJobList{}
|
||||
return &v1beta1.CronJobList{}
|
||||
}
|
||||
|
||||
func (s *cronJobClient) Controller() CronJobController {
|
||||
s.client.Lock()
|
||||
defer s.client.Unlock()
|
||||
|
||||
c, ok := s.client.cronJobControllers[s.ns]
|
||||
if ok {
|
||||
return c
|
||||
}
|
||||
|
||||
genericController := controller.NewGenericController(CronJobGroupVersionKind.Kind+"Controller",
|
||||
s.objectClient)
|
||||
s.client.controllerFactory.ForResourceKind(CronJobGroupVersionResource, CronJobGroupVersionKind.Kind, true))
|
||||
|
||||
c = &cronJobController{
|
||||
return &cronJobController{
|
||||
GenericController: genericController,
|
||||
}
|
||||
|
||||
s.client.cronJobControllers[s.ns] = c
|
||||
s.client.starters = append(s.client.starters, c)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
type cronJobClient struct {
|
||||
@@ -263,6 +242,11 @@ func (s *cronJobClient) Update(o *v1beta1.CronJob) (*v1beta1.CronJob, error) {
|
||||
return obj.(*v1beta1.CronJob), err
|
||||
}
|
||||
|
||||
func (s *cronJobClient) UpdateStatus(o *v1beta1.CronJob) (*v1beta1.CronJob, error) {
|
||||
obj, err := s.objectClient.UpdateStatus(o.Name, o)
|
||||
return obj.(*v1beta1.CronJob), err
|
||||
}
|
||||
|
||||
func (s *cronJobClient) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.Delete(name, options)
|
||||
}
|
||||
@@ -271,14 +255,14 @@ func (s *cronJobClient) DeleteNamespaced(namespace, name string, options *metav1
|
||||
return s.objectClient.DeleteNamespaced(namespace, name, options)
|
||||
}
|
||||
|
||||
func (s *cronJobClient) List(opts metav1.ListOptions) (*CronJobList, error) {
|
||||
func (s *cronJobClient) List(opts metav1.ListOptions) (*v1beta1.CronJobList, error) {
|
||||
obj, err := s.objectClient.List(opts)
|
||||
return obj.(*CronJobList), err
|
||||
return obj.(*v1beta1.CronJobList), err
|
||||
}
|
||||
|
||||
func (s *cronJobClient) ListNamespaced(namespace string, opts metav1.ListOptions) (*CronJobList, error) {
|
||||
func (s *cronJobClient) ListNamespaced(namespace string, opts metav1.ListOptions) (*v1beta1.CronJobList, error) {
|
||||
obj, err := s.objectClient.ListNamespaced(namespace, opts)
|
||||
return obj.(*CronJobList), err
|
||||
return obj.(*v1beta1.CronJobList), err
|
||||
}
|
||||
|
||||
func (s *cronJobClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
|
@@ -1,39 +0,0 @@
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
batchv1beta1 "k8s.io/api/batch/v1beta1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CronJobList) DeepCopyInto(out *CronJobList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]batchv1beta1.CronJob, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CronJobList.
|
||||
func (in *CronJobList) DeepCopy() *CronJobList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CronJobList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *CronJobList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
@@ -1,71 +1,34 @@
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"github.com/rancher/norman/controller"
|
||||
"github.com/rancher/lasso/pkg/client"
|
||||
"github.com/rancher/lasso/pkg/controller"
|
||||
"github.com/rancher/norman/objectclient"
|
||||
"github.com/rancher/norman/objectclient/dynamic"
|
||||
"github.com/rancher/norman/restwatch"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
type (
|
||||
contextKeyType struct{}
|
||||
contextClientsKeyType struct{}
|
||||
)
|
||||
|
||||
type Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
controller.Starter
|
||||
|
||||
CronJobsGetter
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
sync.Mutex
|
||||
restClient rest.Interface
|
||||
starters []controller.Starter
|
||||
|
||||
cronJobControllers map[string]CronJobController
|
||||
controllerFactory controller.SharedControllerFactory
|
||||
clientFactory client.SharedClientFactory
|
||||
}
|
||||
|
||||
func NewForConfig(config rest.Config) (Interface, error) {
|
||||
if config.NegotiatedSerializer == nil {
|
||||
config.NegotiatedSerializer = dynamic.NegotiatedSerializer
|
||||
}
|
||||
|
||||
restClient, err := restwatch.UnversionedRESTClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func NewFromControllerFactory(factory controller.SharedControllerFactory) (Interface, error) {
|
||||
return &Client{
|
||||
restClient: restClient,
|
||||
|
||||
cronJobControllers: map[string]CronJobController{},
|
||||
controllerFactory: factory,
|
||||
clientFactory: factory.SharedCacheFactory().SharedClientFactory(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *Client) RESTClient() rest.Interface {
|
||||
return c.restClient
|
||||
}
|
||||
|
||||
func (c *Client) Sync(ctx context.Context) error {
|
||||
return controller.Sync(ctx, c.starters...)
|
||||
}
|
||||
|
||||
func (c *Client) Start(ctx context.Context, threadiness int) error {
|
||||
return controller.Start(ctx, threadiness, c.starters...)
|
||||
}
|
||||
|
||||
type CronJobsGetter interface {
|
||||
CronJobs(namespace string) CronJobInterface
|
||||
}
|
||||
|
||||
func (c *Client) CronJobs(namespace string) CronJobInterface {
|
||||
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &CronJobResource, CronJobGroupVersionKind, cronJobFactory{})
|
||||
sharedClient := c.clientFactory.ForResourceKind(CronJobGroupVersionResource, CronJobGroupVersionKind.Kind, true)
|
||||
objectClient := objectclient.NewObjectClient(namespace, sharedClient, &CronJobResource, CronJobGroupVersionKind, cronJobFactory{})
|
||||
return &cronJobClient{
|
||||
ns: namespace,
|
||||
client: c,
|
||||
|
@@ -1,8 +1,6 @@
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
@@ -23,19 +21,3 @@ func Kind(kind string) schema.GroupKind {
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
|
||||
var (
|
||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
// Adds the list of known types to api.Scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
// TODO this gets cleaned up when the types are fixed
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
|
||||
&CronJobList{},
|
||||
)
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user