1
0
mirror of https://github.com/rancher/types.git synced 2025-09-07 08:01:13 +00:00

generate changes

This commit is contained in:
Daishan Peng
2018-03-19 09:41:22 -07:00
committed by Darren Shepherd
parent 8ad7a4777f
commit ed47e37c35
25 changed files with 1828 additions and 0 deletions

View File

@@ -0,0 +1,252 @@
package v3
import (
"context"
"github.com/rancher/norman/clientbase"
"github.com/rancher/norman/controller"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/tools/cache"
)
var (
ClusterComposeConfigGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "ClusterComposeConfig",
}
ClusterComposeConfigResource = metav1.APIResource{
Name: "clustercomposeconfigs",
SingularName: "clustercomposeconfig",
Namespaced: true,
Kind: ClusterComposeConfigGroupVersionKind.Kind,
}
)
type ClusterComposeConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ClusterComposeConfig
}
type ClusterComposeConfigHandlerFunc func(key string, obj *ClusterComposeConfig) error
type ClusterComposeConfigLister interface {
List(namespace string, selector labels.Selector) (ret []*ClusterComposeConfig, err error)
Get(namespace, name string) (*ClusterComposeConfig, error)
}
type ClusterComposeConfigController interface {
Informer() cache.SharedIndexInformer
Lister() ClusterComposeConfigLister
AddHandler(name string, handler ClusterComposeConfigHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler ClusterComposeConfigHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type ClusterComposeConfigInterface interface {
ObjectClient() *clientbase.ObjectClient
Create(*ClusterComposeConfig) (*ClusterComposeConfig, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ClusterComposeConfig, error)
Get(name string, opts metav1.GetOptions) (*ClusterComposeConfig, error)
Update(*ClusterComposeConfig) (*ClusterComposeConfig, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*ClusterComposeConfigList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() ClusterComposeConfigController
AddHandler(name string, sync ClusterComposeConfigHandlerFunc)
AddLifecycle(name string, lifecycle ClusterComposeConfigLifecycle)
AddClusterScopedHandler(name, clusterName string, sync ClusterComposeConfigHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle ClusterComposeConfigLifecycle)
}
type clusterComposeConfigLister struct {
controller *clusterComposeConfigController
}
func (l *clusterComposeConfigLister) List(namespace string, selector labels.Selector) (ret []*ClusterComposeConfig, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*ClusterComposeConfig))
})
return
}
func (l *clusterComposeConfigLister) Get(namespace, name string) (*ClusterComposeConfig, error) {
var key string
if namespace != "" {
key = namespace + "/" + name
} else {
key = name
}
obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(schema.GroupResource{
Group: ClusterComposeConfigGroupVersionKind.Group,
Resource: "clusterComposeConfig",
}, name)
}
return obj.(*ClusterComposeConfig), nil
}
type clusterComposeConfigController struct {
controller.GenericController
}
func (c *clusterComposeConfigController) Lister() ClusterComposeConfigLister {
return &clusterComposeConfigLister{
controller: c,
}
}
func (c *clusterComposeConfigController) AddHandler(name string, handler ClusterComposeConfigHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
return handler(key, obj.(*ClusterComposeConfig))
})
}
func (c *clusterComposeConfigController) AddClusterScopedHandler(name, cluster string, handler ClusterComposeConfigHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*ClusterComposeConfig))
})
}
type clusterComposeConfigFactory struct {
}
func (c clusterComposeConfigFactory) Object() runtime.Object {
return &ClusterComposeConfig{}
}
func (c clusterComposeConfigFactory) List() runtime.Object {
return &ClusterComposeConfigList{}
}
func (s *clusterComposeConfigClient) Controller() ClusterComposeConfigController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.clusterComposeConfigControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(ClusterComposeConfigGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &clusterComposeConfigController{
GenericController: genericController,
}
s.client.clusterComposeConfigControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type clusterComposeConfigClient struct {
client *Client
ns string
objectClient *clientbase.ObjectClient
controller ClusterComposeConfigController
}
func (s *clusterComposeConfigClient) ObjectClient() *clientbase.ObjectClient {
return s.objectClient
}
func (s *clusterComposeConfigClient) Create(o *ClusterComposeConfig) (*ClusterComposeConfig, error) {
obj, err := s.objectClient.Create(o)
return obj.(*ClusterComposeConfig), err
}
func (s *clusterComposeConfigClient) Get(name string, opts metav1.GetOptions) (*ClusterComposeConfig, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*ClusterComposeConfig), err
}
func (s *clusterComposeConfigClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ClusterComposeConfig, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*ClusterComposeConfig), err
}
func (s *clusterComposeConfigClient) Update(o *ClusterComposeConfig) (*ClusterComposeConfig, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*ClusterComposeConfig), err
}
func (s *clusterComposeConfigClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *clusterComposeConfigClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *clusterComposeConfigClient) List(opts metav1.ListOptions) (*ClusterComposeConfigList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*ClusterComposeConfigList), err
}
func (s *clusterComposeConfigClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *clusterComposeConfigClient) Patch(o *ClusterComposeConfig, data []byte, subresources ...string) (*ClusterComposeConfig, error) {
obj, err := s.objectClient.Patch(o.Name, o, data, subresources...)
return obj.(*ClusterComposeConfig), err
}
func (s *clusterComposeConfigClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *clusterComposeConfigClient) AddHandler(name string, sync ClusterComposeConfigHandlerFunc) {
s.Controller().AddHandler(name, sync)
}
func (s *clusterComposeConfigClient) AddLifecycle(name string, lifecycle ClusterComposeConfigLifecycle) {
sync := NewClusterComposeConfigLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *clusterComposeConfigClient) AddClusterScopedHandler(name, clusterName string, sync ClusterComposeConfigHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *clusterComposeConfigClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle ClusterComposeConfigLifecycle) {
sync := NewClusterComposeConfigLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@@ -0,0 +1,51 @@
package v3
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type ClusterComposeConfigLifecycle interface {
Create(obj *ClusterComposeConfig) (*ClusterComposeConfig, error)
Remove(obj *ClusterComposeConfig) (*ClusterComposeConfig, error)
Updated(obj *ClusterComposeConfig) (*ClusterComposeConfig, error)
}
type clusterComposeConfigLifecycleAdapter struct {
lifecycle ClusterComposeConfigLifecycle
}
func (w *clusterComposeConfigLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*ClusterComposeConfig))
if o == nil {
return nil, err
}
return o, err
}
func (w *clusterComposeConfigLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*ClusterComposeConfig))
if o == nil {
return nil, err
}
return o, err
}
func (w *clusterComposeConfigLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*ClusterComposeConfig))
if o == nil {
return nil, err
}
return o, err
}
func NewClusterComposeConfigLifecycleAdapter(name string, clusterScoped bool, client ClusterComposeConfigInterface, l ClusterComposeConfigLifecycle) ClusterComposeConfigHandlerFunc {
adapter := &clusterComposeConfigLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *ClusterComposeConfig) error {
if obj == nil {
return syncFn(key, nil)
}
return syncFn(key, obj)
}
}

View File

@@ -115,6 +115,18 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
in.(*ClusterComponentStatus).DeepCopyInto(out.(*ClusterComponentStatus))
return nil
}, InType: reflect.TypeOf(&ClusterComponentStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*ClusterComposeConfig).DeepCopyInto(out.(*ClusterComposeConfig))
return nil
}, InType: reflect.TypeOf(&ClusterComposeConfig{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*ClusterComposeConfigList).DeepCopyInto(out.(*ClusterComposeConfigList))
return nil
}, InType: reflect.TypeOf(&ClusterComposeConfigList{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*ClusterComposeSpec).DeepCopyInto(out.(*ClusterComposeSpec))
return nil
}, InType: reflect.TypeOf(&ClusterComposeSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*ClusterCondition).DeepCopyInto(out.(*ClusterCondition))
return nil
@@ -191,6 +203,18 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
in.(*ClusterStatus).DeepCopyInto(out.(*ClusterStatus))
return nil
}, InType: reflect.TypeOf(&ClusterStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*ComposeCondition).DeepCopyInto(out.(*ComposeCondition))
return nil
}, InType: reflect.TypeOf(&ComposeCondition{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*ComposeSpec).DeepCopyInto(out.(*ComposeSpec))
return nil
}, InType: reflect.TypeOf(&ComposeSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*ComposeStatus).DeepCopyInto(out.(*ComposeStatus))
return nil
}, InType: reflect.TypeOf(&ComposeStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*Condition).DeepCopyInto(out.(*Condition))
return nil
@@ -255,6 +279,14 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
in.(*GithubConfigTestOutput).DeepCopyInto(out.(*GithubConfigTestOutput))
return nil
}, InType: reflect.TypeOf(&GithubConfigTestOutput{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*GlobalComposeConfig).DeepCopyInto(out.(*GlobalComposeConfig))
return nil
}, InType: reflect.TypeOf(&GlobalComposeConfig{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*GlobalComposeConfigList).DeepCopyInto(out.(*GlobalComposeConfigList))
return nil
}, InType: reflect.TypeOf(&GlobalComposeConfigList{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*GlobalRole).DeepCopyInto(out.(*GlobalRole))
return nil
@@ -1400,6 +1432,86 @@ func (in *ClusterComponentStatus) DeepCopy() *ClusterComponentStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterComposeConfig) DeepCopyInto(out *ClusterComposeConfig) {
*out = *in
out.Namespaced = in.Namespaced
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterComposeConfig.
func (in *ClusterComposeConfig) DeepCopy() *ClusterComposeConfig {
if in == nil {
return nil
}
out := new(ClusterComposeConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterComposeConfig) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterComposeConfigList) DeepCopyInto(out *ClusterComposeConfigList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ClusterComposeConfig, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterComposeConfigList.
func (in *ClusterComposeConfigList) DeepCopy() *ClusterComposeConfigList {
if in == nil {
return nil
}
out := new(ClusterComposeConfigList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterComposeConfigList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterComposeSpec) DeepCopyInto(out *ClusterComposeSpec) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterComposeSpec.
func (in *ClusterComposeSpec) DeepCopy() *ClusterComposeSpec {
if in == nil {
return nil
}
out := new(ClusterComposeSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterCondition) DeepCopyInto(out *ClusterCondition) {
*out = *in
@@ -1982,6 +2094,59 @@ func (in *ClusterStatus) DeepCopy() *ClusterStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ComposeCondition) DeepCopyInto(out *ComposeCondition) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComposeCondition.
func (in *ComposeCondition) DeepCopy() *ComposeCondition {
if in == nil {
return nil
}
out := new(ComposeCondition)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ComposeSpec) DeepCopyInto(out *ComposeSpec) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComposeSpec.
func (in *ComposeSpec) DeepCopy() *ComposeSpec {
if in == nil {
return nil
}
out := new(ComposeSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ComposeStatus) DeepCopyInto(out *ComposeStatus) {
*out = *in
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]ComposeCondition, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComposeStatus.
func (in *ComposeStatus) DeepCopy() *ComposeStatus {
if in == nil {
return nil
}
out := new(ComposeStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Condition) DeepCopyInto(out *Condition) {
*out = *in
@@ -2349,6 +2514,69 @@ func (in *GithubConfigTestOutput) DeepCopy() *GithubConfigTestOutput {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *GlobalComposeConfig) DeepCopyInto(out *GlobalComposeConfig) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalComposeConfig.
func (in *GlobalComposeConfig) DeepCopy() *GlobalComposeConfig {
if in == nil {
return nil
}
out := new(GlobalComposeConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *GlobalComposeConfig) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *GlobalComposeConfigList) DeepCopyInto(out *GlobalComposeConfigList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]GlobalComposeConfig, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalComposeConfigList.
func (in *GlobalComposeConfigList) DeepCopy() *GlobalComposeConfigList {
if in == nil {
return nil
}
out := new(GlobalComposeConfigList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *GlobalComposeConfigList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *GlobalRole) DeepCopyInto(out *GlobalRole) {
*out = *in

View File

@@ -0,0 +1,251 @@
package v3
import (
"context"
"github.com/rancher/norman/clientbase"
"github.com/rancher/norman/controller"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/tools/cache"
)
var (
GlobalComposeConfigGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "GlobalComposeConfig",
}
GlobalComposeConfigResource = metav1.APIResource{
Name: "globalcomposeconfigs",
SingularName: "globalcomposeconfig",
Namespaced: false,
Kind: GlobalComposeConfigGroupVersionKind.Kind,
}
)
type GlobalComposeConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []GlobalComposeConfig
}
type GlobalComposeConfigHandlerFunc func(key string, obj *GlobalComposeConfig) error
type GlobalComposeConfigLister interface {
List(namespace string, selector labels.Selector) (ret []*GlobalComposeConfig, err error)
Get(namespace, name string) (*GlobalComposeConfig, error)
}
type GlobalComposeConfigController interface {
Informer() cache.SharedIndexInformer
Lister() GlobalComposeConfigLister
AddHandler(name string, handler GlobalComposeConfigHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler GlobalComposeConfigHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type GlobalComposeConfigInterface interface {
ObjectClient() *clientbase.ObjectClient
Create(*GlobalComposeConfig) (*GlobalComposeConfig, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*GlobalComposeConfig, error)
Get(name string, opts metav1.GetOptions) (*GlobalComposeConfig, error)
Update(*GlobalComposeConfig) (*GlobalComposeConfig, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*GlobalComposeConfigList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() GlobalComposeConfigController
AddHandler(name string, sync GlobalComposeConfigHandlerFunc)
AddLifecycle(name string, lifecycle GlobalComposeConfigLifecycle)
AddClusterScopedHandler(name, clusterName string, sync GlobalComposeConfigHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle GlobalComposeConfigLifecycle)
}
type globalComposeConfigLister struct {
controller *globalComposeConfigController
}
func (l *globalComposeConfigLister) List(namespace string, selector labels.Selector) (ret []*GlobalComposeConfig, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*GlobalComposeConfig))
})
return
}
func (l *globalComposeConfigLister) Get(namespace, name string) (*GlobalComposeConfig, error) {
var key string
if namespace != "" {
key = namespace + "/" + name
} else {
key = name
}
obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(schema.GroupResource{
Group: GlobalComposeConfigGroupVersionKind.Group,
Resource: "globalComposeConfig",
}, name)
}
return obj.(*GlobalComposeConfig), nil
}
type globalComposeConfigController struct {
controller.GenericController
}
func (c *globalComposeConfigController) Lister() GlobalComposeConfigLister {
return &globalComposeConfigLister{
controller: c,
}
}
func (c *globalComposeConfigController) AddHandler(name string, handler GlobalComposeConfigHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
return handler(key, obj.(*GlobalComposeConfig))
})
}
func (c *globalComposeConfigController) AddClusterScopedHandler(name, cluster string, handler GlobalComposeConfigHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*GlobalComposeConfig))
})
}
type globalComposeConfigFactory struct {
}
func (c globalComposeConfigFactory) Object() runtime.Object {
return &GlobalComposeConfig{}
}
func (c globalComposeConfigFactory) List() runtime.Object {
return &GlobalComposeConfigList{}
}
func (s *globalComposeConfigClient) Controller() GlobalComposeConfigController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.globalComposeConfigControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(GlobalComposeConfigGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &globalComposeConfigController{
GenericController: genericController,
}
s.client.globalComposeConfigControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type globalComposeConfigClient struct {
client *Client
ns string
objectClient *clientbase.ObjectClient
controller GlobalComposeConfigController
}
func (s *globalComposeConfigClient) ObjectClient() *clientbase.ObjectClient {
return s.objectClient
}
func (s *globalComposeConfigClient) Create(o *GlobalComposeConfig) (*GlobalComposeConfig, error) {
obj, err := s.objectClient.Create(o)
return obj.(*GlobalComposeConfig), err
}
func (s *globalComposeConfigClient) Get(name string, opts metav1.GetOptions) (*GlobalComposeConfig, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*GlobalComposeConfig), err
}
func (s *globalComposeConfigClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*GlobalComposeConfig, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*GlobalComposeConfig), err
}
func (s *globalComposeConfigClient) Update(o *GlobalComposeConfig) (*GlobalComposeConfig, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*GlobalComposeConfig), err
}
func (s *globalComposeConfigClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *globalComposeConfigClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *globalComposeConfigClient) List(opts metav1.ListOptions) (*GlobalComposeConfigList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*GlobalComposeConfigList), err
}
func (s *globalComposeConfigClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *globalComposeConfigClient) Patch(o *GlobalComposeConfig, data []byte, subresources ...string) (*GlobalComposeConfig, error) {
obj, err := s.objectClient.Patch(o.Name, o, data, subresources...)
return obj.(*GlobalComposeConfig), err
}
func (s *globalComposeConfigClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *globalComposeConfigClient) AddHandler(name string, sync GlobalComposeConfigHandlerFunc) {
s.Controller().AddHandler(name, sync)
}
func (s *globalComposeConfigClient) AddLifecycle(name string, lifecycle GlobalComposeConfigLifecycle) {
sync := NewGlobalComposeConfigLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *globalComposeConfigClient) AddClusterScopedHandler(name, clusterName string, sync GlobalComposeConfigHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *globalComposeConfigClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle GlobalComposeConfigLifecycle) {
sync := NewGlobalComposeConfigLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@@ -0,0 +1,51 @@
package v3
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type GlobalComposeConfigLifecycle interface {
Create(obj *GlobalComposeConfig) (*GlobalComposeConfig, error)
Remove(obj *GlobalComposeConfig) (*GlobalComposeConfig, error)
Updated(obj *GlobalComposeConfig) (*GlobalComposeConfig, error)
}
type globalComposeConfigLifecycleAdapter struct {
lifecycle GlobalComposeConfigLifecycle
}
func (w *globalComposeConfigLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*GlobalComposeConfig))
if o == nil {
return nil, err
}
return o, err
}
func (w *globalComposeConfigLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*GlobalComposeConfig))
if o == nil {
return nil, err
}
return o, err
}
func (w *globalComposeConfigLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*GlobalComposeConfig))
if o == nil {
return nil, err
}
return o, err
}
func NewGlobalComposeConfigLifecycleAdapter(name string, clusterScoped bool, client GlobalComposeConfigInterface, l GlobalComposeConfigLifecycle) GlobalComposeConfigHandlerFunc {
adapter := &globalComposeConfigLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *GlobalComposeConfig) error {
if obj == nil {
return syncFn(key, nil)
}
return syncFn(key, obj)
}
}

View File

@@ -53,6 +53,8 @@ type Interface interface {
PipelineExecutionsGetter
PipelineExecutionLogsGetter
SourceCodeRepositoriesGetter
GlobalComposeConfigsGetter
ClusterComposeConfigsGetter
}
type Client struct {
@@ -99,6 +101,8 @@ type Client struct {
pipelineExecutionControllers map[string]PipelineExecutionController
pipelineExecutionLogControllers map[string]PipelineExecutionLogController
sourceCodeRepositoryControllers map[string]SourceCodeRepositoryController
globalComposeConfigControllers map[string]GlobalComposeConfigController
clusterComposeConfigControllers map[string]ClusterComposeConfigController
}
func NewForConfig(config rest.Config) (Interface, error) {
@@ -154,6 +158,8 @@ func NewForConfig(config rest.Config) (Interface, error) {
pipelineExecutionControllers: map[string]PipelineExecutionController{},
pipelineExecutionLogControllers: map[string]PipelineExecutionLogController{},
sourceCodeRepositoryControllers: map[string]SourceCodeRepositoryController{},
globalComposeConfigControllers: map[string]GlobalComposeConfigController{},
clusterComposeConfigControllers: map[string]ClusterComposeConfigController{},
}, nil
}
@@ -675,3 +681,29 @@ func (c *Client) SourceCodeRepositories(namespace string) SourceCodeRepositoryIn
objectClient: objectClient,
}
}
type GlobalComposeConfigsGetter interface {
GlobalComposeConfigs(namespace string) GlobalComposeConfigInterface
}
func (c *Client) GlobalComposeConfigs(namespace string) GlobalComposeConfigInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &GlobalComposeConfigResource, GlobalComposeConfigGroupVersionKind, globalComposeConfigFactory{})
return &globalComposeConfigClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type ClusterComposeConfigsGetter interface {
ClusterComposeConfigs(namespace string) ClusterComposeConfigInterface
}
func (c *Client) ClusterComposeConfigs(namespace string) ClusterComposeConfigInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ClusterComposeConfigResource, ClusterComposeConfigGroupVersionKind, clusterComposeConfigFactory{})
return &clusterComposeConfigClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}

View File

@@ -111,6 +111,10 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&PipelineExecutionLogList{},
&SourceCodeRepository{},
&SourceCodeRepositoryList{},
&GlobalComposeConfig{},
&GlobalComposeConfigList{},
&ClusterComposeConfig{},
&ClusterComposeConfigList{},
)
return nil
}

View File

@@ -53,6 +53,14 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
in.(*CertificateList).DeepCopyInto(out.(*CertificateList))
return nil
}, InType: reflect.TypeOf(&CertificateList{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*ComposeCondition).DeepCopyInto(out.(*ComposeCondition))
return nil
}, InType: reflect.TypeOf(&ComposeCondition{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*ComposeStatus).DeepCopyInto(out.(*ComposeStatus))
return nil
}, InType: reflect.TypeOf(&ComposeStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*DockerCredential).DeepCopyInto(out.(*DockerCredential))
return nil
@@ -61,6 +69,18 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
in.(*DockerCredentialList).DeepCopyInto(out.(*DockerCredentialList))
return nil
}, InType: reflect.TypeOf(&DockerCredentialList{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*NamespaceComposeConfig).DeepCopyInto(out.(*NamespaceComposeConfig))
return nil
}, InType: reflect.TypeOf(&NamespaceComposeConfig{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*NamespaceComposeConfigList).DeepCopyInto(out.(*NamespaceComposeConfigList))
return nil
}, InType: reflect.TypeOf(&NamespaceComposeConfigList{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*NamespaceComposeSpec).DeepCopyInto(out.(*NamespaceComposeSpec))
return nil
}, InType: reflect.TypeOf(&NamespaceComposeSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*NamespacedBasicAuth).DeepCopyInto(out.(*NamespacedBasicAuth))
return nil
@@ -405,6 +425,43 @@ func (in *CertificateList) DeepCopyObject() runtime.Object {
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ComposeCondition) DeepCopyInto(out *ComposeCondition) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComposeCondition.
func (in *ComposeCondition) DeepCopy() *ComposeCondition {
if in == nil {
return nil
}
out := new(ComposeCondition)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ComposeStatus) DeepCopyInto(out *ComposeStatus) {
*out = *in
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]ComposeCondition, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComposeStatus.
func (in *ComposeStatus) DeepCopy() *ComposeStatus {
if in == nil {
return nil
}
out := new(ComposeStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DockerCredential) DeepCopyInto(out *DockerCredential) {
*out = *in
@@ -474,6 +531,86 @@ func (in *DockerCredentialList) DeepCopyObject() runtime.Object {
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NamespaceComposeConfig) DeepCopyInto(out *NamespaceComposeConfig) {
*out = *in
out.Namespaced = in.Namespaced
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceComposeConfig.
func (in *NamespaceComposeConfig) DeepCopy() *NamespaceComposeConfig {
if in == nil {
return nil
}
out := new(NamespaceComposeConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *NamespaceComposeConfig) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NamespaceComposeConfigList) DeepCopyInto(out *NamespaceComposeConfigList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]NamespaceComposeConfig, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceComposeConfigList.
func (in *NamespaceComposeConfigList) DeepCopy() *NamespaceComposeConfigList {
if in == nil {
return nil
}
out := new(NamespaceComposeConfigList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *NamespaceComposeConfigList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
} else {
return nil
}
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NamespaceComposeSpec) DeepCopyInto(out *NamespaceComposeSpec) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceComposeSpec.
func (in *NamespaceComposeSpec) DeepCopy() *NamespaceComposeSpec {
if in == nil {
return nil
}
out := new(NamespaceComposeSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NamespacedBasicAuth) DeepCopyInto(out *NamespacedBasicAuth) {
*out = *in

View File

@@ -26,6 +26,7 @@ type Interface interface {
NamespacedSSHAuthsGetter
WorkloadsGetter
AppsGetter
NamespaceComposeConfigsGetter
}
type Client struct {
@@ -45,6 +46,7 @@ type Client struct {
namespacedSshAuthControllers map[string]NamespacedSSHAuthController
workloadControllers map[string]WorkloadController
appControllers map[string]AppController
namespaceComposeConfigControllers map[string]NamespaceComposeConfigController
}
func NewForConfig(config rest.Config) (Interface, error) {
@@ -73,6 +75,7 @@ func NewForConfig(config rest.Config) (Interface, error) {
namespacedSshAuthControllers: map[string]NamespacedSSHAuthController{},
workloadControllers: map[string]WorkloadController{},
appControllers: map[string]AppController{},
namespaceComposeConfigControllers: map[string]NamespaceComposeConfigController{},
}, nil
}
@@ -243,3 +246,16 @@ func (c *Client) Apps(namespace string) AppInterface {
objectClient: objectClient,
}
}
type NamespaceComposeConfigsGetter interface {
NamespaceComposeConfigs(namespace string) NamespaceComposeConfigInterface
}
func (c *Client) NamespaceComposeConfigs(namespace string) NamespaceComposeConfigInterface {
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &NamespaceComposeConfigResource, NamespaceComposeConfigGroupVersionKind, namespaceComposeConfigFactory{})
return &namespaceComposeConfigClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}

View File

@@ -0,0 +1,252 @@
package v3
import (
"context"
"github.com/rancher/norman/clientbase"
"github.com/rancher/norman/controller"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/tools/cache"
)
var (
NamespaceComposeConfigGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "NamespaceComposeConfig",
}
NamespaceComposeConfigResource = metav1.APIResource{
Name: "namespacecomposeconfigs",
SingularName: "namespacecomposeconfig",
Namespaced: true,
Kind: NamespaceComposeConfigGroupVersionKind.Kind,
}
)
type NamespaceComposeConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []NamespaceComposeConfig
}
type NamespaceComposeConfigHandlerFunc func(key string, obj *NamespaceComposeConfig) error
type NamespaceComposeConfigLister interface {
List(namespace string, selector labels.Selector) (ret []*NamespaceComposeConfig, err error)
Get(namespace, name string) (*NamespaceComposeConfig, error)
}
type NamespaceComposeConfigController interface {
Informer() cache.SharedIndexInformer
Lister() NamespaceComposeConfigLister
AddHandler(name string, handler NamespaceComposeConfigHandlerFunc)
AddClusterScopedHandler(name, clusterName string, handler NamespaceComposeConfigHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type NamespaceComposeConfigInterface interface {
ObjectClient() *clientbase.ObjectClient
Create(*NamespaceComposeConfig) (*NamespaceComposeConfig, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*NamespaceComposeConfig, error)
Get(name string, opts metav1.GetOptions) (*NamespaceComposeConfig, error)
Update(*NamespaceComposeConfig) (*NamespaceComposeConfig, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*NamespaceComposeConfigList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() NamespaceComposeConfigController
AddHandler(name string, sync NamespaceComposeConfigHandlerFunc)
AddLifecycle(name string, lifecycle NamespaceComposeConfigLifecycle)
AddClusterScopedHandler(name, clusterName string, sync NamespaceComposeConfigHandlerFunc)
AddClusterScopedLifecycle(name, clusterName string, lifecycle NamespaceComposeConfigLifecycle)
}
type namespaceComposeConfigLister struct {
controller *namespaceComposeConfigController
}
func (l *namespaceComposeConfigLister) List(namespace string, selector labels.Selector) (ret []*NamespaceComposeConfig, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*NamespaceComposeConfig))
})
return
}
func (l *namespaceComposeConfigLister) Get(namespace, name string) (*NamespaceComposeConfig, error) {
var key string
if namespace != "" {
key = namespace + "/" + name
} else {
key = name
}
obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(schema.GroupResource{
Group: NamespaceComposeConfigGroupVersionKind.Group,
Resource: "namespaceComposeConfig",
}, name)
}
return obj.(*NamespaceComposeConfig), nil
}
type namespaceComposeConfigController struct {
controller.GenericController
}
func (c *namespaceComposeConfigController) Lister() NamespaceComposeConfigLister {
return &namespaceComposeConfigLister{
controller: c,
}
}
func (c *namespaceComposeConfigController) AddHandler(name string, handler NamespaceComposeConfigHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
return handler(key, obj.(*NamespaceComposeConfig))
})
}
func (c *namespaceComposeConfigController) AddClusterScopedHandler(name, cluster string, handler NamespaceComposeConfigHandlerFunc) {
c.GenericController.AddHandler(name, func(key string) error {
obj, exists, err := c.Informer().GetStore().GetByKey(key)
if err != nil {
return err
}
if !exists {
return handler(key, nil)
}
if !controller.ObjectInCluster(cluster, obj) {
return nil
}
return handler(key, obj.(*NamespaceComposeConfig))
})
}
type namespaceComposeConfigFactory struct {
}
func (c namespaceComposeConfigFactory) Object() runtime.Object {
return &NamespaceComposeConfig{}
}
func (c namespaceComposeConfigFactory) List() runtime.Object {
return &NamespaceComposeConfigList{}
}
func (s *namespaceComposeConfigClient) Controller() NamespaceComposeConfigController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.namespaceComposeConfigControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(NamespaceComposeConfigGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &namespaceComposeConfigController{
GenericController: genericController,
}
s.client.namespaceComposeConfigControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type namespaceComposeConfigClient struct {
client *Client
ns string
objectClient *clientbase.ObjectClient
controller NamespaceComposeConfigController
}
func (s *namespaceComposeConfigClient) ObjectClient() *clientbase.ObjectClient {
return s.objectClient
}
func (s *namespaceComposeConfigClient) Create(o *NamespaceComposeConfig) (*NamespaceComposeConfig, error) {
obj, err := s.objectClient.Create(o)
return obj.(*NamespaceComposeConfig), err
}
func (s *namespaceComposeConfigClient) Get(name string, opts metav1.GetOptions) (*NamespaceComposeConfig, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*NamespaceComposeConfig), err
}
func (s *namespaceComposeConfigClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*NamespaceComposeConfig, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*NamespaceComposeConfig), err
}
func (s *namespaceComposeConfigClient) Update(o *NamespaceComposeConfig) (*NamespaceComposeConfig, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*NamespaceComposeConfig), err
}
func (s *namespaceComposeConfigClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *namespaceComposeConfigClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *namespaceComposeConfigClient) List(opts metav1.ListOptions) (*NamespaceComposeConfigList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*NamespaceComposeConfigList), err
}
func (s *namespaceComposeConfigClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *namespaceComposeConfigClient) Patch(o *NamespaceComposeConfig, data []byte, subresources ...string) (*NamespaceComposeConfig, error) {
obj, err := s.objectClient.Patch(o.Name, o, data, subresources...)
return obj.(*NamespaceComposeConfig), err
}
func (s *namespaceComposeConfigClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *namespaceComposeConfigClient) AddHandler(name string, sync NamespaceComposeConfigHandlerFunc) {
s.Controller().AddHandler(name, sync)
}
func (s *namespaceComposeConfigClient) AddLifecycle(name string, lifecycle NamespaceComposeConfigLifecycle) {
sync := NewNamespaceComposeConfigLifecycleAdapter(name, false, s, lifecycle)
s.AddHandler(name, sync)
}
func (s *namespaceComposeConfigClient) AddClusterScopedHandler(name, clusterName string, sync NamespaceComposeConfigHandlerFunc) {
s.Controller().AddClusterScopedHandler(name, clusterName, sync)
}
func (s *namespaceComposeConfigClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle NamespaceComposeConfigLifecycle) {
sync := NewNamespaceComposeConfigLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.AddClusterScopedHandler(name, clusterName, sync)
}

View File

@@ -0,0 +1,51 @@
package v3
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type NamespaceComposeConfigLifecycle interface {
Create(obj *NamespaceComposeConfig) (*NamespaceComposeConfig, error)
Remove(obj *NamespaceComposeConfig) (*NamespaceComposeConfig, error)
Updated(obj *NamespaceComposeConfig) (*NamespaceComposeConfig, error)
}
type namespaceComposeConfigLifecycleAdapter struct {
lifecycle NamespaceComposeConfigLifecycle
}
func (w *namespaceComposeConfigLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*NamespaceComposeConfig))
if o == nil {
return nil, err
}
return o, err
}
func (w *namespaceComposeConfigLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*NamespaceComposeConfig))
if o == nil {
return nil, err
}
return o, err
}
func (w *namespaceComposeConfigLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*NamespaceComposeConfig))
if o == nil {
return nil, err
}
return o, err
}
func NewNamespaceComposeConfigLifecycleAdapter(name string, clusterScoped bool, client NamespaceComposeConfigInterface, l NamespaceComposeConfigLifecycle) NamespaceComposeConfigHandlerFunc {
adapter := &namespaceComposeConfigLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *NamespaceComposeConfig) error {
if obj == nil {
return syncFn(key, nil)
}
return syncFn(key, obj)
}
}

View File

@@ -57,6 +57,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&WorkloadList{},
&App{},
&AppList{},
&NamespaceComposeConfig{},
&NamespaceComposeConfigList{},
)
return nil
}