1
0
mirror of https://github.com/rancher/types.git synced 2025-09-03 22:24:38 +00:00

Update generated code

This commit is contained in:
Darren Shepherd
2020-05-16 22:09:08 -07:00
parent 8d8abc899c
commit f477d5d0b2
300 changed files with 4421 additions and 19279 deletions

View File

@@ -150,8 +150,6 @@ var (
lockClusterAuthTokenControllerMockGeneric sync.RWMutex
lockClusterAuthTokenControllerMockInformer sync.RWMutex
lockClusterAuthTokenControllerMockLister sync.RWMutex
lockClusterAuthTokenControllerMockStart sync.RWMutex
lockClusterAuthTokenControllerMockSync sync.RWMutex
)
// Ensure, that ClusterAuthTokenControllerMock does implement ClusterAuthTokenController.
@@ -191,12 +189,6 @@ var _ v3.ClusterAuthTokenController = &ClusterAuthTokenControllerMock{}
// ListerFunc: func() v3.ClusterAuthTokenLister {
// 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 mockedClusterAuthTokenController in code that requires ClusterAuthTokenController
@@ -231,12 +223,6 @@ type ClusterAuthTokenControllerMock struct {
// ListerFunc mocks the Lister method.
ListerFunc func() v3.ClusterAuthTokenLister
// 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 ClusterAuthTokenControllerMock 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 *ClusterAuthTokenControllerMock) ListerCalls() []struct {
return calls
}
// Start calls StartFunc.
func (mock *ClusterAuthTokenControllerMock) Start(ctx context.Context, threadiness int) error {
if mock.StartFunc == nil {
panic("ClusterAuthTokenControllerMock.StartFunc: method is nil but ClusterAuthTokenController.Start was just called")
}
callInfo := struct {
Ctx context.Context
Threadiness int
}{
Ctx: ctx,
Threadiness: threadiness,
}
lockClusterAuthTokenControllerMockStart.Lock()
mock.calls.Start = append(mock.calls.Start, callInfo)
lockClusterAuthTokenControllerMockStart.Unlock()
return mock.StartFunc(ctx, threadiness)
}
// StartCalls gets all the calls that were made to Start.
// Check the length with:
// len(mockedClusterAuthTokenController.StartCalls())
func (mock *ClusterAuthTokenControllerMock) StartCalls() []struct {
Ctx context.Context
Threadiness int
} {
var calls []struct {
Ctx context.Context
Threadiness int
}
lockClusterAuthTokenControllerMockStart.RLock()
calls = mock.calls.Start
lockClusterAuthTokenControllerMockStart.RUnlock()
return calls
}
// Sync calls SyncFunc.
func (mock *ClusterAuthTokenControllerMock) Sync(ctx context.Context) error {
if mock.SyncFunc == nil {
panic("ClusterAuthTokenControllerMock.SyncFunc: method is nil but ClusterAuthTokenController.Sync was just called")
}
callInfo := struct {
Ctx context.Context
}{
Ctx: ctx,
}
lockClusterAuthTokenControllerMockSync.Lock()
mock.calls.Sync = append(mock.calls.Sync, callInfo)
lockClusterAuthTokenControllerMockSync.Unlock()
return mock.SyncFunc(ctx)
}
// SyncCalls gets all the calls that were made to Sync.
// Check the length with:
// len(mockedClusterAuthTokenController.SyncCalls())
func (mock *ClusterAuthTokenControllerMock) SyncCalls() []struct {
Ctx context.Context
} {
var calls []struct {
Ctx context.Context
}
lockClusterAuthTokenControllerMockSync.RLock()
calls = mock.calls.Sync
lockClusterAuthTokenControllerMockSync.RUnlock()
return calls
}
var (
lockClusterAuthTokenInterfaceMockAddClusterScopedFeatureHandler sync.RWMutex
lockClusterAuthTokenInterfaceMockAddClusterScopedFeatureLifecycle sync.RWMutex

View File

@@ -150,8 +150,6 @@ var (
lockClusterUserAttributeControllerMockGeneric sync.RWMutex
lockClusterUserAttributeControllerMockInformer sync.RWMutex
lockClusterUserAttributeControllerMockLister sync.RWMutex
lockClusterUserAttributeControllerMockStart sync.RWMutex
lockClusterUserAttributeControllerMockSync sync.RWMutex
)
// Ensure, that ClusterUserAttributeControllerMock does implement ClusterUserAttributeController.
@@ -191,12 +189,6 @@ var _ v3.ClusterUserAttributeController = &ClusterUserAttributeControllerMock{}
// ListerFunc: func() v3.ClusterUserAttributeLister {
// 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 mockedClusterUserAttributeController in code that requires ClusterUserAttributeController
@@ -231,12 +223,6 @@ type ClusterUserAttributeControllerMock struct {
// ListerFunc mocks the Lister method.
ListerFunc func() v3.ClusterUserAttributeLister
// 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 ClusterUserAttributeControllerMock 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 *ClusterUserAttributeControllerMock) ListerCalls() []struct {
return calls
}
// Start calls StartFunc.
func (mock *ClusterUserAttributeControllerMock) Start(ctx context.Context, threadiness int) error {
if mock.StartFunc == nil {
panic("ClusterUserAttributeControllerMock.StartFunc: method is nil but ClusterUserAttributeController.Start was just called")
}
callInfo := struct {
Ctx context.Context
Threadiness int
}{
Ctx: ctx,
Threadiness: threadiness,
}
lockClusterUserAttributeControllerMockStart.Lock()
mock.calls.Start = append(mock.calls.Start, callInfo)
lockClusterUserAttributeControllerMockStart.Unlock()
return mock.StartFunc(ctx, threadiness)
}
// StartCalls gets all the calls that were made to Start.
// Check the length with:
// len(mockedClusterUserAttributeController.StartCalls())
func (mock *ClusterUserAttributeControllerMock) StartCalls() []struct {
Ctx context.Context
Threadiness int
} {
var calls []struct {
Ctx context.Context
Threadiness int
}
lockClusterUserAttributeControllerMockStart.RLock()
calls = mock.calls.Start
lockClusterUserAttributeControllerMockStart.RUnlock()
return calls
}
// Sync calls SyncFunc.
func (mock *ClusterUserAttributeControllerMock) Sync(ctx context.Context) error {
if mock.SyncFunc == nil {
panic("ClusterUserAttributeControllerMock.SyncFunc: method is nil but ClusterUserAttributeController.Sync was just called")
}
callInfo := struct {
Ctx context.Context
}{
Ctx: ctx,
}
lockClusterUserAttributeControllerMockSync.Lock()
mock.calls.Sync = append(mock.calls.Sync, callInfo)
lockClusterUserAttributeControllerMockSync.Unlock()
return mock.SyncFunc(ctx)
}
// SyncCalls gets all the calls that were made to Sync.
// Check the length with:
// len(mockedClusterUserAttributeController.SyncCalls())
func (mock *ClusterUserAttributeControllerMock) SyncCalls() []struct {
Ctx context.Context
} {
var calls []struct {
Ctx context.Context
}
lockClusterUserAttributeControllerMockSync.RLock()
calls = mock.calls.Sync
lockClusterUserAttributeControllerMockSync.RUnlock()
return calls
}
var (
lockClusterUserAttributeInterfaceMockAddClusterScopedFeatureHandler sync.RWMutex
lockClusterUserAttributeInterfaceMockAddClusterScopedFeatureLifecycle sync.RWMutex

View File

@@ -74,8 +74,6 @@ type ClusterAuthTokenController interface {
AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, handler ClusterAuthTokenHandlerFunc)
Enqueue(namespace, name string)
EnqueueAfter(namespace, name string, after time.Duration)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type ClusterAuthTokenInterface interface {
@@ -126,7 +124,7 @@ func (l *clusterAuthTokenLister) Get(namespace, name string) (*ClusterAuthToken,
if !exists {
return nil, errors.NewNotFound(schema.GroupResource{
Group: ClusterAuthTokenGroupVersionKind.Group,
Resource: "clusterAuthToken",
Resource: ClusterAuthTokenGroupVersionResource.Resource,
}, key)
}
return obj.(*ClusterAuthToken), nil
@@ -210,25 +208,12 @@ func (c clusterAuthTokenFactory) List() runtime.Object {
}
func (s *clusterAuthTokenClient) Controller() ClusterAuthTokenController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.clusterAuthTokenControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(ClusterAuthTokenGroupVersionKind.Kind+"Controller",
s.objectClient)
s.client.controllerFactory.ForResourceKind(ClusterAuthTokenGroupVersionResource, ClusterAuthTokenGroupVersionKind.Kind, true))
c = &clusterAuthTokenController{
return &clusterAuthTokenController{
GenericController: genericController,
}
s.client.clusterAuthTokenControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type clusterAuthTokenClient struct {
@@ -262,6 +247,11 @@ func (s *clusterAuthTokenClient) Update(o *ClusterAuthToken) (*ClusterAuthToken,
return obj.(*ClusterAuthToken), err
}
func (s *clusterAuthTokenClient) UpdateStatus(o *ClusterAuthToken) (*ClusterAuthToken, error) {
obj, err := s.objectClient.UpdateStatus(o.Name, o)
return obj.(*ClusterAuthToken), err
}
func (s *clusterAuthTokenClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}

View File

@@ -74,8 +74,6 @@ type ClusterUserAttributeController interface {
AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, handler ClusterUserAttributeHandlerFunc)
Enqueue(namespace, name string)
EnqueueAfter(namespace, name string, after time.Duration)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type ClusterUserAttributeInterface interface {
@@ -126,7 +124,7 @@ func (l *clusterUserAttributeLister) Get(namespace, name string) (*ClusterUserAt
if !exists {
return nil, errors.NewNotFound(schema.GroupResource{
Group: ClusterUserAttributeGroupVersionKind.Group,
Resource: "clusterUserAttribute",
Resource: ClusterUserAttributeGroupVersionResource.Resource,
}, key)
}
return obj.(*ClusterUserAttribute), nil
@@ -210,25 +208,12 @@ func (c clusterUserAttributeFactory) List() runtime.Object {
}
func (s *clusterUserAttributeClient) Controller() ClusterUserAttributeController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.clusterUserAttributeControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(ClusterUserAttributeGroupVersionKind.Kind+"Controller",
s.objectClient)
s.client.controllerFactory.ForResourceKind(ClusterUserAttributeGroupVersionResource, ClusterUserAttributeGroupVersionKind.Kind, true))
c = &clusterUserAttributeController{
return &clusterUserAttributeController{
GenericController: genericController,
}
s.client.clusterUserAttributeControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type clusterUserAttributeClient struct {
@@ -262,6 +247,11 @@ func (s *clusterUserAttributeClient) Update(o *ClusterUserAttribute) (*ClusterUs
return obj.(*ClusterUserAttribute), err
}
func (s *clusterUserAttributeClient) UpdateStatus(o *ClusterUserAttribute) (*ClusterUserAttribute, error) {
obj, err := s.objectClient.UpdateStatus(o.Name, o)
return obj.(*ClusterUserAttribute), err
}
func (s *clusterUserAttributeClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}

View File

@@ -1,74 +1,49 @@
package v3
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
ClusterAuthTokensGetter
ClusterUserAttributesGetter
}
type Client struct {
sync.Mutex
restClient rest.Interface
starters []controller.Starter
clusterAuthTokenControllers map[string]ClusterAuthTokenController
clusterUserAttributeControllers map[string]ClusterUserAttributeController
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,
clusterAuthTokenControllers: map[string]ClusterAuthTokenController{},
clusterUserAttributeControllers: map[string]ClusterUserAttributeController{},
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 ClusterAuthTokensGetter interface {
ClusterAuthTokens(namespace string) ClusterAuthTokenInterface
}
func (c *Client) ClusterAuthTokens(namespace string) ClusterAuthTokenInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ClusterAuthTokenResource, ClusterAuthTokenGroupVersionKind, clusterAuthTokenFactory{})
sharedClient := c.clientFactory.ForResourceKind(ClusterAuthTokenGroupVersionResource, ClusterAuthTokenGroupVersionKind.Kind, true)
objectClient := objectclient.NewObjectClient(namespace, sharedClient, &ClusterAuthTokenResource, ClusterAuthTokenGroupVersionKind, clusterAuthTokenFactory{})
return &clusterAuthTokenClient{
ns: namespace,
client: c,
@@ -81,7 +56,8 @@ type ClusterUserAttributesGetter interface {
}
func (c *Client) ClusterUserAttributes(namespace string) ClusterUserAttributeInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ClusterUserAttributeResource, ClusterUserAttributeGroupVersionKind, clusterUserAttributeFactory{})
sharedClient := c.clientFactory.ForResourceKind(ClusterUserAttributeGroupVersionResource, ClusterUserAttributeGroupVersionKind.Kind, true)
objectClient := objectclient.NewObjectClient(namespace, sharedClient, &ClusterUserAttributeResource, ClusterUserAttributeGroupVersionKind, clusterUserAttributeFactory{})
return &clusterUserAttributeClient{
ns: namespace,
client: c,

View File

@@ -35,7 +35,9 @@ func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&ClusterAuthToken{},
&ClusterAuthTokenList{},
&ClusterUserAttribute{},
&ClusterUserAttributeList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil