mirror of
https://github.com/rancher/types.git
synced 2025-08-31 21:00:16 +00:00
Update generated code
This commit is contained in:
@@ -151,8 +151,6 @@ var (
|
||||
lockAPIServiceControllerMockGeneric sync.RWMutex
|
||||
lockAPIServiceControllerMockInformer sync.RWMutex
|
||||
lockAPIServiceControllerMockLister sync.RWMutex
|
||||
lockAPIServiceControllerMockStart sync.RWMutex
|
||||
lockAPIServiceControllerMockSync sync.RWMutex
|
||||
)
|
||||
|
||||
// Ensure, that APIServiceControllerMock does implement APIServiceController.
|
||||
@@ -192,12 +190,6 @@ var _ v1a.APIServiceController = &APIServiceControllerMock{}
|
||||
// ListerFunc: func() v1a.APIServiceLister {
|
||||
// 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 mockedAPIServiceController in code that requires APIServiceController
|
||||
@@ -232,12 +224,6 @@ type APIServiceControllerMock struct {
|
||||
// ListerFunc mocks the Lister method.
|
||||
ListerFunc func() v1a.APIServiceLister
|
||||
|
||||
// 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 APIServiceControllerMock 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 *APIServiceControllerMock) ListerCalls() []struct {
|
||||
return calls
|
||||
}
|
||||
|
||||
// Start calls StartFunc.
|
||||
func (mock *APIServiceControllerMock) Start(ctx context.Context, threadiness int) error {
|
||||
if mock.StartFunc == nil {
|
||||
panic("APIServiceControllerMock.StartFunc: method is nil but APIServiceController.Start was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
Ctx context.Context
|
||||
Threadiness int
|
||||
}{
|
||||
Ctx: ctx,
|
||||
Threadiness: threadiness,
|
||||
}
|
||||
lockAPIServiceControllerMockStart.Lock()
|
||||
mock.calls.Start = append(mock.calls.Start, callInfo)
|
||||
lockAPIServiceControllerMockStart.Unlock()
|
||||
return mock.StartFunc(ctx, threadiness)
|
||||
}
|
||||
|
||||
// StartCalls gets all the calls that were made to Start.
|
||||
// Check the length with:
|
||||
// len(mockedAPIServiceController.StartCalls())
|
||||
func (mock *APIServiceControllerMock) StartCalls() []struct {
|
||||
Ctx context.Context
|
||||
Threadiness int
|
||||
} {
|
||||
var calls []struct {
|
||||
Ctx context.Context
|
||||
Threadiness int
|
||||
}
|
||||
lockAPIServiceControllerMockStart.RLock()
|
||||
calls = mock.calls.Start
|
||||
lockAPIServiceControllerMockStart.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// Sync calls SyncFunc.
|
||||
func (mock *APIServiceControllerMock) Sync(ctx context.Context) error {
|
||||
if mock.SyncFunc == nil {
|
||||
panic("APIServiceControllerMock.SyncFunc: method is nil but APIServiceController.Sync was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
Ctx context.Context
|
||||
}{
|
||||
Ctx: ctx,
|
||||
}
|
||||
lockAPIServiceControllerMockSync.Lock()
|
||||
mock.calls.Sync = append(mock.calls.Sync, callInfo)
|
||||
lockAPIServiceControllerMockSync.Unlock()
|
||||
return mock.SyncFunc(ctx)
|
||||
}
|
||||
|
||||
// SyncCalls gets all the calls that were made to Sync.
|
||||
// Check the length with:
|
||||
// len(mockedAPIServiceController.SyncCalls())
|
||||
func (mock *APIServiceControllerMock) SyncCalls() []struct {
|
||||
Ctx context.Context
|
||||
} {
|
||||
var calls []struct {
|
||||
Ctx context.Context
|
||||
}
|
||||
lockAPIServiceControllerMockSync.RLock()
|
||||
calls = mock.calls.Sync
|
||||
lockAPIServiceControllerMockSync.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
var (
|
||||
lockAPIServiceInterfaceMockAddClusterScopedFeatureHandler sync.RWMutex
|
||||
lockAPIServiceInterfaceMockAddClusterScopedFeatureLifecycle sync.RWMutex
|
||||
@@ -792,10 +700,10 @@ var _ v1a.APIServiceInterface = &APIServiceInterfaceMock{}
|
||||
// GetNamespacedFunc: func(namespace string, name string, opts v1b.GetOptions) (*v1.APIService, error) {
|
||||
// panic("mock out the GetNamespaced method")
|
||||
// },
|
||||
// ListFunc: func(opts v1b.ListOptions) (*v1a.APIServiceList, error) {
|
||||
// ListFunc: func(opts v1b.ListOptions) (*v1.APIServiceList, error) {
|
||||
// panic("mock out the List method")
|
||||
// },
|
||||
// ListNamespacedFunc: func(namespace string, opts v1b.ListOptions) (*v1a.APIServiceList, error) {
|
||||
// ListNamespacedFunc: func(namespace string, opts v1b.ListOptions) (*v1.APIServiceList, error) {
|
||||
// panic("mock out the ListNamespaced method")
|
||||
// },
|
||||
// ObjectClientFunc: func() *objectclient.ObjectClient {
|
||||
@@ -860,10 +768,10 @@ type APIServiceInterfaceMock struct {
|
||||
GetNamespacedFunc func(namespace string, name string, opts v1b.GetOptions) (*v1.APIService, error)
|
||||
|
||||
// ListFunc mocks the List method.
|
||||
ListFunc func(opts v1b.ListOptions) (*v1a.APIServiceList, error)
|
||||
ListFunc func(opts v1b.ListOptions) (*v1.APIServiceList, error)
|
||||
|
||||
// ListNamespacedFunc mocks the ListNamespaced method.
|
||||
ListNamespacedFunc func(namespace string, opts v1b.ListOptions) (*v1a.APIServiceList, error)
|
||||
ListNamespacedFunc func(namespace string, opts v1b.ListOptions) (*v1.APIServiceList, error)
|
||||
|
||||
// ObjectClientFunc mocks the ObjectClient method.
|
||||
ObjectClientFunc func() *objectclient.ObjectClient
|
||||
@@ -1624,7 +1532,7 @@ func (mock *APIServiceInterfaceMock) GetNamespacedCalls() []struct {
|
||||
}
|
||||
|
||||
// List calls ListFunc.
|
||||
func (mock *APIServiceInterfaceMock) List(opts v1b.ListOptions) (*v1a.APIServiceList, error) {
|
||||
func (mock *APIServiceInterfaceMock) List(opts v1b.ListOptions) (*v1.APIServiceList, error) {
|
||||
if mock.ListFunc == nil {
|
||||
panic("APIServiceInterfaceMock.ListFunc: method is nil but APIServiceInterface.List was just called")
|
||||
}
|
||||
@@ -1655,7 +1563,7 @@ func (mock *APIServiceInterfaceMock) ListCalls() []struct {
|
||||
}
|
||||
|
||||
// ListNamespaced calls ListNamespacedFunc.
|
||||
func (mock *APIServiceInterfaceMock) ListNamespaced(namespace string, opts v1b.ListOptions) (*v1a.APIServiceList, error) {
|
||||
func (mock *APIServiceInterfaceMock) ListNamespaced(namespace string, opts v1b.ListOptions) (*v1.APIServiceList, error) {
|
||||
if mock.ListNamespacedFunc == nil {
|
||||
panic("APIServiceInterfaceMock.ListNamespacedFunc: method is nil but APIServiceInterface.ListNamespaced was just called")
|
||||
}
|
||||
|
@@ -49,12 +49,6 @@ func NewAPIService(namespace, name string, obj v1.APIService) *v1.APIService {
|
||||
return &obj
|
||||
}
|
||||
|
||||
type APIServiceList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []v1.APIService `json:"items"`
|
||||
}
|
||||
|
||||
type APIServiceHandlerFunc func(key string, obj *v1.APIService) (runtime.Object, error)
|
||||
|
||||
type APIServiceChangeHandlerFunc func(obj *v1.APIService) (runtime.Object, error)
|
||||
@@ -74,8 +68,6 @@ type APIServiceController interface {
|
||||
AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, handler APIServiceHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
EnqueueAfter(namespace, name string, after time.Duration)
|
||||
Sync(ctx context.Context) error
|
||||
Start(ctx context.Context, threadiness int) error
|
||||
}
|
||||
|
||||
type APIServiceInterface interface {
|
||||
@@ -86,8 +78,8 @@ type APIServiceInterface interface {
|
||||
Update(*v1.APIService) (*v1.APIService, error)
|
||||
Delete(name string, options *metav1.DeleteOptions) error
|
||||
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (*APIServiceList, error)
|
||||
ListNamespaced(namespace string, opts metav1.ListOptions) (*APIServiceList, error)
|
||||
List(opts metav1.ListOptions) (*v1.APIServiceList, error)
|
||||
ListNamespaced(namespace string, opts metav1.ListOptions) (*v1.APIServiceList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Controller() APIServiceController
|
||||
@@ -126,7 +118,7 @@ func (l *apiServiceLister) Get(namespace, name string) (*v1.APIService, error) {
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(schema.GroupResource{
|
||||
Group: APIServiceGroupVersionKind.Group,
|
||||
Resource: "apiService",
|
||||
Resource: APIServiceGroupVersionResource.Resource,
|
||||
}, key)
|
||||
}
|
||||
return obj.(*v1.APIService), nil
|
||||
@@ -206,29 +198,16 @@ func (c apiServiceFactory) Object() runtime.Object {
|
||||
}
|
||||
|
||||
func (c apiServiceFactory) List() runtime.Object {
|
||||
return &APIServiceList{}
|
||||
return &v1.APIServiceList{}
|
||||
}
|
||||
|
||||
func (s *apiServiceClient) Controller() APIServiceController {
|
||||
s.client.Lock()
|
||||
defer s.client.Unlock()
|
||||
|
||||
c, ok := s.client.apiServiceControllers[s.ns]
|
||||
if ok {
|
||||
return c
|
||||
}
|
||||
|
||||
genericController := controller.NewGenericController(APIServiceGroupVersionKind.Kind+"Controller",
|
||||
s.objectClient)
|
||||
s.client.controllerFactory.ForResourceKind(APIServiceGroupVersionResource, APIServiceGroupVersionKind.Kind, false))
|
||||
|
||||
c = &apiServiceController{
|
||||
return &apiServiceController{
|
||||
GenericController: genericController,
|
||||
}
|
||||
|
||||
s.client.apiServiceControllers[s.ns] = c
|
||||
s.client.starters = append(s.client.starters, c)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
type apiServiceClient struct {
|
||||
@@ -262,6 +241,11 @@ func (s *apiServiceClient) Update(o *v1.APIService) (*v1.APIService, error) {
|
||||
return obj.(*v1.APIService), err
|
||||
}
|
||||
|
||||
func (s *apiServiceClient) UpdateStatus(o *v1.APIService) (*v1.APIService, error) {
|
||||
obj, err := s.objectClient.UpdateStatus(o.Name, o)
|
||||
return obj.(*v1.APIService), err
|
||||
}
|
||||
|
||||
func (s *apiServiceClient) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.Delete(name, options)
|
||||
}
|
||||
@@ -270,14 +254,14 @@ func (s *apiServiceClient) DeleteNamespaced(namespace, name string, options *met
|
||||
return s.objectClient.DeleteNamespaced(namespace, name, options)
|
||||
}
|
||||
|
||||
func (s *apiServiceClient) List(opts metav1.ListOptions) (*APIServiceList, error) {
|
||||
func (s *apiServiceClient) List(opts metav1.ListOptions) (*v1.APIServiceList, error) {
|
||||
obj, err := s.objectClient.List(opts)
|
||||
return obj.(*APIServiceList), err
|
||||
return obj.(*v1.APIServiceList), err
|
||||
}
|
||||
|
||||
func (s *apiServiceClient) ListNamespaced(namespace string, opts metav1.ListOptions) (*APIServiceList, error) {
|
||||
func (s *apiServiceClient) ListNamespaced(namespace string, opts metav1.ListOptions) (*v1.APIServiceList, error) {
|
||||
obj, err := s.objectClient.ListNamespaced(namespace, opts)
|
||||
return obj.(*APIServiceList), err
|
||||
return obj.(*v1.APIServiceList), err
|
||||
}
|
||||
|
||||
func (s *apiServiceClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
|
@@ -1,39 +0,0 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *APIServiceList) DeepCopyInto(out *APIServiceList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]apiregistrationv1.APIService, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServiceList.
|
||||
func (in *APIServiceList) DeepCopy() *APIServiceList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(APIServiceList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *APIServiceList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
@@ -1,71 +1,34 @@
|
||||
package v1
|
||||
|
||||
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
|
||||
|
||||
APIServicesGetter
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
sync.Mutex
|
||||
restClient rest.Interface
|
||||
starters []controller.Starter
|
||||
|
||||
apiServiceControllers map[string]APIServiceController
|
||||
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,
|
||||
|
||||
apiServiceControllers: map[string]APIServiceController{},
|
||||
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 APIServicesGetter interface {
|
||||
APIServices(namespace string) APIServiceInterface
|
||||
}
|
||||
|
||||
func (c *Client) APIServices(namespace string) APIServiceInterface {
|
||||
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &APIServiceResource, APIServiceGroupVersionKind, apiServiceFactory{})
|
||||
sharedClient := c.clientFactory.ForResourceKind(APIServiceGroupVersionResource, APIServiceGroupVersionKind.Kind, false)
|
||||
objectClient := objectclient.NewObjectClient(namespace, sharedClient, &APIServiceResource, APIServiceGroupVersionKind, apiServiceFactory{})
|
||||
return &apiServiceClient{
|
||||
ns: namespace,
|
||||
client: c,
|
||||
|
@@ -1,8 +1,6 @@
|
||||
package v1
|
||||
|
||||
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,
|
||||
|
||||
&APIServiceList{},
|
||||
)
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user