mirror of
https://github.com/rancher/types.git
synced 2025-09-16 06:49:21 +00:00
Update generated code
This commit is contained in:
@@ -150,8 +150,6 @@ var (
|
||||
lockAuthProviderControllerMockGeneric sync.RWMutex
|
||||
lockAuthProviderControllerMockInformer sync.RWMutex
|
||||
lockAuthProviderControllerMockLister sync.RWMutex
|
||||
lockAuthProviderControllerMockStart sync.RWMutex
|
||||
lockAuthProviderControllerMockSync sync.RWMutex
|
||||
)
|
||||
|
||||
// Ensure, that AuthProviderControllerMock does implement AuthProviderController.
|
||||
@@ -191,12 +189,6 @@ var _ v3public.AuthProviderController = &AuthProviderControllerMock{}
|
||||
// ListerFunc: func() v3public.AuthProviderLister {
|
||||
// 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 mockedAuthProviderController in code that requires AuthProviderController
|
||||
@@ -231,12 +223,6 @@ type AuthProviderControllerMock struct {
|
||||
// ListerFunc mocks the Lister method.
|
||||
ListerFunc func() v3public.AuthProviderLister
|
||||
|
||||
// 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.
|
||||
@@ -308,18 +294,6 @@ type AuthProviderControllerMock 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -647,72 +621,6 @@ func (mock *AuthProviderControllerMock) ListerCalls() []struct {
|
||||
return calls
|
||||
}
|
||||
|
||||
// Start calls StartFunc.
|
||||
func (mock *AuthProviderControllerMock) Start(ctx context.Context, threadiness int) error {
|
||||
if mock.StartFunc == nil {
|
||||
panic("AuthProviderControllerMock.StartFunc: method is nil but AuthProviderController.Start was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
Ctx context.Context
|
||||
Threadiness int
|
||||
}{
|
||||
Ctx: ctx,
|
||||
Threadiness: threadiness,
|
||||
}
|
||||
lockAuthProviderControllerMockStart.Lock()
|
||||
mock.calls.Start = append(mock.calls.Start, callInfo)
|
||||
lockAuthProviderControllerMockStart.Unlock()
|
||||
return mock.StartFunc(ctx, threadiness)
|
||||
}
|
||||
|
||||
// StartCalls gets all the calls that were made to Start.
|
||||
// Check the length with:
|
||||
// len(mockedAuthProviderController.StartCalls())
|
||||
func (mock *AuthProviderControllerMock) StartCalls() []struct {
|
||||
Ctx context.Context
|
||||
Threadiness int
|
||||
} {
|
||||
var calls []struct {
|
||||
Ctx context.Context
|
||||
Threadiness int
|
||||
}
|
||||
lockAuthProviderControllerMockStart.RLock()
|
||||
calls = mock.calls.Start
|
||||
lockAuthProviderControllerMockStart.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// Sync calls SyncFunc.
|
||||
func (mock *AuthProviderControllerMock) Sync(ctx context.Context) error {
|
||||
if mock.SyncFunc == nil {
|
||||
panic("AuthProviderControllerMock.SyncFunc: method is nil but AuthProviderController.Sync was just called")
|
||||
}
|
||||
callInfo := struct {
|
||||
Ctx context.Context
|
||||
}{
|
||||
Ctx: ctx,
|
||||
}
|
||||
lockAuthProviderControllerMockSync.Lock()
|
||||
mock.calls.Sync = append(mock.calls.Sync, callInfo)
|
||||
lockAuthProviderControllerMockSync.Unlock()
|
||||
return mock.SyncFunc(ctx)
|
||||
}
|
||||
|
||||
// SyncCalls gets all the calls that were made to Sync.
|
||||
// Check the length with:
|
||||
// len(mockedAuthProviderController.SyncCalls())
|
||||
func (mock *AuthProviderControllerMock) SyncCalls() []struct {
|
||||
Ctx context.Context
|
||||
} {
|
||||
var calls []struct {
|
||||
Ctx context.Context
|
||||
}
|
||||
lockAuthProviderControllerMockSync.RLock()
|
||||
calls = mock.calls.Sync
|
||||
lockAuthProviderControllerMockSync.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
var (
|
||||
lockAuthProviderInterfaceMockAddClusterScopedFeatureHandler sync.RWMutex
|
||||
lockAuthProviderInterfaceMockAddClusterScopedFeatureLifecycle sync.RWMutex
|
||||
|
@@ -73,8 +73,6 @@ type AuthProviderController interface {
|
||||
AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, handler AuthProviderHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
EnqueueAfter(namespace, name string, after time.Duration)
|
||||
Sync(ctx context.Context) error
|
||||
Start(ctx context.Context, threadiness int) error
|
||||
}
|
||||
|
||||
type AuthProviderInterface interface {
|
||||
@@ -125,7 +123,7 @@ func (l *authProviderLister) Get(namespace, name string) (*AuthProvider, error)
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(schema.GroupResource{
|
||||
Group: AuthProviderGroupVersionKind.Group,
|
||||
Resource: "authProvider",
|
||||
Resource: AuthProviderGroupVersionResource.Resource,
|
||||
}, key)
|
||||
}
|
||||
return obj.(*AuthProvider), nil
|
||||
@@ -209,25 +207,12 @@ func (c authProviderFactory) List() runtime.Object {
|
||||
}
|
||||
|
||||
func (s *authProviderClient) Controller() AuthProviderController {
|
||||
s.client.Lock()
|
||||
defer s.client.Unlock()
|
||||
|
||||
c, ok := s.client.authProviderControllers[s.ns]
|
||||
if ok {
|
||||
return c
|
||||
}
|
||||
|
||||
genericController := controller.NewGenericController(AuthProviderGroupVersionKind.Kind+"Controller",
|
||||
s.objectClient)
|
||||
s.client.controllerFactory.ForResourceKind(AuthProviderGroupVersionResource, AuthProviderGroupVersionKind.Kind, false))
|
||||
|
||||
c = &authProviderController{
|
||||
return &authProviderController{
|
||||
GenericController: genericController,
|
||||
}
|
||||
|
||||
s.client.authProviderControllers[s.ns] = c
|
||||
s.client.starters = append(s.client.starters, c)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
type authProviderClient struct {
|
||||
@@ -261,6 +246,11 @@ func (s *authProviderClient) Update(o *AuthProvider) (*AuthProvider, error) {
|
||||
return obj.(*AuthProvider), err
|
||||
}
|
||||
|
||||
func (s *authProviderClient) UpdateStatus(o *AuthProvider) (*AuthProvider, error) {
|
||||
obj, err := s.objectClient.UpdateStatus(o.Name, o)
|
||||
return obj.(*AuthProvider), err
|
||||
}
|
||||
|
||||
func (s *authProviderClient) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.Delete(name, options)
|
||||
}
|
||||
|
@@ -1,71 +1,48 @@
|
||||
package v3public
|
||||
|
||||
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/apimachinery/pkg/runtime"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
type (
|
||||
contextKeyType struct{}
|
||||
contextClientsKeyType struct{}
|
||||
)
|
||||
|
||||
type Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
controller.Starter
|
||||
|
||||
AuthProvidersGetter
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
sync.Mutex
|
||||
restClient rest.Interface
|
||||
starters []controller.Starter
|
||||
|
||||
authProviderControllers map[string]AuthProviderController
|
||||
controllerFactory controller.SharedControllerFactory
|
||||
clientFactory client.SharedClientFactory
|
||||
}
|
||||
|
||||
func NewForConfig(config rest.Config) (Interface, error) {
|
||||
if config.NegotiatedSerializer == nil {
|
||||
config.NegotiatedSerializer = dynamic.NegotiatedSerializer
|
||||
func NewForConfig(cfg rest.Config) (Interface, error) {
|
||||
scheme := runtime.NewScheme()
|
||||
if err := AddToScheme(scheme); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
restClient, err := restwatch.UnversionedRESTClientFor(&config)
|
||||
controllerFactory, err := controller.NewSharedControllerFactoryFromConfig(&cfg, scheme)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewFromControllerFactory(controllerFactory)
|
||||
}
|
||||
|
||||
func NewFromControllerFactory(factory controller.SharedControllerFactory) (Interface, error) {
|
||||
return &Client{
|
||||
restClient: restClient,
|
||||
|
||||
authProviderControllers: map[string]AuthProviderController{},
|
||||
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 AuthProvidersGetter interface {
|
||||
AuthProviders(namespace string) AuthProviderInterface
|
||||
}
|
||||
|
||||
func (c *Client) AuthProviders(namespace string) AuthProviderInterface {
|
||||
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &AuthProviderResource, AuthProviderGroupVersionKind, authProviderFactory{})
|
||||
sharedClient := c.clientFactory.ForResourceKind(AuthProviderGroupVersionResource, AuthProviderGroupVersionKind.Kind, false)
|
||||
objectClient := objectclient.NewObjectClient(namespace, sharedClient, &AuthProviderResource, AuthProviderGroupVersionKind, authProviderFactory{})
|
||||
return &authProviderClient{
|
||||
ns: namespace,
|
||||
client: c,
|
||||
|
Reference in New Issue
Block a user