mirror of
https://github.com/rancher/types.git
synced 2025-09-12 13:03:45 +00:00
Update generated code
This commit is contained in:
@@ -38,6 +38,8 @@ type JobList struct {
|
||||
|
||||
type JobHandlerFunc func(key string, obj *v1.Job) (runtime.Object, error)
|
||||
|
||||
type JobChangeHandlerFunc func(obj *v1.Job) (runtime.Object, error)
|
||||
|
||||
type JobLister interface {
|
||||
List(namespace string, selector labels.Selector) (ret []*v1.Job, err error)
|
||||
Get(namespace, name string) (*v1.Job, error)
|
||||
@@ -249,3 +251,182 @@ func (s *jobClient) AddClusterScopedLifecycle(ctx context.Context, name, cluster
|
||||
sync := NewJobLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
|
||||
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
|
||||
}
|
||||
|
||||
type JobIndexer func(obj *v1.Job) ([]string, error)
|
||||
|
||||
type JobClientCache interface {
|
||||
Get(namespace, name string) (*v1.Job, error)
|
||||
List(namespace string, selector labels.Selector) ([]*v1.Job, error)
|
||||
|
||||
Index(name string, indexer JobIndexer)
|
||||
GetIndexed(name, key string) ([]*v1.Job, error)
|
||||
}
|
||||
|
||||
type JobClient interface {
|
||||
Create(*v1.Job) (*v1.Job, error)
|
||||
Get(namespace, name string, opts metav1.GetOptions) (*v1.Job, error)
|
||||
Update(*v1.Job) (*v1.Job, error)
|
||||
Delete(namespace, name string, options *metav1.DeleteOptions) error
|
||||
List(namespace string, opts metav1.ListOptions) (*JobList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
|
||||
Cache() JobClientCache
|
||||
|
||||
OnCreate(ctx context.Context, name string, sync JobChangeHandlerFunc)
|
||||
OnChange(ctx context.Context, name string, sync JobChangeHandlerFunc)
|
||||
OnRemove(ctx context.Context, name string, sync JobChangeHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
|
||||
Generic() controller.GenericController
|
||||
Interface() JobInterface
|
||||
}
|
||||
|
||||
type jobClientCache struct {
|
||||
client *jobClient2
|
||||
}
|
||||
|
||||
type jobClient2 struct {
|
||||
iface JobInterface
|
||||
controller JobController
|
||||
}
|
||||
|
||||
func (n *jobClient2) Interface() JobInterface {
|
||||
return n.iface
|
||||
}
|
||||
|
||||
func (n *jobClient2) Generic() controller.GenericController {
|
||||
return n.iface.Controller().Generic()
|
||||
}
|
||||
|
||||
func (n *jobClient2) Enqueue(namespace, name string) {
|
||||
n.iface.Controller().Enqueue(namespace, name)
|
||||
}
|
||||
|
||||
func (n *jobClient2) Create(obj *v1.Job) (*v1.Job, error) {
|
||||
return n.iface.Create(obj)
|
||||
}
|
||||
|
||||
func (n *jobClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1.Job, error) {
|
||||
return n.iface.GetNamespaced(namespace, name, opts)
|
||||
}
|
||||
|
||||
func (n *jobClient2) Update(obj *v1.Job) (*v1.Job, error) {
|
||||
return n.iface.Update(obj)
|
||||
}
|
||||
|
||||
func (n *jobClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
|
||||
return n.iface.DeleteNamespaced(namespace, name, options)
|
||||
}
|
||||
|
||||
func (n *jobClient2) List(namespace string, opts metav1.ListOptions) (*JobList, error) {
|
||||
return n.iface.List(opts)
|
||||
}
|
||||
|
||||
func (n *jobClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return n.iface.Watch(opts)
|
||||
}
|
||||
|
||||
func (n *jobClientCache) Get(namespace, name string) (*v1.Job, error) {
|
||||
return n.client.controller.Lister().Get(namespace, name)
|
||||
}
|
||||
|
||||
func (n *jobClientCache) List(namespace string, selector labels.Selector) ([]*v1.Job, error) {
|
||||
return n.client.controller.Lister().List(namespace, selector)
|
||||
}
|
||||
|
||||
func (n *jobClient2) Cache() JobClientCache {
|
||||
n.loadController()
|
||||
return &jobClientCache{
|
||||
client: n,
|
||||
}
|
||||
}
|
||||
|
||||
func (n *jobClient2) OnCreate(ctx context.Context, name string, sync JobChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name, &jobLifecycleDelegate{create: sync})
|
||||
}
|
||||
|
||||
func (n *jobClient2) OnChange(ctx context.Context, name string, sync JobChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name, &jobLifecycleDelegate{update: sync})
|
||||
}
|
||||
|
||||
func (n *jobClient2) OnRemove(ctx context.Context, name string, sync JobChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name, &jobLifecycleDelegate{remove: sync})
|
||||
}
|
||||
|
||||
func (n *jobClientCache) Index(name string, indexer JobIndexer) {
|
||||
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
|
||||
name: func(obj interface{}) ([]string, error) {
|
||||
if v, ok := obj.(*v1.Job); ok {
|
||||
return indexer(v)
|
||||
}
|
||||
return nil, nil
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *jobClientCache) GetIndexed(name, key string) ([]*v1.Job, error) {
|
||||
var result []*v1.Job
|
||||
objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, obj := range objs {
|
||||
if v, ok := obj.(*v1.Job); ok {
|
||||
result = append(result, v)
|
||||
}
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (n *jobClient2) loadController() {
|
||||
if n.controller == nil {
|
||||
n.controller = n.iface.Controller()
|
||||
}
|
||||
}
|
||||
|
||||
type jobLifecycleDelegate struct {
|
||||
create JobChangeHandlerFunc
|
||||
update JobChangeHandlerFunc
|
||||
remove JobChangeHandlerFunc
|
||||
}
|
||||
|
||||
func (n *jobLifecycleDelegate) HasCreate() bool {
|
||||
return n.create != nil
|
||||
}
|
||||
|
||||
func (n *jobLifecycleDelegate) Create(obj *v1.Job) (runtime.Object, error) {
|
||||
if n.create == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.create(obj)
|
||||
}
|
||||
|
||||
func (n *jobLifecycleDelegate) HasFinalize() bool {
|
||||
return n.remove != nil
|
||||
}
|
||||
|
||||
func (n *jobLifecycleDelegate) Remove(obj *v1.Job) (runtime.Object, error) {
|
||||
if n.remove == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.remove(obj)
|
||||
}
|
||||
|
||||
func (n *jobLifecycleDelegate) HasUpdated() bool {
|
||||
return n.remove != nil
|
||||
}
|
||||
|
||||
func (n *jobLifecycleDelegate) Updated(obj *v1.Job) (runtime.Object, error) {
|
||||
if n.update == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.update(obj)
|
||||
}
|
||||
|
@@ -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 {
|
||||
JobsGetter
|
||||
}
|
||||
|
||||
type Clients struct {
|
||||
Job JobClient
|
||||
}
|
||||
|
||||
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{
|
||||
|
||||
Job: &jobClient2{
|
||||
iface: iface.Jobs(""),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func NewForConfig(config rest.Config) (Interface, error) {
|
||||
if config.NegotiatedSerializer == nil {
|
||||
config.NegotiatedSerializer = dynamic.NegotiatedSerializer
|
||||
|
@@ -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)
|
||||
}
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user