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

@@ -151,8 +151,6 @@ var (
lockIngressControllerMockGeneric sync.RWMutex
lockIngressControllerMockInformer sync.RWMutex
lockIngressControllerMockLister sync.RWMutex
lockIngressControllerMockStart sync.RWMutex
lockIngressControllerMockSync sync.RWMutex
)
// Ensure, that IngressControllerMock does implement IngressController.
@@ -192,12 +190,6 @@ var _ v1beta1a.IngressController = &IngressControllerMock{}
// ListerFunc: func() v1beta1a.IngressLister {
// 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 mockedIngressController in code that requires IngressController
@@ -232,12 +224,6 @@ type IngressControllerMock struct {
// ListerFunc mocks the Lister method.
ListerFunc func() v1beta1a.IngressLister
// 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 IngressControllerMock 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 *IngressControllerMock) ListerCalls() []struct {
return calls
}
// Start calls StartFunc.
func (mock *IngressControllerMock) Start(ctx context.Context, threadiness int) error {
if mock.StartFunc == nil {
panic("IngressControllerMock.StartFunc: method is nil but IngressController.Start was just called")
}
callInfo := struct {
Ctx context.Context
Threadiness int
}{
Ctx: ctx,
Threadiness: threadiness,
}
lockIngressControllerMockStart.Lock()
mock.calls.Start = append(mock.calls.Start, callInfo)
lockIngressControllerMockStart.Unlock()
return mock.StartFunc(ctx, threadiness)
}
// StartCalls gets all the calls that were made to Start.
// Check the length with:
// len(mockedIngressController.StartCalls())
func (mock *IngressControllerMock) StartCalls() []struct {
Ctx context.Context
Threadiness int
} {
var calls []struct {
Ctx context.Context
Threadiness int
}
lockIngressControllerMockStart.RLock()
calls = mock.calls.Start
lockIngressControllerMockStart.RUnlock()
return calls
}
// Sync calls SyncFunc.
func (mock *IngressControllerMock) Sync(ctx context.Context) error {
if mock.SyncFunc == nil {
panic("IngressControllerMock.SyncFunc: method is nil but IngressController.Sync was just called")
}
callInfo := struct {
Ctx context.Context
}{
Ctx: ctx,
}
lockIngressControllerMockSync.Lock()
mock.calls.Sync = append(mock.calls.Sync, callInfo)
lockIngressControllerMockSync.Unlock()
return mock.SyncFunc(ctx)
}
// SyncCalls gets all the calls that were made to Sync.
// Check the length with:
// len(mockedIngressController.SyncCalls())
func (mock *IngressControllerMock) SyncCalls() []struct {
Ctx context.Context
} {
var calls []struct {
Ctx context.Context
}
lockIngressControllerMockSync.RLock()
calls = mock.calls.Sync
lockIngressControllerMockSync.RUnlock()
return calls
}
var (
lockIngressInterfaceMockAddClusterScopedFeatureHandler sync.RWMutex
lockIngressInterfaceMockAddClusterScopedFeatureLifecycle sync.RWMutex
@@ -792,10 +700,10 @@ var _ v1beta1a.IngressInterface = &IngressInterfaceMock{}
// GetNamespacedFunc: func(namespace string, name string, opts v1.GetOptions) (*v1beta1.Ingress, error) {
// panic("mock out the GetNamespaced method")
// },
// ListFunc: func(opts v1.ListOptions) (*v1beta1a.IngressList, error) {
// ListFunc: func(opts v1.ListOptions) (*v1beta1.IngressList, error) {
// panic("mock out the List method")
// },
// ListNamespacedFunc: func(namespace string, opts v1.ListOptions) (*v1beta1a.IngressList, error) {
// ListNamespacedFunc: func(namespace string, opts v1.ListOptions) (*v1beta1.IngressList, error) {
// panic("mock out the ListNamespaced method")
// },
// ObjectClientFunc: func() *objectclient.ObjectClient {
@@ -860,10 +768,10 @@ type IngressInterfaceMock struct {
GetNamespacedFunc func(namespace string, name string, opts v1.GetOptions) (*v1beta1.Ingress, error)
// ListFunc mocks the List method.
ListFunc func(opts v1.ListOptions) (*v1beta1a.IngressList, error)
ListFunc func(opts v1.ListOptions) (*v1beta1.IngressList, error)
// ListNamespacedFunc mocks the ListNamespaced method.
ListNamespacedFunc func(namespace string, opts v1.ListOptions) (*v1beta1a.IngressList, error)
ListNamespacedFunc func(namespace string, opts v1.ListOptions) (*v1beta1.IngressList, error)
// ObjectClientFunc mocks the ObjectClient method.
ObjectClientFunc func() *objectclient.ObjectClient
@@ -1624,7 +1532,7 @@ func (mock *IngressInterfaceMock) GetNamespacedCalls() []struct {
}
// List calls ListFunc.
func (mock *IngressInterfaceMock) List(opts v1.ListOptions) (*v1beta1a.IngressList, error) {
func (mock *IngressInterfaceMock) List(opts v1.ListOptions) (*v1beta1.IngressList, error) {
if mock.ListFunc == nil {
panic("IngressInterfaceMock.ListFunc: method is nil but IngressInterface.List was just called")
}
@@ -1655,7 +1563,7 @@ func (mock *IngressInterfaceMock) ListCalls() []struct {
}
// ListNamespaced calls ListNamespacedFunc.
func (mock *IngressInterfaceMock) ListNamespaced(namespace string, opts v1.ListOptions) (*v1beta1a.IngressList, error) {
func (mock *IngressInterfaceMock) ListNamespaced(namespace string, opts v1.ListOptions) (*v1beta1.IngressList, error) {
if mock.ListNamespacedFunc == nil {
panic("IngressInterfaceMock.ListNamespacedFunc: method is nil but IngressInterface.ListNamespaced was just called")
}

View File

@@ -1,39 +0,0 @@
package v1beta1
import (
extensionsv1beta1 "k8s.io/api/extensions/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 *IngressList) DeepCopyInto(out *IngressList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]extensionsv1beta1.Ingress, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressList.
func (in *IngressList) DeepCopy() *IngressList {
if in == nil {
return nil
}
out := new(IngressList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *IngressList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}

View File

@@ -50,12 +50,6 @@ func NewIngress(namespace, name string, obj v1beta1.Ingress) *v1beta1.Ingress {
return &obj
}
type IngressList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []v1beta1.Ingress `json:"items"`
}
type IngressHandlerFunc func(key string, obj *v1beta1.Ingress) (runtime.Object, error)
type IngressChangeHandlerFunc func(obj *v1beta1.Ingress) (runtime.Object, error)
@@ -75,8 +69,6 @@ type IngressController interface {
AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, handler IngressHandlerFunc)
Enqueue(namespace, name string)
EnqueueAfter(namespace, name string, after time.Duration)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type IngressInterface interface {
@@ -87,8 +79,8 @@ type IngressInterface interface {
Update(*v1beta1.Ingress) (*v1beta1.Ingress, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*IngressList, error)
ListNamespaced(namespace string, opts metav1.ListOptions) (*IngressList, error)
List(opts metav1.ListOptions) (*v1beta1.IngressList, error)
ListNamespaced(namespace string, opts metav1.ListOptions) (*v1beta1.IngressList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() IngressController
@@ -127,7 +119,7 @@ func (l *ingressLister) Get(namespace, name string) (*v1beta1.Ingress, error) {
if !exists {
return nil, errors.NewNotFound(schema.GroupResource{
Group: IngressGroupVersionKind.Group,
Resource: "ingress",
Resource: IngressGroupVersionResource.Resource,
}, key)
}
return obj.(*v1beta1.Ingress), nil
@@ -207,29 +199,16 @@ func (c ingressFactory) Object() runtime.Object {
}
func (c ingressFactory) List() runtime.Object {
return &IngressList{}
return &v1beta1.IngressList{}
}
func (s *ingressClient) Controller() IngressController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.ingressControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(IngressGroupVersionKind.Kind+"Controller",
s.objectClient)
s.client.controllerFactory.ForResourceKind(IngressGroupVersionResource, IngressGroupVersionKind.Kind, true))
c = &ingressController{
return &ingressController{
GenericController: genericController,
}
s.client.ingressControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type ingressClient struct {
@@ -263,6 +242,11 @@ func (s *ingressClient) Update(o *v1beta1.Ingress) (*v1beta1.Ingress, error) {
return obj.(*v1beta1.Ingress), err
}
func (s *ingressClient) UpdateStatus(o *v1beta1.Ingress) (*v1beta1.Ingress, error) {
obj, err := s.objectClient.UpdateStatus(o.Name, o)
return obj.(*v1beta1.Ingress), err
}
func (s *ingressClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
@@ -271,14 +255,14 @@ func (s *ingressClient) DeleteNamespaced(namespace, name string, options *metav1
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *ingressClient) List(opts metav1.ListOptions) (*IngressList, error) {
func (s *ingressClient) List(opts metav1.ListOptions) (*v1beta1.IngressList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*IngressList), err
return obj.(*v1beta1.IngressList), err
}
func (s *ingressClient) ListNamespaced(namespace string, opts metav1.ListOptions) (*IngressList, error) {
func (s *ingressClient) ListNamespaced(namespace string, opts metav1.ListOptions) (*v1beta1.IngressList, error) {
obj, err := s.objectClient.ListNamespaced(namespace, opts)
return obj.(*IngressList), err
return obj.(*v1beta1.IngressList), err
}
func (s *ingressClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {

View File

@@ -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
IngressesGetter
}
type Client struct {
sync.Mutex
restClient rest.Interface
starters []controller.Starter
ingressControllers map[string]IngressController
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,
ingressControllers: map[string]IngressController{},
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 IngressesGetter interface {
Ingresses(namespace string) IngressInterface
}
func (c *Client) Ingresses(namespace string) IngressInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &IngressResource, IngressGroupVersionKind, ingressFactory{})
sharedClient := c.clientFactory.ForResourceKind(IngressGroupVersionResource, IngressGroupVersionKind.Kind, true)
objectClient := objectclient.NewObjectClient(namespace, sharedClient, &IngressResource, IngressGroupVersionKind, ingressFactory{})
return &ingressClient{
ns: namespace,
client: c,

View File

@@ -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,
&IngressList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}