1
0
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:
Darren Shepherd
2018-11-26 08:51:20 -07:00
parent 8f68f81062
commit 7df53e1173
96 changed files with 16210 additions and 20 deletions

View File

@@ -38,6 +38,8 @@ type CronJobList struct {
type CronJobHandlerFunc func(key string, obj *v1beta1.CronJob) (runtime.Object, error)
type CronJobChangeHandlerFunc func(obj *v1beta1.CronJob) (runtime.Object, error)
type CronJobLister interface {
List(namespace string, selector labels.Selector) (ret []*v1beta1.CronJob, err error)
Get(namespace, name string) (*v1beta1.CronJob, error)
@@ -249,3 +251,182 @@ func (s *cronJobClient) AddClusterScopedLifecycle(ctx context.Context, name, clu
sync := NewCronJobLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
type CronJobIndexer func(obj *v1beta1.CronJob) ([]string, error)
type CronJobClientCache interface {
Get(namespace, name string) (*v1beta1.CronJob, error)
List(namespace string, selector labels.Selector) ([]*v1beta1.CronJob, error)
Index(name string, indexer CronJobIndexer)
GetIndexed(name, key string) ([]*v1beta1.CronJob, error)
}
type CronJobClient interface {
Create(*v1beta1.CronJob) (*v1beta1.CronJob, error)
Get(namespace, name string, opts metav1.GetOptions) (*v1beta1.CronJob, error)
Update(*v1beta1.CronJob) (*v1beta1.CronJob, error)
Delete(namespace, name string, options *metav1.DeleteOptions) error
List(namespace string, opts metav1.ListOptions) (*CronJobList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Cache() CronJobClientCache
OnCreate(ctx context.Context, name string, sync CronJobChangeHandlerFunc)
OnChange(ctx context.Context, name string, sync CronJobChangeHandlerFunc)
OnRemove(ctx context.Context, name string, sync CronJobChangeHandlerFunc)
Enqueue(namespace, name string)
Generic() controller.GenericController
Interface() CronJobInterface
}
type cronJobClientCache struct {
client *cronJobClient2
}
type cronJobClient2 struct {
iface CronJobInterface
controller CronJobController
}
func (n *cronJobClient2) Interface() CronJobInterface {
return n.iface
}
func (n *cronJobClient2) Generic() controller.GenericController {
return n.iface.Controller().Generic()
}
func (n *cronJobClient2) Enqueue(namespace, name string) {
n.iface.Controller().Enqueue(namespace, name)
}
func (n *cronJobClient2) Create(obj *v1beta1.CronJob) (*v1beta1.CronJob, error) {
return n.iface.Create(obj)
}
func (n *cronJobClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1beta1.CronJob, error) {
return n.iface.GetNamespaced(namespace, name, opts)
}
func (n *cronJobClient2) Update(obj *v1beta1.CronJob) (*v1beta1.CronJob, error) {
return n.iface.Update(obj)
}
func (n *cronJobClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
return n.iface.DeleteNamespaced(namespace, name, options)
}
func (n *cronJobClient2) List(namespace string, opts metav1.ListOptions) (*CronJobList, error) {
return n.iface.List(opts)
}
func (n *cronJobClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return n.iface.Watch(opts)
}
func (n *cronJobClientCache) Get(namespace, name string) (*v1beta1.CronJob, error) {
return n.client.controller.Lister().Get(namespace, name)
}
func (n *cronJobClientCache) List(namespace string, selector labels.Selector) ([]*v1beta1.CronJob, error) {
return n.client.controller.Lister().List(namespace, selector)
}
func (n *cronJobClient2) Cache() CronJobClientCache {
n.loadController()
return &cronJobClientCache{
client: n,
}
}
func (n *cronJobClient2) OnCreate(ctx context.Context, name string, sync CronJobChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &cronJobLifecycleDelegate{create: sync})
}
func (n *cronJobClient2) OnChange(ctx context.Context, name string, sync CronJobChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &cronJobLifecycleDelegate{update: sync})
}
func (n *cronJobClient2) OnRemove(ctx context.Context, name string, sync CronJobChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &cronJobLifecycleDelegate{remove: sync})
}
func (n *cronJobClientCache) Index(name string, indexer CronJobIndexer) {
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
name: func(obj interface{}) ([]string, error) {
if v, ok := obj.(*v1beta1.CronJob); ok {
return indexer(v)
}
return nil, nil
},
})
if err != nil {
panic(err)
}
}
func (n *cronJobClientCache) GetIndexed(name, key string) ([]*v1beta1.CronJob, error) {
var result []*v1beta1.CronJob
objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key)
if err != nil {
return nil, err
}
for _, obj := range objs {
if v, ok := obj.(*v1beta1.CronJob); ok {
result = append(result, v)
}
}
return result, nil
}
func (n *cronJobClient2) loadController() {
if n.controller == nil {
n.controller = n.iface.Controller()
}
}
type cronJobLifecycleDelegate struct {
create CronJobChangeHandlerFunc
update CronJobChangeHandlerFunc
remove CronJobChangeHandlerFunc
}
func (n *cronJobLifecycleDelegate) HasCreate() bool {
return n.create != nil
}
func (n *cronJobLifecycleDelegate) Create(obj *v1beta1.CronJob) (runtime.Object, error) {
if n.create == nil {
return obj, nil
}
return n.create(obj)
}
func (n *cronJobLifecycleDelegate) HasFinalize() bool {
return n.remove != nil
}
func (n *cronJobLifecycleDelegate) Remove(obj *v1beta1.CronJob) (runtime.Object, error) {
if n.remove == nil {
return obj, nil
}
return n.remove(obj)
}
func (n *cronJobLifecycleDelegate) HasUpdated() bool {
return n.remove != nil
}
func (n *cronJobLifecycleDelegate) Updated(obj *v1beta1.CronJob) (runtime.Object, error) {
if n.update == nil {
return obj, nil
}
return n.update(obj)
}

View File

@@ -11,7 +11,10 @@ import (
"k8s.io/client-go/rest"
)
type contextKeyType struct{}
type (
contextKeyType struct{}
contextClientsKeyType struct{}
)
type Interface interface {
RESTClient() rest.Interface
@@ -20,6 +23,10 @@ type Interface interface {
CronJobsGetter
}
type Clients struct {
CronJob CronJobClient
}
type Client struct {
sync.Mutex
restClient rest.Interface
@@ -34,13 +41,38 @@ func Factory(ctx context.Context, config rest.Config) (context.Context, controll
return ctx, nil, err
}
return context.WithValue(ctx, contextKeyType{}, c), c, nil
cs := NewClientsFromInterface(c)
ctx = context.WithValue(ctx, contextKeyType{}, c)
ctx = context.WithValue(ctx, contextClientsKeyType{}, cs)
return ctx, c, nil
}
func ClientsFrom(ctx context.Context) *Clients {
return ctx.Value(contextClientsKeyType{}).(*Clients)
}
func From(ctx context.Context) Interface {
return ctx.Value(contextKeyType{}).(Interface)
}
func NewClients(config rest.Config) (*Clients, error) {
iface, err := NewForConfig(config)
if err != nil {
return nil, err
}
return NewClientsFromInterface(iface), nil
}
func NewClientsFromInterface(iface Interface) *Clients {
return &Clients{
CronJob: &cronJobClient2{
iface: iface.CronJobs(""),
},
}
}
func NewForConfig(config rest.Config) (Interface, error) {
if config.NegotiatedSerializer == nil {
config.NegotiatedSerializer = dynamic.NegotiatedSerializer