1
0
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:
Darren Shepherd
2018-10-30 10:06:55 -07:00
parent 641bd0bfd9
commit abee9812f6
172 changed files with 2924 additions and 3440 deletions

View File

@@ -36,7 +36,7 @@ type IngressList struct {
Items []v1beta1.Ingress
}
type IngressHandlerFunc func(key string, obj *v1beta1.Ingress) error
type IngressHandlerFunc func(key string, obj *v1beta1.Ingress) (*v1beta1.Ingress, error)
type IngressLister interface {
List(namespace string, selector labels.Selector) (ret []*v1beta1.Ingress, err error)
@@ -47,8 +47,8 @@ type IngressController interface {
Generic() controller.GenericController
Informer() cache.SharedIndexInformer
Lister() IngressLister
AddHandler(name string, handler IngressHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler IngressHandlerFunc)
AddHandler(ctx context.Context, name string, handler IngressHandlerFunc)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler IngressHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@@ -66,10 +66,10 @@ type IngressInterface interface {
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() IngressController
AddHandler(name string, sync IngressHandlerFunc)
AddLifecycle(name string, lifecycle IngressLifecycle)
AddClusterScopedHandler(name, clusterName string, sync IngressHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle IngressLifecycle)
AddHandler(ctx context.Context, name string, sync IngressHandlerFunc)
AddLifecycle(ctx context.Context, name string, lifecycle IngressLifecycle)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync IngressHandlerFunc)
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle IngressLifecycle)
}
type ingressLister struct {
@@ -117,34 +117,27 @@ func (c *ingressController) Lister() IngressLister {
}
}
func (c *ingressController) AddHandler(name string, handler IngressHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
func (c *ingressController) AddHandler(ctx context.Context, name string, handler IngressHandlerFunc) {
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if obj == nil {
return handler(key, nil)
} else if v, ok := obj.(*v1beta1.Ingress); ok {
return handler(key, v)
} else {
return nil, nil
}
return handler(key, obj.(*v1beta1.Ingress))
})
}
func (c *ingressController) AddClusterScopedHandler(name, cluster string, handler IngressHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
func (c *ingressController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler IngressHandlerFunc) {
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if obj == nil {
return handler(key, nil)
} else if v, ok := obj.(*v1beta1.Ingress); ok && controller.ObjectInCluster(cluster, obj) {
return handler(key, v)
} else {
return nil, nil
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*v1beta1.Ingress))
})
}
@@ -239,20 +232,20 @@ func (s *ingressClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listO
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *ingressClient) AddHandler(name string, sync IngressHandlerFunc) {
s.Controller().AddHandler(name, sync)
func (s *ingressClient) AddHandler(ctx context.Context, name string, sync IngressHandlerFunc) {
s.Controller().AddHandler(ctx, name, sync)
}
func (s *ingressClient) AddLifecycle(name string, lifecycle IngressLifecycle) {
func (s *ingressClient) AddLifecycle(ctx context.Context, name string, lifecycle IngressLifecycle) {
sync := NewIngressLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
s.Controller().AddHandler(ctx, name, sync)
}
func (s *ingressClient) AddClusterScopedHandler(name, clusterName string, sync IngressHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
func (s *ingressClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync IngressHandlerFunc) {
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *ingressClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle IngressLifecycle) {
func (s *ingressClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle IngressLifecycle) {
sync := NewIngressLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}

View File

@@ -43,10 +43,11 @@ func (w *ingressLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, e
func NewIngressLifecycleAdapter(name string, clusterScoped bool, client IngressInterface, l IngressLifecycle) IngressHandlerFunc {
adapter := &ingressLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1beta1.Ingress) error {
if obj == nil {
return syncFn(key, nil)
return func(key string, obj *v1beta1.Ingress) (*v1beta1.Ingress, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(*v1beta1.Ingress); ok {
return o, err
}
return syncFn(key, obj)
return nil, err
}
}

View File

@@ -35,7 +35,7 @@ type PodSecurityPolicyList struct {
Items []v1beta1.PodSecurityPolicy
}
type PodSecurityPolicyHandlerFunc func(key string, obj *v1beta1.PodSecurityPolicy) error
type PodSecurityPolicyHandlerFunc func(key string, obj *v1beta1.PodSecurityPolicy) (*v1beta1.PodSecurityPolicy, error)
type PodSecurityPolicyLister interface {
List(namespace string, selector labels.Selector) (ret []*v1beta1.PodSecurityPolicy, err error)
@@ -46,8 +46,8 @@ type PodSecurityPolicyController interface {
Generic() controller.GenericController
Informer() cache.SharedIndexInformer
Lister() PodSecurityPolicyLister
AddHandler(name string, handler PodSecurityPolicyHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler PodSecurityPolicyHandlerFunc)
AddHandler(ctx context.Context, name string, handler PodSecurityPolicyHandlerFunc)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler PodSecurityPolicyHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
@@ -65,10 +65,10 @@ type PodSecurityPolicyInterface interface {
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() PodSecurityPolicyController
AddHandler(name string, sync PodSecurityPolicyHandlerFunc)
AddLifecycle(name string, lifecycle PodSecurityPolicyLifecycle)
AddClusterScopedHandler(name, clusterName string, sync PodSecurityPolicyHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle PodSecurityPolicyLifecycle)
AddHandler(ctx context.Context, name string, sync PodSecurityPolicyHandlerFunc)
AddLifecycle(ctx context.Context, name string, lifecycle PodSecurityPolicyLifecycle)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync PodSecurityPolicyHandlerFunc)
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle PodSecurityPolicyLifecycle)
}
type podSecurityPolicyLister struct {
@@ -116,34 +116,27 @@ func (c *podSecurityPolicyController) Lister() PodSecurityPolicyLister {
}
}
func (c *podSecurityPolicyController) AddHandler(name string, handler PodSecurityPolicyHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
func (c *podSecurityPolicyController) AddHandler(ctx context.Context, name string, handler PodSecurityPolicyHandlerFunc) {
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if obj == nil {
return handler(key, nil)
} else if v, ok := obj.(*v1beta1.PodSecurityPolicy); ok {
return handler(key, v)
} else {
return nil, nil
}
return handler(key, obj.(*v1beta1.PodSecurityPolicy))
})
}
func (c *podSecurityPolicyController) AddClusterScopedHandler(name, cluster string, handler PodSecurityPolicyHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
func (c *podSecurityPolicyController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler PodSecurityPolicyHandlerFunc) {
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if obj == nil {
return handler(key, nil)
} else if v, ok := obj.(*v1beta1.PodSecurityPolicy); ok && controller.ObjectInCluster(cluster, obj) {
return handler(key, v)
} else {
return nil, nil
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*v1beta1.PodSecurityPolicy))
})
}
@@ -238,20 +231,20 @@ func (s *podSecurityPolicyClient) DeleteCollection(deleteOpts *metav1.DeleteOpti
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *podSecurityPolicyClient) AddHandler(name string, sync PodSecurityPolicyHandlerFunc) {
s.Controller().AddHandler(name, sync)
func (s *podSecurityPolicyClient) AddHandler(ctx context.Context, name string, sync PodSecurityPolicyHandlerFunc) {
s.Controller().AddHandler(ctx, name, sync)
}
func (s *podSecurityPolicyClient) AddLifecycle(name string, lifecycle PodSecurityPolicyLifecycle) {
func (s *podSecurityPolicyClient) AddLifecycle(ctx context.Context, name string, lifecycle PodSecurityPolicyLifecycle) {
sync := NewPodSecurityPolicyLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
s.Controller().AddHandler(ctx, name, sync)
}
func (s *podSecurityPolicyClient) AddClusterScopedHandler(name, clusterName string, sync PodSecurityPolicyHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
func (s *podSecurityPolicyClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync PodSecurityPolicyHandlerFunc) {
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *podSecurityPolicyClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle PodSecurityPolicyLifecycle) {
func (s *podSecurityPolicyClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle PodSecurityPolicyLifecycle) {
sync := NewPodSecurityPolicyLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}

View File

@@ -43,10 +43,11 @@ func (w *podSecurityPolicyLifecycleAdapter) Updated(obj runtime.Object) (runtime
func NewPodSecurityPolicyLifecycleAdapter(name string, clusterScoped bool, client PodSecurityPolicyInterface, l PodSecurityPolicyLifecycle) PodSecurityPolicyHandlerFunc {
adapter := &podSecurityPolicyLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *v1beta1.PodSecurityPolicy) error {
if obj == nil {
return syncFn(key, nil)
return func(key string, obj *v1beta1.PodSecurityPolicy) (*v1beta1.PodSecurityPolicy, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(*v1beta1.PodSecurityPolicy); ok {
return o, err
}
return syncFn(key, obj)
return nil, err
}
}