mirror of
https://github.com/rancher/types.git
synced 2025-09-24 19:39:13 +00:00
Update generated code
This commit is contained in:
@@ -347,6 +347,10 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
in.(*RancherKubernetesEngineConfig).DeepCopyInto(out.(*RancherKubernetesEngineConfig))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&RancherKubernetesEngineConfig{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*ReleaseInfo).DeepCopyInto(out.(*ReleaseInfo))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&ReleaseInfo{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*RoleTemplate).DeepCopyInto(out.(*RoleTemplate))
|
||||
return nil
|
||||
@@ -359,6 +363,22 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
in.(*SchedulerService).DeepCopyInto(out.(*SchedulerService))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SchedulerService{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*Stack).DeepCopyInto(out.(*Stack))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&Stack{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*StackList).DeepCopyInto(out.(*StackList))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&StackList{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*StackSpec).DeepCopyInto(out.(*StackSpec))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&StackSpec{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*StackStatus).DeepCopyInto(out.(*StackStatus))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&StackStatus{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*Template).DeepCopyInto(out.(*Template))
|
||||
return nil
|
||||
@@ -2592,6 +2612,22 @@ func (in *RancherKubernetesEngineConfig) DeepCopy() *RancherKubernetesEngineConf
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ReleaseInfo) DeepCopyInto(out *ReleaseInfo) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReleaseInfo.
|
||||
func (in *ReleaseInfo) DeepCopy() *ReleaseInfo {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ReleaseInfo)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RoleTemplate) DeepCopyInto(out *RoleTemplate) {
|
||||
*out = *in
|
||||
@@ -2682,6 +2718,133 @@ func (in *SchedulerService) DeepCopy() *SchedulerService {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Stack) DeepCopyInto(out *Stack) {
|
||||
*out = *in
|
||||
out.Namespaced = in.Namespaced
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Stack.
|
||||
func (in *Stack) DeepCopy() *Stack {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Stack)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Stack) 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 *StackList) DeepCopyInto(out *StackList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Stack, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StackList.
|
||||
func (in *StackList) DeepCopy() *StackList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(StackList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *StackList) 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 *StackSpec) DeepCopyInto(out *StackSpec) {
|
||||
*out = *in
|
||||
if in.Templates != nil {
|
||||
in, out := &in.Templates, &out.Templates
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.Answers != nil {
|
||||
in, out := &in.Answers, &out.Answers
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.Tag != nil {
|
||||
in, out := &in.Tag, &out.Tag
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.Groups != nil {
|
||||
in, out := &in.Groups, &out.Groups
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StackSpec.
|
||||
func (in *StackSpec) DeepCopy() *StackSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(StackSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *StackStatus) DeepCopyInto(out *StackStatus) {
|
||||
*out = *in
|
||||
if in.Releases != nil {
|
||||
in, out := &in.Releases, &out.Releases
|
||||
*out = make([]ReleaseInfo, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StackStatus.
|
||||
func (in *StackStatus) DeepCopy() *StackStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(StackStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Template) DeepCopyInto(out *Template) {
|
||||
*out = *in
|
||||
|
@@ -36,6 +36,7 @@ type Interface interface {
|
||||
TokensGetter
|
||||
UsersGetter
|
||||
DynamicSchemasGetter
|
||||
StacksGetter
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
@@ -65,6 +66,7 @@ type Client struct {
|
||||
tokenControllers map[string]TokenController
|
||||
userControllers map[string]UserController
|
||||
dynamicSchemaControllers map[string]DynamicSchemaController
|
||||
stackControllers map[string]StackController
|
||||
}
|
||||
|
||||
func NewForConfig(config rest.Config) (Interface, error) {
|
||||
@@ -103,6 +105,7 @@ func NewForConfig(config rest.Config) (Interface, error) {
|
||||
tokenControllers: map[string]TokenController{},
|
||||
userControllers: map[string]UserController{},
|
||||
dynamicSchemaControllers: map[string]DynamicSchemaController{},
|
||||
stackControllers: map[string]StackController{},
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -403,3 +406,16 @@ func (c *Client) DynamicSchemas(namespace string) DynamicSchemaInterface {
|
||||
objectClient: objectClient,
|
||||
}
|
||||
}
|
||||
|
||||
type StacksGetter interface {
|
||||
Stacks(namespace string) StackInterface
|
||||
}
|
||||
|
||||
func (c *Client) Stacks(namespace string) StackInterface {
|
||||
objectClient := clientbase.NewObjectClient(namespace, c.restClient, &StackResource, StackGroupVersionKind, stackFactory{})
|
||||
return &stackClient{
|
||||
ns: namespace,
|
||||
client: c,
|
||||
objectClient: objectClient,
|
||||
}
|
||||
}
|
||||
|
@@ -77,6 +77,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
&UserList{},
|
||||
&DynamicSchema{},
|
||||
&DynamicSchemaList{},
|
||||
&Stack{},
|
||||
&StackList{},
|
||||
)
|
||||
return nil
|
||||
}
|
||||
|
222
apis/management.cattle.io/v3/zz_generated_stack_controller.go
Normal file
222
apis/management.cattle.io/v3/zz_generated_stack_controller.go
Normal file
@@ -0,0 +1,222 @@
|
||||
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 (
|
||||
StackGroupVersionKind = schema.GroupVersionKind{
|
||||
Version: Version,
|
||||
Group: GroupName,
|
||||
Kind: "Stack",
|
||||
}
|
||||
StackResource = metav1.APIResource{
|
||||
Name: "stacks",
|
||||
SingularName: "stack",
|
||||
Namespaced: true,
|
||||
|
||||
Kind: StackGroupVersionKind.Kind,
|
||||
}
|
||||
)
|
||||
|
||||
type StackList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Stack
|
||||
}
|
||||
|
||||
type StackHandlerFunc func(key string, obj *Stack) error
|
||||
|
||||
type StackLister interface {
|
||||
List(namespace string, selector labels.Selector) (ret []*Stack, err error)
|
||||
Get(namespace, name string) (*Stack, error)
|
||||
}
|
||||
|
||||
type StackController interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() StackLister
|
||||
AddHandler(handler StackHandlerFunc)
|
||||
Enqueue(namespace, name string)
|
||||
Sync(ctx context.Context) error
|
||||
Start(ctx context.Context, threadiness int) error
|
||||
}
|
||||
|
||||
type StackInterface interface {
|
||||
ObjectClient() *clientbase.ObjectClient
|
||||
Create(*Stack) (*Stack, error)
|
||||
GetNamespace(name, namespace string, opts metav1.GetOptions) (*Stack, error)
|
||||
Get(name string, opts metav1.GetOptions) (*Stack, error)
|
||||
Update(*Stack) (*Stack, error)
|
||||
Delete(name string, options *metav1.DeleteOptions) error
|
||||
DeleteNamespace(name, namespace string, options *metav1.DeleteOptions) error
|
||||
List(opts metav1.ListOptions) (*StackList, error)
|
||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Controller() StackController
|
||||
AddSyncHandler(sync StackHandlerFunc)
|
||||
AddLifecycle(name string, lifecycle StackLifecycle)
|
||||
}
|
||||
|
||||
type stackLister struct {
|
||||
controller *stackController
|
||||
}
|
||||
|
||||
func (l *stackLister) List(namespace string, selector labels.Selector) (ret []*Stack, err error) {
|
||||
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
|
||||
ret = append(ret, obj.(*Stack))
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (l *stackLister) Get(namespace, name string) (*Stack, 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: StackGroupVersionKind.Group,
|
||||
Resource: "stack",
|
||||
}, name)
|
||||
}
|
||||
return obj.(*Stack), nil
|
||||
}
|
||||
|
||||
type stackController struct {
|
||||
controller.GenericController
|
||||
}
|
||||
|
||||
func (c *stackController) Lister() StackLister {
|
||||
return &stackLister{
|
||||
controller: c,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *stackController) AddHandler(handler StackHandlerFunc) {
|
||||
c.GenericController.AddHandler(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.(*Stack))
|
||||
})
|
||||
}
|
||||
|
||||
type stackFactory struct {
|
||||
}
|
||||
|
||||
func (c stackFactory) Object() runtime.Object {
|
||||
return &Stack{}
|
||||
}
|
||||
|
||||
func (c stackFactory) List() runtime.Object {
|
||||
return &StackList{}
|
||||
}
|
||||
|
||||
func (s *stackClient) Controller() StackController {
|
||||
s.client.Lock()
|
||||
defer s.client.Unlock()
|
||||
|
||||
c, ok := s.client.stackControllers[s.ns]
|
||||
if ok {
|
||||
return c
|
||||
}
|
||||
|
||||
genericController := controller.NewGenericController(StackGroupVersionKind.Kind+"Controller",
|
||||
s.objectClient)
|
||||
|
||||
c = &stackController{
|
||||
GenericController: genericController,
|
||||
}
|
||||
|
||||
s.client.stackControllers[s.ns] = c
|
||||
s.client.starters = append(s.client.starters, c)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
type stackClient struct {
|
||||
client *Client
|
||||
ns string
|
||||
objectClient *clientbase.ObjectClient
|
||||
controller StackController
|
||||
}
|
||||
|
||||
func (s *stackClient) ObjectClient() *clientbase.ObjectClient {
|
||||
return s.objectClient
|
||||
}
|
||||
|
||||
func (s *stackClient) Create(o *Stack) (*Stack, error) {
|
||||
obj, err := s.objectClient.Create(o)
|
||||
return obj.(*Stack), err
|
||||
}
|
||||
|
||||
func (s *stackClient) Get(name string, opts metav1.GetOptions) (*Stack, error) {
|
||||
obj, err := s.objectClient.Get(name, opts)
|
||||
return obj.(*Stack), err
|
||||
}
|
||||
|
||||
func (s *stackClient) GetNamespace(name, namespace string, opts metav1.GetOptions) (*Stack, error) {
|
||||
obj, err := s.objectClient.GetNamespace(name, namespace, opts)
|
||||
return obj.(*Stack), err
|
||||
}
|
||||
|
||||
func (s *stackClient) Update(o *Stack) (*Stack, error) {
|
||||
obj, err := s.objectClient.Update(o.Name, o)
|
||||
return obj.(*Stack), err
|
||||
}
|
||||
|
||||
func (s *stackClient) Delete(name string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.Delete(name, options)
|
||||
}
|
||||
|
||||
func (s *stackClient) DeleteNamespace(name, namespace string, options *metav1.DeleteOptions) error {
|
||||
return s.objectClient.DeleteNamespace(name, namespace, options)
|
||||
}
|
||||
|
||||
func (s *stackClient) List(opts metav1.ListOptions) (*StackList, error) {
|
||||
obj, err := s.objectClient.List(opts)
|
||||
return obj.(*StackList), err
|
||||
}
|
||||
|
||||
func (s *stackClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
return s.objectClient.Watch(opts)
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched deployment.
|
||||
func (s *stackClient) Patch(o *Stack, data []byte, subresources ...string) (*Stack, error) {
|
||||
obj, err := s.objectClient.Patch(o.Name, o, data, subresources...)
|
||||
return obj.(*Stack), err
|
||||
}
|
||||
|
||||
func (s *stackClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
|
||||
}
|
||||
|
||||
func (s *stackClient) AddSyncHandler(sync StackHandlerFunc) {
|
||||
s.Controller().AddHandler(sync)
|
||||
}
|
||||
|
||||
func (s *stackClient) AddLifecycle(name string, lifecycle StackLifecycle) {
|
||||
sync := NewStackLifecycleAdapter(name, s, lifecycle)
|
||||
s.AddSyncHandler(sync)
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/lifecycle"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
type StackLifecycle interface {
|
||||
Create(obj *Stack) (*Stack, error)
|
||||
Remove(obj *Stack) (*Stack, error)
|
||||
Updated(obj *Stack) (*Stack, error)
|
||||
}
|
||||
|
||||
type stackLifecycleAdapter struct {
|
||||
lifecycle StackLifecycle
|
||||
}
|
||||
|
||||
func (w *stackLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Create(obj.(*Stack))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *stackLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Remove(obj.(*Stack))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (w *stackLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
|
||||
o, err := w.lifecycle.Updated(obj.(*Stack))
|
||||
if o == nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func NewStackLifecycleAdapter(name string, client StackInterface, l StackLifecycle) StackHandlerFunc {
|
||||
adapter := &stackLifecycleAdapter{lifecycle: l}
|
||||
syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient())
|
||||
return func(key string, obj *Stack) error {
|
||||
if obj == nil {
|
||||
return syncFn(key, nil)
|
||||
}
|
||||
return syncFn(key, obj)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user