1
0
mirror of https://github.com/rancher/types.git synced 2025-09-03 14:14:32 +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 (
lockPodSecurityPolicyControllerMockGeneric sync.RWMutex
lockPodSecurityPolicyControllerMockInformer sync.RWMutex
lockPodSecurityPolicyControllerMockLister sync.RWMutex
lockPodSecurityPolicyControllerMockStart sync.RWMutex
lockPodSecurityPolicyControllerMockSync sync.RWMutex
)
// Ensure, that PodSecurityPolicyControllerMock does implement PodSecurityPolicyController.
@@ -192,12 +190,6 @@ var _ v1beta1a.PodSecurityPolicyController = &PodSecurityPolicyControllerMock{}
// ListerFunc: func() v1beta1a.PodSecurityPolicyLister {
// 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 mockedPodSecurityPolicyController in code that requires PodSecurityPolicyController
@@ -232,12 +224,6 @@ type PodSecurityPolicyControllerMock struct {
// ListerFunc mocks the Lister method.
ListerFunc func() v1beta1a.PodSecurityPolicyLister
// 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 PodSecurityPolicyControllerMock 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 *PodSecurityPolicyControllerMock) ListerCalls() []struct {
return calls
}
// Start calls StartFunc.
func (mock *PodSecurityPolicyControllerMock) Start(ctx context.Context, threadiness int) error {
if mock.StartFunc == nil {
panic("PodSecurityPolicyControllerMock.StartFunc: method is nil but PodSecurityPolicyController.Start was just called")
}
callInfo := struct {
Ctx context.Context
Threadiness int
}{
Ctx: ctx,
Threadiness: threadiness,
}
lockPodSecurityPolicyControllerMockStart.Lock()
mock.calls.Start = append(mock.calls.Start, callInfo)
lockPodSecurityPolicyControllerMockStart.Unlock()
return mock.StartFunc(ctx, threadiness)
}
// StartCalls gets all the calls that were made to Start.
// Check the length with:
// len(mockedPodSecurityPolicyController.StartCalls())
func (mock *PodSecurityPolicyControllerMock) StartCalls() []struct {
Ctx context.Context
Threadiness int
} {
var calls []struct {
Ctx context.Context
Threadiness int
}
lockPodSecurityPolicyControllerMockStart.RLock()
calls = mock.calls.Start
lockPodSecurityPolicyControllerMockStart.RUnlock()
return calls
}
// Sync calls SyncFunc.
func (mock *PodSecurityPolicyControllerMock) Sync(ctx context.Context) error {
if mock.SyncFunc == nil {
panic("PodSecurityPolicyControllerMock.SyncFunc: method is nil but PodSecurityPolicyController.Sync was just called")
}
callInfo := struct {
Ctx context.Context
}{
Ctx: ctx,
}
lockPodSecurityPolicyControllerMockSync.Lock()
mock.calls.Sync = append(mock.calls.Sync, callInfo)
lockPodSecurityPolicyControllerMockSync.Unlock()
return mock.SyncFunc(ctx)
}
// SyncCalls gets all the calls that were made to Sync.
// Check the length with:
// len(mockedPodSecurityPolicyController.SyncCalls())
func (mock *PodSecurityPolicyControllerMock) SyncCalls() []struct {
Ctx context.Context
} {
var calls []struct {
Ctx context.Context
}
lockPodSecurityPolicyControllerMockSync.RLock()
calls = mock.calls.Sync
lockPodSecurityPolicyControllerMockSync.RUnlock()
return calls
}
var (
lockPodSecurityPolicyInterfaceMockAddClusterScopedFeatureHandler sync.RWMutex
lockPodSecurityPolicyInterfaceMockAddClusterScopedFeatureLifecycle sync.RWMutex
@@ -792,10 +700,10 @@ var _ v1beta1a.PodSecurityPolicyInterface = &PodSecurityPolicyInterfaceMock{}
// GetNamespacedFunc: func(namespace string, name string, opts v1.GetOptions) (*v1beta1.PodSecurityPolicy, error) {
// panic("mock out the GetNamespaced method")
// },
// ListFunc: func(opts v1.ListOptions) (*v1beta1a.PodSecurityPolicyList, error) {
// ListFunc: func(opts v1.ListOptions) (*v1beta1.PodSecurityPolicyList, error) {
// panic("mock out the List method")
// },
// ListNamespacedFunc: func(namespace string, opts v1.ListOptions) (*v1beta1a.PodSecurityPolicyList, error) {
// ListNamespacedFunc: func(namespace string, opts v1.ListOptions) (*v1beta1.PodSecurityPolicyList, error) {
// panic("mock out the ListNamespaced method")
// },
// ObjectClientFunc: func() *objectclient.ObjectClient {
@@ -860,10 +768,10 @@ type PodSecurityPolicyInterfaceMock struct {
GetNamespacedFunc func(namespace string, name string, opts v1.GetOptions) (*v1beta1.PodSecurityPolicy, error)
// ListFunc mocks the List method.
ListFunc func(opts v1.ListOptions) (*v1beta1a.PodSecurityPolicyList, error)
ListFunc func(opts v1.ListOptions) (*v1beta1.PodSecurityPolicyList, error)
// ListNamespacedFunc mocks the ListNamespaced method.
ListNamespacedFunc func(namespace string, opts v1.ListOptions) (*v1beta1a.PodSecurityPolicyList, error)
ListNamespacedFunc func(namespace string, opts v1.ListOptions) (*v1beta1.PodSecurityPolicyList, error)
// ObjectClientFunc mocks the ObjectClient method.
ObjectClientFunc func() *objectclient.ObjectClient
@@ -1624,7 +1532,7 @@ func (mock *PodSecurityPolicyInterfaceMock) GetNamespacedCalls() []struct {
}
// List calls ListFunc.
func (mock *PodSecurityPolicyInterfaceMock) List(opts v1.ListOptions) (*v1beta1a.PodSecurityPolicyList, error) {
func (mock *PodSecurityPolicyInterfaceMock) List(opts v1.ListOptions) (*v1beta1.PodSecurityPolicyList, error) {
if mock.ListFunc == nil {
panic("PodSecurityPolicyInterfaceMock.ListFunc: method is nil but PodSecurityPolicyInterface.List was just called")
}
@@ -1655,7 +1563,7 @@ func (mock *PodSecurityPolicyInterfaceMock) ListCalls() []struct {
}
// ListNamespaced calls ListNamespacedFunc.
func (mock *PodSecurityPolicyInterfaceMock) ListNamespaced(namespace string, opts v1.ListOptions) (*v1beta1a.PodSecurityPolicyList, error) {
func (mock *PodSecurityPolicyInterfaceMock) ListNamespaced(namespace string, opts v1.ListOptions) (*v1beta1.PodSecurityPolicyList, error) {
if mock.ListNamespacedFunc == nil {
panic("PodSecurityPolicyInterfaceMock.ListNamespacedFunc: method is nil but PodSecurityPolicyInterface.ListNamespaced was just called")
}

View File

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

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
PodSecurityPoliciesGetter
}
type Client struct {
sync.Mutex
restClient rest.Interface
starters []controller.Starter
podSecurityPolicyControllers map[string]PodSecurityPolicyController
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,
podSecurityPolicyControllers: map[string]PodSecurityPolicyController{},
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 PodSecurityPoliciesGetter interface {
PodSecurityPolicies(namespace string) PodSecurityPolicyInterface
}
func (c *Client) PodSecurityPolicies(namespace string) PodSecurityPolicyInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &PodSecurityPolicyResource, PodSecurityPolicyGroupVersionKind, podSecurityPolicyFactory{})
sharedClient := c.clientFactory.ForResourceKind(PodSecurityPolicyGroupVersionResource, PodSecurityPolicyGroupVersionKind.Kind, false)
objectClient := objectclient.NewObjectClient(namespace, sharedClient, &PodSecurityPolicyResource, PodSecurityPolicyGroupVersionKind, podSecurityPolicyFactory{})
return &podSecurityPolicyClient{
ns: namespace,
client: c,

View File

@@ -49,12 +49,6 @@ func NewPodSecurityPolicy(namespace, name string, obj v1beta1.PodSecurityPolicy)
return &obj
}
type PodSecurityPolicyList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []v1beta1.PodSecurityPolicy `json:"items"`
}
type PodSecurityPolicyHandlerFunc func(key string, obj *v1beta1.PodSecurityPolicy) (runtime.Object, error)
type PodSecurityPolicyChangeHandlerFunc func(obj *v1beta1.PodSecurityPolicy) (runtime.Object, error)
@@ -74,8 +68,6 @@ type PodSecurityPolicyController interface {
AddClusterScopedFeatureHandler(ctx context.Context, enabled func() bool, name, clusterName string, handler PodSecurityPolicyHandlerFunc)
Enqueue(namespace, name string)
EnqueueAfter(namespace, name string, after time.Duration)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type PodSecurityPolicyInterface interface {
@@ -86,8 +78,8 @@ type PodSecurityPolicyInterface interface {
Update(*v1beta1.PodSecurityPolicy) (*v1beta1.PodSecurityPolicy, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*PodSecurityPolicyList, error)
ListNamespaced(namespace string, opts metav1.ListOptions) (*PodSecurityPolicyList, error)
List(opts metav1.ListOptions) (*v1beta1.PodSecurityPolicyList, error)
ListNamespaced(namespace string, opts metav1.ListOptions) (*v1beta1.PodSecurityPolicyList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() PodSecurityPolicyController
@@ -126,7 +118,7 @@ func (l *podSecurityPolicyLister) Get(namespace, name string) (*v1beta1.PodSecur
if !exists {
return nil, errors.NewNotFound(schema.GroupResource{
Group: PodSecurityPolicyGroupVersionKind.Group,
Resource: "podSecurityPolicy",
Resource: PodSecurityPolicyGroupVersionResource.Resource,
}, key)
}
return obj.(*v1beta1.PodSecurityPolicy), nil
@@ -206,29 +198,16 @@ func (c podSecurityPolicyFactory) Object() runtime.Object {
}
func (c podSecurityPolicyFactory) List() runtime.Object {
return &PodSecurityPolicyList{}
return &v1beta1.PodSecurityPolicyList{}
}
func (s *podSecurityPolicyClient) Controller() PodSecurityPolicyController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.podSecurityPolicyControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(PodSecurityPolicyGroupVersionKind.Kind+"Controller",
s.objectClient)
s.client.controllerFactory.ForResourceKind(PodSecurityPolicyGroupVersionResource, PodSecurityPolicyGroupVersionKind.Kind, false))
c = &podSecurityPolicyController{
return &podSecurityPolicyController{
GenericController: genericController,
}
s.client.podSecurityPolicyControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type podSecurityPolicyClient struct {
@@ -262,6 +241,11 @@ func (s *podSecurityPolicyClient) Update(o *v1beta1.PodSecurityPolicy) (*v1beta1
return obj.(*v1beta1.PodSecurityPolicy), err
}
func (s *podSecurityPolicyClient) UpdateStatus(o *v1beta1.PodSecurityPolicy) (*v1beta1.PodSecurityPolicy, error) {
obj, err := s.objectClient.UpdateStatus(o.Name, o)
return obj.(*v1beta1.PodSecurityPolicy), err
}
func (s *podSecurityPolicyClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
@@ -270,14 +254,14 @@ func (s *podSecurityPolicyClient) DeleteNamespaced(namespace, name string, optio
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *podSecurityPolicyClient) List(opts metav1.ListOptions) (*PodSecurityPolicyList, error) {
func (s *podSecurityPolicyClient) List(opts metav1.ListOptions) (*v1beta1.PodSecurityPolicyList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*PodSecurityPolicyList), err
return obj.(*v1beta1.PodSecurityPolicyList), err
}
func (s *podSecurityPolicyClient) ListNamespaced(namespace string, opts metav1.ListOptions) (*PodSecurityPolicyList, error) {
func (s *podSecurityPolicyClient) ListNamespaced(namespace string, opts metav1.ListOptions) (*v1beta1.PodSecurityPolicyList, error) {
obj, err := s.objectClient.ListNamespaced(namespace, opts)
return obj.(*PodSecurityPolicyList), err
return obj.(*v1beta1.PodSecurityPolicyList), err
}
func (s *podSecurityPolicyClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {

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