1
0
mirror of https://github.com/rancher/types.git synced 2025-08-31 04:40:56 +00:00

Generated changes

This commit is contained in:
rajashree
2018-12-12 12:04:31 -08:00
committed by Alena Prokharchyk
parent eb49d0d119
commit 35e65403b5
12 changed files with 1454 additions and 0 deletions

View File

@@ -0,0 +1,440 @@
package v3
import (
"context"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
"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/types"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/tools/cache"
)
var (
CatalogTemplateGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "CatalogTemplate",
}
CatalogTemplateResource = metav1.APIResource{
Name: "catalogtemplates",
SingularName: "catalogtemplate",
Namespaced: true,
Kind: CatalogTemplateGroupVersionKind.Kind,
}
)
func NewCatalogTemplate(namespace, name string, obj CatalogTemplate) *CatalogTemplate {
obj.APIVersion, obj.Kind = CatalogTemplateGroupVersionKind.ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
type CatalogTemplateList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []CatalogTemplate
}
type CatalogTemplateHandlerFunc func(key string, obj *CatalogTemplate) (runtime.Object, error)
type CatalogTemplateChangeHandlerFunc func(obj *CatalogTemplate) (runtime.Object, error)
type CatalogTemplateLister interface {
List(namespace string, selector labels.Selector) (ret []*CatalogTemplate, err error)
Get(namespace, name string) (*CatalogTemplate, error)
}
type CatalogTemplateController interface {
Generic() controller.GenericController
Informer() cache.SharedIndexInformer
Lister() CatalogTemplateLister
AddHandler(ctx context.Context, name string, handler CatalogTemplateHandlerFunc)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler CatalogTemplateHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type CatalogTemplateInterface interface {
ObjectClient() *objectclient.ObjectClient
Create(*CatalogTemplate) (*CatalogTemplate, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*CatalogTemplate, error)
Get(name string, opts metav1.GetOptions) (*CatalogTemplate, error)
Update(*CatalogTemplate) (*CatalogTemplate, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*CatalogTemplateList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() CatalogTemplateController
AddHandler(ctx context.Context, name string, sync CatalogTemplateHandlerFunc)
AddLifecycle(ctx context.Context, name string, lifecycle CatalogTemplateLifecycle)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync CatalogTemplateHandlerFunc)
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle CatalogTemplateLifecycle)
}
type catalogTemplateLister struct {
controller *catalogTemplateController
}
func (l *catalogTemplateLister) List(namespace string, selector labels.Selector) (ret []*CatalogTemplate, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*CatalogTemplate))
})
return
}
func (l *catalogTemplateLister) Get(namespace, name string) (*CatalogTemplate, 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: CatalogTemplateGroupVersionKind.Group,
Resource: "catalogTemplate",
}, key)
}
return obj.(*CatalogTemplate), nil
}
type catalogTemplateController struct {
controller.GenericController
}
func (c *catalogTemplateController) Generic() controller.GenericController {
return c.GenericController
}
func (c *catalogTemplateController) Lister() CatalogTemplateLister {
return &catalogTemplateLister{
controller: c,
}
}
func (c *catalogTemplateController) AddHandler(ctx context.Context, name string, handler CatalogTemplateHandlerFunc) {
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if obj == nil {
return handler(key, nil)
} else if v, ok := obj.(*CatalogTemplate); ok {
return handler(key, v)
} else {
return nil, nil
}
})
}
func (c *catalogTemplateController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler CatalogTemplateHandlerFunc) {
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if obj == nil {
return handler(key, nil)
} else if v, ok := obj.(*CatalogTemplate); ok && controller.ObjectInCluster(cluster, obj) {
return handler(key, v)
} else {
return nil, nil
}
})
}
type catalogTemplateFactory struct {
}
func (c catalogTemplateFactory) Object() runtime.Object {
return &CatalogTemplate{}
}
func (c catalogTemplateFactory) List() runtime.Object {
return &CatalogTemplateList{}
}
func (s *catalogTemplateClient) Controller() CatalogTemplateController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.catalogTemplateControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(CatalogTemplateGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &catalogTemplateController{
GenericController: genericController,
}
s.client.catalogTemplateControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type catalogTemplateClient struct {
client *Client
ns string
objectClient *objectclient.ObjectClient
controller CatalogTemplateController
}
func (s *catalogTemplateClient) ObjectClient() *objectclient.ObjectClient {
return s.objectClient
}
func (s *catalogTemplateClient) Create(o *CatalogTemplate) (*CatalogTemplate, error) {
obj, err := s.objectClient.Create(o)
return obj.(*CatalogTemplate), err
}
func (s *catalogTemplateClient) Get(name string, opts metav1.GetOptions) (*CatalogTemplate, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*CatalogTemplate), err
}
func (s *catalogTemplateClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*CatalogTemplate, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*CatalogTemplate), err
}
func (s *catalogTemplateClient) Update(o *CatalogTemplate) (*CatalogTemplate, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*CatalogTemplate), err
}
func (s *catalogTemplateClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *catalogTemplateClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *catalogTemplateClient) List(opts metav1.ListOptions) (*CatalogTemplateList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*CatalogTemplateList), err
}
func (s *catalogTemplateClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *catalogTemplateClient) Patch(o *CatalogTemplate, patchType types.PatchType, data []byte, subresources ...string) (*CatalogTemplate, error) {
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
return obj.(*CatalogTemplate), err
}
func (s *catalogTemplateClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *catalogTemplateClient) AddHandler(ctx context.Context, name string, sync CatalogTemplateHandlerFunc) {
s.Controller().AddHandler(ctx, name, sync)
}
func (s *catalogTemplateClient) AddLifecycle(ctx context.Context, name string, lifecycle CatalogTemplateLifecycle) {
sync := NewCatalogTemplateLifecycleAdapter(name, false, s, lifecycle)
s.Controller().AddHandler(ctx, name, sync)
}
func (s *catalogTemplateClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync CatalogTemplateHandlerFunc) {
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *catalogTemplateClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle CatalogTemplateLifecycle) {
sync := NewCatalogTemplateLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
type CatalogTemplateIndexer func(obj *CatalogTemplate) ([]string, error)
type CatalogTemplateClientCache interface {
Get(namespace, name string) (*CatalogTemplate, error)
List(namespace string, selector labels.Selector) ([]*CatalogTemplate, error)
Index(name string, indexer CatalogTemplateIndexer)
GetIndexed(name, key string) ([]*CatalogTemplate, error)
}
type CatalogTemplateClient interface {
Create(*CatalogTemplate) (*CatalogTemplate, error)
Get(namespace, name string, opts metav1.GetOptions) (*CatalogTemplate, error)
Update(*CatalogTemplate) (*CatalogTemplate, error)
Delete(namespace, name string, options *metav1.DeleteOptions) error
List(namespace string, opts metav1.ListOptions) (*CatalogTemplateList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Cache() CatalogTemplateClientCache
OnCreate(ctx context.Context, name string, sync CatalogTemplateChangeHandlerFunc)
OnChange(ctx context.Context, name string, sync CatalogTemplateChangeHandlerFunc)
OnRemove(ctx context.Context, name string, sync CatalogTemplateChangeHandlerFunc)
Enqueue(namespace, name string)
Generic() controller.GenericController
ObjectClient() *objectclient.ObjectClient
Interface() CatalogTemplateInterface
}
type catalogTemplateClientCache struct {
client *catalogTemplateClient2
}
type catalogTemplateClient2 struct {
iface CatalogTemplateInterface
controller CatalogTemplateController
}
func (n *catalogTemplateClient2) Interface() CatalogTemplateInterface {
return n.iface
}
func (n *catalogTemplateClient2) Generic() controller.GenericController {
return n.iface.Controller().Generic()
}
func (n *catalogTemplateClient2) ObjectClient() *objectclient.ObjectClient {
return n.Interface().ObjectClient()
}
func (n *catalogTemplateClient2) Enqueue(namespace, name string) {
n.iface.Controller().Enqueue(namespace, name)
}
func (n *catalogTemplateClient2) Create(obj *CatalogTemplate) (*CatalogTemplate, error) {
return n.iface.Create(obj)
}
func (n *catalogTemplateClient2) Get(namespace, name string, opts metav1.GetOptions) (*CatalogTemplate, error) {
return n.iface.GetNamespaced(namespace, name, opts)
}
func (n *catalogTemplateClient2) Update(obj *CatalogTemplate) (*CatalogTemplate, error) {
return n.iface.Update(obj)
}
func (n *catalogTemplateClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
return n.iface.DeleteNamespaced(namespace, name, options)
}
func (n *catalogTemplateClient2) List(namespace string, opts metav1.ListOptions) (*CatalogTemplateList, error) {
return n.iface.List(opts)
}
func (n *catalogTemplateClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return n.iface.Watch(opts)
}
func (n *catalogTemplateClientCache) Get(namespace, name string) (*CatalogTemplate, error) {
return n.client.controller.Lister().Get(namespace, name)
}
func (n *catalogTemplateClientCache) List(namespace string, selector labels.Selector) ([]*CatalogTemplate, error) {
return n.client.controller.Lister().List(namespace, selector)
}
func (n *catalogTemplateClient2) Cache() CatalogTemplateClientCache {
n.loadController()
return &catalogTemplateClientCache{
client: n,
}
}
func (n *catalogTemplateClient2) OnCreate(ctx context.Context, name string, sync CatalogTemplateChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-create", &catalogTemplateLifecycleDelegate{create: sync})
}
func (n *catalogTemplateClient2) OnChange(ctx context.Context, name string, sync CatalogTemplateChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-change", &catalogTemplateLifecycleDelegate{update: sync})
}
func (n *catalogTemplateClient2) OnRemove(ctx context.Context, name string, sync CatalogTemplateChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &catalogTemplateLifecycleDelegate{remove: sync})
}
func (n *catalogTemplateClientCache) Index(name string, indexer CatalogTemplateIndexer) {
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
name: func(obj interface{}) ([]string, error) {
if v, ok := obj.(*CatalogTemplate); ok {
return indexer(v)
}
return nil, nil
},
})
if err != nil {
panic(err)
}
}
func (n *catalogTemplateClientCache) GetIndexed(name, key string) ([]*CatalogTemplate, error) {
var result []*CatalogTemplate
objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key)
if err != nil {
return nil, err
}
for _, obj := range objs {
if v, ok := obj.(*CatalogTemplate); ok {
result = append(result, v)
}
}
return result, nil
}
func (n *catalogTemplateClient2) loadController() {
if n.controller == nil {
n.controller = n.iface.Controller()
}
}
type catalogTemplateLifecycleDelegate struct {
create CatalogTemplateChangeHandlerFunc
update CatalogTemplateChangeHandlerFunc
remove CatalogTemplateChangeHandlerFunc
}
func (n *catalogTemplateLifecycleDelegate) HasCreate() bool {
return n.create != nil
}
func (n *catalogTemplateLifecycleDelegate) Create(obj *CatalogTemplate) (runtime.Object, error) {
if n.create == nil {
return obj, nil
}
return n.create(obj)
}
func (n *catalogTemplateLifecycleDelegate) HasFinalize() bool {
return n.remove != nil
}
func (n *catalogTemplateLifecycleDelegate) Remove(obj *CatalogTemplate) (runtime.Object, error) {
if n.remove == nil {
return obj, nil
}
return n.remove(obj)
}
func (n *catalogTemplateLifecycleDelegate) Updated(obj *CatalogTemplate) (runtime.Object, error) {
if n.update == nil {
return obj, nil
}
return n.update(obj)
}

View File

@@ -0,0 +1,62 @@
package v3
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type CatalogTemplateLifecycle interface {
Create(obj *CatalogTemplate) (runtime.Object, error)
Remove(obj *CatalogTemplate) (runtime.Object, error)
Updated(obj *CatalogTemplate) (runtime.Object, error)
}
type catalogTemplateLifecycleAdapter struct {
lifecycle CatalogTemplateLifecycle
}
func (w *catalogTemplateLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *catalogTemplateLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *catalogTemplateLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*CatalogTemplate))
if o == nil {
return nil, err
}
return o, err
}
func (w *catalogTemplateLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*CatalogTemplate))
if o == nil {
return nil, err
}
return o, err
}
func (w *catalogTemplateLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*CatalogTemplate))
if o == nil {
return nil, err
}
return o, err
}
func NewCatalogTemplateLifecycleAdapter(name string, clusterScoped bool, client CatalogTemplateInterface, l CatalogTemplateLifecycle) CatalogTemplateHandlerFunc {
adapter := &catalogTemplateLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *CatalogTemplate) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}

View File

@@ -0,0 +1,440 @@
package v3
import (
"context"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
"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/types"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/tools/cache"
)
var (
CatalogTemplateVersionGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "CatalogTemplateVersion",
}
CatalogTemplateVersionResource = metav1.APIResource{
Name: "catalogtemplateversions",
SingularName: "catalogtemplateversion",
Namespaced: true,
Kind: CatalogTemplateVersionGroupVersionKind.Kind,
}
)
func NewCatalogTemplateVersion(namespace, name string, obj CatalogTemplateVersion) *CatalogTemplateVersion {
obj.APIVersion, obj.Kind = CatalogTemplateVersionGroupVersionKind.ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
type CatalogTemplateVersionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []CatalogTemplateVersion
}
type CatalogTemplateVersionHandlerFunc func(key string, obj *CatalogTemplateVersion) (runtime.Object, error)
type CatalogTemplateVersionChangeHandlerFunc func(obj *CatalogTemplateVersion) (runtime.Object, error)
type CatalogTemplateVersionLister interface {
List(namespace string, selector labels.Selector) (ret []*CatalogTemplateVersion, err error)
Get(namespace, name string) (*CatalogTemplateVersion, error)
}
type CatalogTemplateVersionController interface {
Generic() controller.GenericController
Informer() cache.SharedIndexInformer
Lister() CatalogTemplateVersionLister
AddHandler(ctx context.Context, name string, handler CatalogTemplateVersionHandlerFunc)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler CatalogTemplateVersionHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type CatalogTemplateVersionInterface interface {
ObjectClient() *objectclient.ObjectClient
Create(*CatalogTemplateVersion) (*CatalogTemplateVersion, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*CatalogTemplateVersion, error)
Get(name string, opts metav1.GetOptions) (*CatalogTemplateVersion, error)
Update(*CatalogTemplateVersion) (*CatalogTemplateVersion, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*CatalogTemplateVersionList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() CatalogTemplateVersionController
AddHandler(ctx context.Context, name string, sync CatalogTemplateVersionHandlerFunc)
AddLifecycle(ctx context.Context, name string, lifecycle CatalogTemplateVersionLifecycle)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync CatalogTemplateVersionHandlerFunc)
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle CatalogTemplateVersionLifecycle)
}
type catalogTemplateVersionLister struct {
controller *catalogTemplateVersionController
}
func (l *catalogTemplateVersionLister) List(namespace string, selector labels.Selector) (ret []*CatalogTemplateVersion, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*CatalogTemplateVersion))
})
return
}
func (l *catalogTemplateVersionLister) Get(namespace, name string) (*CatalogTemplateVersion, 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: CatalogTemplateVersionGroupVersionKind.Group,
Resource: "catalogTemplateVersion",
}, key)
}
return obj.(*CatalogTemplateVersion), nil
}
type catalogTemplateVersionController struct {
controller.GenericController
}
func (c *catalogTemplateVersionController) Generic() controller.GenericController {
return c.GenericController
}
func (c *catalogTemplateVersionController) Lister() CatalogTemplateVersionLister {
return &catalogTemplateVersionLister{
controller: c,
}
}
func (c *catalogTemplateVersionController) AddHandler(ctx context.Context, name string, handler CatalogTemplateVersionHandlerFunc) {
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if obj == nil {
return handler(key, nil)
} else if v, ok := obj.(*CatalogTemplateVersion); ok {
return handler(key, v)
} else {
return nil, nil
}
})
}
func (c *catalogTemplateVersionController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler CatalogTemplateVersionHandlerFunc) {
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if obj == nil {
return handler(key, nil)
} else if v, ok := obj.(*CatalogTemplateVersion); ok && controller.ObjectInCluster(cluster, obj) {
return handler(key, v)
} else {
return nil, nil
}
})
}
type catalogTemplateVersionFactory struct {
}
func (c catalogTemplateVersionFactory) Object() runtime.Object {
return &CatalogTemplateVersion{}
}
func (c catalogTemplateVersionFactory) List() runtime.Object {
return &CatalogTemplateVersionList{}
}
func (s *catalogTemplateVersionClient) Controller() CatalogTemplateVersionController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.catalogTemplateVersionControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(CatalogTemplateVersionGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &catalogTemplateVersionController{
GenericController: genericController,
}
s.client.catalogTemplateVersionControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type catalogTemplateVersionClient struct {
client *Client
ns string
objectClient *objectclient.ObjectClient
controller CatalogTemplateVersionController
}
func (s *catalogTemplateVersionClient) ObjectClient() *objectclient.ObjectClient {
return s.objectClient
}
func (s *catalogTemplateVersionClient) Create(o *CatalogTemplateVersion) (*CatalogTemplateVersion, error) {
obj, err := s.objectClient.Create(o)
return obj.(*CatalogTemplateVersion), err
}
func (s *catalogTemplateVersionClient) Get(name string, opts metav1.GetOptions) (*CatalogTemplateVersion, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*CatalogTemplateVersion), err
}
func (s *catalogTemplateVersionClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*CatalogTemplateVersion, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*CatalogTemplateVersion), err
}
func (s *catalogTemplateVersionClient) Update(o *CatalogTemplateVersion) (*CatalogTemplateVersion, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*CatalogTemplateVersion), err
}
func (s *catalogTemplateVersionClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *catalogTemplateVersionClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *catalogTemplateVersionClient) List(opts metav1.ListOptions) (*CatalogTemplateVersionList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*CatalogTemplateVersionList), err
}
func (s *catalogTemplateVersionClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *catalogTemplateVersionClient) Patch(o *CatalogTemplateVersion, patchType types.PatchType, data []byte, subresources ...string) (*CatalogTemplateVersion, error) {
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
return obj.(*CatalogTemplateVersion), err
}
func (s *catalogTemplateVersionClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *catalogTemplateVersionClient) AddHandler(ctx context.Context, name string, sync CatalogTemplateVersionHandlerFunc) {
s.Controller().AddHandler(ctx, name, sync)
}
func (s *catalogTemplateVersionClient) AddLifecycle(ctx context.Context, name string, lifecycle CatalogTemplateVersionLifecycle) {
sync := NewCatalogTemplateVersionLifecycleAdapter(name, false, s, lifecycle)
s.Controller().AddHandler(ctx, name, sync)
}
func (s *catalogTemplateVersionClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync CatalogTemplateVersionHandlerFunc) {
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *catalogTemplateVersionClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle CatalogTemplateVersionLifecycle) {
sync := NewCatalogTemplateVersionLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
type CatalogTemplateVersionIndexer func(obj *CatalogTemplateVersion) ([]string, error)
type CatalogTemplateVersionClientCache interface {
Get(namespace, name string) (*CatalogTemplateVersion, error)
List(namespace string, selector labels.Selector) ([]*CatalogTemplateVersion, error)
Index(name string, indexer CatalogTemplateVersionIndexer)
GetIndexed(name, key string) ([]*CatalogTemplateVersion, error)
}
type CatalogTemplateVersionClient interface {
Create(*CatalogTemplateVersion) (*CatalogTemplateVersion, error)
Get(namespace, name string, opts metav1.GetOptions) (*CatalogTemplateVersion, error)
Update(*CatalogTemplateVersion) (*CatalogTemplateVersion, error)
Delete(namespace, name string, options *metav1.DeleteOptions) error
List(namespace string, opts metav1.ListOptions) (*CatalogTemplateVersionList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Cache() CatalogTemplateVersionClientCache
OnCreate(ctx context.Context, name string, sync CatalogTemplateVersionChangeHandlerFunc)
OnChange(ctx context.Context, name string, sync CatalogTemplateVersionChangeHandlerFunc)
OnRemove(ctx context.Context, name string, sync CatalogTemplateVersionChangeHandlerFunc)
Enqueue(namespace, name string)
Generic() controller.GenericController
ObjectClient() *objectclient.ObjectClient
Interface() CatalogTemplateVersionInterface
}
type catalogTemplateVersionClientCache struct {
client *catalogTemplateVersionClient2
}
type catalogTemplateVersionClient2 struct {
iface CatalogTemplateVersionInterface
controller CatalogTemplateVersionController
}
func (n *catalogTemplateVersionClient2) Interface() CatalogTemplateVersionInterface {
return n.iface
}
func (n *catalogTemplateVersionClient2) Generic() controller.GenericController {
return n.iface.Controller().Generic()
}
func (n *catalogTemplateVersionClient2) ObjectClient() *objectclient.ObjectClient {
return n.Interface().ObjectClient()
}
func (n *catalogTemplateVersionClient2) Enqueue(namespace, name string) {
n.iface.Controller().Enqueue(namespace, name)
}
func (n *catalogTemplateVersionClient2) Create(obj *CatalogTemplateVersion) (*CatalogTemplateVersion, error) {
return n.iface.Create(obj)
}
func (n *catalogTemplateVersionClient2) Get(namespace, name string, opts metav1.GetOptions) (*CatalogTemplateVersion, error) {
return n.iface.GetNamespaced(namespace, name, opts)
}
func (n *catalogTemplateVersionClient2) Update(obj *CatalogTemplateVersion) (*CatalogTemplateVersion, error) {
return n.iface.Update(obj)
}
func (n *catalogTemplateVersionClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
return n.iface.DeleteNamespaced(namespace, name, options)
}
func (n *catalogTemplateVersionClient2) List(namespace string, opts metav1.ListOptions) (*CatalogTemplateVersionList, error) {
return n.iface.List(opts)
}
func (n *catalogTemplateVersionClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return n.iface.Watch(opts)
}
func (n *catalogTemplateVersionClientCache) Get(namespace, name string) (*CatalogTemplateVersion, error) {
return n.client.controller.Lister().Get(namespace, name)
}
func (n *catalogTemplateVersionClientCache) List(namespace string, selector labels.Selector) ([]*CatalogTemplateVersion, error) {
return n.client.controller.Lister().List(namespace, selector)
}
func (n *catalogTemplateVersionClient2) Cache() CatalogTemplateVersionClientCache {
n.loadController()
return &catalogTemplateVersionClientCache{
client: n,
}
}
func (n *catalogTemplateVersionClient2) OnCreate(ctx context.Context, name string, sync CatalogTemplateVersionChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-create", &catalogTemplateVersionLifecycleDelegate{create: sync})
}
func (n *catalogTemplateVersionClient2) OnChange(ctx context.Context, name string, sync CatalogTemplateVersionChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-change", &catalogTemplateVersionLifecycleDelegate{update: sync})
}
func (n *catalogTemplateVersionClient2) OnRemove(ctx context.Context, name string, sync CatalogTemplateVersionChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &catalogTemplateVersionLifecycleDelegate{remove: sync})
}
func (n *catalogTemplateVersionClientCache) Index(name string, indexer CatalogTemplateVersionIndexer) {
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
name: func(obj interface{}) ([]string, error) {
if v, ok := obj.(*CatalogTemplateVersion); ok {
return indexer(v)
}
return nil, nil
},
})
if err != nil {
panic(err)
}
}
func (n *catalogTemplateVersionClientCache) GetIndexed(name, key string) ([]*CatalogTemplateVersion, error) {
var result []*CatalogTemplateVersion
objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key)
if err != nil {
return nil, err
}
for _, obj := range objs {
if v, ok := obj.(*CatalogTemplateVersion); ok {
result = append(result, v)
}
}
return result, nil
}
func (n *catalogTemplateVersionClient2) loadController() {
if n.controller == nil {
n.controller = n.iface.Controller()
}
}
type catalogTemplateVersionLifecycleDelegate struct {
create CatalogTemplateVersionChangeHandlerFunc
update CatalogTemplateVersionChangeHandlerFunc
remove CatalogTemplateVersionChangeHandlerFunc
}
func (n *catalogTemplateVersionLifecycleDelegate) HasCreate() bool {
return n.create != nil
}
func (n *catalogTemplateVersionLifecycleDelegate) Create(obj *CatalogTemplateVersion) (runtime.Object, error) {
if n.create == nil {
return obj, nil
}
return n.create(obj)
}
func (n *catalogTemplateVersionLifecycleDelegate) HasFinalize() bool {
return n.remove != nil
}
func (n *catalogTemplateVersionLifecycleDelegate) Remove(obj *CatalogTemplateVersion) (runtime.Object, error) {
if n.remove == nil {
return obj, nil
}
return n.remove(obj)
}
func (n *catalogTemplateVersionLifecycleDelegate) Updated(obj *CatalogTemplateVersion) (runtime.Object, error) {
if n.update == nil {
return obj, nil
}
return n.update(obj)
}

View File

@@ -0,0 +1,62 @@
package v3
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type CatalogTemplateVersionLifecycle interface {
Create(obj *CatalogTemplateVersion) (runtime.Object, error)
Remove(obj *CatalogTemplateVersion) (runtime.Object, error)
Updated(obj *CatalogTemplateVersion) (runtime.Object, error)
}
type catalogTemplateVersionLifecycleAdapter struct {
lifecycle CatalogTemplateVersionLifecycle
}
func (w *catalogTemplateVersionLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *catalogTemplateVersionLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *catalogTemplateVersionLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*CatalogTemplateVersion))
if o == nil {
return nil, err
}
return o, err
}
func (w *catalogTemplateVersionLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*CatalogTemplateVersion))
if o == nil {
return nil, err
}
return o, err
}
func (w *catalogTemplateVersionLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*CatalogTemplateVersion))
if o == nil {
return nil, err
}
return o, err
}
func NewCatalogTemplateVersionLifecycleAdapter(name string, clusterScoped bool, client CatalogTemplateVersionInterface, l CatalogTemplateVersionLifecycle) CatalogTemplateVersionHandlerFunc {
adapter := &catalogTemplateVersionLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *CatalogTemplateVersion) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}

View File

@@ -662,6 +662,128 @@ func (in *CatalogStatus) DeepCopy() *CatalogStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CatalogTemplate) DeepCopyInto(out *CatalogTemplate) {
*out = *in
out.Namespaced = in.Namespaced
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Template.DeepCopyInto(&out.Template)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogTemplate.
func (in *CatalogTemplate) DeepCopy() *CatalogTemplate {
if in == nil {
return nil
}
out := new(CatalogTemplate)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *CatalogTemplate) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CatalogTemplateList) DeepCopyInto(out *CatalogTemplateList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]CatalogTemplate, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogTemplateList.
func (in *CatalogTemplateList) DeepCopy() *CatalogTemplateList {
if in == nil {
return nil
}
out := new(CatalogTemplateList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *CatalogTemplateList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CatalogTemplateVersion) DeepCopyInto(out *CatalogTemplateVersion) {
*out = *in
out.Namespaced = in.Namespaced
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.TemplateVersion.DeepCopyInto(&out.TemplateVersion)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogTemplateVersion.
func (in *CatalogTemplateVersion) DeepCopy() *CatalogTemplateVersion {
if in == nil {
return nil
}
out := new(CatalogTemplateVersion)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *CatalogTemplateVersion) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CatalogTemplateVersionList) DeepCopyInto(out *CatalogTemplateVersionList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]CatalogTemplateVersion, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogTemplateVersionList.
func (in *CatalogTemplateVersionList) DeepCopy() *CatalogTemplateVersionList {
if in == nil {
return nil
}
out := new(CatalogTemplateVersionList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *CatalogTemplateVersionList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ChangePasswordInput) DeepCopyInto(out *ChangePasswordInput) {
*out = *in

View File

@@ -36,6 +36,8 @@ type Interface interface {
ClusterRegistrationTokensGetter
CatalogsGetter
TemplatesGetter
CatalogTemplatesGetter
CatalogTemplateVersionsGetter
TemplateVersionsGetter
TemplateContentsGetter
GroupsGetter
@@ -93,6 +95,8 @@ type Clients struct {
ClusterRegistrationToken ClusterRegistrationTokenClient
Catalog CatalogClient
Template TemplateClient
CatalogTemplate CatalogTemplateClient
CatalogTemplateVersion CatalogTemplateVersionClient
TemplateVersion TemplateVersionClient
TemplateContent TemplateContentClient
Group GroupClient
@@ -152,6 +156,8 @@ type Client struct {
clusterRegistrationTokenControllers map[string]ClusterRegistrationTokenController
catalogControllers map[string]CatalogController
templateControllers map[string]TemplateController
catalogTemplateControllers map[string]CatalogTemplateController
catalogTemplateVersionControllers map[string]CatalogTemplateVersionController
templateVersionControllers map[string]TemplateVersionController
templateContentControllers map[string]TemplateContentController
groupControllers map[string]GroupController
@@ -271,6 +277,12 @@ func NewClientsFromInterface(iface Interface) *Clients {
Template: &templateClient2{
iface: iface.Templates(""),
},
CatalogTemplate: &catalogTemplateClient2{
iface: iface.CatalogTemplates(""),
},
CatalogTemplateVersion: &catalogTemplateVersionClient2{
iface: iface.CatalogTemplateVersions(""),
},
TemplateVersion: &templateVersionClient2{
iface: iface.TemplateVersions(""),
},
@@ -411,6 +423,8 @@ func NewForConfig(config rest.Config) (Interface, error) {
clusterRegistrationTokenControllers: map[string]ClusterRegistrationTokenController{},
catalogControllers: map[string]CatalogController{},
templateControllers: map[string]TemplateController{},
catalogTemplateControllers: map[string]CatalogTemplateController{},
catalogTemplateVersionControllers: map[string]CatalogTemplateVersionController{},
templateVersionControllers: map[string]TemplateVersionController{},
templateContentControllers: map[string]TemplateContentController{},
groupControllers: map[string]GroupController{},
@@ -670,6 +684,32 @@ func (c *Client) Templates(namespace string) TemplateInterface {
}
}
type CatalogTemplatesGetter interface {
CatalogTemplates(namespace string) CatalogTemplateInterface
}
func (c *Client) CatalogTemplates(namespace string) CatalogTemplateInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &CatalogTemplateResource, CatalogTemplateGroupVersionKind, catalogTemplateFactory{})
return &catalogTemplateClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type CatalogTemplateVersionsGetter interface {
CatalogTemplateVersions(namespace string) CatalogTemplateVersionInterface
}
func (c *Client) CatalogTemplateVersions(namespace string) CatalogTemplateVersionInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &CatalogTemplateVersionResource, CatalogTemplateVersionGroupVersionKind, catalogTemplateVersionFactory{})
return &catalogTemplateVersionClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type TemplateVersionsGetter interface {
TemplateVersions(namespace string) TemplateVersionInterface
}

View File

@@ -65,6 +65,10 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&CatalogList{},
&Template{},
&TemplateList{},
&CatalogTemplate{},
&CatalogTemplateList{},
&CatalogTemplateVersion{},
&CatalogTemplateVersionList{},
&TemplateVersion{},
&TemplateVersionList{},
&TemplateContent{},

View File

@@ -0,0 +1,147 @@
package client
import (
"github.com/rancher/norman/types"
)
const (
CatalogTemplateType = "catalogTemplate"
CatalogTemplateFieldAnnotations = "annotations"
CatalogTemplateFieldCatalogID = "catalogId"
CatalogTemplateFieldCategories = "categories"
CatalogTemplateFieldCategory = "category"
CatalogTemplateFieldClusterCatalogID = "clusterCatalogId"
CatalogTemplateFieldClusterID = "clusterId"
CatalogTemplateFieldCreated = "created"
CatalogTemplateFieldCreatorID = "creatorId"
CatalogTemplateFieldDefaultTemplateVersionID = "defaultTemplateVersionId"
CatalogTemplateFieldDefaultVersion = "defaultVersion"
CatalogTemplateFieldDescription = "description"
CatalogTemplateFieldFolderName = "folderName"
CatalogTemplateFieldIcon = "icon"
CatalogTemplateFieldIconFilename = "iconFilename"
CatalogTemplateFieldLabels = "labels"
CatalogTemplateFieldMaintainer = "maintainer"
CatalogTemplateFieldName = "name"
CatalogTemplateFieldOwnerReferences = "ownerReferences"
CatalogTemplateFieldPath = "path"
CatalogTemplateFieldProjectCatalogID = "projectCatalogId"
CatalogTemplateFieldProjectID = "projectId"
CatalogTemplateFieldProjectURL = "projectURL"
CatalogTemplateFieldReadme = "readme"
CatalogTemplateFieldRemoved = "removed"
CatalogTemplateFieldState = "state"
CatalogTemplateFieldStatus = "status"
CatalogTemplateFieldTransitioning = "transitioning"
CatalogTemplateFieldTransitioningMessage = "transitioningMessage"
CatalogTemplateFieldUUID = "uuid"
CatalogTemplateFieldUpgradeFrom = "upgradeFrom"
CatalogTemplateFieldVersionLinks = "versionLinks"
CatalogTemplateFieldVersions = "versions"
)
type CatalogTemplate struct {
types.Resource
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
CatalogID string `json:"catalogId,omitempty" yaml:"catalogId,omitempty"`
Categories []string `json:"categories,omitempty" yaml:"categories,omitempty"`
Category string `json:"category,omitempty" yaml:"category,omitempty"`
ClusterCatalogID string `json:"clusterCatalogId,omitempty" yaml:"clusterCatalogId,omitempty"`
ClusterID string `json:"clusterId,omitempty" yaml:"clusterId,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"`
DefaultTemplateVersionID string `json:"defaultTemplateVersionId,omitempty" yaml:"defaultTemplateVersionId,omitempty"`
DefaultVersion string `json:"defaultVersion,omitempty" yaml:"defaultVersion,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
FolderName string `json:"folderName,omitempty" yaml:"folderName,omitempty"`
Icon string `json:"icon,omitempty" yaml:"icon,omitempty"`
IconFilename string `json:"iconFilename,omitempty" yaml:"iconFilename,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
Maintainer string `json:"maintainer,omitempty" yaml:"maintainer,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"`
Path string `json:"path,omitempty" yaml:"path,omitempty"`
ProjectCatalogID string `json:"projectCatalogId,omitempty" yaml:"projectCatalogId,omitempty"`
ProjectID string `json:"projectId,omitempty" yaml:"projectId,omitempty"`
ProjectURL string `json:"projectURL,omitempty" yaml:"projectURL,omitempty"`
Readme string `json:"readme,omitempty" yaml:"readme,omitempty"`
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
Status *TemplateStatus `json:"status,omitempty" yaml:"status,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioningMessage,omitempty"`
UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
UpgradeFrom string `json:"upgradeFrom,omitempty" yaml:"upgradeFrom,omitempty"`
VersionLinks map[string]string `json:"versionLinks,omitempty" yaml:"versionLinks,omitempty"`
Versions []TemplateVersionSpec `json:"versions,omitempty" yaml:"versions,omitempty"`
}
type CatalogTemplateCollection struct {
types.Collection
Data []CatalogTemplate `json:"data,omitempty"`
client *CatalogTemplateClient
}
type CatalogTemplateClient struct {
apiClient *Client
}
type CatalogTemplateOperations interface {
List(opts *types.ListOpts) (*CatalogTemplateCollection, error)
Create(opts *CatalogTemplate) (*CatalogTemplate, error)
Update(existing *CatalogTemplate, updates interface{}) (*CatalogTemplate, error)
Replace(existing *CatalogTemplate) (*CatalogTemplate, error)
ByID(id string) (*CatalogTemplate, error)
Delete(container *CatalogTemplate) error
}
func newCatalogTemplateClient(apiClient *Client) *CatalogTemplateClient {
return &CatalogTemplateClient{
apiClient: apiClient,
}
}
func (c *CatalogTemplateClient) Create(container *CatalogTemplate) (*CatalogTemplate, error) {
resp := &CatalogTemplate{}
err := c.apiClient.Ops.DoCreate(CatalogTemplateType, container, resp)
return resp, err
}
func (c *CatalogTemplateClient) Update(existing *CatalogTemplate, updates interface{}) (*CatalogTemplate, error) {
resp := &CatalogTemplate{}
err := c.apiClient.Ops.DoUpdate(CatalogTemplateType, &existing.Resource, updates, resp)
return resp, err
}
func (c *CatalogTemplateClient) Replace(obj *CatalogTemplate) (*CatalogTemplate, error) {
resp := &CatalogTemplate{}
err := c.apiClient.Ops.DoReplace(CatalogTemplateType, &obj.Resource, obj, resp)
return resp, err
}
func (c *CatalogTemplateClient) List(opts *types.ListOpts) (*CatalogTemplateCollection, error) {
resp := &CatalogTemplateCollection{}
err := c.apiClient.Ops.DoList(CatalogTemplateType, opts, resp)
resp.client = c
return resp, err
}
func (cc *CatalogTemplateCollection) Next() (*CatalogTemplateCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &CatalogTemplateCollection{}
err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *CatalogTemplateClient) ByID(id string) (*CatalogTemplate, error) {
resp := &CatalogTemplate{}
err := c.apiClient.Ops.DoByID(CatalogTemplateType, id, resp)
return resp, err
}
func (c *CatalogTemplateClient) Delete(container *CatalogTemplate) error {
return c.apiClient.Ops.DoResourceDelete(CatalogTemplateType, &container.Resource)
}

View File

@@ -0,0 +1,129 @@
package client
import (
"github.com/rancher/norman/types"
)
const (
CatalogTemplateVersionType = "catalogTemplateVersion"
CatalogTemplateVersionFieldAnnotations = "annotations"
CatalogTemplateVersionFieldAppReadme = "appReadme"
CatalogTemplateVersionFieldCreated = "created"
CatalogTemplateVersionFieldCreatorID = "creatorId"
CatalogTemplateVersionFieldDigest = "digest"
CatalogTemplateVersionFieldExternalID = "externalId"
CatalogTemplateVersionFieldFiles = "files"
CatalogTemplateVersionFieldKubeVersion = "kubeVersion"
CatalogTemplateVersionFieldLabels = "labels"
CatalogTemplateVersionFieldName = "name"
CatalogTemplateVersionFieldOwnerReferences = "ownerReferences"
CatalogTemplateVersionFieldQuestions = "questions"
CatalogTemplateVersionFieldRancherVersion = "rancherVersion"
CatalogTemplateVersionFieldReadme = "readme"
CatalogTemplateVersionFieldRemoved = "removed"
CatalogTemplateVersionFieldRequiredNamespace = "requiredNamespace"
CatalogTemplateVersionFieldState = "state"
CatalogTemplateVersionFieldStatus = "status"
CatalogTemplateVersionFieldTransitioning = "transitioning"
CatalogTemplateVersionFieldTransitioningMessage = "transitioningMessage"
CatalogTemplateVersionFieldUUID = "uuid"
CatalogTemplateVersionFieldUpgradeVersionLinks = "upgradeVersionLinks"
CatalogTemplateVersionFieldVersion = "version"
)
type CatalogTemplateVersion struct {
types.Resource
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
AppReadme string `json:"appReadme,omitempty" yaml:"appReadme,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"`
Digest string `json:"digest,omitempty" yaml:"digest,omitempty"`
ExternalID string `json:"externalId,omitempty" yaml:"externalId,omitempty"`
Files map[string]string `json:"files,omitempty" yaml:"files,omitempty"`
KubeVersion string `json:"kubeVersion,omitempty" yaml:"kubeVersion,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"`
Questions []Question `json:"questions,omitempty" yaml:"questions,omitempty"`
RancherVersion string `json:"rancherVersion,omitempty" yaml:"rancherVersion,omitempty"`
Readme string `json:"readme,omitempty" yaml:"readme,omitempty"`
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
RequiredNamespace string `json:"requiredNamespace,omitempty" yaml:"requiredNamespace,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
Status *TemplateVersionStatus `json:"status,omitempty" yaml:"status,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioningMessage,omitempty"`
UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
UpgradeVersionLinks map[string]string `json:"upgradeVersionLinks,omitempty" yaml:"upgradeVersionLinks,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
}
type CatalogTemplateVersionCollection struct {
types.Collection
Data []CatalogTemplateVersion `json:"data,omitempty"`
client *CatalogTemplateVersionClient
}
type CatalogTemplateVersionClient struct {
apiClient *Client
}
type CatalogTemplateVersionOperations interface {
List(opts *types.ListOpts) (*CatalogTemplateVersionCollection, error)
Create(opts *CatalogTemplateVersion) (*CatalogTemplateVersion, error)
Update(existing *CatalogTemplateVersion, updates interface{}) (*CatalogTemplateVersion, error)
Replace(existing *CatalogTemplateVersion) (*CatalogTemplateVersion, error)
ByID(id string) (*CatalogTemplateVersion, error)
Delete(container *CatalogTemplateVersion) error
}
func newCatalogTemplateVersionClient(apiClient *Client) *CatalogTemplateVersionClient {
return &CatalogTemplateVersionClient{
apiClient: apiClient,
}
}
func (c *CatalogTemplateVersionClient) Create(container *CatalogTemplateVersion) (*CatalogTemplateVersion, error) {
resp := &CatalogTemplateVersion{}
err := c.apiClient.Ops.DoCreate(CatalogTemplateVersionType, container, resp)
return resp, err
}
func (c *CatalogTemplateVersionClient) Update(existing *CatalogTemplateVersion, updates interface{}) (*CatalogTemplateVersion, error) {
resp := &CatalogTemplateVersion{}
err := c.apiClient.Ops.DoUpdate(CatalogTemplateVersionType, &existing.Resource, updates, resp)
return resp, err
}
func (c *CatalogTemplateVersionClient) Replace(obj *CatalogTemplateVersion) (*CatalogTemplateVersion, error) {
resp := &CatalogTemplateVersion{}
err := c.apiClient.Ops.DoReplace(CatalogTemplateVersionType, &obj.Resource, obj, resp)
return resp, err
}
func (c *CatalogTemplateVersionClient) List(opts *types.ListOpts) (*CatalogTemplateVersionCollection, error) {
resp := &CatalogTemplateVersionCollection{}
err := c.apiClient.Ops.DoList(CatalogTemplateVersionType, opts, resp)
resp.client = c
return resp, err
}
func (cc *CatalogTemplateVersionCollection) Next() (*CatalogTemplateVersionCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &CatalogTemplateVersionCollection{}
err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *CatalogTemplateVersionClient) ByID(id string) (*CatalogTemplateVersion, error) {
resp := &CatalogTemplateVersion{}
err := c.apiClient.Ops.DoByID(CatalogTemplateVersionType, id, resp)
return resp, err
}
func (c *CatalogTemplateVersionClient) Delete(container *CatalogTemplateVersion) error {
return c.apiClient.Ops.DoResourceDelete(CatalogTemplateVersionType, &container.Resource)
}

View File

@@ -23,6 +23,8 @@ type Client struct {
ClusterRegistrationToken ClusterRegistrationTokenOperations
Catalog CatalogOperations
Template TemplateOperations
CatalogTemplate CatalogTemplateOperations
CatalogTemplateVersion CatalogTemplateVersionOperations
TemplateVersion TemplateVersionOperations
TemplateContent TemplateContentOperations
Group GroupOperations
@@ -86,6 +88,8 @@ func NewClient(opts *clientbase.ClientOpts) (*Client, error) {
client.ClusterRegistrationToken = newClusterRegistrationTokenClient(client)
client.Catalog = newCatalogClient(client)
client.Template = newTemplateClient(client)
client.CatalogTemplate = newCatalogTemplateClient(client)
client.CatalogTemplateVersion = newCatalogTemplateVersionClient(client)
client.TemplateVersion = newTemplateVersionClient(client)
client.TemplateContent = newTemplateContentClient(client)
client.Group = newGroupClient(client)

View File

@@ -6,6 +6,7 @@ import (
const (
RoleTemplateType = "roleTemplate"
RoleTemplateFieldAdministrative = "administrative"
RoleTemplateFieldAnnotations = "annotations"
RoleTemplateFieldBuiltin = "builtin"
RoleTemplateFieldClusterCreatorDefault = "clusterCreatorDefault"
@@ -28,6 +29,7 @@ const (
type RoleTemplate struct {
types.Resource
Administrative bool `json:"administrative,omitempty" yaml:"administrative,omitempty"`
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
Builtin bool `json:"builtin,omitempty" yaml:"builtin,omitempty"`
ClusterCreatorDefault bool `json:"clusterCreatorDefault,omitempty" yaml:"clusterCreatorDefault,omitempty"`

View File

@@ -25,6 +25,8 @@ type Config struct {
ClusterRegistrationTokens map[string]managementClient.ClusterRegistrationToken `json:"clusterRegistrationTokens,omitempty" yaml:"clusterRegistrationTokens,omitempty"`
Catalogs map[string]managementClient.Catalog `json:"catalogs,omitempty" yaml:"catalogs,omitempty"`
Templates map[string]managementClient.Template `json:"templates,omitempty" yaml:"templates,omitempty"`
CatalogTemplates map[string]managementClient.CatalogTemplate `json:"catalogTemplates,omitempty" yaml:"catalogTemplates,omitempty"`
CatalogTemplateVersions map[string]managementClient.CatalogTemplateVersion `json:"catalogTemplateVersions,omitempty" yaml:"catalogTemplateVersions,omitempty"`
TemplateVersions map[string]managementClient.TemplateVersion `json:"templateVersions,omitempty" yaml:"templateVersions,omitempty"`
TemplateContents map[string]managementClient.TemplateContent `json:"templateContents,omitempty" yaml:"templateContents,omitempty"`
Groups map[string]managementClient.Group `json:"groups,omitempty" yaml:"groups,omitempty"`