mirror of
https://github.com/rancher/types.git
synced 2025-09-02 13:45:51 +00:00
Update generated code
This commit is contained in:
@@ -38,6 +38,8 @@ type DaemonSetList struct {
|
||||
|
||||
type DaemonSetHandlerFunc func(key string, obj *v1beta2.DaemonSet) (runtime.Object, error)
|
||||
|
||||
type DaemonSetChangeHandlerFunc func(obj *v1beta2.DaemonSet) (runtime.Object, error)
|
||||
|
||||
type DaemonSetLister interface {
|
||||
List(namespace string, selector labels.Selector) (ret []*v1beta2.DaemonSet, err error)
|
||||
Get(namespace, name string) (*v1beta2.DaemonSet, error)
|
||||
@@ -249,3 +251,182 @@ func (s *daemonSetClient) AddClusterScopedLifecycle(ctx context.Context, name, c
|
||||
sync := NewDaemonSetLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
|
||||
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
|
||||
}
|
||||
|
||||
type DaemonSetIndexer func(obj *v1beta2.DaemonSet) ([]string, error)
|
||||
|
||||
type DaemonSetClientCache interface {
|
||||
Get(namespace, name string) (*v1beta2.DaemonSet, error)
|
||||
List(namespace string, selector labels.Selector) ([]*v1beta2.DaemonSet, error)
|
||||
|
||||
Index(name string, indexer DaemonSetIndexer)
|
||||
GetIndexed(name, key string) ([]*v1beta2.DaemonSet, error)
|
||||
}
|
||||
|
||||
type DaemonSetClient interface {
|
||||
Create(*v1beta2.DaemonSet) (*v1beta2.DaemonSet, error)
|
||||
Get(namespace, name string, opts metav1.GetOptions) (*v1beta2.DaemonSet, error)
|
||||
Update(*v1beta2.DaemonSet) (*v1beta2.DaemonSet, error)
|
||||
Delete(namespace, name string, options *metav1.DeleteOptions) error
|
||||
List(namespace string, opts metav1.ListOptions) (*DaemonSetList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
|
||||
Cache() DaemonSetClientCache
|
||||
|
||||
OnCreate(ctx context.Context, name string, sync DaemonSetChangeHandlerFunc)
|
||||
OnChange(ctx context.Context, name string, sync DaemonSetChangeHandlerFunc)
|
||||
OnRemove(ctx context.Context, name string, sync DaemonSetChangeHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
|
||||
Generic() controller.GenericController
|
||||
Interface() DaemonSetInterface
|
||||
}
|
||||
|
||||
type daemonSetClientCache struct {
|
||||
client *daemonSetClient2
|
||||
}
|
||||
|
||||
type daemonSetClient2 struct {
|
||||
iface DaemonSetInterface
|
||||
controller DaemonSetController
|
||||
}
|
||||
|
||||
func (n *daemonSetClient2) Interface() DaemonSetInterface {
|
||||
return n.iface
|
||||
}
|
||||
|
||||
func (n *daemonSetClient2) Generic() controller.GenericController {
|
||||
return n.iface.Controller().Generic()
|
||||
}
|
||||
|
||||
func (n *daemonSetClient2) Enqueue(namespace, name string) {
|
||||
n.iface.Controller().Enqueue(namespace, name)
|
||||
}
|
||||
|
||||
func (n *daemonSetClient2) Create(obj *v1beta2.DaemonSet) (*v1beta2.DaemonSet, error) {
|
||||
return n.iface.Create(obj)
|
||||
}
|
||||
|
||||
func (n *daemonSetClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1beta2.DaemonSet, error) {
|
||||
return n.iface.GetNamespaced(namespace, name, opts)
|
||||
}
|
||||
|
||||
func (n *daemonSetClient2) Update(obj *v1beta2.DaemonSet) (*v1beta2.DaemonSet, error) {
|
||||
return n.iface.Update(obj)
|
||||
}
|
||||
|
||||
func (n *daemonSetClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
|
||||
return n.iface.DeleteNamespaced(namespace, name, options)
|
||||
}
|
||||
|
||||
func (n *daemonSetClient2) List(namespace string, opts metav1.ListOptions) (*DaemonSetList, error) {
|
||||
return n.iface.List(opts)
|
||||
}
|
||||
|
||||
func (n *daemonSetClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return n.iface.Watch(opts)
|
||||
}
|
||||
|
||||
func (n *daemonSetClientCache) Get(namespace, name string) (*v1beta2.DaemonSet, error) {
|
||||
return n.client.controller.Lister().Get(namespace, name)
|
||||
}
|
||||
|
||||
func (n *daemonSetClientCache) List(namespace string, selector labels.Selector) ([]*v1beta2.DaemonSet, error) {
|
||||
return n.client.controller.Lister().List(namespace, selector)
|
||||
}
|
||||
|
||||
func (n *daemonSetClient2) Cache() DaemonSetClientCache {
|
||||
n.loadController()
|
||||
return &daemonSetClientCache{
|
||||
client: n,
|
||||
}
|
||||
}
|
||||
|
||||
func (n *daemonSetClient2) OnCreate(ctx context.Context, name string, sync DaemonSetChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name, &daemonSetLifecycleDelegate{create: sync})
|
||||
}
|
||||
|
||||
func (n *daemonSetClient2) OnChange(ctx context.Context, name string, sync DaemonSetChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name, &daemonSetLifecycleDelegate{update: sync})
|
||||
}
|
||||
|
||||
func (n *daemonSetClient2) OnRemove(ctx context.Context, name string, sync DaemonSetChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name, &daemonSetLifecycleDelegate{remove: sync})
|
||||
}
|
||||
|
||||
func (n *daemonSetClientCache) Index(name string, indexer DaemonSetIndexer) {
|
||||
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
|
||||
name: func(obj interface{}) ([]string, error) {
|
||||
if v, ok := obj.(*v1beta2.DaemonSet); ok {
|
||||
return indexer(v)
|
||||
}
|
||||
return nil, nil
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *daemonSetClientCache) GetIndexed(name, key string) ([]*v1beta2.DaemonSet, error) {
|
||||
var result []*v1beta2.DaemonSet
|
||||
objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, obj := range objs {
|
||||
if v, ok := obj.(*v1beta2.DaemonSet); ok {
|
||||
result = append(result, v)
|
||||
}
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (n *daemonSetClient2) loadController() {
|
||||
if n.controller == nil {
|
||||
n.controller = n.iface.Controller()
|
||||
}
|
||||
}
|
||||
|
||||
type daemonSetLifecycleDelegate struct {
|
||||
create DaemonSetChangeHandlerFunc
|
||||
update DaemonSetChangeHandlerFunc
|
||||
remove DaemonSetChangeHandlerFunc
|
||||
}
|
||||
|
||||
func (n *daemonSetLifecycleDelegate) HasCreate() bool {
|
||||
return n.create != nil
|
||||
}
|
||||
|
||||
func (n *daemonSetLifecycleDelegate) Create(obj *v1beta2.DaemonSet) (runtime.Object, error) {
|
||||
if n.create == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.create(obj)
|
||||
}
|
||||
|
||||
func (n *daemonSetLifecycleDelegate) HasFinalize() bool {
|
||||
return n.remove != nil
|
||||
}
|
||||
|
||||
func (n *daemonSetLifecycleDelegate) Remove(obj *v1beta2.DaemonSet) (runtime.Object, error) {
|
||||
if n.remove == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.remove(obj)
|
||||
}
|
||||
|
||||
func (n *daemonSetLifecycleDelegate) HasUpdated() bool {
|
||||
return n.remove != nil
|
||||
}
|
||||
|
||||
func (n *daemonSetLifecycleDelegate) Updated(obj *v1beta2.DaemonSet) (runtime.Object, error) {
|
||||
if n.update == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.update(obj)
|
||||
}
|
||||
|
@@ -38,6 +38,8 @@ type DeploymentList struct {
|
||||
|
||||
type DeploymentHandlerFunc func(key string, obj *v1beta2.Deployment) (runtime.Object, error)
|
||||
|
||||
type DeploymentChangeHandlerFunc func(obj *v1beta2.Deployment) (runtime.Object, error)
|
||||
|
||||
type DeploymentLister interface {
|
||||
List(namespace string, selector labels.Selector) (ret []*v1beta2.Deployment, err error)
|
||||
Get(namespace, name string) (*v1beta2.Deployment, error)
|
||||
@@ -249,3 +251,182 @@ func (s *deploymentClient) AddClusterScopedLifecycle(ctx context.Context, name,
|
||||
sync := NewDeploymentLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
|
||||
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
|
||||
}
|
||||
|
||||
type DeploymentIndexer func(obj *v1beta2.Deployment) ([]string, error)
|
||||
|
||||
type DeploymentClientCache interface {
|
||||
Get(namespace, name string) (*v1beta2.Deployment, error)
|
||||
List(namespace string, selector labels.Selector) ([]*v1beta2.Deployment, error)
|
||||
|
||||
Index(name string, indexer DeploymentIndexer)
|
||||
GetIndexed(name, key string) ([]*v1beta2.Deployment, error)
|
||||
}
|
||||
|
||||
type DeploymentClient interface {
|
||||
Create(*v1beta2.Deployment) (*v1beta2.Deployment, error)
|
||||
Get(namespace, name string, opts metav1.GetOptions) (*v1beta2.Deployment, error)
|
||||
Update(*v1beta2.Deployment) (*v1beta2.Deployment, error)
|
||||
Delete(namespace, name string, options *metav1.DeleteOptions) error
|
||||
List(namespace string, opts metav1.ListOptions) (*DeploymentList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
|
||||
Cache() DeploymentClientCache
|
||||
|
||||
OnCreate(ctx context.Context, name string, sync DeploymentChangeHandlerFunc)
|
||||
OnChange(ctx context.Context, name string, sync DeploymentChangeHandlerFunc)
|
||||
OnRemove(ctx context.Context, name string, sync DeploymentChangeHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
|
||||
Generic() controller.GenericController
|
||||
Interface() DeploymentInterface
|
||||
}
|
||||
|
||||
type deploymentClientCache struct {
|
||||
client *deploymentClient2
|
||||
}
|
||||
|
||||
type deploymentClient2 struct {
|
||||
iface DeploymentInterface
|
||||
controller DeploymentController
|
||||
}
|
||||
|
||||
func (n *deploymentClient2) Interface() DeploymentInterface {
|
||||
return n.iface
|
||||
}
|
||||
|
||||
func (n *deploymentClient2) Generic() controller.GenericController {
|
||||
return n.iface.Controller().Generic()
|
||||
}
|
||||
|
||||
func (n *deploymentClient2) Enqueue(namespace, name string) {
|
||||
n.iface.Controller().Enqueue(namespace, name)
|
||||
}
|
||||
|
||||
func (n *deploymentClient2) Create(obj *v1beta2.Deployment) (*v1beta2.Deployment, error) {
|
||||
return n.iface.Create(obj)
|
||||
}
|
||||
|
||||
func (n *deploymentClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1beta2.Deployment, error) {
|
||||
return n.iface.GetNamespaced(namespace, name, opts)
|
||||
}
|
||||
|
||||
func (n *deploymentClient2) Update(obj *v1beta2.Deployment) (*v1beta2.Deployment, error) {
|
||||
return n.iface.Update(obj)
|
||||
}
|
||||
|
||||
func (n *deploymentClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
|
||||
return n.iface.DeleteNamespaced(namespace, name, options)
|
||||
}
|
||||
|
||||
func (n *deploymentClient2) List(namespace string, opts metav1.ListOptions) (*DeploymentList, error) {
|
||||
return n.iface.List(opts)
|
||||
}
|
||||
|
||||
func (n *deploymentClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return n.iface.Watch(opts)
|
||||
}
|
||||
|
||||
func (n *deploymentClientCache) Get(namespace, name string) (*v1beta2.Deployment, error) {
|
||||
return n.client.controller.Lister().Get(namespace, name)
|
||||
}
|
||||
|
||||
func (n *deploymentClientCache) List(namespace string, selector labels.Selector) ([]*v1beta2.Deployment, error) {
|
||||
return n.client.controller.Lister().List(namespace, selector)
|
||||
}
|
||||
|
||||
func (n *deploymentClient2) Cache() DeploymentClientCache {
|
||||
n.loadController()
|
||||
return &deploymentClientCache{
|
||||
client: n,
|
||||
}
|
||||
}
|
||||
|
||||
func (n *deploymentClient2) OnCreate(ctx context.Context, name string, sync DeploymentChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name, &deploymentLifecycleDelegate{create: sync})
|
||||
}
|
||||
|
||||
func (n *deploymentClient2) OnChange(ctx context.Context, name string, sync DeploymentChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name, &deploymentLifecycleDelegate{update: sync})
|
||||
}
|
||||
|
||||
func (n *deploymentClient2) OnRemove(ctx context.Context, name string, sync DeploymentChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name, &deploymentLifecycleDelegate{remove: sync})
|
||||
}
|
||||
|
||||
func (n *deploymentClientCache) Index(name string, indexer DeploymentIndexer) {
|
||||
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
|
||||
name: func(obj interface{}) ([]string, error) {
|
||||
if v, ok := obj.(*v1beta2.Deployment); ok {
|
||||
return indexer(v)
|
||||
}
|
||||
return nil, nil
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *deploymentClientCache) GetIndexed(name, key string) ([]*v1beta2.Deployment, error) {
|
||||
var result []*v1beta2.Deployment
|
||||
objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, obj := range objs {
|
||||
if v, ok := obj.(*v1beta2.Deployment); ok {
|
||||
result = append(result, v)
|
||||
}
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (n *deploymentClient2) loadController() {
|
||||
if n.controller == nil {
|
||||
n.controller = n.iface.Controller()
|
||||
}
|
||||
}
|
||||
|
||||
type deploymentLifecycleDelegate struct {
|
||||
create DeploymentChangeHandlerFunc
|
||||
update DeploymentChangeHandlerFunc
|
||||
remove DeploymentChangeHandlerFunc
|
||||
}
|
||||
|
||||
func (n *deploymentLifecycleDelegate) HasCreate() bool {
|
||||
return n.create != nil
|
||||
}
|
||||
|
||||
func (n *deploymentLifecycleDelegate) Create(obj *v1beta2.Deployment) (runtime.Object, error) {
|
||||
if n.create == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.create(obj)
|
||||
}
|
||||
|
||||
func (n *deploymentLifecycleDelegate) HasFinalize() bool {
|
||||
return n.remove != nil
|
||||
}
|
||||
|
||||
func (n *deploymentLifecycleDelegate) Remove(obj *v1beta2.Deployment) (runtime.Object, error) {
|
||||
if n.remove == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.remove(obj)
|
||||
}
|
||||
|
||||
func (n *deploymentLifecycleDelegate) HasUpdated() bool {
|
||||
return n.remove != nil
|
||||
}
|
||||
|
||||
func (n *deploymentLifecycleDelegate) Updated(obj *v1beta2.Deployment) (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
|
||||
@@ -23,6 +26,13 @@ type Interface interface {
|
||||
ReplicaSetsGetter
|
||||
}
|
||||
|
||||
type Clients struct {
|
||||
Deployment DeploymentClient
|
||||
DaemonSet DaemonSetClient
|
||||
StatefulSet StatefulSetClient
|
||||
ReplicaSet ReplicaSetClient
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
sync.Mutex
|
||||
restClient rest.Interface
|
||||
@@ -40,13 +50,47 @@ 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{
|
||||
|
||||
Deployment: &deploymentClient2{
|
||||
iface: iface.Deployments(""),
|
||||
},
|
||||
DaemonSet: &daemonSetClient2{
|
||||
iface: iface.DaemonSets(""),
|
||||
},
|
||||
StatefulSet: &statefulSetClient2{
|
||||
iface: iface.StatefulSets(""),
|
||||
},
|
||||
ReplicaSet: &replicaSetClient2{
|
||||
iface: iface.ReplicaSets(""),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func NewForConfig(config rest.Config) (Interface, error) {
|
||||
if config.NegotiatedSerializer == nil {
|
||||
config.NegotiatedSerializer = dynamic.NegotiatedSerializer
|
||||
|
@@ -38,6 +38,8 @@ type ReplicaSetList struct {
|
||||
|
||||
type ReplicaSetHandlerFunc func(key string, obj *v1beta2.ReplicaSet) (runtime.Object, error)
|
||||
|
||||
type ReplicaSetChangeHandlerFunc func(obj *v1beta2.ReplicaSet) (runtime.Object, error)
|
||||
|
||||
type ReplicaSetLister interface {
|
||||
List(namespace string, selector labels.Selector) (ret []*v1beta2.ReplicaSet, err error)
|
||||
Get(namespace, name string) (*v1beta2.ReplicaSet, error)
|
||||
@@ -249,3 +251,182 @@ func (s *replicaSetClient) AddClusterScopedLifecycle(ctx context.Context, name,
|
||||
sync := NewReplicaSetLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
|
||||
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
|
||||
}
|
||||
|
||||
type ReplicaSetIndexer func(obj *v1beta2.ReplicaSet) ([]string, error)
|
||||
|
||||
type ReplicaSetClientCache interface {
|
||||
Get(namespace, name string) (*v1beta2.ReplicaSet, error)
|
||||
List(namespace string, selector labels.Selector) ([]*v1beta2.ReplicaSet, error)
|
||||
|
||||
Index(name string, indexer ReplicaSetIndexer)
|
||||
GetIndexed(name, key string) ([]*v1beta2.ReplicaSet, error)
|
||||
}
|
||||
|
||||
type ReplicaSetClient interface {
|
||||
Create(*v1beta2.ReplicaSet) (*v1beta2.ReplicaSet, error)
|
||||
Get(namespace, name string, opts metav1.GetOptions) (*v1beta2.ReplicaSet, error)
|
||||
Update(*v1beta2.ReplicaSet) (*v1beta2.ReplicaSet, error)
|
||||
Delete(namespace, name string, options *metav1.DeleteOptions) error
|
||||
List(namespace string, opts metav1.ListOptions) (*ReplicaSetList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
|
||||
Cache() ReplicaSetClientCache
|
||||
|
||||
OnCreate(ctx context.Context, name string, sync ReplicaSetChangeHandlerFunc)
|
||||
OnChange(ctx context.Context, name string, sync ReplicaSetChangeHandlerFunc)
|
||||
OnRemove(ctx context.Context, name string, sync ReplicaSetChangeHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
|
||||
Generic() controller.GenericController
|
||||
Interface() ReplicaSetInterface
|
||||
}
|
||||
|
||||
type replicaSetClientCache struct {
|
||||
client *replicaSetClient2
|
||||
}
|
||||
|
||||
type replicaSetClient2 struct {
|
||||
iface ReplicaSetInterface
|
||||
controller ReplicaSetController
|
||||
}
|
||||
|
||||
func (n *replicaSetClient2) Interface() ReplicaSetInterface {
|
||||
return n.iface
|
||||
}
|
||||
|
||||
func (n *replicaSetClient2) Generic() controller.GenericController {
|
||||
return n.iface.Controller().Generic()
|
||||
}
|
||||
|
||||
func (n *replicaSetClient2) Enqueue(namespace, name string) {
|
||||
n.iface.Controller().Enqueue(namespace, name)
|
||||
}
|
||||
|
||||
func (n *replicaSetClient2) Create(obj *v1beta2.ReplicaSet) (*v1beta2.ReplicaSet, error) {
|
||||
return n.iface.Create(obj)
|
||||
}
|
||||
|
||||
func (n *replicaSetClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1beta2.ReplicaSet, error) {
|
||||
return n.iface.GetNamespaced(namespace, name, opts)
|
||||
}
|
||||
|
||||
func (n *replicaSetClient2) Update(obj *v1beta2.ReplicaSet) (*v1beta2.ReplicaSet, error) {
|
||||
return n.iface.Update(obj)
|
||||
}
|
||||
|
||||
func (n *replicaSetClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
|
||||
return n.iface.DeleteNamespaced(namespace, name, options)
|
||||
}
|
||||
|
||||
func (n *replicaSetClient2) List(namespace string, opts metav1.ListOptions) (*ReplicaSetList, error) {
|
||||
return n.iface.List(opts)
|
||||
}
|
||||
|
||||
func (n *replicaSetClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return n.iface.Watch(opts)
|
||||
}
|
||||
|
||||
func (n *replicaSetClientCache) Get(namespace, name string) (*v1beta2.ReplicaSet, error) {
|
||||
return n.client.controller.Lister().Get(namespace, name)
|
||||
}
|
||||
|
||||
func (n *replicaSetClientCache) List(namespace string, selector labels.Selector) ([]*v1beta2.ReplicaSet, error) {
|
||||
return n.client.controller.Lister().List(namespace, selector)
|
||||
}
|
||||
|
||||
func (n *replicaSetClient2) Cache() ReplicaSetClientCache {
|
||||
n.loadController()
|
||||
return &replicaSetClientCache{
|
||||
client: n,
|
||||
}
|
||||
}
|
||||
|
||||
func (n *replicaSetClient2) OnCreate(ctx context.Context, name string, sync ReplicaSetChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name, &replicaSetLifecycleDelegate{create: sync})
|
||||
}
|
||||
|
||||
func (n *replicaSetClient2) OnChange(ctx context.Context, name string, sync ReplicaSetChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name, &replicaSetLifecycleDelegate{update: sync})
|
||||
}
|
||||
|
||||
func (n *replicaSetClient2) OnRemove(ctx context.Context, name string, sync ReplicaSetChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name, &replicaSetLifecycleDelegate{remove: sync})
|
||||
}
|
||||
|
||||
func (n *replicaSetClientCache) Index(name string, indexer ReplicaSetIndexer) {
|
||||
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
|
||||
name: func(obj interface{}) ([]string, error) {
|
||||
if v, ok := obj.(*v1beta2.ReplicaSet); ok {
|
||||
return indexer(v)
|
||||
}
|
||||
return nil, nil
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *replicaSetClientCache) GetIndexed(name, key string) ([]*v1beta2.ReplicaSet, error) {
|
||||
var result []*v1beta2.ReplicaSet
|
||||
objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, obj := range objs {
|
||||
if v, ok := obj.(*v1beta2.ReplicaSet); ok {
|
||||
result = append(result, v)
|
||||
}
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (n *replicaSetClient2) loadController() {
|
||||
if n.controller == nil {
|
||||
n.controller = n.iface.Controller()
|
||||
}
|
||||
}
|
||||
|
||||
type replicaSetLifecycleDelegate struct {
|
||||
create ReplicaSetChangeHandlerFunc
|
||||
update ReplicaSetChangeHandlerFunc
|
||||
remove ReplicaSetChangeHandlerFunc
|
||||
}
|
||||
|
||||
func (n *replicaSetLifecycleDelegate) HasCreate() bool {
|
||||
return n.create != nil
|
||||
}
|
||||
|
||||
func (n *replicaSetLifecycleDelegate) Create(obj *v1beta2.ReplicaSet) (runtime.Object, error) {
|
||||
if n.create == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.create(obj)
|
||||
}
|
||||
|
||||
func (n *replicaSetLifecycleDelegate) HasFinalize() bool {
|
||||
return n.remove != nil
|
||||
}
|
||||
|
||||
func (n *replicaSetLifecycleDelegate) Remove(obj *v1beta2.ReplicaSet) (runtime.Object, error) {
|
||||
if n.remove == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.remove(obj)
|
||||
}
|
||||
|
||||
func (n *replicaSetLifecycleDelegate) HasUpdated() bool {
|
||||
return n.remove != nil
|
||||
}
|
||||
|
||||
func (n *replicaSetLifecycleDelegate) Updated(obj *v1beta2.ReplicaSet) (runtime.Object, error) {
|
||||
if n.update == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.update(obj)
|
||||
}
|
||||
|
@@ -38,6 +38,8 @@ type StatefulSetList struct {
|
||||
|
||||
type StatefulSetHandlerFunc func(key string, obj *v1beta2.StatefulSet) (runtime.Object, error)
|
||||
|
||||
type StatefulSetChangeHandlerFunc func(obj *v1beta2.StatefulSet) (runtime.Object, error)
|
||||
|
||||
type StatefulSetLister interface {
|
||||
List(namespace string, selector labels.Selector) (ret []*v1beta2.StatefulSet, err error)
|
||||
Get(namespace, name string) (*v1beta2.StatefulSet, error)
|
||||
@@ -249,3 +251,182 @@ func (s *statefulSetClient) AddClusterScopedLifecycle(ctx context.Context, name,
|
||||
sync := NewStatefulSetLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
|
||||
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
|
||||
}
|
||||
|
||||
type StatefulSetIndexer func(obj *v1beta2.StatefulSet) ([]string, error)
|
||||
|
||||
type StatefulSetClientCache interface {
|
||||
Get(namespace, name string) (*v1beta2.StatefulSet, error)
|
||||
List(namespace string, selector labels.Selector) ([]*v1beta2.StatefulSet, error)
|
||||
|
||||
Index(name string, indexer StatefulSetIndexer)
|
||||
GetIndexed(name, key string) ([]*v1beta2.StatefulSet, error)
|
||||
}
|
||||
|
||||
type StatefulSetClient interface {
|
||||
Create(*v1beta2.StatefulSet) (*v1beta2.StatefulSet, error)
|
||||
Get(namespace, name string, opts metav1.GetOptions) (*v1beta2.StatefulSet, error)
|
||||
Update(*v1beta2.StatefulSet) (*v1beta2.StatefulSet, error)
|
||||
Delete(namespace, name string, options *metav1.DeleteOptions) error
|
||||
List(namespace string, opts metav1.ListOptions) (*StatefulSetList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
|
||||
Cache() StatefulSetClientCache
|
||||
|
||||
OnCreate(ctx context.Context, name string, sync StatefulSetChangeHandlerFunc)
|
||||
OnChange(ctx context.Context, name string, sync StatefulSetChangeHandlerFunc)
|
||||
OnRemove(ctx context.Context, name string, sync StatefulSetChangeHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
|
||||
Generic() controller.GenericController
|
||||
Interface() StatefulSetInterface
|
||||
}
|
||||
|
||||
type statefulSetClientCache struct {
|
||||
client *statefulSetClient2
|
||||
}
|
||||
|
||||
type statefulSetClient2 struct {
|
||||
iface StatefulSetInterface
|
||||
controller StatefulSetController
|
||||
}
|
||||
|
||||
func (n *statefulSetClient2) Interface() StatefulSetInterface {
|
||||
return n.iface
|
||||
}
|
||||
|
||||
func (n *statefulSetClient2) Generic() controller.GenericController {
|
||||
return n.iface.Controller().Generic()
|
||||
}
|
||||
|
||||
func (n *statefulSetClient2) Enqueue(namespace, name string) {
|
||||
n.iface.Controller().Enqueue(namespace, name)
|
||||
}
|
||||
|
||||
func (n *statefulSetClient2) Create(obj *v1beta2.StatefulSet) (*v1beta2.StatefulSet, error) {
|
||||
return n.iface.Create(obj)
|
||||
}
|
||||
|
||||
func (n *statefulSetClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1beta2.StatefulSet, error) {
|
||||
return n.iface.GetNamespaced(namespace, name, opts)
|
||||
}
|
||||
|
||||
func (n *statefulSetClient2) Update(obj *v1beta2.StatefulSet) (*v1beta2.StatefulSet, error) {
|
||||
return n.iface.Update(obj)
|
||||
}
|
||||
|
||||
func (n *statefulSetClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
|
||||
return n.iface.DeleteNamespaced(namespace, name, options)
|
||||
}
|
||||
|
||||
func (n *statefulSetClient2) List(namespace string, opts metav1.ListOptions) (*StatefulSetList, error) {
|
||||
return n.iface.List(opts)
|
||||
}
|
||||
|
||||
func (n *statefulSetClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return n.iface.Watch(opts)
|
||||
}
|
||||
|
||||
func (n *statefulSetClientCache) Get(namespace, name string) (*v1beta2.StatefulSet, error) {
|
||||
return n.client.controller.Lister().Get(namespace, name)
|
||||
}
|
||||
|
||||
func (n *statefulSetClientCache) List(namespace string, selector labels.Selector) ([]*v1beta2.StatefulSet, error) {
|
||||
return n.client.controller.Lister().List(namespace, selector)
|
||||
}
|
||||
|
||||
func (n *statefulSetClient2) Cache() StatefulSetClientCache {
|
||||
n.loadController()
|
||||
return &statefulSetClientCache{
|
||||
client: n,
|
||||
}
|
||||
}
|
||||
|
||||
func (n *statefulSetClient2) OnCreate(ctx context.Context, name string, sync StatefulSetChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name, &statefulSetLifecycleDelegate{create: sync})
|
||||
}
|
||||
|
||||
func (n *statefulSetClient2) OnChange(ctx context.Context, name string, sync StatefulSetChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name, &statefulSetLifecycleDelegate{update: sync})
|
||||
}
|
||||
|
||||
func (n *statefulSetClient2) OnRemove(ctx context.Context, name string, sync StatefulSetChangeHandlerFunc) {
|
||||
n.loadController()
|
||||
n.iface.AddLifecycle(ctx, name, &statefulSetLifecycleDelegate{remove: sync})
|
||||
}
|
||||
|
||||
func (n *statefulSetClientCache) Index(name string, indexer StatefulSetIndexer) {
|
||||
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
|
||||
name: func(obj interface{}) ([]string, error) {
|
||||
if v, ok := obj.(*v1beta2.StatefulSet); ok {
|
||||
return indexer(v)
|
||||
}
|
||||
return nil, nil
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *statefulSetClientCache) GetIndexed(name, key string) ([]*v1beta2.StatefulSet, error) {
|
||||
var result []*v1beta2.StatefulSet
|
||||
objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, obj := range objs {
|
||||
if v, ok := obj.(*v1beta2.StatefulSet); ok {
|
||||
result = append(result, v)
|
||||
}
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (n *statefulSetClient2) loadController() {
|
||||
if n.controller == nil {
|
||||
n.controller = n.iface.Controller()
|
||||
}
|
||||
}
|
||||
|
||||
type statefulSetLifecycleDelegate struct {
|
||||
create StatefulSetChangeHandlerFunc
|
||||
update StatefulSetChangeHandlerFunc
|
||||
remove StatefulSetChangeHandlerFunc
|
||||
}
|
||||
|
||||
func (n *statefulSetLifecycleDelegate) HasCreate() bool {
|
||||
return n.create != nil
|
||||
}
|
||||
|
||||
func (n *statefulSetLifecycleDelegate) Create(obj *v1beta2.StatefulSet) (runtime.Object, error) {
|
||||
if n.create == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.create(obj)
|
||||
}
|
||||
|
||||
func (n *statefulSetLifecycleDelegate) HasFinalize() bool {
|
||||
return n.remove != nil
|
||||
}
|
||||
|
||||
func (n *statefulSetLifecycleDelegate) Remove(obj *v1beta2.StatefulSet) (runtime.Object, error) {
|
||||
if n.remove == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.remove(obj)
|
||||
}
|
||||
|
||||
func (n *statefulSetLifecycleDelegate) HasUpdated() bool {
|
||||
return n.remove != nil
|
||||
}
|
||||
|
||||
func (n *statefulSetLifecycleDelegate) Updated(obj *v1beta2.StatefulSet) (runtime.Object, error) {
|
||||
if n.update == nil {
|
||||
return obj, nil
|
||||
}
|
||||
return n.update(obj)
|
||||
}
|
||||
|
Reference in New Issue
Block a user