diff --git a/apis/management.cattle.io/v3/zz_generated_cluster_alert_group_controller.go b/apis/management.cattle.io/v3/zz_generated_cluster_alert_group_controller.go new file mode 100644 index 00000000..5e75a3ba --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_cluster_alert_group_controller.go @@ -0,0 +1,427 @@ +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/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + ClusterAlertGroupGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "ClusterAlertGroup", + } + ClusterAlertGroupResource = metav1.APIResource{ + Name: "clusteralertgroups", + SingularName: "clusteralertgroup", + Namespaced: true, + + Kind: ClusterAlertGroupGroupVersionKind.Kind, + } +) + +type ClusterAlertGroupList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ClusterAlertGroup +} + +type ClusterAlertGroupHandlerFunc func(key string, obj *ClusterAlertGroup) (runtime.Object, error) + +type ClusterAlertGroupChangeHandlerFunc func(obj *ClusterAlertGroup) (runtime.Object, error) + +type ClusterAlertGroupLister interface { + List(namespace string, selector labels.Selector) (ret []*ClusterAlertGroup, err error) + Get(namespace, name string) (*ClusterAlertGroup, error) +} + +type ClusterAlertGroupController interface { + Generic() controller.GenericController + Informer() cache.SharedIndexInformer + Lister() ClusterAlertGroupLister + AddHandler(ctx context.Context, name string, handler ClusterAlertGroupHandlerFunc) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler ClusterAlertGroupHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type ClusterAlertGroupInterface interface { + ObjectClient() *objectclient.ObjectClient + Create(*ClusterAlertGroup) (*ClusterAlertGroup, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ClusterAlertGroup, error) + Get(name string, opts metav1.GetOptions) (*ClusterAlertGroup, error) + Update(*ClusterAlertGroup) (*ClusterAlertGroup, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*ClusterAlertGroupList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() ClusterAlertGroupController + AddHandler(ctx context.Context, name string, sync ClusterAlertGroupHandlerFunc) + AddLifecycle(ctx context.Context, name string, lifecycle ClusterAlertGroupLifecycle) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ClusterAlertGroupHandlerFunc) + AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ClusterAlertGroupLifecycle) +} + +type clusterAlertGroupLister struct { + controller *clusterAlertGroupController +} + +func (l *clusterAlertGroupLister) List(namespace string, selector labels.Selector) (ret []*ClusterAlertGroup, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*ClusterAlertGroup)) + }) + return +} + +func (l *clusterAlertGroupLister) Get(namespace, name string) (*ClusterAlertGroup, 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: ClusterAlertGroupGroupVersionKind.Group, + Resource: "clusterAlertGroup", + }, key) + } + return obj.(*ClusterAlertGroup), nil +} + +type clusterAlertGroupController struct { + controller.GenericController +} + +func (c *clusterAlertGroupController) Generic() controller.GenericController { + return c.GenericController +} + +func (c *clusterAlertGroupController) Lister() ClusterAlertGroupLister { + return &clusterAlertGroupLister{ + controller: c, + } +} + +func (c *clusterAlertGroupController) AddHandler(ctx context.Context, name string, handler ClusterAlertGroupHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*ClusterAlertGroup); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *clusterAlertGroupController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler ClusterAlertGroupHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*ClusterAlertGroup); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +type clusterAlertGroupFactory struct { +} + +func (c clusterAlertGroupFactory) Object() runtime.Object { + return &ClusterAlertGroup{} +} + +func (c clusterAlertGroupFactory) List() runtime.Object { + return &ClusterAlertGroupList{} +} + +func (s *clusterAlertGroupClient) Controller() ClusterAlertGroupController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.clusterAlertGroupControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(ClusterAlertGroupGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &clusterAlertGroupController{ + GenericController: genericController, + } + + s.client.clusterAlertGroupControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type clusterAlertGroupClient struct { + client *Client + ns string + objectClient *objectclient.ObjectClient + controller ClusterAlertGroupController +} + +func (s *clusterAlertGroupClient) ObjectClient() *objectclient.ObjectClient { + return s.objectClient +} + +func (s *clusterAlertGroupClient) Create(o *ClusterAlertGroup) (*ClusterAlertGroup, error) { + obj, err := s.objectClient.Create(o) + return obj.(*ClusterAlertGroup), err +} + +func (s *clusterAlertGroupClient) Get(name string, opts metav1.GetOptions) (*ClusterAlertGroup, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*ClusterAlertGroup), err +} + +func (s *clusterAlertGroupClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ClusterAlertGroup, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*ClusterAlertGroup), err +} + +func (s *clusterAlertGroupClient) Update(o *ClusterAlertGroup) (*ClusterAlertGroup, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*ClusterAlertGroup), err +} + +func (s *clusterAlertGroupClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *clusterAlertGroupClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *clusterAlertGroupClient) List(opts metav1.ListOptions) (*ClusterAlertGroupList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*ClusterAlertGroupList), err +} + +func (s *clusterAlertGroupClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *clusterAlertGroupClient) Patch(o *ClusterAlertGroup, data []byte, subresources ...string) (*ClusterAlertGroup, error) { + obj, err := s.objectClient.Patch(o.Name, o, data, subresources...) + return obj.(*ClusterAlertGroup), err +} + +func (s *clusterAlertGroupClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *clusterAlertGroupClient) AddHandler(ctx context.Context, name string, sync ClusterAlertGroupHandlerFunc) { + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *clusterAlertGroupClient) AddLifecycle(ctx context.Context, name string, lifecycle ClusterAlertGroupLifecycle) { + sync := NewClusterAlertGroupLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *clusterAlertGroupClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ClusterAlertGroupHandlerFunc) { + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *clusterAlertGroupClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ClusterAlertGroupLifecycle) { + sync := NewClusterAlertGroupLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +type ClusterAlertGroupIndexer func(obj *ClusterAlertGroup) ([]string, error) + +type ClusterAlertGroupClientCache interface { + Get(namespace, name string) (*ClusterAlertGroup, error) + List(namespace string, selector labels.Selector) ([]*ClusterAlertGroup, error) + + Index(name string, indexer ClusterAlertGroupIndexer) + GetIndexed(name, key string) ([]*ClusterAlertGroup, error) +} + +type ClusterAlertGroupClient interface { + Create(*ClusterAlertGroup) (*ClusterAlertGroup, error) + Get(namespace, name string, opts metav1.GetOptions) (*ClusterAlertGroup, error) + Update(*ClusterAlertGroup) (*ClusterAlertGroup, error) + Delete(namespace, name string, options *metav1.DeleteOptions) error + List(namespace string, opts metav1.ListOptions) (*ClusterAlertGroupList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + + Cache() ClusterAlertGroupClientCache + + OnCreate(ctx context.Context, name string, sync ClusterAlertGroupChangeHandlerFunc) + OnChange(ctx context.Context, name string, sync ClusterAlertGroupChangeHandlerFunc) + OnRemove(ctx context.Context, name string, sync ClusterAlertGroupChangeHandlerFunc) + Enqueue(namespace, name string) + + Generic() controller.GenericController + Interface() ClusterAlertGroupInterface +} + +type clusterAlertGroupClientCache struct { + client *clusterAlertGroupClient2 +} + +type clusterAlertGroupClient2 struct { + iface ClusterAlertGroupInterface + controller ClusterAlertGroupController +} + +func (n *clusterAlertGroupClient2) Interface() ClusterAlertGroupInterface { + return n.iface +} + +func (n *clusterAlertGroupClient2) Generic() controller.GenericController { + return n.iface.Controller().Generic() +} + +func (n *clusterAlertGroupClient2) Enqueue(namespace, name string) { + n.iface.Controller().Enqueue(namespace, name) +} + +func (n *clusterAlertGroupClient2) Create(obj *ClusterAlertGroup) (*ClusterAlertGroup, error) { + return n.iface.Create(obj) +} + +func (n *clusterAlertGroupClient2) Get(namespace, name string, opts metav1.GetOptions) (*ClusterAlertGroup, error) { + return n.iface.GetNamespaced(namespace, name, opts) +} + +func (n *clusterAlertGroupClient2) Update(obj *ClusterAlertGroup) (*ClusterAlertGroup, error) { + return n.iface.Update(obj) +} + +func (n *clusterAlertGroupClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error { + return n.iface.DeleteNamespaced(namespace, name, options) +} + +func (n *clusterAlertGroupClient2) List(namespace string, opts metav1.ListOptions) (*ClusterAlertGroupList, error) { + return n.iface.List(opts) +} + +func (n *clusterAlertGroupClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return n.iface.Watch(opts) +} + +func (n *clusterAlertGroupClientCache) Get(namespace, name string) (*ClusterAlertGroup, error) { + return n.client.controller.Lister().Get(namespace, name) +} + +func (n *clusterAlertGroupClientCache) List(namespace string, selector labels.Selector) ([]*ClusterAlertGroup, error) { + return n.client.controller.Lister().List(namespace, selector) +} + +func (n *clusterAlertGroupClient2) Cache() ClusterAlertGroupClientCache { + n.loadController() + return &clusterAlertGroupClientCache{ + client: n, + } +} + +func (n *clusterAlertGroupClient2) OnCreate(ctx context.Context, name string, sync ClusterAlertGroupChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-create", &clusterAlertGroupLifecycleDelegate{create: sync}) +} + +func (n *clusterAlertGroupClient2) OnChange(ctx context.Context, name string, sync ClusterAlertGroupChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-change", &clusterAlertGroupLifecycleDelegate{update: sync}) +} + +func (n *clusterAlertGroupClient2) OnRemove(ctx context.Context, name string, sync ClusterAlertGroupChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name, &clusterAlertGroupLifecycleDelegate{remove: sync}) +} + +func (n *clusterAlertGroupClientCache) Index(name string, indexer ClusterAlertGroupIndexer) { + err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{ + name: func(obj interface{}) ([]string, error) { + if v, ok := obj.(*ClusterAlertGroup); ok { + return indexer(v) + } + return nil, nil + }, + }) + + if err != nil { + panic(err) + } +} + +func (n *clusterAlertGroupClientCache) GetIndexed(name, key string) ([]*ClusterAlertGroup, error) { + var result []*ClusterAlertGroup + objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key) + if err != nil { + return nil, err + } + for _, obj := range objs { + if v, ok := obj.(*ClusterAlertGroup); ok { + result = append(result, v) + } + } + + return result, nil +} + +func (n *clusterAlertGroupClient2) loadController() { + if n.controller == nil { + n.controller = n.iface.Controller() + } +} + +type clusterAlertGroupLifecycleDelegate struct { + create ClusterAlertGroupChangeHandlerFunc + update ClusterAlertGroupChangeHandlerFunc + remove ClusterAlertGroupChangeHandlerFunc +} + +func (n *clusterAlertGroupLifecycleDelegate) HasCreate() bool { + return n.create != nil +} + +func (n *clusterAlertGroupLifecycleDelegate) Create(obj *ClusterAlertGroup) (runtime.Object, error) { + if n.create == nil { + return obj, nil + } + return n.create(obj) +} + +func (n *clusterAlertGroupLifecycleDelegate) HasFinalize() bool { + return n.remove != nil +} + +func (n *clusterAlertGroupLifecycleDelegate) Remove(obj *ClusterAlertGroup) (runtime.Object, error) { + if n.remove == nil { + return obj, nil + } + return n.remove(obj) +} + +func (n *clusterAlertGroupLifecycleDelegate) Updated(obj *ClusterAlertGroup) (runtime.Object, error) { + if n.update == nil { + return obj, nil + } + return n.update(obj) +} diff --git a/apis/management.cattle.io/v3/zz_generated_cluster_alert_group_lifecycle_adapter.go b/apis/management.cattle.io/v3/zz_generated_cluster_alert_group_lifecycle_adapter.go new file mode 100644 index 00000000..2d9db443 --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_cluster_alert_group_lifecycle_adapter.go @@ -0,0 +1,62 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type ClusterAlertGroupLifecycle interface { + Create(obj *ClusterAlertGroup) (runtime.Object, error) + Remove(obj *ClusterAlertGroup) (runtime.Object, error) + Updated(obj *ClusterAlertGroup) (runtime.Object, error) +} + +type clusterAlertGroupLifecycleAdapter struct { + lifecycle ClusterAlertGroupLifecycle +} + +func (w *clusterAlertGroupLifecycleAdapter) HasCreate() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasCreate() +} + +func (w *clusterAlertGroupLifecycleAdapter) HasFinalize() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasFinalize() +} + +func (w *clusterAlertGroupLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*ClusterAlertGroup)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *clusterAlertGroupLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*ClusterAlertGroup)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *clusterAlertGroupLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*ClusterAlertGroup)) + if o == nil { + return nil, err + } + return o, err +} + +func NewClusterAlertGroupLifecycleAdapter(name string, clusterScoped bool, client ClusterAlertGroupInterface, l ClusterAlertGroupLifecycle) ClusterAlertGroupHandlerFunc { + adapter := &clusterAlertGroupLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *ClusterAlertGroup) (runtime.Object, error) { + newObj, err := syncFn(key, obj) + if o, ok := newObj.(runtime.Object); ok { + return o, err + } + return nil, err + } +} diff --git a/apis/management.cattle.io/v3/zz_generated_cluster_alert_rule_controller.go b/apis/management.cattle.io/v3/zz_generated_cluster_alert_rule_controller.go new file mode 100644 index 00000000..bdea3797 --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_cluster_alert_rule_controller.go @@ -0,0 +1,427 @@ +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/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + ClusterAlertRuleGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "ClusterAlertRule", + } + ClusterAlertRuleResource = metav1.APIResource{ + Name: "clusteralertrules", + SingularName: "clusteralertrule", + Namespaced: true, + + Kind: ClusterAlertRuleGroupVersionKind.Kind, + } +) + +type ClusterAlertRuleList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ClusterAlertRule +} + +type ClusterAlertRuleHandlerFunc func(key string, obj *ClusterAlertRule) (runtime.Object, error) + +type ClusterAlertRuleChangeHandlerFunc func(obj *ClusterAlertRule) (runtime.Object, error) + +type ClusterAlertRuleLister interface { + List(namespace string, selector labels.Selector) (ret []*ClusterAlertRule, err error) + Get(namespace, name string) (*ClusterAlertRule, error) +} + +type ClusterAlertRuleController interface { + Generic() controller.GenericController + Informer() cache.SharedIndexInformer + Lister() ClusterAlertRuleLister + AddHandler(ctx context.Context, name string, handler ClusterAlertRuleHandlerFunc) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler ClusterAlertRuleHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type ClusterAlertRuleInterface interface { + ObjectClient() *objectclient.ObjectClient + Create(*ClusterAlertRule) (*ClusterAlertRule, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ClusterAlertRule, error) + Get(name string, opts metav1.GetOptions) (*ClusterAlertRule, error) + Update(*ClusterAlertRule) (*ClusterAlertRule, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*ClusterAlertRuleList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() ClusterAlertRuleController + AddHandler(ctx context.Context, name string, sync ClusterAlertRuleHandlerFunc) + AddLifecycle(ctx context.Context, name string, lifecycle ClusterAlertRuleLifecycle) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ClusterAlertRuleHandlerFunc) + AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ClusterAlertRuleLifecycle) +} + +type clusterAlertRuleLister struct { + controller *clusterAlertRuleController +} + +func (l *clusterAlertRuleLister) List(namespace string, selector labels.Selector) (ret []*ClusterAlertRule, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*ClusterAlertRule)) + }) + return +} + +func (l *clusterAlertRuleLister) Get(namespace, name string) (*ClusterAlertRule, 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: ClusterAlertRuleGroupVersionKind.Group, + Resource: "clusterAlertRule", + }, key) + } + return obj.(*ClusterAlertRule), nil +} + +type clusterAlertRuleController struct { + controller.GenericController +} + +func (c *clusterAlertRuleController) Generic() controller.GenericController { + return c.GenericController +} + +func (c *clusterAlertRuleController) Lister() ClusterAlertRuleLister { + return &clusterAlertRuleLister{ + controller: c, + } +} + +func (c *clusterAlertRuleController) AddHandler(ctx context.Context, name string, handler ClusterAlertRuleHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*ClusterAlertRule); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *clusterAlertRuleController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler ClusterAlertRuleHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*ClusterAlertRule); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +type clusterAlertRuleFactory struct { +} + +func (c clusterAlertRuleFactory) Object() runtime.Object { + return &ClusterAlertRule{} +} + +func (c clusterAlertRuleFactory) List() runtime.Object { + return &ClusterAlertRuleList{} +} + +func (s *clusterAlertRuleClient) Controller() ClusterAlertRuleController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.clusterAlertRuleControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(ClusterAlertRuleGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &clusterAlertRuleController{ + GenericController: genericController, + } + + s.client.clusterAlertRuleControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type clusterAlertRuleClient struct { + client *Client + ns string + objectClient *objectclient.ObjectClient + controller ClusterAlertRuleController +} + +func (s *clusterAlertRuleClient) ObjectClient() *objectclient.ObjectClient { + return s.objectClient +} + +func (s *clusterAlertRuleClient) Create(o *ClusterAlertRule) (*ClusterAlertRule, error) { + obj, err := s.objectClient.Create(o) + return obj.(*ClusterAlertRule), err +} + +func (s *clusterAlertRuleClient) Get(name string, opts metav1.GetOptions) (*ClusterAlertRule, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*ClusterAlertRule), err +} + +func (s *clusterAlertRuleClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ClusterAlertRule, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*ClusterAlertRule), err +} + +func (s *clusterAlertRuleClient) Update(o *ClusterAlertRule) (*ClusterAlertRule, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*ClusterAlertRule), err +} + +func (s *clusterAlertRuleClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *clusterAlertRuleClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *clusterAlertRuleClient) List(opts metav1.ListOptions) (*ClusterAlertRuleList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*ClusterAlertRuleList), err +} + +func (s *clusterAlertRuleClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *clusterAlertRuleClient) Patch(o *ClusterAlertRule, data []byte, subresources ...string) (*ClusterAlertRule, error) { + obj, err := s.objectClient.Patch(o.Name, o, data, subresources...) + return obj.(*ClusterAlertRule), err +} + +func (s *clusterAlertRuleClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *clusterAlertRuleClient) AddHandler(ctx context.Context, name string, sync ClusterAlertRuleHandlerFunc) { + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *clusterAlertRuleClient) AddLifecycle(ctx context.Context, name string, lifecycle ClusterAlertRuleLifecycle) { + sync := NewClusterAlertRuleLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *clusterAlertRuleClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ClusterAlertRuleHandlerFunc) { + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *clusterAlertRuleClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ClusterAlertRuleLifecycle) { + sync := NewClusterAlertRuleLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +type ClusterAlertRuleIndexer func(obj *ClusterAlertRule) ([]string, error) + +type ClusterAlertRuleClientCache interface { + Get(namespace, name string) (*ClusterAlertRule, error) + List(namespace string, selector labels.Selector) ([]*ClusterAlertRule, error) + + Index(name string, indexer ClusterAlertRuleIndexer) + GetIndexed(name, key string) ([]*ClusterAlertRule, error) +} + +type ClusterAlertRuleClient interface { + Create(*ClusterAlertRule) (*ClusterAlertRule, error) + Get(namespace, name string, opts metav1.GetOptions) (*ClusterAlertRule, error) + Update(*ClusterAlertRule) (*ClusterAlertRule, error) + Delete(namespace, name string, options *metav1.DeleteOptions) error + List(namespace string, opts metav1.ListOptions) (*ClusterAlertRuleList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + + Cache() ClusterAlertRuleClientCache + + OnCreate(ctx context.Context, name string, sync ClusterAlertRuleChangeHandlerFunc) + OnChange(ctx context.Context, name string, sync ClusterAlertRuleChangeHandlerFunc) + OnRemove(ctx context.Context, name string, sync ClusterAlertRuleChangeHandlerFunc) + Enqueue(namespace, name string) + + Generic() controller.GenericController + Interface() ClusterAlertRuleInterface +} + +type clusterAlertRuleClientCache struct { + client *clusterAlertRuleClient2 +} + +type clusterAlertRuleClient2 struct { + iface ClusterAlertRuleInterface + controller ClusterAlertRuleController +} + +func (n *clusterAlertRuleClient2) Interface() ClusterAlertRuleInterface { + return n.iface +} + +func (n *clusterAlertRuleClient2) Generic() controller.GenericController { + return n.iface.Controller().Generic() +} + +func (n *clusterAlertRuleClient2) Enqueue(namespace, name string) { + n.iface.Controller().Enqueue(namespace, name) +} + +func (n *clusterAlertRuleClient2) Create(obj *ClusterAlertRule) (*ClusterAlertRule, error) { + return n.iface.Create(obj) +} + +func (n *clusterAlertRuleClient2) Get(namespace, name string, opts metav1.GetOptions) (*ClusterAlertRule, error) { + return n.iface.GetNamespaced(namespace, name, opts) +} + +func (n *clusterAlertRuleClient2) Update(obj *ClusterAlertRule) (*ClusterAlertRule, error) { + return n.iface.Update(obj) +} + +func (n *clusterAlertRuleClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error { + return n.iface.DeleteNamespaced(namespace, name, options) +} + +func (n *clusterAlertRuleClient2) List(namespace string, opts metav1.ListOptions) (*ClusterAlertRuleList, error) { + return n.iface.List(opts) +} + +func (n *clusterAlertRuleClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return n.iface.Watch(opts) +} + +func (n *clusterAlertRuleClientCache) Get(namespace, name string) (*ClusterAlertRule, error) { + return n.client.controller.Lister().Get(namespace, name) +} + +func (n *clusterAlertRuleClientCache) List(namespace string, selector labels.Selector) ([]*ClusterAlertRule, error) { + return n.client.controller.Lister().List(namespace, selector) +} + +func (n *clusterAlertRuleClient2) Cache() ClusterAlertRuleClientCache { + n.loadController() + return &clusterAlertRuleClientCache{ + client: n, + } +} + +func (n *clusterAlertRuleClient2) OnCreate(ctx context.Context, name string, sync ClusterAlertRuleChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-create", &clusterAlertRuleLifecycleDelegate{create: sync}) +} + +func (n *clusterAlertRuleClient2) OnChange(ctx context.Context, name string, sync ClusterAlertRuleChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-change", &clusterAlertRuleLifecycleDelegate{update: sync}) +} + +func (n *clusterAlertRuleClient2) OnRemove(ctx context.Context, name string, sync ClusterAlertRuleChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name, &clusterAlertRuleLifecycleDelegate{remove: sync}) +} + +func (n *clusterAlertRuleClientCache) Index(name string, indexer ClusterAlertRuleIndexer) { + err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{ + name: func(obj interface{}) ([]string, error) { + if v, ok := obj.(*ClusterAlertRule); ok { + return indexer(v) + } + return nil, nil + }, + }) + + if err != nil { + panic(err) + } +} + +func (n *clusterAlertRuleClientCache) GetIndexed(name, key string) ([]*ClusterAlertRule, error) { + var result []*ClusterAlertRule + objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key) + if err != nil { + return nil, err + } + for _, obj := range objs { + if v, ok := obj.(*ClusterAlertRule); ok { + result = append(result, v) + } + } + + return result, nil +} + +func (n *clusterAlertRuleClient2) loadController() { + if n.controller == nil { + n.controller = n.iface.Controller() + } +} + +type clusterAlertRuleLifecycleDelegate struct { + create ClusterAlertRuleChangeHandlerFunc + update ClusterAlertRuleChangeHandlerFunc + remove ClusterAlertRuleChangeHandlerFunc +} + +func (n *clusterAlertRuleLifecycleDelegate) HasCreate() bool { + return n.create != nil +} + +func (n *clusterAlertRuleLifecycleDelegate) Create(obj *ClusterAlertRule) (runtime.Object, error) { + if n.create == nil { + return obj, nil + } + return n.create(obj) +} + +func (n *clusterAlertRuleLifecycleDelegate) HasFinalize() bool { + return n.remove != nil +} + +func (n *clusterAlertRuleLifecycleDelegate) Remove(obj *ClusterAlertRule) (runtime.Object, error) { + if n.remove == nil { + return obj, nil + } + return n.remove(obj) +} + +func (n *clusterAlertRuleLifecycleDelegate) Updated(obj *ClusterAlertRule) (runtime.Object, error) { + if n.update == nil { + return obj, nil + } + return n.update(obj) +} diff --git a/apis/management.cattle.io/v3/zz_generated_cluster_alert_rule_lifecycle_adapter.go b/apis/management.cattle.io/v3/zz_generated_cluster_alert_rule_lifecycle_adapter.go new file mode 100644 index 00000000..87d21225 --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_cluster_alert_rule_lifecycle_adapter.go @@ -0,0 +1,62 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type ClusterAlertRuleLifecycle interface { + Create(obj *ClusterAlertRule) (runtime.Object, error) + Remove(obj *ClusterAlertRule) (runtime.Object, error) + Updated(obj *ClusterAlertRule) (runtime.Object, error) +} + +type clusterAlertRuleLifecycleAdapter struct { + lifecycle ClusterAlertRuleLifecycle +} + +func (w *clusterAlertRuleLifecycleAdapter) HasCreate() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasCreate() +} + +func (w *clusterAlertRuleLifecycleAdapter) HasFinalize() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasFinalize() +} + +func (w *clusterAlertRuleLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*ClusterAlertRule)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *clusterAlertRuleLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*ClusterAlertRule)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *clusterAlertRuleLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*ClusterAlertRule)) + if o == nil { + return nil, err + } + return o, err +} + +func NewClusterAlertRuleLifecycleAdapter(name string, clusterScoped bool, client ClusterAlertRuleInterface, l ClusterAlertRuleLifecycle) ClusterAlertRuleHandlerFunc { + adapter := &clusterAlertRuleLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *ClusterAlertRule) (runtime.Object, error) { + newObj, err := syncFn(key, obj) + if o, ok := newObj.(runtime.Object); ok { + return o, err + } + return nil, err + } +} diff --git a/apis/management.cattle.io/v3/zz_generated_cluster_monitor_graph_controller.go b/apis/management.cattle.io/v3/zz_generated_cluster_monitor_graph_controller.go new file mode 100644 index 00000000..2b129ace --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_cluster_monitor_graph_controller.go @@ -0,0 +1,427 @@ +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/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + ClusterMonitorGraphGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "ClusterMonitorGraph", + } + ClusterMonitorGraphResource = metav1.APIResource{ + Name: "clustermonitorgraphs", + SingularName: "clustermonitorgraph", + Namespaced: true, + + Kind: ClusterMonitorGraphGroupVersionKind.Kind, + } +) + +type ClusterMonitorGraphList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ClusterMonitorGraph +} + +type ClusterMonitorGraphHandlerFunc func(key string, obj *ClusterMonitorGraph) (runtime.Object, error) + +type ClusterMonitorGraphChangeHandlerFunc func(obj *ClusterMonitorGraph) (runtime.Object, error) + +type ClusterMonitorGraphLister interface { + List(namespace string, selector labels.Selector) (ret []*ClusterMonitorGraph, err error) + Get(namespace, name string) (*ClusterMonitorGraph, error) +} + +type ClusterMonitorGraphController interface { + Generic() controller.GenericController + Informer() cache.SharedIndexInformer + Lister() ClusterMonitorGraphLister + AddHandler(ctx context.Context, name string, handler ClusterMonitorGraphHandlerFunc) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler ClusterMonitorGraphHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type ClusterMonitorGraphInterface interface { + ObjectClient() *objectclient.ObjectClient + Create(*ClusterMonitorGraph) (*ClusterMonitorGraph, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ClusterMonitorGraph, error) + Get(name string, opts metav1.GetOptions) (*ClusterMonitorGraph, error) + Update(*ClusterMonitorGraph) (*ClusterMonitorGraph, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*ClusterMonitorGraphList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() ClusterMonitorGraphController + AddHandler(ctx context.Context, name string, sync ClusterMonitorGraphHandlerFunc) + AddLifecycle(ctx context.Context, name string, lifecycle ClusterMonitorGraphLifecycle) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ClusterMonitorGraphHandlerFunc) + AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ClusterMonitorGraphLifecycle) +} + +type clusterMonitorGraphLister struct { + controller *clusterMonitorGraphController +} + +func (l *clusterMonitorGraphLister) List(namespace string, selector labels.Selector) (ret []*ClusterMonitorGraph, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*ClusterMonitorGraph)) + }) + return +} + +func (l *clusterMonitorGraphLister) Get(namespace, name string) (*ClusterMonitorGraph, 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: ClusterMonitorGraphGroupVersionKind.Group, + Resource: "clusterMonitorGraph", + }, key) + } + return obj.(*ClusterMonitorGraph), nil +} + +type clusterMonitorGraphController struct { + controller.GenericController +} + +func (c *clusterMonitorGraphController) Generic() controller.GenericController { + return c.GenericController +} + +func (c *clusterMonitorGraphController) Lister() ClusterMonitorGraphLister { + return &clusterMonitorGraphLister{ + controller: c, + } +} + +func (c *clusterMonitorGraphController) AddHandler(ctx context.Context, name string, handler ClusterMonitorGraphHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*ClusterMonitorGraph); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *clusterMonitorGraphController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler ClusterMonitorGraphHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*ClusterMonitorGraph); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +type clusterMonitorGraphFactory struct { +} + +func (c clusterMonitorGraphFactory) Object() runtime.Object { + return &ClusterMonitorGraph{} +} + +func (c clusterMonitorGraphFactory) List() runtime.Object { + return &ClusterMonitorGraphList{} +} + +func (s *clusterMonitorGraphClient) Controller() ClusterMonitorGraphController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.clusterMonitorGraphControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(ClusterMonitorGraphGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &clusterMonitorGraphController{ + GenericController: genericController, + } + + s.client.clusterMonitorGraphControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type clusterMonitorGraphClient struct { + client *Client + ns string + objectClient *objectclient.ObjectClient + controller ClusterMonitorGraphController +} + +func (s *clusterMonitorGraphClient) ObjectClient() *objectclient.ObjectClient { + return s.objectClient +} + +func (s *clusterMonitorGraphClient) Create(o *ClusterMonitorGraph) (*ClusterMonitorGraph, error) { + obj, err := s.objectClient.Create(o) + return obj.(*ClusterMonitorGraph), err +} + +func (s *clusterMonitorGraphClient) Get(name string, opts metav1.GetOptions) (*ClusterMonitorGraph, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*ClusterMonitorGraph), err +} + +func (s *clusterMonitorGraphClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ClusterMonitorGraph, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*ClusterMonitorGraph), err +} + +func (s *clusterMonitorGraphClient) Update(o *ClusterMonitorGraph) (*ClusterMonitorGraph, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*ClusterMonitorGraph), err +} + +func (s *clusterMonitorGraphClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *clusterMonitorGraphClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *clusterMonitorGraphClient) List(opts metav1.ListOptions) (*ClusterMonitorGraphList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*ClusterMonitorGraphList), err +} + +func (s *clusterMonitorGraphClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *clusterMonitorGraphClient) Patch(o *ClusterMonitorGraph, data []byte, subresources ...string) (*ClusterMonitorGraph, error) { + obj, err := s.objectClient.Patch(o.Name, o, data, subresources...) + return obj.(*ClusterMonitorGraph), err +} + +func (s *clusterMonitorGraphClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *clusterMonitorGraphClient) AddHandler(ctx context.Context, name string, sync ClusterMonitorGraphHandlerFunc) { + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *clusterMonitorGraphClient) AddLifecycle(ctx context.Context, name string, lifecycle ClusterMonitorGraphLifecycle) { + sync := NewClusterMonitorGraphLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *clusterMonitorGraphClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ClusterMonitorGraphHandlerFunc) { + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *clusterMonitorGraphClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ClusterMonitorGraphLifecycle) { + sync := NewClusterMonitorGraphLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +type ClusterMonitorGraphIndexer func(obj *ClusterMonitorGraph) ([]string, error) + +type ClusterMonitorGraphClientCache interface { + Get(namespace, name string) (*ClusterMonitorGraph, error) + List(namespace string, selector labels.Selector) ([]*ClusterMonitorGraph, error) + + Index(name string, indexer ClusterMonitorGraphIndexer) + GetIndexed(name, key string) ([]*ClusterMonitorGraph, error) +} + +type ClusterMonitorGraphClient interface { + Create(*ClusterMonitorGraph) (*ClusterMonitorGraph, error) + Get(namespace, name string, opts metav1.GetOptions) (*ClusterMonitorGraph, error) + Update(*ClusterMonitorGraph) (*ClusterMonitorGraph, error) + Delete(namespace, name string, options *metav1.DeleteOptions) error + List(namespace string, opts metav1.ListOptions) (*ClusterMonitorGraphList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + + Cache() ClusterMonitorGraphClientCache + + OnCreate(ctx context.Context, name string, sync ClusterMonitorGraphChangeHandlerFunc) + OnChange(ctx context.Context, name string, sync ClusterMonitorGraphChangeHandlerFunc) + OnRemove(ctx context.Context, name string, sync ClusterMonitorGraphChangeHandlerFunc) + Enqueue(namespace, name string) + + Generic() controller.GenericController + Interface() ClusterMonitorGraphInterface +} + +type clusterMonitorGraphClientCache struct { + client *clusterMonitorGraphClient2 +} + +type clusterMonitorGraphClient2 struct { + iface ClusterMonitorGraphInterface + controller ClusterMonitorGraphController +} + +func (n *clusterMonitorGraphClient2) Interface() ClusterMonitorGraphInterface { + return n.iface +} + +func (n *clusterMonitorGraphClient2) Generic() controller.GenericController { + return n.iface.Controller().Generic() +} + +func (n *clusterMonitorGraphClient2) Enqueue(namespace, name string) { + n.iface.Controller().Enqueue(namespace, name) +} + +func (n *clusterMonitorGraphClient2) Create(obj *ClusterMonitorGraph) (*ClusterMonitorGraph, error) { + return n.iface.Create(obj) +} + +func (n *clusterMonitorGraphClient2) Get(namespace, name string, opts metav1.GetOptions) (*ClusterMonitorGraph, error) { + return n.iface.GetNamespaced(namespace, name, opts) +} + +func (n *clusterMonitorGraphClient2) Update(obj *ClusterMonitorGraph) (*ClusterMonitorGraph, error) { + return n.iface.Update(obj) +} + +func (n *clusterMonitorGraphClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error { + return n.iface.DeleteNamespaced(namespace, name, options) +} + +func (n *clusterMonitorGraphClient2) List(namespace string, opts metav1.ListOptions) (*ClusterMonitorGraphList, error) { + return n.iface.List(opts) +} + +func (n *clusterMonitorGraphClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return n.iface.Watch(opts) +} + +func (n *clusterMonitorGraphClientCache) Get(namespace, name string) (*ClusterMonitorGraph, error) { + return n.client.controller.Lister().Get(namespace, name) +} + +func (n *clusterMonitorGraphClientCache) List(namespace string, selector labels.Selector) ([]*ClusterMonitorGraph, error) { + return n.client.controller.Lister().List(namespace, selector) +} + +func (n *clusterMonitorGraphClient2) Cache() ClusterMonitorGraphClientCache { + n.loadController() + return &clusterMonitorGraphClientCache{ + client: n, + } +} + +func (n *clusterMonitorGraphClient2) OnCreate(ctx context.Context, name string, sync ClusterMonitorGraphChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-create", &clusterMonitorGraphLifecycleDelegate{create: sync}) +} + +func (n *clusterMonitorGraphClient2) OnChange(ctx context.Context, name string, sync ClusterMonitorGraphChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-change", &clusterMonitorGraphLifecycleDelegate{update: sync}) +} + +func (n *clusterMonitorGraphClient2) OnRemove(ctx context.Context, name string, sync ClusterMonitorGraphChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name, &clusterMonitorGraphLifecycleDelegate{remove: sync}) +} + +func (n *clusterMonitorGraphClientCache) Index(name string, indexer ClusterMonitorGraphIndexer) { + err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{ + name: func(obj interface{}) ([]string, error) { + if v, ok := obj.(*ClusterMonitorGraph); ok { + return indexer(v) + } + return nil, nil + }, + }) + + if err != nil { + panic(err) + } +} + +func (n *clusterMonitorGraphClientCache) GetIndexed(name, key string) ([]*ClusterMonitorGraph, error) { + var result []*ClusterMonitorGraph + objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key) + if err != nil { + return nil, err + } + for _, obj := range objs { + if v, ok := obj.(*ClusterMonitorGraph); ok { + result = append(result, v) + } + } + + return result, nil +} + +func (n *clusterMonitorGraphClient2) loadController() { + if n.controller == nil { + n.controller = n.iface.Controller() + } +} + +type clusterMonitorGraphLifecycleDelegate struct { + create ClusterMonitorGraphChangeHandlerFunc + update ClusterMonitorGraphChangeHandlerFunc + remove ClusterMonitorGraphChangeHandlerFunc +} + +func (n *clusterMonitorGraphLifecycleDelegate) HasCreate() bool { + return n.create != nil +} + +func (n *clusterMonitorGraphLifecycleDelegate) Create(obj *ClusterMonitorGraph) (runtime.Object, error) { + if n.create == nil { + return obj, nil + } + return n.create(obj) +} + +func (n *clusterMonitorGraphLifecycleDelegate) HasFinalize() bool { + return n.remove != nil +} + +func (n *clusterMonitorGraphLifecycleDelegate) Remove(obj *ClusterMonitorGraph) (runtime.Object, error) { + if n.remove == nil { + return obj, nil + } + return n.remove(obj) +} + +func (n *clusterMonitorGraphLifecycleDelegate) Updated(obj *ClusterMonitorGraph) (runtime.Object, error) { + if n.update == nil { + return obj, nil + } + return n.update(obj) +} diff --git a/apis/management.cattle.io/v3/zz_generated_cluster_monitor_graph_lifecycle_adapter.go b/apis/management.cattle.io/v3/zz_generated_cluster_monitor_graph_lifecycle_adapter.go new file mode 100644 index 00000000..cd5c0ab3 --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_cluster_monitor_graph_lifecycle_adapter.go @@ -0,0 +1,62 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type ClusterMonitorGraphLifecycle interface { + Create(obj *ClusterMonitorGraph) (runtime.Object, error) + Remove(obj *ClusterMonitorGraph) (runtime.Object, error) + Updated(obj *ClusterMonitorGraph) (runtime.Object, error) +} + +type clusterMonitorGraphLifecycleAdapter struct { + lifecycle ClusterMonitorGraphLifecycle +} + +func (w *clusterMonitorGraphLifecycleAdapter) HasCreate() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasCreate() +} + +func (w *clusterMonitorGraphLifecycleAdapter) HasFinalize() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasFinalize() +} + +func (w *clusterMonitorGraphLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*ClusterMonitorGraph)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *clusterMonitorGraphLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*ClusterMonitorGraph)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *clusterMonitorGraphLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*ClusterMonitorGraph)) + if o == nil { + return nil, err + } + return o, err +} + +func NewClusterMonitorGraphLifecycleAdapter(name string, clusterScoped bool, client ClusterMonitorGraphInterface, l ClusterMonitorGraphLifecycle) ClusterMonitorGraphHandlerFunc { + adapter := &clusterMonitorGraphLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *ClusterMonitorGraph) (runtime.Object, error) { + newObj, err := syncFn(key, obj) + if o, ok := newObj.(runtime.Object); ok { + return o, err + } + return nil, err + } +} diff --git a/apis/management.cattle.io/v3/zz_generated_deepcopy.go b/apis/management.cattle.io/v3/zz_generated_deepcopy.go index 9b59fd1b..44cba884 100644 --- a/apis/management.cattle.io/v3/zz_generated_deepcopy.go +++ b/apis/management.cattle.io/v3/zz_generated_deepcopy.go @@ -735,6 +735,68 @@ func (in *ClusterAlert) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterAlertGroup) DeepCopyInto(out *ClusterAlertGroup) { + *out = *in + out.Namespaced = in.Namespaced + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterAlertGroup. +func (in *ClusterAlertGroup) DeepCopy() *ClusterAlertGroup { + if in == nil { + return nil + } + out := new(ClusterAlertGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterAlertGroup) 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 *ClusterAlertGroupList) DeepCopyInto(out *ClusterAlertGroupList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterAlertGroup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterAlertGroupList. +func (in *ClusterAlertGroupList) DeepCopy() *ClusterAlertGroupList { + if in == nil { + return nil + } + out := new(ClusterAlertGroupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterAlertGroupList) 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 *ClusterAlertList) DeepCopyInto(out *ClusterAlertList) { *out = *in @@ -768,6 +830,105 @@ func (in *ClusterAlertList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterAlertRule) DeepCopyInto(out *ClusterAlertRule) { + *out = *in + out.Namespaced = in.Namespaced + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterAlertRule. +func (in *ClusterAlertRule) DeepCopy() *ClusterAlertRule { + if in == nil { + return nil + } + out := new(ClusterAlertRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterAlertRule) 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 *ClusterAlertRuleList) DeepCopyInto(out *ClusterAlertRuleList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterAlertRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterAlertRuleList. +func (in *ClusterAlertRuleList) DeepCopy() *ClusterAlertRuleList { + if in == nil { + return nil + } + out := new(ClusterAlertRuleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterAlertRuleList) 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 *ClusterAlertRuleSpec) DeepCopyInto(out *ClusterAlertRuleSpec) { + *out = *in + out.CommonRuleField = in.CommonRuleField + if in.NodeRule != nil { + in, out := &in.NodeRule, &out.NodeRule + *out = new(NodeRule) + (*in).DeepCopyInto(*out) + } + if in.EventRule != nil { + in, out := &in.EventRule, &out.EventRule + *out = new(EventRule) + **out = **in + } + if in.SystemServiceRule != nil { + in, out := &in.SystemServiceRule, &out.SystemServiceRule + *out = new(SystemServiceRule) + **out = **in + } + if in.MetricRule != nil { + in, out := &in.MetricRule, &out.MetricRule + *out = new(MetricRule) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterAlertRuleSpec. +func (in *ClusterAlertRuleSpec) DeepCopy() *ClusterAlertRuleSpec { + if in == nil { + return nil + } + out := new(ClusterAlertRuleSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterAlertSpec) DeepCopyInto(out *ClusterAlertSpec) { *out = *in @@ -896,6 +1057,28 @@ func (in *ClusterCondition) DeepCopy() *ClusterCondition { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterGroupSpec) DeepCopyInto(out *ClusterGroupSpec) { + *out = *in + if in.Recipients != nil { + in, out := &in.Recipients, &out.Recipients + *out = make([]Recipient, len(*in)) + copy(*out, *in) + } + out.CommonGroupField = in.CommonGroupField + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterGroupSpec. +func (in *ClusterGroupSpec) DeepCopy() *ClusterGroupSpec { + if in == nil { + return nil + } + out := new(ClusterGroupSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterList) DeepCopyInto(out *ClusterList) { *out = *in @@ -1035,6 +1218,100 @@ func (in *ClusterLoggingStatus) DeepCopy() *ClusterLoggingStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterMetricNamesInput) DeepCopyInto(out *ClusterMetricNamesInput) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterMetricNamesInput. +func (in *ClusterMetricNamesInput) DeepCopy() *ClusterMetricNamesInput { + if in == nil { + return nil + } + out := new(ClusterMetricNamesInput) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterMonitorGraph) DeepCopyInto(out *ClusterMonitorGraph) { + *out = *in + out.Namespaced = in.Namespaced + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterMonitorGraph. +func (in *ClusterMonitorGraph) DeepCopy() *ClusterMonitorGraph { + if in == nil { + return nil + } + out := new(ClusterMonitorGraph) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterMonitorGraph) 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 *ClusterMonitorGraphList) DeepCopyInto(out *ClusterMonitorGraphList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterMonitorGraph, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterMonitorGraphList. +func (in *ClusterMonitorGraphList) DeepCopy() *ClusterMonitorGraphList { + if in == nil { + return nil + } + out := new(ClusterMonitorGraphList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterMonitorGraphList) 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 *ClusterMonitorGraphSpec) DeepCopyInto(out *ClusterMonitorGraphSpec) { + *out = *in + in.CommonMonitorGraphSpec.DeepCopyInto(&out.CommonMonitorGraphSpec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterMonitorGraphSpec. +func (in *ClusterMonitorGraphSpec) DeepCopy() *ClusterMonitorGraphSpec { + if in == nil { + return nil + } + out := new(ClusterMonitorGraphSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterRegistrationToken) DeepCopyInto(out *ClusterRegistrationToken) { *out = *in @@ -1291,6 +1568,11 @@ func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus) { **out = **in } in.Capabilities.DeepCopyInto(&out.Capabilities) + if in.MonitoringStatus != nil { + in, out := &in.MonitoringStatus, &out.MonitoringStatus + *out = new(MonitoringStatus) + (*in).DeepCopyInto(*out) + } return } @@ -1304,6 +1586,87 @@ 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 *CommonGroupField) DeepCopyInto(out *CommonGroupField) { + *out = *in + out.TimingField = in.TimingField + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonGroupField. +func (in *CommonGroupField) DeepCopy() *CommonGroupField { + if in == nil { + return nil + } + out := new(CommonGroupField) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CommonMonitorGraphSpec) DeepCopyInto(out *CommonMonitorGraphSpec) { + *out = *in + if in.MetricsSelector != nil { + in, out := &in.MetricsSelector, &out.MetricsSelector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.DetailsMetricsSelector != nil { + in, out := &in.DetailsMetricsSelector, &out.DetailsMetricsSelector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + out.YAxis = in.YAxis + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonMonitorGraphSpec. +func (in *CommonMonitorGraphSpec) DeepCopy() *CommonMonitorGraphSpec { + if in == nil { + return nil + } + out := new(CommonMonitorGraphSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CommonQueryMetricInput) DeepCopyInto(out *CommonQueryMetricInput) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonQueryMetricInput. +func (in *CommonQueryMetricInput) DeepCopy() *CommonQueryMetricInput { + if in == nil { + return nil + } + out := new(CommonQueryMetricInput) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CommonRuleField) DeepCopyInto(out *CommonRuleField) { + *out = *in + out.TimingField = in.TimingField + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonRuleField. +func (in *CommonRuleField) DeepCopy() *CommonRuleField { + if in == nil { + return nil + } + out := new(CommonRuleField) + in.DeepCopyInto(out) + 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 @@ -1680,6 +2043,22 @@ func (in *ElasticsearchConfig) DeepCopy() *ElasticsearchConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EventRule) DeepCopyInto(out *EventRule) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EventRule. +func (in *EventRule) DeepCopy() *EventRule { + if in == nil { + return nil + } + out := new(EventRule) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExportOutput) DeepCopyInto(out *ExportOutput) { *out = *in @@ -3148,6 +3527,136 @@ func (in *MetadataOpenstackOpts) DeepCopy() *MetadataOpenstackOpts { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MetricNamesOutput) DeepCopyInto(out *MetricNamesOutput) { + *out = *in + if in.Names != nil { + in, out := &in.Names, &out.Names + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricNamesOutput. +func (in *MetricNamesOutput) DeepCopy() *MetricNamesOutput { + if in == nil { + return nil + } + out := new(MetricNamesOutput) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MetricRule) DeepCopyInto(out *MetricRule) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricRule. +func (in *MetricRule) DeepCopy() *MetricRule { + if in == nil { + return nil + } + out := new(MetricRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MonitorMetric) DeepCopyInto(out *MonitorMetric) { + *out = *in + out.Namespaced = in.Namespaced + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitorMetric. +func (in *MonitorMetric) DeepCopy() *MonitorMetric { + if in == nil { + return nil + } + out := new(MonitorMetric) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MonitorMetric) 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 *MonitorMetricList) DeepCopyInto(out *MonitorMetricList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MonitorMetric, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitorMetricList. +func (in *MonitorMetricList) DeepCopy() *MonitorMetricList { + if in == nil { + return nil + } + out := new(MonitorMetricList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MonitorMetricList) 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 *MonitorMetricSpec) DeepCopyInto(out *MonitorMetricSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitorMetricSpec. +func (in *MonitorMetricSpec) DeepCopy() *MonitorMetricSpec { + if in == nil { + return nil + } + out := new(MonitorMetricSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MonitoringCondition) DeepCopyInto(out *MonitoringCondition) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitoringCondition. +func (in *MonitoringCondition) DeepCopy() *MonitoringCondition { + if in == nil { + return nil + } + out := new(MonitoringCondition) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MonitoringConfig) DeepCopyInto(out *MonitoringConfig) { *out = *in @@ -3171,6 +3680,50 @@ func (in *MonitoringConfig) DeepCopy() *MonitoringConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MonitoringInput) DeepCopyInto(out *MonitoringInput) { + *out = *in + 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 + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitoringInput. +func (in *MonitoringInput) DeepCopy() *MonitoringInput { + if in == nil { + return nil + } + out := new(MonitoringInput) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MonitoringStatus) DeepCopyInto(out *MonitoringStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]MonitoringCondition, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitoringStatus. +func (in *MonitoringStatus) DeepCopy() *MonitoringStatus { + if in == nil { + return nil + } + out := new(MonitoringStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MultiClusterApp) DeepCopyInto(out *MultiClusterApp) { *out = *in @@ -3710,6 +4263,29 @@ func (in *NodePoolStatus) DeepCopy() *NodePoolStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeRule) DeepCopyInto(out *NodeRule) { + *out = *in + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeRule. +func (in *NodeRule) DeepCopy() *NodeRule { + if in == nil { + return nil + } + out := new(NodeRule) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeSpec) DeepCopyInto(out *NodeSpec) { *out = *in @@ -4215,6 +4791,22 @@ func (in *PingConfig) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodRule) DeepCopyInto(out *PodRule) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodRule. +func (in *PodRule) DeepCopy() *PodRule { + if in == nil { + return nil + } + out := new(PodRule) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PodSecurityPolicyTemplate) DeepCopyInto(out *PodSecurityPolicyTemplate) { *out = *in @@ -4628,6 +5220,68 @@ func (in *ProjectAlert) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectAlertGroup) DeepCopyInto(out *ProjectAlertGroup) { + *out = *in + out.Namespaced = in.Namespaced + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectAlertGroup. +func (in *ProjectAlertGroup) DeepCopy() *ProjectAlertGroup { + if in == nil { + return nil + } + out := new(ProjectAlertGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProjectAlertGroup) 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 *ProjectAlertGroupList) DeepCopyInto(out *ProjectAlertGroupList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ProjectAlertGroup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectAlertGroupList. +func (in *ProjectAlertGroupList) DeepCopy() *ProjectAlertGroupList { + if in == nil { + return nil + } + out := new(ProjectAlertGroupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProjectAlertGroupList) 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 *ProjectAlertList) DeepCopyInto(out *ProjectAlertList) { *out = *in @@ -4661,6 +5315,100 @@ func (in *ProjectAlertList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectAlertRule) DeepCopyInto(out *ProjectAlertRule) { + *out = *in + out.Namespaced = in.Namespaced + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectAlertRule. +func (in *ProjectAlertRule) DeepCopy() *ProjectAlertRule { + if in == nil { + return nil + } + out := new(ProjectAlertRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProjectAlertRule) 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 *ProjectAlertRuleList) DeepCopyInto(out *ProjectAlertRuleList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ProjectAlertRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectAlertRuleList. +func (in *ProjectAlertRuleList) DeepCopy() *ProjectAlertRuleList { + if in == nil { + return nil + } + out := new(ProjectAlertRuleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProjectAlertRuleList) 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 *ProjectAlertRuleSpec) DeepCopyInto(out *ProjectAlertRuleSpec) { + *out = *in + out.CommonRuleField = in.CommonRuleField + if in.PodRule != nil { + in, out := &in.PodRule, &out.PodRule + *out = new(PodRule) + **out = **in + } + if in.WorkloadRule != nil { + in, out := &in.WorkloadRule, &out.WorkloadRule + *out = new(WorkloadRule) + (*in).DeepCopyInto(*out) + } + if in.MetricRule != nil { + in, out := &in.MetricRule, &out.MetricRule + *out = new(MetricRule) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectAlertRuleSpec. +func (in *ProjectAlertRuleSpec) DeepCopy() *ProjectAlertRuleSpec { + if in == nil { + return nil + } + out := new(ProjectAlertRuleSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ProjectAlertSpec) DeepCopyInto(out *ProjectAlertSpec) { *out = *in @@ -4763,6 +5511,28 @@ func (in *ProjectCondition) DeepCopy() *ProjectCondition { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectGroupSpec) DeepCopyInto(out *ProjectGroupSpec) { + *out = *in + if in.Recipients != nil { + in, out := &in.Recipients, &out.Recipients + *out = make([]Recipient, len(*in)) + copy(*out, *in) + } + out.CommonGroupField = in.CommonGroupField + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectGroupSpec. +func (in *ProjectGroupSpec) DeepCopy() *ProjectGroupSpec { + if in == nil { + return nil + } + out := new(ProjectGroupSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ProjectList) DeepCopyInto(out *ProjectList) { *out = *in @@ -4897,6 +5667,100 @@ func (in *ProjectLoggingStatus) DeepCopy() *ProjectLoggingStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectMetricNamesInput) DeepCopyInto(out *ProjectMetricNamesInput) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectMetricNamesInput. +func (in *ProjectMetricNamesInput) DeepCopy() *ProjectMetricNamesInput { + if in == nil { + return nil + } + out := new(ProjectMetricNamesInput) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectMonitorGraph) DeepCopyInto(out *ProjectMonitorGraph) { + *out = *in + out.Namespaced = in.Namespaced + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectMonitorGraph. +func (in *ProjectMonitorGraph) DeepCopy() *ProjectMonitorGraph { + if in == nil { + return nil + } + out := new(ProjectMonitorGraph) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProjectMonitorGraph) 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 *ProjectMonitorGraphList) DeepCopyInto(out *ProjectMonitorGraphList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ProjectMonitorGraph, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectMonitorGraphList. +func (in *ProjectMonitorGraphList) DeepCopy() *ProjectMonitorGraphList { + if in == nil { + return nil + } + out := new(ProjectMonitorGraphList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProjectMonitorGraphList) 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 *ProjectMonitorGraphSpec) DeepCopyInto(out *ProjectMonitorGraphSpec) { + *out = *in + in.CommonMonitorGraphSpec.DeepCopyInto(&out.CommonMonitorGraphSpec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectMonitorGraphSpec. +func (in *ProjectMonitorGraphSpec) DeepCopy() *ProjectMonitorGraphSpec { + if in == nil { + return nil + } + out := new(ProjectMonitorGraphSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ProjectNetworkPolicy) DeepCopyInto(out *ProjectNetworkPolicy) { *out = *in @@ -5107,6 +5971,11 @@ func (in *ProjectStatus) DeepCopyInto(out *ProjectStatus) { *out = make([]ProjectCondition, len(*in)) copy(*out, *in) } + if in.MonitoringStatus != nil { + in, out := &in.MonitoringStatus, &out.MonitoringStatus + *out = new(MonitoringStatus) + (*in).DeepCopyInto(*out) + } return } @@ -5141,6 +6010,197 @@ func (in *PublicEndpoint) DeepCopy() *PublicEndpoint { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *QueryClusterGraph) DeepCopyInto(out *QueryClusterGraph) { + *out = *in + if in.Series != nil { + in, out := &in.Series, &out.Series + *out = make([]*TimeSeries, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(TimeSeries) + (*in).DeepCopyInto(*out) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueryClusterGraph. +func (in *QueryClusterGraph) DeepCopy() *QueryClusterGraph { + if in == nil { + return nil + } + out := new(QueryClusterGraph) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *QueryClusterGraphOutput) DeepCopyInto(out *QueryClusterGraphOutput) { + *out = *in + if in.Data != nil { + in, out := &in.Data, &out.Data + *out = make([]QueryClusterGraph, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueryClusterGraphOutput. +func (in *QueryClusterGraphOutput) DeepCopy() *QueryClusterGraphOutput { + if in == nil { + return nil + } + out := new(QueryClusterGraphOutput) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *QueryClusterMetricInput) DeepCopyInto(out *QueryClusterMetricInput) { + *out = *in + out.CommonQueryMetricInput = in.CommonQueryMetricInput + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueryClusterMetricInput. +func (in *QueryClusterMetricInput) DeepCopy() *QueryClusterMetricInput { + if in == nil { + return nil + } + out := new(QueryClusterMetricInput) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *QueryGraphInput) DeepCopyInto(out *QueryGraphInput) { + *out = *in + if in.MetricParams != nil { + in, out := &in.MetricParams, &out.MetricParams + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Filters != nil { + in, out := &in.Filters, &out.Filters + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueryGraphInput. +func (in *QueryGraphInput) DeepCopy() *QueryGraphInput { + if in == nil { + return nil + } + out := new(QueryGraphInput) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *QueryMetricOutput) DeepCopyInto(out *QueryMetricOutput) { + *out = *in + if in.Series != nil { + in, out := &in.Series, &out.Series + *out = make([]*TimeSeries, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(TimeSeries) + (*in).DeepCopyInto(*out) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueryMetricOutput. +func (in *QueryMetricOutput) DeepCopy() *QueryMetricOutput { + if in == nil { + return nil + } + out := new(QueryMetricOutput) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *QueryProjectGraph) DeepCopyInto(out *QueryProjectGraph) { + *out = *in + if in.Series != nil { + in, out := &in.Series, &out.Series + *out = make([]*TimeSeries, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(TimeSeries) + (*in).DeepCopyInto(*out) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueryProjectGraph. +func (in *QueryProjectGraph) DeepCopy() *QueryProjectGraph { + if in == nil { + return nil + } + out := new(QueryProjectGraph) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *QueryProjectGraphOutput) DeepCopyInto(out *QueryProjectGraphOutput) { + *out = *in + if in.Data != nil { + in, out := &in.Data, &out.Data + *out = make([]QueryProjectGraph, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueryProjectGraphOutput. +func (in *QueryProjectGraphOutput) DeepCopy() *QueryProjectGraphOutput { + if in == nil { + return nil + } + out := new(QueryProjectGraphOutput) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *QueryProjectMetricInput) DeepCopyInto(out *QueryProjectMetricInput) { + *out = *in + out.CommonQueryMetricInput = in.CommonQueryMetricInput + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueryProjectMetricInput. +func (in *QueryProjectMetricInput) DeepCopy() *QueryProjectMetricInput { + if in == nil { + return nil + } + out := new(QueryProjectMetricInput) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Question) DeepCopyInto(out *Question) { *out = *in @@ -5750,6 +6810,22 @@ func (in *SyslogConfig) DeepCopy() *SyslogConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SystemServiceRule) DeepCopyInto(out *SystemServiceRule) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SystemServiceRule. +func (in *SystemServiceRule) DeepCopy() *SystemServiceRule { + if in == nil { + return nil + } + out := new(SystemServiceRule) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Target) DeepCopyInto(out *Target) { *out = *in @@ -6138,6 +7214,49 @@ func (in *TemplateVersionStatus) DeepCopy() *TemplateVersionStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TimeSeries) DeepCopyInto(out *TimeSeries) { + *out = *in + if in.Points != nil { + in, out := &in.Points, &out.Points + *out = make([][]float64, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = make([]float64, len(*in)) + copy(*out, *in) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimeSeries. +func (in *TimeSeries) DeepCopy() *TimeSeries { + if in == nil { + return nil + } + out := new(TimeSeries) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TimingField) DeepCopyInto(out *TimingField) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimingField. +func (in *TimingField) DeepCopy() *TimingField { + if in == nil { + return nil + } + out := new(TimingField) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Token) DeepCopyInto(out *Token) { *out = *in @@ -6537,6 +7656,29 @@ func (in *WindowsSystemImages) DeepCopy() *WindowsSystemImages { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadRule) DeepCopyInto(out *WorkloadRule) { + *out = *in + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadRule. +func (in *WorkloadRule) DeepCopy() *WorkloadRule { + if in == nil { + return nil + } + out := new(WorkloadRule) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WorkspaceVsphereOpts) DeepCopyInto(out *WorkspaceVsphereOpts) { *out = *in @@ -6552,3 +7694,19 @@ func (in *WorkspaceVsphereOpts) DeepCopy() *WorkspaceVsphereOpts { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *YAxis) DeepCopyInto(out *YAxis) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new YAxis. +func (in *YAxis) DeepCopy() *YAxis { + if in == nil { + return nil + } + out := new(YAxis) + in.DeepCopyInto(out) + return out +} diff --git a/apis/management.cattle.io/v3/zz_generated_k8s_client.go b/apis/management.cattle.io/v3/zz_generated_k8s_client.go index 513e8bb4..52925f77 100644 --- a/apis/management.cattle.io/v3/zz_generated_k8s_client.go +++ b/apis/management.cattle.io/v3/zz_generated_k8s_client.go @@ -53,9 +53,13 @@ type Interface interface { ProjectLoggingsGetter ListenConfigsGetter SettingsGetter - NotifiersGetter ClusterAlertsGetter ProjectAlertsGetter + NotifiersGetter + ClusterAlertGroupsGetter + ProjectAlertGroupsGetter + ClusterAlertRulesGetter + ProjectAlertRulesGetter ComposeConfigsGetter ProjectCatalogsGetter ClusterCatalogsGetter @@ -63,6 +67,9 @@ type Interface interface { GlobalDNSsGetter GlobalDNSProvidersGetter KontainerDriversGetter + MonitorMetricsGetter + ClusterMonitorGraphsGetter + ProjectMonitorGraphsGetter } type Clients struct { @@ -99,9 +106,13 @@ type Clients struct { ProjectLogging ProjectLoggingClient ListenConfig ListenConfigClient Setting SettingClient - Notifier NotifierClient ClusterAlert ClusterAlertClient ProjectAlert ProjectAlertClient + Notifier NotifierClient + ClusterAlertGroup ClusterAlertGroupClient + ProjectAlertGroup ProjectAlertGroupClient + ClusterAlertRule ClusterAlertRuleClient + ProjectAlertRule ProjectAlertRuleClient ComposeConfig ComposeConfigClient ProjectCatalog ProjectCatalogClient ClusterCatalog ClusterCatalogClient @@ -109,6 +120,9 @@ type Clients struct { GlobalDNS GlobalDNSClient GlobalDNSProvider GlobalDNSProviderClient KontainerDriver KontainerDriverClient + MonitorMetric MonitorMetricClient + ClusterMonitorGraph ClusterMonitorGraphClient + ProjectMonitorGraph ProjectMonitorGraphClient } type Client struct { @@ -149,9 +163,13 @@ type Client struct { projectLoggingControllers map[string]ProjectLoggingController listenConfigControllers map[string]ListenConfigController settingControllers map[string]SettingController - notifierControllers map[string]NotifierController clusterAlertControllers map[string]ClusterAlertController projectAlertControllers map[string]ProjectAlertController + notifierControllers map[string]NotifierController + clusterAlertGroupControllers map[string]ClusterAlertGroupController + projectAlertGroupControllers map[string]ProjectAlertGroupController + clusterAlertRuleControllers map[string]ClusterAlertRuleController + projectAlertRuleControllers map[string]ProjectAlertRuleController composeConfigControllers map[string]ComposeConfigController projectCatalogControllers map[string]ProjectCatalogController clusterCatalogControllers map[string]ClusterCatalogController @@ -159,6 +177,9 @@ type Client struct { globalDnsControllers map[string]GlobalDNSController globalDnsProviderControllers map[string]GlobalDNSProviderController kontainerDriverControllers map[string]KontainerDriverController + monitorMetricControllers map[string]MonitorMetricController + clusterMonitorGraphControllers map[string]ClusterMonitorGraphController + projectMonitorGraphControllers map[string]ProjectMonitorGraphController } func Factory(ctx context.Context, config rest.Config) (context.Context, controller.Starter, error) { @@ -292,15 +313,27 @@ func NewClientsFromInterface(iface Interface) *Clients { Setting: &settingClient2{ iface: iface.Settings(""), }, - Notifier: ¬ifierClient2{ - iface: iface.Notifiers(""), - }, ClusterAlert: &clusterAlertClient2{ iface: iface.ClusterAlerts(""), }, ProjectAlert: &projectAlertClient2{ iface: iface.ProjectAlerts(""), }, + Notifier: ¬ifierClient2{ + iface: iface.Notifiers(""), + }, + ClusterAlertGroup: &clusterAlertGroupClient2{ + iface: iface.ClusterAlertGroups(""), + }, + ProjectAlertGroup: &projectAlertGroupClient2{ + iface: iface.ProjectAlertGroups(""), + }, + ClusterAlertRule: &clusterAlertRuleClient2{ + iface: iface.ClusterAlertRules(""), + }, + ProjectAlertRule: &projectAlertRuleClient2{ + iface: iface.ProjectAlertRules(""), + }, ComposeConfig: &composeConfigClient2{ iface: iface.ComposeConfigs(""), }, @@ -322,6 +355,15 @@ func NewClientsFromInterface(iface Interface) *Clients { KontainerDriver: &kontainerDriverClient2{ iface: iface.KontainerDrivers(""), }, + MonitorMetric: &monitorMetricClient2{ + iface: iface.MonitorMetrics(""), + }, + ClusterMonitorGraph: &clusterMonitorGraphClient2{ + iface: iface.ClusterMonitorGraphs(""), + }, + ProjectMonitorGraph: &projectMonitorGraphClient2{ + iface: iface.ProjectMonitorGraphs(""), + }, } } @@ -371,9 +413,13 @@ func NewForConfig(config rest.Config) (Interface, error) { projectLoggingControllers: map[string]ProjectLoggingController{}, listenConfigControllers: map[string]ListenConfigController{}, settingControllers: map[string]SettingController{}, - notifierControllers: map[string]NotifierController{}, clusterAlertControllers: map[string]ClusterAlertController{}, projectAlertControllers: map[string]ProjectAlertController{}, + notifierControllers: map[string]NotifierController{}, + clusterAlertGroupControllers: map[string]ClusterAlertGroupController{}, + projectAlertGroupControllers: map[string]ProjectAlertGroupController{}, + clusterAlertRuleControllers: map[string]ClusterAlertRuleController{}, + projectAlertRuleControllers: map[string]ProjectAlertRuleController{}, composeConfigControllers: map[string]ComposeConfigController{}, projectCatalogControllers: map[string]ProjectCatalogController{}, clusterCatalogControllers: map[string]ClusterCatalogController{}, @@ -381,6 +427,9 @@ func NewForConfig(config rest.Config) (Interface, error) { globalDnsControllers: map[string]GlobalDNSController{}, globalDnsProviderControllers: map[string]GlobalDNSProviderController{}, kontainerDriverControllers: map[string]KontainerDriverController{}, + monitorMetricControllers: map[string]MonitorMetricController{}, + clusterMonitorGraphControllers: map[string]ClusterMonitorGraphController{}, + projectMonitorGraphControllers: map[string]ProjectMonitorGraphController{}, }, nil } @@ -825,19 +874,6 @@ func (c *Client) Settings(namespace string) SettingInterface { } } -type NotifiersGetter interface { - Notifiers(namespace string) NotifierInterface -} - -func (c *Client) Notifiers(namespace string) NotifierInterface { - objectClient := objectclient.NewObjectClient(namespace, c.restClient, &NotifierResource, NotifierGroupVersionKind, notifierFactory{}) - return ¬ifierClient{ - ns: namespace, - client: c, - objectClient: objectClient, - } -} - type ClusterAlertsGetter interface { ClusterAlerts(namespace string) ClusterAlertInterface } @@ -864,6 +900,71 @@ func (c *Client) ProjectAlerts(namespace string) ProjectAlertInterface { } } +type NotifiersGetter interface { + Notifiers(namespace string) NotifierInterface +} + +func (c *Client) Notifiers(namespace string) NotifierInterface { + objectClient := objectclient.NewObjectClient(namespace, c.restClient, &NotifierResource, NotifierGroupVersionKind, notifierFactory{}) + return ¬ifierClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type ClusterAlertGroupsGetter interface { + ClusterAlertGroups(namespace string) ClusterAlertGroupInterface +} + +func (c *Client) ClusterAlertGroups(namespace string) ClusterAlertGroupInterface { + objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ClusterAlertGroupResource, ClusterAlertGroupGroupVersionKind, clusterAlertGroupFactory{}) + return &clusterAlertGroupClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type ProjectAlertGroupsGetter interface { + ProjectAlertGroups(namespace string) ProjectAlertGroupInterface +} + +func (c *Client) ProjectAlertGroups(namespace string) ProjectAlertGroupInterface { + objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ProjectAlertGroupResource, ProjectAlertGroupGroupVersionKind, projectAlertGroupFactory{}) + return &projectAlertGroupClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type ClusterAlertRulesGetter interface { + ClusterAlertRules(namespace string) ClusterAlertRuleInterface +} + +func (c *Client) ClusterAlertRules(namespace string) ClusterAlertRuleInterface { + objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ClusterAlertRuleResource, ClusterAlertRuleGroupVersionKind, clusterAlertRuleFactory{}) + return &clusterAlertRuleClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type ProjectAlertRulesGetter interface { + ProjectAlertRules(namespace string) ProjectAlertRuleInterface +} + +func (c *Client) ProjectAlertRules(namespace string) ProjectAlertRuleInterface { + objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ProjectAlertRuleResource, ProjectAlertRuleGroupVersionKind, projectAlertRuleFactory{}) + return &projectAlertRuleClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + type ComposeConfigsGetter interface { ComposeConfigs(namespace string) ComposeConfigInterface } @@ -954,3 +1055,42 @@ func (c *Client) KontainerDrivers(namespace string) KontainerDriverInterface { objectClient: objectClient, } } + +type MonitorMetricsGetter interface { + MonitorMetrics(namespace string) MonitorMetricInterface +} + +func (c *Client) MonitorMetrics(namespace string) MonitorMetricInterface { + objectClient := objectclient.NewObjectClient(namespace, c.restClient, &MonitorMetricResource, MonitorMetricGroupVersionKind, monitorMetricFactory{}) + return &monitorMetricClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type ClusterMonitorGraphsGetter interface { + ClusterMonitorGraphs(namespace string) ClusterMonitorGraphInterface +} + +func (c *Client) ClusterMonitorGraphs(namespace string) ClusterMonitorGraphInterface { + objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ClusterMonitorGraphResource, ClusterMonitorGraphGroupVersionKind, clusterMonitorGraphFactory{}) + return &clusterMonitorGraphClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type ProjectMonitorGraphsGetter interface { + ProjectMonitorGraphs(namespace string) ProjectMonitorGraphInterface +} + +func (c *Client) ProjectMonitorGraphs(namespace string) ProjectMonitorGraphInterface { + objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ProjectMonitorGraphResource, ProjectMonitorGraphGroupVersionKind, projectMonitorGraphFactory{}) + return &projectMonitorGraphClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} diff --git a/apis/management.cattle.io/v3/zz_generated_monitor_metric_controller.go b/apis/management.cattle.io/v3/zz_generated_monitor_metric_controller.go new file mode 100644 index 00000000..a8ebfb84 --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_monitor_metric_controller.go @@ -0,0 +1,427 @@ +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/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + MonitorMetricGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "MonitorMetric", + } + MonitorMetricResource = metav1.APIResource{ + Name: "monitormetrics", + SingularName: "monitormetric", + Namespaced: true, + + Kind: MonitorMetricGroupVersionKind.Kind, + } +) + +type MonitorMetricList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []MonitorMetric +} + +type MonitorMetricHandlerFunc func(key string, obj *MonitorMetric) (runtime.Object, error) + +type MonitorMetricChangeHandlerFunc func(obj *MonitorMetric) (runtime.Object, error) + +type MonitorMetricLister interface { + List(namespace string, selector labels.Selector) (ret []*MonitorMetric, err error) + Get(namespace, name string) (*MonitorMetric, error) +} + +type MonitorMetricController interface { + Generic() controller.GenericController + Informer() cache.SharedIndexInformer + Lister() MonitorMetricLister + AddHandler(ctx context.Context, name string, handler MonitorMetricHandlerFunc) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler MonitorMetricHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type MonitorMetricInterface interface { + ObjectClient() *objectclient.ObjectClient + Create(*MonitorMetric) (*MonitorMetric, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*MonitorMetric, error) + Get(name string, opts metav1.GetOptions) (*MonitorMetric, error) + Update(*MonitorMetric) (*MonitorMetric, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*MonitorMetricList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() MonitorMetricController + AddHandler(ctx context.Context, name string, sync MonitorMetricHandlerFunc) + AddLifecycle(ctx context.Context, name string, lifecycle MonitorMetricLifecycle) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync MonitorMetricHandlerFunc) + AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle MonitorMetricLifecycle) +} + +type monitorMetricLister struct { + controller *monitorMetricController +} + +func (l *monitorMetricLister) List(namespace string, selector labels.Selector) (ret []*MonitorMetric, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*MonitorMetric)) + }) + return +} + +func (l *monitorMetricLister) Get(namespace, name string) (*MonitorMetric, 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: MonitorMetricGroupVersionKind.Group, + Resource: "monitorMetric", + }, key) + } + return obj.(*MonitorMetric), nil +} + +type monitorMetricController struct { + controller.GenericController +} + +func (c *monitorMetricController) Generic() controller.GenericController { + return c.GenericController +} + +func (c *monitorMetricController) Lister() MonitorMetricLister { + return &monitorMetricLister{ + controller: c, + } +} + +func (c *monitorMetricController) AddHandler(ctx context.Context, name string, handler MonitorMetricHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*MonitorMetric); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *monitorMetricController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler MonitorMetricHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*MonitorMetric); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +type monitorMetricFactory struct { +} + +func (c monitorMetricFactory) Object() runtime.Object { + return &MonitorMetric{} +} + +func (c monitorMetricFactory) List() runtime.Object { + return &MonitorMetricList{} +} + +func (s *monitorMetricClient) Controller() MonitorMetricController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.monitorMetricControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(MonitorMetricGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &monitorMetricController{ + GenericController: genericController, + } + + s.client.monitorMetricControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type monitorMetricClient struct { + client *Client + ns string + objectClient *objectclient.ObjectClient + controller MonitorMetricController +} + +func (s *monitorMetricClient) ObjectClient() *objectclient.ObjectClient { + return s.objectClient +} + +func (s *monitorMetricClient) Create(o *MonitorMetric) (*MonitorMetric, error) { + obj, err := s.objectClient.Create(o) + return obj.(*MonitorMetric), err +} + +func (s *monitorMetricClient) Get(name string, opts metav1.GetOptions) (*MonitorMetric, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*MonitorMetric), err +} + +func (s *monitorMetricClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*MonitorMetric, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*MonitorMetric), err +} + +func (s *monitorMetricClient) Update(o *MonitorMetric) (*MonitorMetric, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*MonitorMetric), err +} + +func (s *monitorMetricClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *monitorMetricClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *monitorMetricClient) List(opts metav1.ListOptions) (*MonitorMetricList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*MonitorMetricList), err +} + +func (s *monitorMetricClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *monitorMetricClient) Patch(o *MonitorMetric, data []byte, subresources ...string) (*MonitorMetric, error) { + obj, err := s.objectClient.Patch(o.Name, o, data, subresources...) + return obj.(*MonitorMetric), err +} + +func (s *monitorMetricClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *monitorMetricClient) AddHandler(ctx context.Context, name string, sync MonitorMetricHandlerFunc) { + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *monitorMetricClient) AddLifecycle(ctx context.Context, name string, lifecycle MonitorMetricLifecycle) { + sync := NewMonitorMetricLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *monitorMetricClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync MonitorMetricHandlerFunc) { + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *monitorMetricClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle MonitorMetricLifecycle) { + sync := NewMonitorMetricLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +type MonitorMetricIndexer func(obj *MonitorMetric) ([]string, error) + +type MonitorMetricClientCache interface { + Get(namespace, name string) (*MonitorMetric, error) + List(namespace string, selector labels.Selector) ([]*MonitorMetric, error) + + Index(name string, indexer MonitorMetricIndexer) + GetIndexed(name, key string) ([]*MonitorMetric, error) +} + +type MonitorMetricClient interface { + Create(*MonitorMetric) (*MonitorMetric, error) + Get(namespace, name string, opts metav1.GetOptions) (*MonitorMetric, error) + Update(*MonitorMetric) (*MonitorMetric, error) + Delete(namespace, name string, options *metav1.DeleteOptions) error + List(namespace string, opts metav1.ListOptions) (*MonitorMetricList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + + Cache() MonitorMetricClientCache + + OnCreate(ctx context.Context, name string, sync MonitorMetricChangeHandlerFunc) + OnChange(ctx context.Context, name string, sync MonitorMetricChangeHandlerFunc) + OnRemove(ctx context.Context, name string, sync MonitorMetricChangeHandlerFunc) + Enqueue(namespace, name string) + + Generic() controller.GenericController + Interface() MonitorMetricInterface +} + +type monitorMetricClientCache struct { + client *monitorMetricClient2 +} + +type monitorMetricClient2 struct { + iface MonitorMetricInterface + controller MonitorMetricController +} + +func (n *monitorMetricClient2) Interface() MonitorMetricInterface { + return n.iface +} + +func (n *monitorMetricClient2) Generic() controller.GenericController { + return n.iface.Controller().Generic() +} + +func (n *monitorMetricClient2) Enqueue(namespace, name string) { + n.iface.Controller().Enqueue(namespace, name) +} + +func (n *monitorMetricClient2) Create(obj *MonitorMetric) (*MonitorMetric, error) { + return n.iface.Create(obj) +} + +func (n *monitorMetricClient2) Get(namespace, name string, opts metav1.GetOptions) (*MonitorMetric, error) { + return n.iface.GetNamespaced(namespace, name, opts) +} + +func (n *monitorMetricClient2) Update(obj *MonitorMetric) (*MonitorMetric, error) { + return n.iface.Update(obj) +} + +func (n *monitorMetricClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error { + return n.iface.DeleteNamespaced(namespace, name, options) +} + +func (n *monitorMetricClient2) List(namespace string, opts metav1.ListOptions) (*MonitorMetricList, error) { + return n.iface.List(opts) +} + +func (n *monitorMetricClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return n.iface.Watch(opts) +} + +func (n *monitorMetricClientCache) Get(namespace, name string) (*MonitorMetric, error) { + return n.client.controller.Lister().Get(namespace, name) +} + +func (n *monitorMetricClientCache) List(namespace string, selector labels.Selector) ([]*MonitorMetric, error) { + return n.client.controller.Lister().List(namespace, selector) +} + +func (n *monitorMetricClient2) Cache() MonitorMetricClientCache { + n.loadController() + return &monitorMetricClientCache{ + client: n, + } +} + +func (n *monitorMetricClient2) OnCreate(ctx context.Context, name string, sync MonitorMetricChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-create", &monitorMetricLifecycleDelegate{create: sync}) +} + +func (n *monitorMetricClient2) OnChange(ctx context.Context, name string, sync MonitorMetricChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-change", &monitorMetricLifecycleDelegate{update: sync}) +} + +func (n *monitorMetricClient2) OnRemove(ctx context.Context, name string, sync MonitorMetricChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name, &monitorMetricLifecycleDelegate{remove: sync}) +} + +func (n *monitorMetricClientCache) Index(name string, indexer MonitorMetricIndexer) { + err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{ + name: func(obj interface{}) ([]string, error) { + if v, ok := obj.(*MonitorMetric); ok { + return indexer(v) + } + return nil, nil + }, + }) + + if err != nil { + panic(err) + } +} + +func (n *monitorMetricClientCache) GetIndexed(name, key string) ([]*MonitorMetric, error) { + var result []*MonitorMetric + objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key) + if err != nil { + return nil, err + } + for _, obj := range objs { + if v, ok := obj.(*MonitorMetric); ok { + result = append(result, v) + } + } + + return result, nil +} + +func (n *monitorMetricClient2) loadController() { + if n.controller == nil { + n.controller = n.iface.Controller() + } +} + +type monitorMetricLifecycleDelegate struct { + create MonitorMetricChangeHandlerFunc + update MonitorMetricChangeHandlerFunc + remove MonitorMetricChangeHandlerFunc +} + +func (n *monitorMetricLifecycleDelegate) HasCreate() bool { + return n.create != nil +} + +func (n *monitorMetricLifecycleDelegate) Create(obj *MonitorMetric) (runtime.Object, error) { + if n.create == nil { + return obj, nil + } + return n.create(obj) +} + +func (n *monitorMetricLifecycleDelegate) HasFinalize() bool { + return n.remove != nil +} + +func (n *monitorMetricLifecycleDelegate) Remove(obj *MonitorMetric) (runtime.Object, error) { + if n.remove == nil { + return obj, nil + } + return n.remove(obj) +} + +func (n *monitorMetricLifecycleDelegate) Updated(obj *MonitorMetric) (runtime.Object, error) { + if n.update == nil { + return obj, nil + } + return n.update(obj) +} diff --git a/apis/management.cattle.io/v3/zz_generated_monitor_metric_lifecycle_adapter.go b/apis/management.cattle.io/v3/zz_generated_monitor_metric_lifecycle_adapter.go new file mode 100644 index 00000000..fd3ed209 --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_monitor_metric_lifecycle_adapter.go @@ -0,0 +1,62 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type MonitorMetricLifecycle interface { + Create(obj *MonitorMetric) (runtime.Object, error) + Remove(obj *MonitorMetric) (runtime.Object, error) + Updated(obj *MonitorMetric) (runtime.Object, error) +} + +type monitorMetricLifecycleAdapter struct { + lifecycle MonitorMetricLifecycle +} + +func (w *monitorMetricLifecycleAdapter) HasCreate() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasCreate() +} + +func (w *monitorMetricLifecycleAdapter) HasFinalize() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasFinalize() +} + +func (w *monitorMetricLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*MonitorMetric)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *monitorMetricLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*MonitorMetric)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *monitorMetricLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*MonitorMetric)) + if o == nil { + return nil, err + } + return o, err +} + +func NewMonitorMetricLifecycleAdapter(name string, clusterScoped bool, client MonitorMetricInterface, l MonitorMetricLifecycle) MonitorMetricHandlerFunc { + adapter := &monitorMetricLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *MonitorMetric) (runtime.Object, error) { + newObj, err := syncFn(key, obj) + if o, ok := newObj.(runtime.Object); ok { + return o, err + } + return nil, err + } +} diff --git a/apis/management.cattle.io/v3/zz_generated_project_alert_group_controller.go b/apis/management.cattle.io/v3/zz_generated_project_alert_group_controller.go new file mode 100644 index 00000000..88684948 --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_project_alert_group_controller.go @@ -0,0 +1,427 @@ +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/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + ProjectAlertGroupGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "ProjectAlertGroup", + } + ProjectAlertGroupResource = metav1.APIResource{ + Name: "projectalertgroups", + SingularName: "projectalertgroup", + Namespaced: true, + + Kind: ProjectAlertGroupGroupVersionKind.Kind, + } +) + +type ProjectAlertGroupList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ProjectAlertGroup +} + +type ProjectAlertGroupHandlerFunc func(key string, obj *ProjectAlertGroup) (runtime.Object, error) + +type ProjectAlertGroupChangeHandlerFunc func(obj *ProjectAlertGroup) (runtime.Object, error) + +type ProjectAlertGroupLister interface { + List(namespace string, selector labels.Selector) (ret []*ProjectAlertGroup, err error) + Get(namespace, name string) (*ProjectAlertGroup, error) +} + +type ProjectAlertGroupController interface { + Generic() controller.GenericController + Informer() cache.SharedIndexInformer + Lister() ProjectAlertGroupLister + AddHandler(ctx context.Context, name string, handler ProjectAlertGroupHandlerFunc) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler ProjectAlertGroupHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type ProjectAlertGroupInterface interface { + ObjectClient() *objectclient.ObjectClient + Create(*ProjectAlertGroup) (*ProjectAlertGroup, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ProjectAlertGroup, error) + Get(name string, opts metav1.GetOptions) (*ProjectAlertGroup, error) + Update(*ProjectAlertGroup) (*ProjectAlertGroup, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*ProjectAlertGroupList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() ProjectAlertGroupController + AddHandler(ctx context.Context, name string, sync ProjectAlertGroupHandlerFunc) + AddLifecycle(ctx context.Context, name string, lifecycle ProjectAlertGroupLifecycle) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ProjectAlertGroupHandlerFunc) + AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ProjectAlertGroupLifecycle) +} + +type projectAlertGroupLister struct { + controller *projectAlertGroupController +} + +func (l *projectAlertGroupLister) List(namespace string, selector labels.Selector) (ret []*ProjectAlertGroup, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*ProjectAlertGroup)) + }) + return +} + +func (l *projectAlertGroupLister) Get(namespace, name string) (*ProjectAlertGroup, 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: ProjectAlertGroupGroupVersionKind.Group, + Resource: "projectAlertGroup", + }, key) + } + return obj.(*ProjectAlertGroup), nil +} + +type projectAlertGroupController struct { + controller.GenericController +} + +func (c *projectAlertGroupController) Generic() controller.GenericController { + return c.GenericController +} + +func (c *projectAlertGroupController) Lister() ProjectAlertGroupLister { + return &projectAlertGroupLister{ + controller: c, + } +} + +func (c *projectAlertGroupController) AddHandler(ctx context.Context, name string, handler ProjectAlertGroupHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*ProjectAlertGroup); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *projectAlertGroupController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler ProjectAlertGroupHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*ProjectAlertGroup); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +type projectAlertGroupFactory struct { +} + +func (c projectAlertGroupFactory) Object() runtime.Object { + return &ProjectAlertGroup{} +} + +func (c projectAlertGroupFactory) List() runtime.Object { + return &ProjectAlertGroupList{} +} + +func (s *projectAlertGroupClient) Controller() ProjectAlertGroupController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.projectAlertGroupControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(ProjectAlertGroupGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &projectAlertGroupController{ + GenericController: genericController, + } + + s.client.projectAlertGroupControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type projectAlertGroupClient struct { + client *Client + ns string + objectClient *objectclient.ObjectClient + controller ProjectAlertGroupController +} + +func (s *projectAlertGroupClient) ObjectClient() *objectclient.ObjectClient { + return s.objectClient +} + +func (s *projectAlertGroupClient) Create(o *ProjectAlertGroup) (*ProjectAlertGroup, error) { + obj, err := s.objectClient.Create(o) + return obj.(*ProjectAlertGroup), err +} + +func (s *projectAlertGroupClient) Get(name string, opts metav1.GetOptions) (*ProjectAlertGroup, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*ProjectAlertGroup), err +} + +func (s *projectAlertGroupClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ProjectAlertGroup, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*ProjectAlertGroup), err +} + +func (s *projectAlertGroupClient) Update(o *ProjectAlertGroup) (*ProjectAlertGroup, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*ProjectAlertGroup), err +} + +func (s *projectAlertGroupClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *projectAlertGroupClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *projectAlertGroupClient) List(opts metav1.ListOptions) (*ProjectAlertGroupList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*ProjectAlertGroupList), err +} + +func (s *projectAlertGroupClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *projectAlertGroupClient) Patch(o *ProjectAlertGroup, data []byte, subresources ...string) (*ProjectAlertGroup, error) { + obj, err := s.objectClient.Patch(o.Name, o, data, subresources...) + return obj.(*ProjectAlertGroup), err +} + +func (s *projectAlertGroupClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *projectAlertGroupClient) AddHandler(ctx context.Context, name string, sync ProjectAlertGroupHandlerFunc) { + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *projectAlertGroupClient) AddLifecycle(ctx context.Context, name string, lifecycle ProjectAlertGroupLifecycle) { + sync := NewProjectAlertGroupLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *projectAlertGroupClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ProjectAlertGroupHandlerFunc) { + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *projectAlertGroupClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ProjectAlertGroupLifecycle) { + sync := NewProjectAlertGroupLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +type ProjectAlertGroupIndexer func(obj *ProjectAlertGroup) ([]string, error) + +type ProjectAlertGroupClientCache interface { + Get(namespace, name string) (*ProjectAlertGroup, error) + List(namespace string, selector labels.Selector) ([]*ProjectAlertGroup, error) + + Index(name string, indexer ProjectAlertGroupIndexer) + GetIndexed(name, key string) ([]*ProjectAlertGroup, error) +} + +type ProjectAlertGroupClient interface { + Create(*ProjectAlertGroup) (*ProjectAlertGroup, error) + Get(namespace, name string, opts metav1.GetOptions) (*ProjectAlertGroup, error) + Update(*ProjectAlertGroup) (*ProjectAlertGroup, error) + Delete(namespace, name string, options *metav1.DeleteOptions) error + List(namespace string, opts metav1.ListOptions) (*ProjectAlertGroupList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + + Cache() ProjectAlertGroupClientCache + + OnCreate(ctx context.Context, name string, sync ProjectAlertGroupChangeHandlerFunc) + OnChange(ctx context.Context, name string, sync ProjectAlertGroupChangeHandlerFunc) + OnRemove(ctx context.Context, name string, sync ProjectAlertGroupChangeHandlerFunc) + Enqueue(namespace, name string) + + Generic() controller.GenericController + Interface() ProjectAlertGroupInterface +} + +type projectAlertGroupClientCache struct { + client *projectAlertGroupClient2 +} + +type projectAlertGroupClient2 struct { + iface ProjectAlertGroupInterface + controller ProjectAlertGroupController +} + +func (n *projectAlertGroupClient2) Interface() ProjectAlertGroupInterface { + return n.iface +} + +func (n *projectAlertGroupClient2) Generic() controller.GenericController { + return n.iface.Controller().Generic() +} + +func (n *projectAlertGroupClient2) Enqueue(namespace, name string) { + n.iface.Controller().Enqueue(namespace, name) +} + +func (n *projectAlertGroupClient2) Create(obj *ProjectAlertGroup) (*ProjectAlertGroup, error) { + return n.iface.Create(obj) +} + +func (n *projectAlertGroupClient2) Get(namespace, name string, opts metav1.GetOptions) (*ProjectAlertGroup, error) { + return n.iface.GetNamespaced(namespace, name, opts) +} + +func (n *projectAlertGroupClient2) Update(obj *ProjectAlertGroup) (*ProjectAlertGroup, error) { + return n.iface.Update(obj) +} + +func (n *projectAlertGroupClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error { + return n.iface.DeleteNamespaced(namespace, name, options) +} + +func (n *projectAlertGroupClient2) List(namespace string, opts metav1.ListOptions) (*ProjectAlertGroupList, error) { + return n.iface.List(opts) +} + +func (n *projectAlertGroupClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return n.iface.Watch(opts) +} + +func (n *projectAlertGroupClientCache) Get(namespace, name string) (*ProjectAlertGroup, error) { + return n.client.controller.Lister().Get(namespace, name) +} + +func (n *projectAlertGroupClientCache) List(namespace string, selector labels.Selector) ([]*ProjectAlertGroup, error) { + return n.client.controller.Lister().List(namespace, selector) +} + +func (n *projectAlertGroupClient2) Cache() ProjectAlertGroupClientCache { + n.loadController() + return &projectAlertGroupClientCache{ + client: n, + } +} + +func (n *projectAlertGroupClient2) OnCreate(ctx context.Context, name string, sync ProjectAlertGroupChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-create", &projectAlertGroupLifecycleDelegate{create: sync}) +} + +func (n *projectAlertGroupClient2) OnChange(ctx context.Context, name string, sync ProjectAlertGroupChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-change", &projectAlertGroupLifecycleDelegate{update: sync}) +} + +func (n *projectAlertGroupClient2) OnRemove(ctx context.Context, name string, sync ProjectAlertGroupChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name, &projectAlertGroupLifecycleDelegate{remove: sync}) +} + +func (n *projectAlertGroupClientCache) Index(name string, indexer ProjectAlertGroupIndexer) { + err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{ + name: func(obj interface{}) ([]string, error) { + if v, ok := obj.(*ProjectAlertGroup); ok { + return indexer(v) + } + return nil, nil + }, + }) + + if err != nil { + panic(err) + } +} + +func (n *projectAlertGroupClientCache) GetIndexed(name, key string) ([]*ProjectAlertGroup, error) { + var result []*ProjectAlertGroup + objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key) + if err != nil { + return nil, err + } + for _, obj := range objs { + if v, ok := obj.(*ProjectAlertGroup); ok { + result = append(result, v) + } + } + + return result, nil +} + +func (n *projectAlertGroupClient2) loadController() { + if n.controller == nil { + n.controller = n.iface.Controller() + } +} + +type projectAlertGroupLifecycleDelegate struct { + create ProjectAlertGroupChangeHandlerFunc + update ProjectAlertGroupChangeHandlerFunc + remove ProjectAlertGroupChangeHandlerFunc +} + +func (n *projectAlertGroupLifecycleDelegate) HasCreate() bool { + return n.create != nil +} + +func (n *projectAlertGroupLifecycleDelegate) Create(obj *ProjectAlertGroup) (runtime.Object, error) { + if n.create == nil { + return obj, nil + } + return n.create(obj) +} + +func (n *projectAlertGroupLifecycleDelegate) HasFinalize() bool { + return n.remove != nil +} + +func (n *projectAlertGroupLifecycleDelegate) Remove(obj *ProjectAlertGroup) (runtime.Object, error) { + if n.remove == nil { + return obj, nil + } + return n.remove(obj) +} + +func (n *projectAlertGroupLifecycleDelegate) Updated(obj *ProjectAlertGroup) (runtime.Object, error) { + if n.update == nil { + return obj, nil + } + return n.update(obj) +} diff --git a/apis/management.cattle.io/v3/zz_generated_project_alert_group_lifecycle_adapter.go b/apis/management.cattle.io/v3/zz_generated_project_alert_group_lifecycle_adapter.go new file mode 100644 index 00000000..4ff4dd2b --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_project_alert_group_lifecycle_adapter.go @@ -0,0 +1,62 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type ProjectAlertGroupLifecycle interface { + Create(obj *ProjectAlertGroup) (runtime.Object, error) + Remove(obj *ProjectAlertGroup) (runtime.Object, error) + Updated(obj *ProjectAlertGroup) (runtime.Object, error) +} + +type projectAlertGroupLifecycleAdapter struct { + lifecycle ProjectAlertGroupLifecycle +} + +func (w *projectAlertGroupLifecycleAdapter) HasCreate() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasCreate() +} + +func (w *projectAlertGroupLifecycleAdapter) HasFinalize() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasFinalize() +} + +func (w *projectAlertGroupLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*ProjectAlertGroup)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *projectAlertGroupLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*ProjectAlertGroup)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *projectAlertGroupLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*ProjectAlertGroup)) + if o == nil { + return nil, err + } + return o, err +} + +func NewProjectAlertGroupLifecycleAdapter(name string, clusterScoped bool, client ProjectAlertGroupInterface, l ProjectAlertGroupLifecycle) ProjectAlertGroupHandlerFunc { + adapter := &projectAlertGroupLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *ProjectAlertGroup) (runtime.Object, error) { + newObj, err := syncFn(key, obj) + if o, ok := newObj.(runtime.Object); ok { + return o, err + } + return nil, err + } +} diff --git a/apis/management.cattle.io/v3/zz_generated_project_alert_rule_controller.go b/apis/management.cattle.io/v3/zz_generated_project_alert_rule_controller.go new file mode 100644 index 00000000..5c3e36f8 --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_project_alert_rule_controller.go @@ -0,0 +1,427 @@ +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/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + ProjectAlertRuleGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "ProjectAlertRule", + } + ProjectAlertRuleResource = metav1.APIResource{ + Name: "projectalertrules", + SingularName: "projectalertrule", + Namespaced: true, + + Kind: ProjectAlertRuleGroupVersionKind.Kind, + } +) + +type ProjectAlertRuleList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ProjectAlertRule +} + +type ProjectAlertRuleHandlerFunc func(key string, obj *ProjectAlertRule) (runtime.Object, error) + +type ProjectAlertRuleChangeHandlerFunc func(obj *ProjectAlertRule) (runtime.Object, error) + +type ProjectAlertRuleLister interface { + List(namespace string, selector labels.Selector) (ret []*ProjectAlertRule, err error) + Get(namespace, name string) (*ProjectAlertRule, error) +} + +type ProjectAlertRuleController interface { + Generic() controller.GenericController + Informer() cache.SharedIndexInformer + Lister() ProjectAlertRuleLister + AddHandler(ctx context.Context, name string, handler ProjectAlertRuleHandlerFunc) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler ProjectAlertRuleHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type ProjectAlertRuleInterface interface { + ObjectClient() *objectclient.ObjectClient + Create(*ProjectAlertRule) (*ProjectAlertRule, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ProjectAlertRule, error) + Get(name string, opts metav1.GetOptions) (*ProjectAlertRule, error) + Update(*ProjectAlertRule) (*ProjectAlertRule, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*ProjectAlertRuleList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() ProjectAlertRuleController + AddHandler(ctx context.Context, name string, sync ProjectAlertRuleHandlerFunc) + AddLifecycle(ctx context.Context, name string, lifecycle ProjectAlertRuleLifecycle) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ProjectAlertRuleHandlerFunc) + AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ProjectAlertRuleLifecycle) +} + +type projectAlertRuleLister struct { + controller *projectAlertRuleController +} + +func (l *projectAlertRuleLister) List(namespace string, selector labels.Selector) (ret []*ProjectAlertRule, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*ProjectAlertRule)) + }) + return +} + +func (l *projectAlertRuleLister) Get(namespace, name string) (*ProjectAlertRule, 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: ProjectAlertRuleGroupVersionKind.Group, + Resource: "projectAlertRule", + }, key) + } + return obj.(*ProjectAlertRule), nil +} + +type projectAlertRuleController struct { + controller.GenericController +} + +func (c *projectAlertRuleController) Generic() controller.GenericController { + return c.GenericController +} + +func (c *projectAlertRuleController) Lister() ProjectAlertRuleLister { + return &projectAlertRuleLister{ + controller: c, + } +} + +func (c *projectAlertRuleController) AddHandler(ctx context.Context, name string, handler ProjectAlertRuleHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*ProjectAlertRule); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *projectAlertRuleController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler ProjectAlertRuleHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*ProjectAlertRule); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +type projectAlertRuleFactory struct { +} + +func (c projectAlertRuleFactory) Object() runtime.Object { + return &ProjectAlertRule{} +} + +func (c projectAlertRuleFactory) List() runtime.Object { + return &ProjectAlertRuleList{} +} + +func (s *projectAlertRuleClient) Controller() ProjectAlertRuleController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.projectAlertRuleControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(ProjectAlertRuleGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &projectAlertRuleController{ + GenericController: genericController, + } + + s.client.projectAlertRuleControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type projectAlertRuleClient struct { + client *Client + ns string + objectClient *objectclient.ObjectClient + controller ProjectAlertRuleController +} + +func (s *projectAlertRuleClient) ObjectClient() *objectclient.ObjectClient { + return s.objectClient +} + +func (s *projectAlertRuleClient) Create(o *ProjectAlertRule) (*ProjectAlertRule, error) { + obj, err := s.objectClient.Create(o) + return obj.(*ProjectAlertRule), err +} + +func (s *projectAlertRuleClient) Get(name string, opts metav1.GetOptions) (*ProjectAlertRule, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*ProjectAlertRule), err +} + +func (s *projectAlertRuleClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ProjectAlertRule, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*ProjectAlertRule), err +} + +func (s *projectAlertRuleClient) Update(o *ProjectAlertRule) (*ProjectAlertRule, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*ProjectAlertRule), err +} + +func (s *projectAlertRuleClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *projectAlertRuleClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *projectAlertRuleClient) List(opts metav1.ListOptions) (*ProjectAlertRuleList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*ProjectAlertRuleList), err +} + +func (s *projectAlertRuleClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *projectAlertRuleClient) Patch(o *ProjectAlertRule, data []byte, subresources ...string) (*ProjectAlertRule, error) { + obj, err := s.objectClient.Patch(o.Name, o, data, subresources...) + return obj.(*ProjectAlertRule), err +} + +func (s *projectAlertRuleClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *projectAlertRuleClient) AddHandler(ctx context.Context, name string, sync ProjectAlertRuleHandlerFunc) { + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *projectAlertRuleClient) AddLifecycle(ctx context.Context, name string, lifecycle ProjectAlertRuleLifecycle) { + sync := NewProjectAlertRuleLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *projectAlertRuleClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ProjectAlertRuleHandlerFunc) { + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *projectAlertRuleClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ProjectAlertRuleLifecycle) { + sync := NewProjectAlertRuleLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +type ProjectAlertRuleIndexer func(obj *ProjectAlertRule) ([]string, error) + +type ProjectAlertRuleClientCache interface { + Get(namespace, name string) (*ProjectAlertRule, error) + List(namespace string, selector labels.Selector) ([]*ProjectAlertRule, error) + + Index(name string, indexer ProjectAlertRuleIndexer) + GetIndexed(name, key string) ([]*ProjectAlertRule, error) +} + +type ProjectAlertRuleClient interface { + Create(*ProjectAlertRule) (*ProjectAlertRule, error) + Get(namespace, name string, opts metav1.GetOptions) (*ProjectAlertRule, error) + Update(*ProjectAlertRule) (*ProjectAlertRule, error) + Delete(namespace, name string, options *metav1.DeleteOptions) error + List(namespace string, opts metav1.ListOptions) (*ProjectAlertRuleList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + + Cache() ProjectAlertRuleClientCache + + OnCreate(ctx context.Context, name string, sync ProjectAlertRuleChangeHandlerFunc) + OnChange(ctx context.Context, name string, sync ProjectAlertRuleChangeHandlerFunc) + OnRemove(ctx context.Context, name string, sync ProjectAlertRuleChangeHandlerFunc) + Enqueue(namespace, name string) + + Generic() controller.GenericController + Interface() ProjectAlertRuleInterface +} + +type projectAlertRuleClientCache struct { + client *projectAlertRuleClient2 +} + +type projectAlertRuleClient2 struct { + iface ProjectAlertRuleInterface + controller ProjectAlertRuleController +} + +func (n *projectAlertRuleClient2) Interface() ProjectAlertRuleInterface { + return n.iface +} + +func (n *projectAlertRuleClient2) Generic() controller.GenericController { + return n.iface.Controller().Generic() +} + +func (n *projectAlertRuleClient2) Enqueue(namespace, name string) { + n.iface.Controller().Enqueue(namespace, name) +} + +func (n *projectAlertRuleClient2) Create(obj *ProjectAlertRule) (*ProjectAlertRule, error) { + return n.iface.Create(obj) +} + +func (n *projectAlertRuleClient2) Get(namespace, name string, opts metav1.GetOptions) (*ProjectAlertRule, error) { + return n.iface.GetNamespaced(namespace, name, opts) +} + +func (n *projectAlertRuleClient2) Update(obj *ProjectAlertRule) (*ProjectAlertRule, error) { + return n.iface.Update(obj) +} + +func (n *projectAlertRuleClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error { + return n.iface.DeleteNamespaced(namespace, name, options) +} + +func (n *projectAlertRuleClient2) List(namespace string, opts metav1.ListOptions) (*ProjectAlertRuleList, error) { + return n.iface.List(opts) +} + +func (n *projectAlertRuleClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return n.iface.Watch(opts) +} + +func (n *projectAlertRuleClientCache) Get(namespace, name string) (*ProjectAlertRule, error) { + return n.client.controller.Lister().Get(namespace, name) +} + +func (n *projectAlertRuleClientCache) List(namespace string, selector labels.Selector) ([]*ProjectAlertRule, error) { + return n.client.controller.Lister().List(namespace, selector) +} + +func (n *projectAlertRuleClient2) Cache() ProjectAlertRuleClientCache { + n.loadController() + return &projectAlertRuleClientCache{ + client: n, + } +} + +func (n *projectAlertRuleClient2) OnCreate(ctx context.Context, name string, sync ProjectAlertRuleChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-create", &projectAlertRuleLifecycleDelegate{create: sync}) +} + +func (n *projectAlertRuleClient2) OnChange(ctx context.Context, name string, sync ProjectAlertRuleChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-change", &projectAlertRuleLifecycleDelegate{update: sync}) +} + +func (n *projectAlertRuleClient2) OnRemove(ctx context.Context, name string, sync ProjectAlertRuleChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name, &projectAlertRuleLifecycleDelegate{remove: sync}) +} + +func (n *projectAlertRuleClientCache) Index(name string, indexer ProjectAlertRuleIndexer) { + err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{ + name: func(obj interface{}) ([]string, error) { + if v, ok := obj.(*ProjectAlertRule); ok { + return indexer(v) + } + return nil, nil + }, + }) + + if err != nil { + panic(err) + } +} + +func (n *projectAlertRuleClientCache) GetIndexed(name, key string) ([]*ProjectAlertRule, error) { + var result []*ProjectAlertRule + objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key) + if err != nil { + return nil, err + } + for _, obj := range objs { + if v, ok := obj.(*ProjectAlertRule); ok { + result = append(result, v) + } + } + + return result, nil +} + +func (n *projectAlertRuleClient2) loadController() { + if n.controller == nil { + n.controller = n.iface.Controller() + } +} + +type projectAlertRuleLifecycleDelegate struct { + create ProjectAlertRuleChangeHandlerFunc + update ProjectAlertRuleChangeHandlerFunc + remove ProjectAlertRuleChangeHandlerFunc +} + +func (n *projectAlertRuleLifecycleDelegate) HasCreate() bool { + return n.create != nil +} + +func (n *projectAlertRuleLifecycleDelegate) Create(obj *ProjectAlertRule) (runtime.Object, error) { + if n.create == nil { + return obj, nil + } + return n.create(obj) +} + +func (n *projectAlertRuleLifecycleDelegate) HasFinalize() bool { + return n.remove != nil +} + +func (n *projectAlertRuleLifecycleDelegate) Remove(obj *ProjectAlertRule) (runtime.Object, error) { + if n.remove == nil { + return obj, nil + } + return n.remove(obj) +} + +func (n *projectAlertRuleLifecycleDelegate) Updated(obj *ProjectAlertRule) (runtime.Object, error) { + if n.update == nil { + return obj, nil + } + return n.update(obj) +} diff --git a/apis/management.cattle.io/v3/zz_generated_project_alert_rule_lifecycle_adapter.go b/apis/management.cattle.io/v3/zz_generated_project_alert_rule_lifecycle_adapter.go new file mode 100644 index 00000000..20531062 --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_project_alert_rule_lifecycle_adapter.go @@ -0,0 +1,62 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type ProjectAlertRuleLifecycle interface { + Create(obj *ProjectAlertRule) (runtime.Object, error) + Remove(obj *ProjectAlertRule) (runtime.Object, error) + Updated(obj *ProjectAlertRule) (runtime.Object, error) +} + +type projectAlertRuleLifecycleAdapter struct { + lifecycle ProjectAlertRuleLifecycle +} + +func (w *projectAlertRuleLifecycleAdapter) HasCreate() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasCreate() +} + +func (w *projectAlertRuleLifecycleAdapter) HasFinalize() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasFinalize() +} + +func (w *projectAlertRuleLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*ProjectAlertRule)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *projectAlertRuleLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*ProjectAlertRule)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *projectAlertRuleLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*ProjectAlertRule)) + if o == nil { + return nil, err + } + return o, err +} + +func NewProjectAlertRuleLifecycleAdapter(name string, clusterScoped bool, client ProjectAlertRuleInterface, l ProjectAlertRuleLifecycle) ProjectAlertRuleHandlerFunc { + adapter := &projectAlertRuleLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *ProjectAlertRule) (runtime.Object, error) { + newObj, err := syncFn(key, obj) + if o, ok := newObj.(runtime.Object); ok { + return o, err + } + return nil, err + } +} diff --git a/apis/management.cattle.io/v3/zz_generated_project_monitor_graph_controller.go b/apis/management.cattle.io/v3/zz_generated_project_monitor_graph_controller.go new file mode 100644 index 00000000..406dc15a --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_project_monitor_graph_controller.go @@ -0,0 +1,427 @@ +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/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + ProjectMonitorGraphGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "ProjectMonitorGraph", + } + ProjectMonitorGraphResource = metav1.APIResource{ + Name: "projectmonitorgraphs", + SingularName: "projectmonitorgraph", + Namespaced: true, + + Kind: ProjectMonitorGraphGroupVersionKind.Kind, + } +) + +type ProjectMonitorGraphList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ProjectMonitorGraph +} + +type ProjectMonitorGraphHandlerFunc func(key string, obj *ProjectMonitorGraph) (runtime.Object, error) + +type ProjectMonitorGraphChangeHandlerFunc func(obj *ProjectMonitorGraph) (runtime.Object, error) + +type ProjectMonitorGraphLister interface { + List(namespace string, selector labels.Selector) (ret []*ProjectMonitorGraph, err error) + Get(namespace, name string) (*ProjectMonitorGraph, error) +} + +type ProjectMonitorGraphController interface { + Generic() controller.GenericController + Informer() cache.SharedIndexInformer + Lister() ProjectMonitorGraphLister + AddHandler(ctx context.Context, name string, handler ProjectMonitorGraphHandlerFunc) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler ProjectMonitorGraphHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type ProjectMonitorGraphInterface interface { + ObjectClient() *objectclient.ObjectClient + Create(*ProjectMonitorGraph) (*ProjectMonitorGraph, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ProjectMonitorGraph, error) + Get(name string, opts metav1.GetOptions) (*ProjectMonitorGraph, error) + Update(*ProjectMonitorGraph) (*ProjectMonitorGraph, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*ProjectMonitorGraphList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() ProjectMonitorGraphController + AddHandler(ctx context.Context, name string, sync ProjectMonitorGraphHandlerFunc) + AddLifecycle(ctx context.Context, name string, lifecycle ProjectMonitorGraphLifecycle) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ProjectMonitorGraphHandlerFunc) + AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ProjectMonitorGraphLifecycle) +} + +type projectMonitorGraphLister struct { + controller *projectMonitorGraphController +} + +func (l *projectMonitorGraphLister) List(namespace string, selector labels.Selector) (ret []*ProjectMonitorGraph, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*ProjectMonitorGraph)) + }) + return +} + +func (l *projectMonitorGraphLister) Get(namespace, name string) (*ProjectMonitorGraph, 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: ProjectMonitorGraphGroupVersionKind.Group, + Resource: "projectMonitorGraph", + }, key) + } + return obj.(*ProjectMonitorGraph), nil +} + +type projectMonitorGraphController struct { + controller.GenericController +} + +func (c *projectMonitorGraphController) Generic() controller.GenericController { + return c.GenericController +} + +func (c *projectMonitorGraphController) Lister() ProjectMonitorGraphLister { + return &projectMonitorGraphLister{ + controller: c, + } +} + +func (c *projectMonitorGraphController) AddHandler(ctx context.Context, name string, handler ProjectMonitorGraphHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*ProjectMonitorGraph); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *projectMonitorGraphController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler ProjectMonitorGraphHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*ProjectMonitorGraph); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +type projectMonitorGraphFactory struct { +} + +func (c projectMonitorGraphFactory) Object() runtime.Object { + return &ProjectMonitorGraph{} +} + +func (c projectMonitorGraphFactory) List() runtime.Object { + return &ProjectMonitorGraphList{} +} + +func (s *projectMonitorGraphClient) Controller() ProjectMonitorGraphController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.projectMonitorGraphControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(ProjectMonitorGraphGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &projectMonitorGraphController{ + GenericController: genericController, + } + + s.client.projectMonitorGraphControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type projectMonitorGraphClient struct { + client *Client + ns string + objectClient *objectclient.ObjectClient + controller ProjectMonitorGraphController +} + +func (s *projectMonitorGraphClient) ObjectClient() *objectclient.ObjectClient { + return s.objectClient +} + +func (s *projectMonitorGraphClient) Create(o *ProjectMonitorGraph) (*ProjectMonitorGraph, error) { + obj, err := s.objectClient.Create(o) + return obj.(*ProjectMonitorGraph), err +} + +func (s *projectMonitorGraphClient) Get(name string, opts metav1.GetOptions) (*ProjectMonitorGraph, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*ProjectMonitorGraph), err +} + +func (s *projectMonitorGraphClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ProjectMonitorGraph, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*ProjectMonitorGraph), err +} + +func (s *projectMonitorGraphClient) Update(o *ProjectMonitorGraph) (*ProjectMonitorGraph, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*ProjectMonitorGraph), err +} + +func (s *projectMonitorGraphClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *projectMonitorGraphClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *projectMonitorGraphClient) List(opts metav1.ListOptions) (*ProjectMonitorGraphList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*ProjectMonitorGraphList), err +} + +func (s *projectMonitorGraphClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *projectMonitorGraphClient) Patch(o *ProjectMonitorGraph, data []byte, subresources ...string) (*ProjectMonitorGraph, error) { + obj, err := s.objectClient.Patch(o.Name, o, data, subresources...) + return obj.(*ProjectMonitorGraph), err +} + +func (s *projectMonitorGraphClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *projectMonitorGraphClient) AddHandler(ctx context.Context, name string, sync ProjectMonitorGraphHandlerFunc) { + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *projectMonitorGraphClient) AddLifecycle(ctx context.Context, name string, lifecycle ProjectMonitorGraphLifecycle) { + sync := NewProjectMonitorGraphLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *projectMonitorGraphClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ProjectMonitorGraphHandlerFunc) { + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *projectMonitorGraphClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ProjectMonitorGraphLifecycle) { + sync := NewProjectMonitorGraphLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +type ProjectMonitorGraphIndexer func(obj *ProjectMonitorGraph) ([]string, error) + +type ProjectMonitorGraphClientCache interface { + Get(namespace, name string) (*ProjectMonitorGraph, error) + List(namespace string, selector labels.Selector) ([]*ProjectMonitorGraph, error) + + Index(name string, indexer ProjectMonitorGraphIndexer) + GetIndexed(name, key string) ([]*ProjectMonitorGraph, error) +} + +type ProjectMonitorGraphClient interface { + Create(*ProjectMonitorGraph) (*ProjectMonitorGraph, error) + Get(namespace, name string, opts metav1.GetOptions) (*ProjectMonitorGraph, error) + Update(*ProjectMonitorGraph) (*ProjectMonitorGraph, error) + Delete(namespace, name string, options *metav1.DeleteOptions) error + List(namespace string, opts metav1.ListOptions) (*ProjectMonitorGraphList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + + Cache() ProjectMonitorGraphClientCache + + OnCreate(ctx context.Context, name string, sync ProjectMonitorGraphChangeHandlerFunc) + OnChange(ctx context.Context, name string, sync ProjectMonitorGraphChangeHandlerFunc) + OnRemove(ctx context.Context, name string, sync ProjectMonitorGraphChangeHandlerFunc) + Enqueue(namespace, name string) + + Generic() controller.GenericController + Interface() ProjectMonitorGraphInterface +} + +type projectMonitorGraphClientCache struct { + client *projectMonitorGraphClient2 +} + +type projectMonitorGraphClient2 struct { + iface ProjectMonitorGraphInterface + controller ProjectMonitorGraphController +} + +func (n *projectMonitorGraphClient2) Interface() ProjectMonitorGraphInterface { + return n.iface +} + +func (n *projectMonitorGraphClient2) Generic() controller.GenericController { + return n.iface.Controller().Generic() +} + +func (n *projectMonitorGraphClient2) Enqueue(namespace, name string) { + n.iface.Controller().Enqueue(namespace, name) +} + +func (n *projectMonitorGraphClient2) Create(obj *ProjectMonitorGraph) (*ProjectMonitorGraph, error) { + return n.iface.Create(obj) +} + +func (n *projectMonitorGraphClient2) Get(namespace, name string, opts metav1.GetOptions) (*ProjectMonitorGraph, error) { + return n.iface.GetNamespaced(namespace, name, opts) +} + +func (n *projectMonitorGraphClient2) Update(obj *ProjectMonitorGraph) (*ProjectMonitorGraph, error) { + return n.iface.Update(obj) +} + +func (n *projectMonitorGraphClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error { + return n.iface.DeleteNamespaced(namespace, name, options) +} + +func (n *projectMonitorGraphClient2) List(namespace string, opts metav1.ListOptions) (*ProjectMonitorGraphList, error) { + return n.iface.List(opts) +} + +func (n *projectMonitorGraphClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return n.iface.Watch(opts) +} + +func (n *projectMonitorGraphClientCache) Get(namespace, name string) (*ProjectMonitorGraph, error) { + return n.client.controller.Lister().Get(namespace, name) +} + +func (n *projectMonitorGraphClientCache) List(namespace string, selector labels.Selector) ([]*ProjectMonitorGraph, error) { + return n.client.controller.Lister().List(namespace, selector) +} + +func (n *projectMonitorGraphClient2) Cache() ProjectMonitorGraphClientCache { + n.loadController() + return &projectMonitorGraphClientCache{ + client: n, + } +} + +func (n *projectMonitorGraphClient2) OnCreate(ctx context.Context, name string, sync ProjectMonitorGraphChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-create", &projectMonitorGraphLifecycleDelegate{create: sync}) +} + +func (n *projectMonitorGraphClient2) OnChange(ctx context.Context, name string, sync ProjectMonitorGraphChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-change", &projectMonitorGraphLifecycleDelegate{update: sync}) +} + +func (n *projectMonitorGraphClient2) OnRemove(ctx context.Context, name string, sync ProjectMonitorGraphChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name, &projectMonitorGraphLifecycleDelegate{remove: sync}) +} + +func (n *projectMonitorGraphClientCache) Index(name string, indexer ProjectMonitorGraphIndexer) { + err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{ + name: func(obj interface{}) ([]string, error) { + if v, ok := obj.(*ProjectMonitorGraph); ok { + return indexer(v) + } + return nil, nil + }, + }) + + if err != nil { + panic(err) + } +} + +func (n *projectMonitorGraphClientCache) GetIndexed(name, key string) ([]*ProjectMonitorGraph, error) { + var result []*ProjectMonitorGraph + objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key) + if err != nil { + return nil, err + } + for _, obj := range objs { + if v, ok := obj.(*ProjectMonitorGraph); ok { + result = append(result, v) + } + } + + return result, nil +} + +func (n *projectMonitorGraphClient2) loadController() { + if n.controller == nil { + n.controller = n.iface.Controller() + } +} + +type projectMonitorGraphLifecycleDelegate struct { + create ProjectMonitorGraphChangeHandlerFunc + update ProjectMonitorGraphChangeHandlerFunc + remove ProjectMonitorGraphChangeHandlerFunc +} + +func (n *projectMonitorGraphLifecycleDelegate) HasCreate() bool { + return n.create != nil +} + +func (n *projectMonitorGraphLifecycleDelegate) Create(obj *ProjectMonitorGraph) (runtime.Object, error) { + if n.create == nil { + return obj, nil + } + return n.create(obj) +} + +func (n *projectMonitorGraphLifecycleDelegate) HasFinalize() bool { + return n.remove != nil +} + +func (n *projectMonitorGraphLifecycleDelegate) Remove(obj *ProjectMonitorGraph) (runtime.Object, error) { + if n.remove == nil { + return obj, nil + } + return n.remove(obj) +} + +func (n *projectMonitorGraphLifecycleDelegate) Updated(obj *ProjectMonitorGraph) (runtime.Object, error) { + if n.update == nil { + return obj, nil + } + return n.update(obj) +} diff --git a/apis/management.cattle.io/v3/zz_generated_project_monitor_graph_lifecycle_adapter.go b/apis/management.cattle.io/v3/zz_generated_project_monitor_graph_lifecycle_adapter.go new file mode 100644 index 00000000..832d8cc2 --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_project_monitor_graph_lifecycle_adapter.go @@ -0,0 +1,62 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type ProjectMonitorGraphLifecycle interface { + Create(obj *ProjectMonitorGraph) (runtime.Object, error) + Remove(obj *ProjectMonitorGraph) (runtime.Object, error) + Updated(obj *ProjectMonitorGraph) (runtime.Object, error) +} + +type projectMonitorGraphLifecycleAdapter struct { + lifecycle ProjectMonitorGraphLifecycle +} + +func (w *projectMonitorGraphLifecycleAdapter) HasCreate() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasCreate() +} + +func (w *projectMonitorGraphLifecycleAdapter) HasFinalize() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasFinalize() +} + +func (w *projectMonitorGraphLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*ProjectMonitorGraph)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *projectMonitorGraphLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*ProjectMonitorGraph)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *projectMonitorGraphLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*ProjectMonitorGraph)) + if o == nil { + return nil, err + } + return o, err +} + +func NewProjectMonitorGraphLifecycleAdapter(name string, clusterScoped bool, client ProjectMonitorGraphInterface, l ProjectMonitorGraphLifecycle) ProjectMonitorGraphHandlerFunc { + adapter := &projectMonitorGraphLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *ProjectMonitorGraph) (runtime.Object, error) { + newObj, err := syncFn(key, obj) + if o, ok := newObj.(runtime.Object); ok { + return o, err + } + return nil, err + } +} diff --git a/apis/management.cattle.io/v3/zz_generated_scheme.go b/apis/management.cattle.io/v3/zz_generated_scheme.go index cdac0e95..db6b1375 100644 --- a/apis/management.cattle.io/v3/zz_generated_scheme.go +++ b/apis/management.cattle.io/v3/zz_generated_scheme.go @@ -98,12 +98,20 @@ func addKnownTypes(scheme *runtime.Scheme) error { &ListenConfigList{}, &Setting{}, &SettingList{}, - &Notifier{}, - &NotifierList{}, &ClusterAlert{}, &ClusterAlertList{}, &ProjectAlert{}, &ProjectAlertList{}, + &Notifier{}, + &NotifierList{}, + &ClusterAlertGroup{}, + &ClusterAlertGroupList{}, + &ProjectAlertGroup{}, + &ProjectAlertGroupList{}, + &ClusterAlertRule{}, + &ClusterAlertRuleList{}, + &ProjectAlertRule{}, + &ProjectAlertRuleList{}, &ComposeConfig{}, &ComposeConfigList{}, &ProjectCatalog{}, @@ -118,6 +126,12 @@ func addKnownTypes(scheme *runtime.Scheme) error { &GlobalDNSProviderList{}, &KontainerDriver{}, &KontainerDriverList{}, + &MonitorMetric{}, + &MonitorMetricList{}, + &ClusterMonitorGraph{}, + &ClusterMonitorGraphList{}, + &ProjectMonitorGraph{}, + &ProjectMonitorGraphList{}, ) return nil } diff --git a/apis/monitoring.coreos.com/v1/zz_generated_alertmanager_controller.go b/apis/monitoring.coreos.com/v1/zz_generated_alertmanager_controller.go new file mode 100644 index 00000000..ec275ae2 --- /dev/null +++ b/apis/monitoring.coreos.com/v1/zz_generated_alertmanager_controller.go @@ -0,0 +1,428 @@ +package v1 + +import ( + "context" + + "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + "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/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + AlertmanagerGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "Alertmanager", + } + AlertmanagerResource = metav1.APIResource{ + Name: "alertmanagers", + SingularName: "alertmanager", + Namespaced: true, + + Kind: AlertmanagerGroupVersionKind.Kind, + } +) + +type AlertmanagerList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []v1.Alertmanager +} + +type AlertmanagerHandlerFunc func(key string, obj *v1.Alertmanager) (runtime.Object, error) + +type AlertmanagerChangeHandlerFunc func(obj *v1.Alertmanager) (runtime.Object, error) + +type AlertmanagerLister interface { + List(namespace string, selector labels.Selector) (ret []*v1.Alertmanager, err error) + Get(namespace, name string) (*v1.Alertmanager, error) +} + +type AlertmanagerController interface { + Generic() controller.GenericController + Informer() cache.SharedIndexInformer + Lister() AlertmanagerLister + AddHandler(ctx context.Context, name string, handler AlertmanagerHandlerFunc) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler AlertmanagerHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type AlertmanagerInterface interface { + ObjectClient() *objectclient.ObjectClient + Create(*v1.Alertmanager) (*v1.Alertmanager, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.Alertmanager, error) + Get(name string, opts metav1.GetOptions) (*v1.Alertmanager, error) + Update(*v1.Alertmanager) (*v1.Alertmanager, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*AlertmanagerList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() AlertmanagerController + AddHandler(ctx context.Context, name string, sync AlertmanagerHandlerFunc) + AddLifecycle(ctx context.Context, name string, lifecycle AlertmanagerLifecycle) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync AlertmanagerHandlerFunc) + AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle AlertmanagerLifecycle) +} + +type alertmanagerLister struct { + controller *alertmanagerController +} + +func (l *alertmanagerLister) List(namespace string, selector labels.Selector) (ret []*v1.Alertmanager, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*v1.Alertmanager)) + }) + return +} + +func (l *alertmanagerLister) Get(namespace, name string) (*v1.Alertmanager, 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: AlertmanagerGroupVersionKind.Group, + Resource: "alertmanager", + }, key) + } + return obj.(*v1.Alertmanager), nil +} + +type alertmanagerController struct { + controller.GenericController +} + +func (c *alertmanagerController) Generic() controller.GenericController { + return c.GenericController +} + +func (c *alertmanagerController) Lister() AlertmanagerLister { + return &alertmanagerLister{ + controller: c, + } +} + +func (c *alertmanagerController) AddHandler(ctx context.Context, name string, handler AlertmanagerHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1.Alertmanager); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *alertmanagerController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler AlertmanagerHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1.Alertmanager); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +type alertmanagerFactory struct { +} + +func (c alertmanagerFactory) Object() runtime.Object { + return &v1.Alertmanager{} +} + +func (c alertmanagerFactory) List() runtime.Object { + return &AlertmanagerList{} +} + +func (s *alertmanagerClient) Controller() AlertmanagerController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.alertmanagerControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(AlertmanagerGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &alertmanagerController{ + GenericController: genericController, + } + + s.client.alertmanagerControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type alertmanagerClient struct { + client *Client + ns string + objectClient *objectclient.ObjectClient + controller AlertmanagerController +} + +func (s *alertmanagerClient) ObjectClient() *objectclient.ObjectClient { + return s.objectClient +} + +func (s *alertmanagerClient) Create(o *v1.Alertmanager) (*v1.Alertmanager, error) { + obj, err := s.objectClient.Create(o) + return obj.(*v1.Alertmanager), err +} + +func (s *alertmanagerClient) Get(name string, opts metav1.GetOptions) (*v1.Alertmanager, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*v1.Alertmanager), err +} + +func (s *alertmanagerClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.Alertmanager, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*v1.Alertmanager), err +} + +func (s *alertmanagerClient) Update(o *v1.Alertmanager) (*v1.Alertmanager, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*v1.Alertmanager), err +} + +func (s *alertmanagerClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *alertmanagerClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *alertmanagerClient) List(opts metav1.ListOptions) (*AlertmanagerList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*AlertmanagerList), err +} + +func (s *alertmanagerClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *alertmanagerClient) Patch(o *v1.Alertmanager, data []byte, subresources ...string) (*v1.Alertmanager, error) { + obj, err := s.objectClient.Patch(o.Name, o, data, subresources...) + return obj.(*v1.Alertmanager), err +} + +func (s *alertmanagerClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *alertmanagerClient) AddHandler(ctx context.Context, name string, sync AlertmanagerHandlerFunc) { + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *alertmanagerClient) AddLifecycle(ctx context.Context, name string, lifecycle AlertmanagerLifecycle) { + sync := NewAlertmanagerLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *alertmanagerClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync AlertmanagerHandlerFunc) { + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *alertmanagerClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle AlertmanagerLifecycle) { + sync := NewAlertmanagerLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +type AlertmanagerIndexer func(obj *v1.Alertmanager) ([]string, error) + +type AlertmanagerClientCache interface { + Get(namespace, name string) (*v1.Alertmanager, error) + List(namespace string, selector labels.Selector) ([]*v1.Alertmanager, error) + + Index(name string, indexer AlertmanagerIndexer) + GetIndexed(name, key string) ([]*v1.Alertmanager, error) +} + +type AlertmanagerClient interface { + Create(*v1.Alertmanager) (*v1.Alertmanager, error) + Get(namespace, name string, opts metav1.GetOptions) (*v1.Alertmanager, error) + Update(*v1.Alertmanager) (*v1.Alertmanager, error) + Delete(namespace, name string, options *metav1.DeleteOptions) error + List(namespace string, opts metav1.ListOptions) (*AlertmanagerList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + + Cache() AlertmanagerClientCache + + OnCreate(ctx context.Context, name string, sync AlertmanagerChangeHandlerFunc) + OnChange(ctx context.Context, name string, sync AlertmanagerChangeHandlerFunc) + OnRemove(ctx context.Context, name string, sync AlertmanagerChangeHandlerFunc) + Enqueue(namespace, name string) + + Generic() controller.GenericController + Interface() AlertmanagerInterface +} + +type alertmanagerClientCache struct { + client *alertmanagerClient2 +} + +type alertmanagerClient2 struct { + iface AlertmanagerInterface + controller AlertmanagerController +} + +func (n *alertmanagerClient2) Interface() AlertmanagerInterface { + return n.iface +} + +func (n *alertmanagerClient2) Generic() controller.GenericController { + return n.iface.Controller().Generic() +} + +func (n *alertmanagerClient2) Enqueue(namespace, name string) { + n.iface.Controller().Enqueue(namespace, name) +} + +func (n *alertmanagerClient2) Create(obj *v1.Alertmanager) (*v1.Alertmanager, error) { + return n.iface.Create(obj) +} + +func (n *alertmanagerClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1.Alertmanager, error) { + return n.iface.GetNamespaced(namespace, name, opts) +} + +func (n *alertmanagerClient2) Update(obj *v1.Alertmanager) (*v1.Alertmanager, error) { + return n.iface.Update(obj) +} + +func (n *alertmanagerClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error { + return n.iface.DeleteNamespaced(namespace, name, options) +} + +func (n *alertmanagerClient2) List(namespace string, opts metav1.ListOptions) (*AlertmanagerList, error) { + return n.iface.List(opts) +} + +func (n *alertmanagerClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return n.iface.Watch(opts) +} + +func (n *alertmanagerClientCache) Get(namespace, name string) (*v1.Alertmanager, error) { + return n.client.controller.Lister().Get(namespace, name) +} + +func (n *alertmanagerClientCache) List(namespace string, selector labels.Selector) ([]*v1.Alertmanager, error) { + return n.client.controller.Lister().List(namespace, selector) +} + +func (n *alertmanagerClient2) Cache() AlertmanagerClientCache { + n.loadController() + return &alertmanagerClientCache{ + client: n, + } +} + +func (n *alertmanagerClient2) OnCreate(ctx context.Context, name string, sync AlertmanagerChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-create", &alertmanagerLifecycleDelegate{create: sync}) +} + +func (n *alertmanagerClient2) OnChange(ctx context.Context, name string, sync AlertmanagerChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-change", &alertmanagerLifecycleDelegate{update: sync}) +} + +func (n *alertmanagerClient2) OnRemove(ctx context.Context, name string, sync AlertmanagerChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name, &alertmanagerLifecycleDelegate{remove: sync}) +} + +func (n *alertmanagerClientCache) Index(name string, indexer AlertmanagerIndexer) { + err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{ + name: func(obj interface{}) ([]string, error) { + if v, ok := obj.(*v1.Alertmanager); ok { + return indexer(v) + } + return nil, nil + }, + }) + + if err != nil { + panic(err) + } +} + +func (n *alertmanagerClientCache) GetIndexed(name, key string) ([]*v1.Alertmanager, error) { + var result []*v1.Alertmanager + objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key) + if err != nil { + return nil, err + } + for _, obj := range objs { + if v, ok := obj.(*v1.Alertmanager); ok { + result = append(result, v) + } + } + + return result, nil +} + +func (n *alertmanagerClient2) loadController() { + if n.controller == nil { + n.controller = n.iface.Controller() + } +} + +type alertmanagerLifecycleDelegate struct { + create AlertmanagerChangeHandlerFunc + update AlertmanagerChangeHandlerFunc + remove AlertmanagerChangeHandlerFunc +} + +func (n *alertmanagerLifecycleDelegate) HasCreate() bool { + return n.create != nil +} + +func (n *alertmanagerLifecycleDelegate) Create(obj *v1.Alertmanager) (runtime.Object, error) { + if n.create == nil { + return obj, nil + } + return n.create(obj) +} + +func (n *alertmanagerLifecycleDelegate) HasFinalize() bool { + return n.remove != nil +} + +func (n *alertmanagerLifecycleDelegate) Remove(obj *v1.Alertmanager) (runtime.Object, error) { + if n.remove == nil { + return obj, nil + } + return n.remove(obj) +} + +func (n *alertmanagerLifecycleDelegate) Updated(obj *v1.Alertmanager) (runtime.Object, error) { + if n.update == nil { + return obj, nil + } + return n.update(obj) +} diff --git a/apis/monitoring.coreos.com/v1/zz_generated_alertmanager_lifecycle_adapter.go b/apis/monitoring.coreos.com/v1/zz_generated_alertmanager_lifecycle_adapter.go new file mode 100644 index 00000000..497e8674 --- /dev/null +++ b/apis/monitoring.coreos.com/v1/zz_generated_alertmanager_lifecycle_adapter.go @@ -0,0 +1,63 @@ +package v1 + +import ( + "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type AlertmanagerLifecycle interface { + Create(obj *v1.Alertmanager) (runtime.Object, error) + Remove(obj *v1.Alertmanager) (runtime.Object, error) + Updated(obj *v1.Alertmanager) (runtime.Object, error) +} + +type alertmanagerLifecycleAdapter struct { + lifecycle AlertmanagerLifecycle +} + +func (w *alertmanagerLifecycleAdapter) HasCreate() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasCreate() +} + +func (w *alertmanagerLifecycleAdapter) HasFinalize() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasFinalize() +} + +func (w *alertmanagerLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*v1.Alertmanager)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *alertmanagerLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*v1.Alertmanager)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *alertmanagerLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*v1.Alertmanager)) + if o == nil { + return nil, err + } + return o, err +} + +func NewAlertmanagerLifecycleAdapter(name string, clusterScoped bool, client AlertmanagerInterface, l AlertmanagerLifecycle) AlertmanagerHandlerFunc { + adapter := &alertmanagerLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *v1.Alertmanager) (runtime.Object, error) { + newObj, err := syncFn(key, obj) + if o, ok := newObj.(runtime.Object); ok { + return o, err + } + return nil, err + } +} diff --git a/apis/monitoring.coreos.com/v1/zz_generated_deepcopy.go b/apis/monitoring.coreos.com/v1/zz_generated_deepcopy.go new file mode 100644 index 00000000..32fda6ef --- /dev/null +++ b/apis/monitoring.coreos.com/v1/zz_generated_deepcopy.go @@ -0,0 +1,138 @@ +package v1 + +import ( + monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AlertmanagerList) DeepCopyInto(out *AlertmanagerList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]monitoringv1.Alertmanager, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerList. +func (in *AlertmanagerList) DeepCopy() *AlertmanagerList { + if in == nil { + return nil + } + out := new(AlertmanagerList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AlertmanagerList) 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 *PrometheusList) DeepCopyInto(out *PrometheusList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]monitoringv1.Prometheus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusList. +func (in *PrometheusList) DeepCopy() *PrometheusList { + if in == nil { + return nil + } + out := new(PrometheusList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PrometheusList) 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 *PrometheusRuleList) DeepCopyInto(out *PrometheusRuleList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]monitoringv1.PrometheusRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusRuleList. +func (in *PrometheusRuleList) DeepCopy() *PrometheusRuleList { + if in == nil { + return nil + } + out := new(PrometheusRuleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PrometheusRuleList) 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 *ServiceMonitorList) DeepCopyInto(out *ServiceMonitorList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]monitoringv1.ServiceMonitor, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceMonitorList. +func (in *ServiceMonitorList) DeepCopy() *ServiceMonitorList { + if in == nil { + return nil + } + out := new(ServiceMonitorList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ServiceMonitorList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} diff --git a/apis/monitoring.coreos.com/v1/zz_generated_k8s_client.go b/apis/monitoring.coreos.com/v1/zz_generated_k8s_client.go new file mode 100644 index 00000000..fa357c1e --- /dev/null +++ b/apis/monitoring.coreos.com/v1/zz_generated_k8s_client.go @@ -0,0 +1,176 @@ +package v1 + +import ( + "context" + "sync" + + "github.com/rancher/norman/controller" + "github.com/rancher/norman/objectclient" + "github.com/rancher/norman/objectclient/dynamic" + "github.com/rancher/norman/restwatch" + "k8s.io/client-go/rest" +) + +type ( + contextKeyType struct{} + contextClientsKeyType struct{} +) + +type Interface interface { + RESTClient() rest.Interface + controller.Starter + + PrometheusesGetter + AlertmanagersGetter + PrometheusRulesGetter + ServiceMonitorsGetter +} + +type Clients struct { + Prometheus PrometheusClient + Alertmanager AlertmanagerClient + PrometheusRule PrometheusRuleClient + ServiceMonitor ServiceMonitorClient +} + +type Client struct { + sync.Mutex + restClient rest.Interface + starters []controller.Starter + + prometheusControllers map[string]PrometheusController + alertmanagerControllers map[string]AlertmanagerController + prometheusRuleControllers map[string]PrometheusRuleController + serviceMonitorControllers map[string]ServiceMonitorController +} + +func Factory(ctx context.Context, config rest.Config) (context.Context, controller.Starter, error) { + c, err := NewForConfig(config) + if err != nil { + return ctx, nil, err + } + + cs := NewClientsFromInterface(c) + + ctx = context.WithValue(ctx, contextKeyType{}, c) + ctx = context.WithValue(ctx, contextClientsKeyType{}, cs) + return ctx, c, nil +} + +func ClientsFrom(ctx context.Context) *Clients { + return ctx.Value(contextClientsKeyType{}).(*Clients) +} + +func From(ctx context.Context) Interface { + return ctx.Value(contextKeyType{}).(Interface) +} + +func NewClients(config rest.Config) (*Clients, error) { + iface, err := NewForConfig(config) + if err != nil { + return nil, err + } + return NewClientsFromInterface(iface), nil +} + +func NewClientsFromInterface(iface Interface) *Clients { + return &Clients{ + + Prometheus: &prometheusClient2{ + iface: iface.Prometheuses(""), + }, + Alertmanager: &alertmanagerClient2{ + iface: iface.Alertmanagers(""), + }, + PrometheusRule: &prometheusRuleClient2{ + iface: iface.PrometheusRules(""), + }, + ServiceMonitor: &serviceMonitorClient2{ + iface: iface.ServiceMonitors(""), + }, + } +} + +func NewForConfig(config rest.Config) (Interface, error) { + if config.NegotiatedSerializer == nil { + config.NegotiatedSerializer = dynamic.NegotiatedSerializer + } + + restClient, err := restwatch.UnversionedRESTClientFor(&config) + if err != nil { + return nil, err + } + + return &Client{ + restClient: restClient, + + prometheusControllers: map[string]PrometheusController{}, + alertmanagerControllers: map[string]AlertmanagerController{}, + prometheusRuleControllers: map[string]PrometheusRuleController{}, + serviceMonitorControllers: map[string]ServiceMonitorController{}, + }, nil +} + +func (c *Client) RESTClient() rest.Interface { + return c.restClient +} + +func (c *Client) Sync(ctx context.Context) error { + return controller.Sync(ctx, c.starters...) +} + +func (c *Client) Start(ctx context.Context, threadiness int) error { + return controller.Start(ctx, threadiness, c.starters...) +} + +type PrometheusesGetter interface { + Prometheuses(namespace string) PrometheusInterface +} + +func (c *Client) Prometheuses(namespace string) PrometheusInterface { + objectClient := objectclient.NewObjectClient(namespace, c.restClient, &PrometheusResource, PrometheusGroupVersionKind, prometheusFactory{}) + return &prometheusClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type AlertmanagersGetter interface { + Alertmanagers(namespace string) AlertmanagerInterface +} + +func (c *Client) Alertmanagers(namespace string) AlertmanagerInterface { + objectClient := objectclient.NewObjectClient(namespace, c.restClient, &AlertmanagerResource, AlertmanagerGroupVersionKind, alertmanagerFactory{}) + return &alertmanagerClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type PrometheusRulesGetter interface { + PrometheusRules(namespace string) PrometheusRuleInterface +} + +func (c *Client) PrometheusRules(namespace string) PrometheusRuleInterface { + objectClient := objectclient.NewObjectClient(namespace, c.restClient, &PrometheusRuleResource, PrometheusRuleGroupVersionKind, prometheusRuleFactory{}) + return &prometheusRuleClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type ServiceMonitorsGetter interface { + ServiceMonitors(namespace string) ServiceMonitorInterface +} + +func (c *Client) ServiceMonitors(namespace string) ServiceMonitorInterface { + objectClient := objectclient.NewObjectClient(namespace, c.restClient, &ServiceMonitorResource, ServiceMonitorGroupVersionKind, serviceMonitorFactory{}) + return &serviceMonitorClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} diff --git a/apis/monitoring.coreos.com/v1/zz_generated_prometheus_controller.go b/apis/monitoring.coreos.com/v1/zz_generated_prometheus_controller.go new file mode 100644 index 00000000..93120dbe --- /dev/null +++ b/apis/monitoring.coreos.com/v1/zz_generated_prometheus_controller.go @@ -0,0 +1,428 @@ +package v1 + +import ( + "context" + + "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + "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/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + PrometheusGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "Prometheus", + } + PrometheusResource = metav1.APIResource{ + Name: "prometheuses", + SingularName: "prometheus", + Namespaced: true, + + Kind: PrometheusGroupVersionKind.Kind, + } +) + +type PrometheusList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []v1.Prometheus +} + +type PrometheusHandlerFunc func(key string, obj *v1.Prometheus) (runtime.Object, error) + +type PrometheusChangeHandlerFunc func(obj *v1.Prometheus) (runtime.Object, error) + +type PrometheusLister interface { + List(namespace string, selector labels.Selector) (ret []*v1.Prometheus, err error) + Get(namespace, name string) (*v1.Prometheus, error) +} + +type PrometheusController interface { + Generic() controller.GenericController + Informer() cache.SharedIndexInformer + Lister() PrometheusLister + AddHandler(ctx context.Context, name string, handler PrometheusHandlerFunc) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler PrometheusHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type PrometheusInterface interface { + ObjectClient() *objectclient.ObjectClient + Create(*v1.Prometheus) (*v1.Prometheus, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.Prometheus, error) + Get(name string, opts metav1.GetOptions) (*v1.Prometheus, error) + Update(*v1.Prometheus) (*v1.Prometheus, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*PrometheusList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() PrometheusController + AddHandler(ctx context.Context, name string, sync PrometheusHandlerFunc) + AddLifecycle(ctx context.Context, name string, lifecycle PrometheusLifecycle) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync PrometheusHandlerFunc) + AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle PrometheusLifecycle) +} + +type prometheusLister struct { + controller *prometheusController +} + +func (l *prometheusLister) List(namespace string, selector labels.Selector) (ret []*v1.Prometheus, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*v1.Prometheus)) + }) + return +} + +func (l *prometheusLister) Get(namespace, name string) (*v1.Prometheus, 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: PrometheusGroupVersionKind.Group, + Resource: "prometheus", + }, key) + } + return obj.(*v1.Prometheus), nil +} + +type prometheusController struct { + controller.GenericController +} + +func (c *prometheusController) Generic() controller.GenericController { + return c.GenericController +} + +func (c *prometheusController) Lister() PrometheusLister { + return &prometheusLister{ + controller: c, + } +} + +func (c *prometheusController) AddHandler(ctx context.Context, name string, handler PrometheusHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1.Prometheus); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *prometheusController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler PrometheusHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1.Prometheus); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +type prometheusFactory struct { +} + +func (c prometheusFactory) Object() runtime.Object { + return &v1.Prometheus{} +} + +func (c prometheusFactory) List() runtime.Object { + return &PrometheusList{} +} + +func (s *prometheusClient) Controller() PrometheusController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.prometheusControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(PrometheusGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &prometheusController{ + GenericController: genericController, + } + + s.client.prometheusControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type prometheusClient struct { + client *Client + ns string + objectClient *objectclient.ObjectClient + controller PrometheusController +} + +func (s *prometheusClient) ObjectClient() *objectclient.ObjectClient { + return s.objectClient +} + +func (s *prometheusClient) Create(o *v1.Prometheus) (*v1.Prometheus, error) { + obj, err := s.objectClient.Create(o) + return obj.(*v1.Prometheus), err +} + +func (s *prometheusClient) Get(name string, opts metav1.GetOptions) (*v1.Prometheus, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*v1.Prometheus), err +} + +func (s *prometheusClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.Prometheus, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*v1.Prometheus), err +} + +func (s *prometheusClient) Update(o *v1.Prometheus) (*v1.Prometheus, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*v1.Prometheus), err +} + +func (s *prometheusClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *prometheusClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *prometheusClient) List(opts metav1.ListOptions) (*PrometheusList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*PrometheusList), err +} + +func (s *prometheusClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *prometheusClient) Patch(o *v1.Prometheus, data []byte, subresources ...string) (*v1.Prometheus, error) { + obj, err := s.objectClient.Patch(o.Name, o, data, subresources...) + return obj.(*v1.Prometheus), err +} + +func (s *prometheusClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *prometheusClient) AddHandler(ctx context.Context, name string, sync PrometheusHandlerFunc) { + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *prometheusClient) AddLifecycle(ctx context.Context, name string, lifecycle PrometheusLifecycle) { + sync := NewPrometheusLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *prometheusClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync PrometheusHandlerFunc) { + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *prometheusClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle PrometheusLifecycle) { + sync := NewPrometheusLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +type PrometheusIndexer func(obj *v1.Prometheus) ([]string, error) + +type PrometheusClientCache interface { + Get(namespace, name string) (*v1.Prometheus, error) + List(namespace string, selector labels.Selector) ([]*v1.Prometheus, error) + + Index(name string, indexer PrometheusIndexer) + GetIndexed(name, key string) ([]*v1.Prometheus, error) +} + +type PrometheusClient interface { + Create(*v1.Prometheus) (*v1.Prometheus, error) + Get(namespace, name string, opts metav1.GetOptions) (*v1.Prometheus, error) + Update(*v1.Prometheus) (*v1.Prometheus, error) + Delete(namespace, name string, options *metav1.DeleteOptions) error + List(namespace string, opts metav1.ListOptions) (*PrometheusList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + + Cache() PrometheusClientCache + + OnCreate(ctx context.Context, name string, sync PrometheusChangeHandlerFunc) + OnChange(ctx context.Context, name string, sync PrometheusChangeHandlerFunc) + OnRemove(ctx context.Context, name string, sync PrometheusChangeHandlerFunc) + Enqueue(namespace, name string) + + Generic() controller.GenericController + Interface() PrometheusInterface +} + +type prometheusClientCache struct { + client *prometheusClient2 +} + +type prometheusClient2 struct { + iface PrometheusInterface + controller PrometheusController +} + +func (n *prometheusClient2) Interface() PrometheusInterface { + return n.iface +} + +func (n *prometheusClient2) Generic() controller.GenericController { + return n.iface.Controller().Generic() +} + +func (n *prometheusClient2) Enqueue(namespace, name string) { + n.iface.Controller().Enqueue(namespace, name) +} + +func (n *prometheusClient2) Create(obj *v1.Prometheus) (*v1.Prometheus, error) { + return n.iface.Create(obj) +} + +func (n *prometheusClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1.Prometheus, error) { + return n.iface.GetNamespaced(namespace, name, opts) +} + +func (n *prometheusClient2) Update(obj *v1.Prometheus) (*v1.Prometheus, error) { + return n.iface.Update(obj) +} + +func (n *prometheusClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error { + return n.iface.DeleteNamespaced(namespace, name, options) +} + +func (n *prometheusClient2) List(namespace string, opts metav1.ListOptions) (*PrometheusList, error) { + return n.iface.List(opts) +} + +func (n *prometheusClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return n.iface.Watch(opts) +} + +func (n *prometheusClientCache) Get(namespace, name string) (*v1.Prometheus, error) { + return n.client.controller.Lister().Get(namespace, name) +} + +func (n *prometheusClientCache) List(namespace string, selector labels.Selector) ([]*v1.Prometheus, error) { + return n.client.controller.Lister().List(namespace, selector) +} + +func (n *prometheusClient2) Cache() PrometheusClientCache { + n.loadController() + return &prometheusClientCache{ + client: n, + } +} + +func (n *prometheusClient2) OnCreate(ctx context.Context, name string, sync PrometheusChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-create", &prometheusLifecycleDelegate{create: sync}) +} + +func (n *prometheusClient2) OnChange(ctx context.Context, name string, sync PrometheusChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-change", &prometheusLifecycleDelegate{update: sync}) +} + +func (n *prometheusClient2) OnRemove(ctx context.Context, name string, sync PrometheusChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name, &prometheusLifecycleDelegate{remove: sync}) +} + +func (n *prometheusClientCache) Index(name string, indexer PrometheusIndexer) { + err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{ + name: func(obj interface{}) ([]string, error) { + if v, ok := obj.(*v1.Prometheus); ok { + return indexer(v) + } + return nil, nil + }, + }) + + if err != nil { + panic(err) + } +} + +func (n *prometheusClientCache) GetIndexed(name, key string) ([]*v1.Prometheus, error) { + var result []*v1.Prometheus + objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key) + if err != nil { + return nil, err + } + for _, obj := range objs { + if v, ok := obj.(*v1.Prometheus); ok { + result = append(result, v) + } + } + + return result, nil +} + +func (n *prometheusClient2) loadController() { + if n.controller == nil { + n.controller = n.iface.Controller() + } +} + +type prometheusLifecycleDelegate struct { + create PrometheusChangeHandlerFunc + update PrometheusChangeHandlerFunc + remove PrometheusChangeHandlerFunc +} + +func (n *prometheusLifecycleDelegate) HasCreate() bool { + return n.create != nil +} + +func (n *prometheusLifecycleDelegate) Create(obj *v1.Prometheus) (runtime.Object, error) { + if n.create == nil { + return obj, nil + } + return n.create(obj) +} + +func (n *prometheusLifecycleDelegate) HasFinalize() bool { + return n.remove != nil +} + +func (n *prometheusLifecycleDelegate) Remove(obj *v1.Prometheus) (runtime.Object, error) { + if n.remove == nil { + return obj, nil + } + return n.remove(obj) +} + +func (n *prometheusLifecycleDelegate) Updated(obj *v1.Prometheus) (runtime.Object, error) { + if n.update == nil { + return obj, nil + } + return n.update(obj) +} diff --git a/apis/monitoring.coreos.com/v1/zz_generated_prometheus_lifecycle_adapter.go b/apis/monitoring.coreos.com/v1/zz_generated_prometheus_lifecycle_adapter.go new file mode 100644 index 00000000..2af85b53 --- /dev/null +++ b/apis/monitoring.coreos.com/v1/zz_generated_prometheus_lifecycle_adapter.go @@ -0,0 +1,63 @@ +package v1 + +import ( + "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type PrometheusLifecycle interface { + Create(obj *v1.Prometheus) (runtime.Object, error) + Remove(obj *v1.Prometheus) (runtime.Object, error) + Updated(obj *v1.Prometheus) (runtime.Object, error) +} + +type prometheusLifecycleAdapter struct { + lifecycle PrometheusLifecycle +} + +func (w *prometheusLifecycleAdapter) HasCreate() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasCreate() +} + +func (w *prometheusLifecycleAdapter) HasFinalize() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasFinalize() +} + +func (w *prometheusLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*v1.Prometheus)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *prometheusLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*v1.Prometheus)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *prometheusLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*v1.Prometheus)) + if o == nil { + return nil, err + } + return o, err +} + +func NewPrometheusLifecycleAdapter(name string, clusterScoped bool, client PrometheusInterface, l PrometheusLifecycle) PrometheusHandlerFunc { + adapter := &prometheusLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *v1.Prometheus) (runtime.Object, error) { + newObj, err := syncFn(key, obj) + if o, ok := newObj.(runtime.Object); ok { + return o, err + } + return nil, err + } +} diff --git a/apis/monitoring.coreos.com/v1/zz_generated_prometheus_rule_controller.go b/apis/monitoring.coreos.com/v1/zz_generated_prometheus_rule_controller.go new file mode 100644 index 00000000..10ddac1e --- /dev/null +++ b/apis/monitoring.coreos.com/v1/zz_generated_prometheus_rule_controller.go @@ -0,0 +1,428 @@ +package v1 + +import ( + "context" + + "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + "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/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + PrometheusRuleGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "PrometheusRule", + } + PrometheusRuleResource = metav1.APIResource{ + Name: "prometheusrules", + SingularName: "prometheusrule", + Namespaced: true, + + Kind: PrometheusRuleGroupVersionKind.Kind, + } +) + +type PrometheusRuleList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []v1.PrometheusRule +} + +type PrometheusRuleHandlerFunc func(key string, obj *v1.PrometheusRule) (runtime.Object, error) + +type PrometheusRuleChangeHandlerFunc func(obj *v1.PrometheusRule) (runtime.Object, error) + +type PrometheusRuleLister interface { + List(namespace string, selector labels.Selector) (ret []*v1.PrometheusRule, err error) + Get(namespace, name string) (*v1.PrometheusRule, error) +} + +type PrometheusRuleController interface { + Generic() controller.GenericController + Informer() cache.SharedIndexInformer + Lister() PrometheusRuleLister + AddHandler(ctx context.Context, name string, handler PrometheusRuleHandlerFunc) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler PrometheusRuleHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type PrometheusRuleInterface interface { + ObjectClient() *objectclient.ObjectClient + Create(*v1.PrometheusRule) (*v1.PrometheusRule, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.PrometheusRule, error) + Get(name string, opts metav1.GetOptions) (*v1.PrometheusRule, error) + Update(*v1.PrometheusRule) (*v1.PrometheusRule, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*PrometheusRuleList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() PrometheusRuleController + AddHandler(ctx context.Context, name string, sync PrometheusRuleHandlerFunc) + AddLifecycle(ctx context.Context, name string, lifecycle PrometheusRuleLifecycle) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync PrometheusRuleHandlerFunc) + AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle PrometheusRuleLifecycle) +} + +type prometheusRuleLister struct { + controller *prometheusRuleController +} + +func (l *prometheusRuleLister) List(namespace string, selector labels.Selector) (ret []*v1.PrometheusRule, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*v1.PrometheusRule)) + }) + return +} + +func (l *prometheusRuleLister) Get(namespace, name string) (*v1.PrometheusRule, 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: PrometheusRuleGroupVersionKind.Group, + Resource: "prometheusRule", + }, key) + } + return obj.(*v1.PrometheusRule), nil +} + +type prometheusRuleController struct { + controller.GenericController +} + +func (c *prometheusRuleController) Generic() controller.GenericController { + return c.GenericController +} + +func (c *prometheusRuleController) Lister() PrometheusRuleLister { + return &prometheusRuleLister{ + controller: c, + } +} + +func (c *prometheusRuleController) AddHandler(ctx context.Context, name string, handler PrometheusRuleHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1.PrometheusRule); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *prometheusRuleController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler PrometheusRuleHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1.PrometheusRule); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +type prometheusRuleFactory struct { +} + +func (c prometheusRuleFactory) Object() runtime.Object { + return &v1.PrometheusRule{} +} + +func (c prometheusRuleFactory) List() runtime.Object { + return &PrometheusRuleList{} +} + +func (s *prometheusRuleClient) Controller() PrometheusRuleController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.prometheusRuleControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(PrometheusRuleGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &prometheusRuleController{ + GenericController: genericController, + } + + s.client.prometheusRuleControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type prometheusRuleClient struct { + client *Client + ns string + objectClient *objectclient.ObjectClient + controller PrometheusRuleController +} + +func (s *prometheusRuleClient) ObjectClient() *objectclient.ObjectClient { + return s.objectClient +} + +func (s *prometheusRuleClient) Create(o *v1.PrometheusRule) (*v1.PrometheusRule, error) { + obj, err := s.objectClient.Create(o) + return obj.(*v1.PrometheusRule), err +} + +func (s *prometheusRuleClient) Get(name string, opts metav1.GetOptions) (*v1.PrometheusRule, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*v1.PrometheusRule), err +} + +func (s *prometheusRuleClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.PrometheusRule, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*v1.PrometheusRule), err +} + +func (s *prometheusRuleClient) Update(o *v1.PrometheusRule) (*v1.PrometheusRule, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*v1.PrometheusRule), err +} + +func (s *prometheusRuleClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *prometheusRuleClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *prometheusRuleClient) List(opts metav1.ListOptions) (*PrometheusRuleList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*PrometheusRuleList), err +} + +func (s *prometheusRuleClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *prometheusRuleClient) Patch(o *v1.PrometheusRule, data []byte, subresources ...string) (*v1.PrometheusRule, error) { + obj, err := s.objectClient.Patch(o.Name, o, data, subresources...) + return obj.(*v1.PrometheusRule), err +} + +func (s *prometheusRuleClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *prometheusRuleClient) AddHandler(ctx context.Context, name string, sync PrometheusRuleHandlerFunc) { + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *prometheusRuleClient) AddLifecycle(ctx context.Context, name string, lifecycle PrometheusRuleLifecycle) { + sync := NewPrometheusRuleLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *prometheusRuleClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync PrometheusRuleHandlerFunc) { + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *prometheusRuleClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle PrometheusRuleLifecycle) { + sync := NewPrometheusRuleLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +type PrometheusRuleIndexer func(obj *v1.PrometheusRule) ([]string, error) + +type PrometheusRuleClientCache interface { + Get(namespace, name string) (*v1.PrometheusRule, error) + List(namespace string, selector labels.Selector) ([]*v1.PrometheusRule, error) + + Index(name string, indexer PrometheusRuleIndexer) + GetIndexed(name, key string) ([]*v1.PrometheusRule, error) +} + +type PrometheusRuleClient interface { + Create(*v1.PrometheusRule) (*v1.PrometheusRule, error) + Get(namespace, name string, opts metav1.GetOptions) (*v1.PrometheusRule, error) + Update(*v1.PrometheusRule) (*v1.PrometheusRule, error) + Delete(namespace, name string, options *metav1.DeleteOptions) error + List(namespace string, opts metav1.ListOptions) (*PrometheusRuleList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + + Cache() PrometheusRuleClientCache + + OnCreate(ctx context.Context, name string, sync PrometheusRuleChangeHandlerFunc) + OnChange(ctx context.Context, name string, sync PrometheusRuleChangeHandlerFunc) + OnRemove(ctx context.Context, name string, sync PrometheusRuleChangeHandlerFunc) + Enqueue(namespace, name string) + + Generic() controller.GenericController + Interface() PrometheusRuleInterface +} + +type prometheusRuleClientCache struct { + client *prometheusRuleClient2 +} + +type prometheusRuleClient2 struct { + iface PrometheusRuleInterface + controller PrometheusRuleController +} + +func (n *prometheusRuleClient2) Interface() PrometheusRuleInterface { + return n.iface +} + +func (n *prometheusRuleClient2) Generic() controller.GenericController { + return n.iface.Controller().Generic() +} + +func (n *prometheusRuleClient2) Enqueue(namespace, name string) { + n.iface.Controller().Enqueue(namespace, name) +} + +func (n *prometheusRuleClient2) Create(obj *v1.PrometheusRule) (*v1.PrometheusRule, error) { + return n.iface.Create(obj) +} + +func (n *prometheusRuleClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1.PrometheusRule, error) { + return n.iface.GetNamespaced(namespace, name, opts) +} + +func (n *prometheusRuleClient2) Update(obj *v1.PrometheusRule) (*v1.PrometheusRule, error) { + return n.iface.Update(obj) +} + +func (n *prometheusRuleClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error { + return n.iface.DeleteNamespaced(namespace, name, options) +} + +func (n *prometheusRuleClient2) List(namespace string, opts metav1.ListOptions) (*PrometheusRuleList, error) { + return n.iface.List(opts) +} + +func (n *prometheusRuleClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return n.iface.Watch(opts) +} + +func (n *prometheusRuleClientCache) Get(namespace, name string) (*v1.PrometheusRule, error) { + return n.client.controller.Lister().Get(namespace, name) +} + +func (n *prometheusRuleClientCache) List(namespace string, selector labels.Selector) ([]*v1.PrometheusRule, error) { + return n.client.controller.Lister().List(namespace, selector) +} + +func (n *prometheusRuleClient2) Cache() PrometheusRuleClientCache { + n.loadController() + return &prometheusRuleClientCache{ + client: n, + } +} + +func (n *prometheusRuleClient2) OnCreate(ctx context.Context, name string, sync PrometheusRuleChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-create", &prometheusRuleLifecycleDelegate{create: sync}) +} + +func (n *prometheusRuleClient2) OnChange(ctx context.Context, name string, sync PrometheusRuleChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-change", &prometheusRuleLifecycleDelegate{update: sync}) +} + +func (n *prometheusRuleClient2) OnRemove(ctx context.Context, name string, sync PrometheusRuleChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name, &prometheusRuleLifecycleDelegate{remove: sync}) +} + +func (n *prometheusRuleClientCache) Index(name string, indexer PrometheusRuleIndexer) { + err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{ + name: func(obj interface{}) ([]string, error) { + if v, ok := obj.(*v1.PrometheusRule); ok { + return indexer(v) + } + return nil, nil + }, + }) + + if err != nil { + panic(err) + } +} + +func (n *prometheusRuleClientCache) GetIndexed(name, key string) ([]*v1.PrometheusRule, error) { + var result []*v1.PrometheusRule + objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key) + if err != nil { + return nil, err + } + for _, obj := range objs { + if v, ok := obj.(*v1.PrometheusRule); ok { + result = append(result, v) + } + } + + return result, nil +} + +func (n *prometheusRuleClient2) loadController() { + if n.controller == nil { + n.controller = n.iface.Controller() + } +} + +type prometheusRuleLifecycleDelegate struct { + create PrometheusRuleChangeHandlerFunc + update PrometheusRuleChangeHandlerFunc + remove PrometheusRuleChangeHandlerFunc +} + +func (n *prometheusRuleLifecycleDelegate) HasCreate() bool { + return n.create != nil +} + +func (n *prometheusRuleLifecycleDelegate) Create(obj *v1.PrometheusRule) (runtime.Object, error) { + if n.create == nil { + return obj, nil + } + return n.create(obj) +} + +func (n *prometheusRuleLifecycleDelegate) HasFinalize() bool { + return n.remove != nil +} + +func (n *prometheusRuleLifecycleDelegate) Remove(obj *v1.PrometheusRule) (runtime.Object, error) { + if n.remove == nil { + return obj, nil + } + return n.remove(obj) +} + +func (n *prometheusRuleLifecycleDelegate) Updated(obj *v1.PrometheusRule) (runtime.Object, error) { + if n.update == nil { + return obj, nil + } + return n.update(obj) +} diff --git a/apis/monitoring.coreos.com/v1/zz_generated_prometheus_rule_lifecycle_adapter.go b/apis/monitoring.coreos.com/v1/zz_generated_prometheus_rule_lifecycle_adapter.go new file mode 100644 index 00000000..3d99e4a2 --- /dev/null +++ b/apis/monitoring.coreos.com/v1/zz_generated_prometheus_rule_lifecycle_adapter.go @@ -0,0 +1,63 @@ +package v1 + +import ( + "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type PrometheusRuleLifecycle interface { + Create(obj *v1.PrometheusRule) (runtime.Object, error) + Remove(obj *v1.PrometheusRule) (runtime.Object, error) + Updated(obj *v1.PrometheusRule) (runtime.Object, error) +} + +type prometheusRuleLifecycleAdapter struct { + lifecycle PrometheusRuleLifecycle +} + +func (w *prometheusRuleLifecycleAdapter) HasCreate() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasCreate() +} + +func (w *prometheusRuleLifecycleAdapter) HasFinalize() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasFinalize() +} + +func (w *prometheusRuleLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*v1.PrometheusRule)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *prometheusRuleLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*v1.PrometheusRule)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *prometheusRuleLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*v1.PrometheusRule)) + if o == nil { + return nil, err + } + return o, err +} + +func NewPrometheusRuleLifecycleAdapter(name string, clusterScoped bool, client PrometheusRuleInterface, l PrometheusRuleLifecycle) PrometheusRuleHandlerFunc { + adapter := &prometheusRuleLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *v1.PrometheusRule) (runtime.Object, error) { + newObj, err := syncFn(key, obj) + if o, ok := newObj.(runtime.Object); ok { + return o, err + } + return nil, err + } +} diff --git a/apis/monitoring.coreos.com/v1/zz_generated_scheme.go b/apis/monitoring.coreos.com/v1/zz_generated_scheme.go new file mode 100644 index 00000000..deee40b3 --- /dev/null +++ b/apis/monitoring.coreos.com/v1/zz_generated_scheme.go @@ -0,0 +1,42 @@ +package v1 + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const ( + GroupName = "monitoring.coreos.com" + Version = "v1" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version} + +// Kind takes an unqualified kind and returns a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + // TODO this gets cleaned up when the types are fixed + scheme.AddKnownTypes(SchemeGroupVersion, + + &PrometheusList{}, + &AlertmanagerList{}, + &PrometheusRuleList{}, + &ServiceMonitorList{}, + ) + return nil +} diff --git a/apis/monitoring.coreos.com/v1/zz_generated_service_monitor_controller.go b/apis/monitoring.coreos.com/v1/zz_generated_service_monitor_controller.go new file mode 100644 index 00000000..58dc8997 --- /dev/null +++ b/apis/monitoring.coreos.com/v1/zz_generated_service_monitor_controller.go @@ -0,0 +1,428 @@ +package v1 + +import ( + "context" + + "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + "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/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + ServiceMonitorGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "ServiceMonitor", + } + ServiceMonitorResource = metav1.APIResource{ + Name: "servicemonitors", + SingularName: "servicemonitor", + Namespaced: true, + + Kind: ServiceMonitorGroupVersionKind.Kind, + } +) + +type ServiceMonitorList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []v1.ServiceMonitor +} + +type ServiceMonitorHandlerFunc func(key string, obj *v1.ServiceMonitor) (runtime.Object, error) + +type ServiceMonitorChangeHandlerFunc func(obj *v1.ServiceMonitor) (runtime.Object, error) + +type ServiceMonitorLister interface { + List(namespace string, selector labels.Selector) (ret []*v1.ServiceMonitor, err error) + Get(namespace, name string) (*v1.ServiceMonitor, error) +} + +type ServiceMonitorController interface { + Generic() controller.GenericController + Informer() cache.SharedIndexInformer + Lister() ServiceMonitorLister + AddHandler(ctx context.Context, name string, handler ServiceMonitorHandlerFunc) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler ServiceMonitorHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type ServiceMonitorInterface interface { + ObjectClient() *objectclient.ObjectClient + Create(*v1.ServiceMonitor) (*v1.ServiceMonitor, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.ServiceMonitor, error) + Get(name string, opts metav1.GetOptions) (*v1.ServiceMonitor, error) + Update(*v1.ServiceMonitor) (*v1.ServiceMonitor, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*ServiceMonitorList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() ServiceMonitorController + AddHandler(ctx context.Context, name string, sync ServiceMonitorHandlerFunc) + AddLifecycle(ctx context.Context, name string, lifecycle ServiceMonitorLifecycle) + AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ServiceMonitorHandlerFunc) + AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ServiceMonitorLifecycle) +} + +type serviceMonitorLister struct { + controller *serviceMonitorController +} + +func (l *serviceMonitorLister) List(namespace string, selector labels.Selector) (ret []*v1.ServiceMonitor, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*v1.ServiceMonitor)) + }) + return +} + +func (l *serviceMonitorLister) Get(namespace, name string) (*v1.ServiceMonitor, 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: ServiceMonitorGroupVersionKind.Group, + Resource: "serviceMonitor", + }, key) + } + return obj.(*v1.ServiceMonitor), nil +} + +type serviceMonitorController struct { + controller.GenericController +} + +func (c *serviceMonitorController) Generic() controller.GenericController { + return c.GenericController +} + +func (c *serviceMonitorController) Lister() ServiceMonitorLister { + return &serviceMonitorLister{ + controller: c, + } +} + +func (c *serviceMonitorController) AddHandler(ctx context.Context, name string, handler ServiceMonitorHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1.ServiceMonitor); ok { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +func (c *serviceMonitorController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler ServiceMonitorHandlerFunc) { + c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) { + if obj == nil { + return handler(key, nil) + } else if v, ok := obj.(*v1.ServiceMonitor); ok && controller.ObjectInCluster(cluster, obj) { + return handler(key, v) + } else { + return nil, nil + } + }) +} + +type serviceMonitorFactory struct { +} + +func (c serviceMonitorFactory) Object() runtime.Object { + return &v1.ServiceMonitor{} +} + +func (c serviceMonitorFactory) List() runtime.Object { + return &ServiceMonitorList{} +} + +func (s *serviceMonitorClient) Controller() ServiceMonitorController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.serviceMonitorControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(ServiceMonitorGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &serviceMonitorController{ + GenericController: genericController, + } + + s.client.serviceMonitorControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type serviceMonitorClient struct { + client *Client + ns string + objectClient *objectclient.ObjectClient + controller ServiceMonitorController +} + +func (s *serviceMonitorClient) ObjectClient() *objectclient.ObjectClient { + return s.objectClient +} + +func (s *serviceMonitorClient) Create(o *v1.ServiceMonitor) (*v1.ServiceMonitor, error) { + obj, err := s.objectClient.Create(o) + return obj.(*v1.ServiceMonitor), err +} + +func (s *serviceMonitorClient) Get(name string, opts metav1.GetOptions) (*v1.ServiceMonitor, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*v1.ServiceMonitor), err +} + +func (s *serviceMonitorClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*v1.ServiceMonitor, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*v1.ServiceMonitor), err +} + +func (s *serviceMonitorClient) Update(o *v1.ServiceMonitor) (*v1.ServiceMonitor, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*v1.ServiceMonitor), err +} + +func (s *serviceMonitorClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *serviceMonitorClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *serviceMonitorClient) List(opts metav1.ListOptions) (*ServiceMonitorList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*ServiceMonitorList), err +} + +func (s *serviceMonitorClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *serviceMonitorClient) Patch(o *v1.ServiceMonitor, data []byte, subresources ...string) (*v1.ServiceMonitor, error) { + obj, err := s.objectClient.Patch(o.Name, o, data, subresources...) + return obj.(*v1.ServiceMonitor), err +} + +func (s *serviceMonitorClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *serviceMonitorClient) AddHandler(ctx context.Context, name string, sync ServiceMonitorHandlerFunc) { + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *serviceMonitorClient) AddLifecycle(ctx context.Context, name string, lifecycle ServiceMonitorLifecycle) { + sync := NewServiceMonitorLifecycleAdapter(name, false, s, lifecycle) + s.Controller().AddHandler(ctx, name, sync) +} + +func (s *serviceMonitorClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync ServiceMonitorHandlerFunc) { + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +func (s *serviceMonitorClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle ServiceMonitorLifecycle) { + sync := NewServiceMonitorLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync) +} + +type ServiceMonitorIndexer func(obj *v1.ServiceMonitor) ([]string, error) + +type ServiceMonitorClientCache interface { + Get(namespace, name string) (*v1.ServiceMonitor, error) + List(namespace string, selector labels.Selector) ([]*v1.ServiceMonitor, error) + + Index(name string, indexer ServiceMonitorIndexer) + GetIndexed(name, key string) ([]*v1.ServiceMonitor, error) +} + +type ServiceMonitorClient interface { + Create(*v1.ServiceMonitor) (*v1.ServiceMonitor, error) + Get(namespace, name string, opts metav1.GetOptions) (*v1.ServiceMonitor, error) + Update(*v1.ServiceMonitor) (*v1.ServiceMonitor, error) + Delete(namespace, name string, options *metav1.DeleteOptions) error + List(namespace string, opts metav1.ListOptions) (*ServiceMonitorList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + + Cache() ServiceMonitorClientCache + + OnCreate(ctx context.Context, name string, sync ServiceMonitorChangeHandlerFunc) + OnChange(ctx context.Context, name string, sync ServiceMonitorChangeHandlerFunc) + OnRemove(ctx context.Context, name string, sync ServiceMonitorChangeHandlerFunc) + Enqueue(namespace, name string) + + Generic() controller.GenericController + Interface() ServiceMonitorInterface +} + +type serviceMonitorClientCache struct { + client *serviceMonitorClient2 +} + +type serviceMonitorClient2 struct { + iface ServiceMonitorInterface + controller ServiceMonitorController +} + +func (n *serviceMonitorClient2) Interface() ServiceMonitorInterface { + return n.iface +} + +func (n *serviceMonitorClient2) Generic() controller.GenericController { + return n.iface.Controller().Generic() +} + +func (n *serviceMonitorClient2) Enqueue(namespace, name string) { + n.iface.Controller().Enqueue(namespace, name) +} + +func (n *serviceMonitorClient2) Create(obj *v1.ServiceMonitor) (*v1.ServiceMonitor, error) { + return n.iface.Create(obj) +} + +func (n *serviceMonitorClient2) Get(namespace, name string, opts metav1.GetOptions) (*v1.ServiceMonitor, error) { + return n.iface.GetNamespaced(namespace, name, opts) +} + +func (n *serviceMonitorClient2) Update(obj *v1.ServiceMonitor) (*v1.ServiceMonitor, error) { + return n.iface.Update(obj) +} + +func (n *serviceMonitorClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error { + return n.iface.DeleteNamespaced(namespace, name, options) +} + +func (n *serviceMonitorClient2) List(namespace string, opts metav1.ListOptions) (*ServiceMonitorList, error) { + return n.iface.List(opts) +} + +func (n *serviceMonitorClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return n.iface.Watch(opts) +} + +func (n *serviceMonitorClientCache) Get(namespace, name string) (*v1.ServiceMonitor, error) { + return n.client.controller.Lister().Get(namespace, name) +} + +func (n *serviceMonitorClientCache) List(namespace string, selector labels.Selector) ([]*v1.ServiceMonitor, error) { + return n.client.controller.Lister().List(namespace, selector) +} + +func (n *serviceMonitorClient2) Cache() ServiceMonitorClientCache { + n.loadController() + return &serviceMonitorClientCache{ + client: n, + } +} + +func (n *serviceMonitorClient2) OnCreate(ctx context.Context, name string, sync ServiceMonitorChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-create", &serviceMonitorLifecycleDelegate{create: sync}) +} + +func (n *serviceMonitorClient2) OnChange(ctx context.Context, name string, sync ServiceMonitorChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name+"-change", &serviceMonitorLifecycleDelegate{update: sync}) +} + +func (n *serviceMonitorClient2) OnRemove(ctx context.Context, name string, sync ServiceMonitorChangeHandlerFunc) { + n.loadController() + n.iface.AddLifecycle(ctx, name, &serviceMonitorLifecycleDelegate{remove: sync}) +} + +func (n *serviceMonitorClientCache) Index(name string, indexer ServiceMonitorIndexer) { + err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{ + name: func(obj interface{}) ([]string, error) { + if v, ok := obj.(*v1.ServiceMonitor); ok { + return indexer(v) + } + return nil, nil + }, + }) + + if err != nil { + panic(err) + } +} + +func (n *serviceMonitorClientCache) GetIndexed(name, key string) ([]*v1.ServiceMonitor, error) { + var result []*v1.ServiceMonitor + objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key) + if err != nil { + return nil, err + } + for _, obj := range objs { + if v, ok := obj.(*v1.ServiceMonitor); ok { + result = append(result, v) + } + } + + return result, nil +} + +func (n *serviceMonitorClient2) loadController() { + if n.controller == nil { + n.controller = n.iface.Controller() + } +} + +type serviceMonitorLifecycleDelegate struct { + create ServiceMonitorChangeHandlerFunc + update ServiceMonitorChangeHandlerFunc + remove ServiceMonitorChangeHandlerFunc +} + +func (n *serviceMonitorLifecycleDelegate) HasCreate() bool { + return n.create != nil +} + +func (n *serviceMonitorLifecycleDelegate) Create(obj *v1.ServiceMonitor) (runtime.Object, error) { + if n.create == nil { + return obj, nil + } + return n.create(obj) +} + +func (n *serviceMonitorLifecycleDelegate) HasFinalize() bool { + return n.remove != nil +} + +func (n *serviceMonitorLifecycleDelegate) Remove(obj *v1.ServiceMonitor) (runtime.Object, error) { + if n.remove == nil { + return obj, nil + } + return n.remove(obj) +} + +func (n *serviceMonitorLifecycleDelegate) Updated(obj *v1.ServiceMonitor) (runtime.Object, error) { + if n.update == nil { + return obj, nil + } + return n.update(obj) +} diff --git a/apis/monitoring.coreos.com/v1/zz_generated_service_monitor_lifecycle_adapter.go b/apis/monitoring.coreos.com/v1/zz_generated_service_monitor_lifecycle_adapter.go new file mode 100644 index 00000000..01800cec --- /dev/null +++ b/apis/monitoring.coreos.com/v1/zz_generated_service_monitor_lifecycle_adapter.go @@ -0,0 +1,63 @@ +package v1 + +import ( + "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type ServiceMonitorLifecycle interface { + Create(obj *v1.ServiceMonitor) (runtime.Object, error) + Remove(obj *v1.ServiceMonitor) (runtime.Object, error) + Updated(obj *v1.ServiceMonitor) (runtime.Object, error) +} + +type serviceMonitorLifecycleAdapter struct { + lifecycle ServiceMonitorLifecycle +} + +func (w *serviceMonitorLifecycleAdapter) HasCreate() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasCreate() +} + +func (w *serviceMonitorLifecycleAdapter) HasFinalize() bool { + o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition) + return !ok || o.HasFinalize() +} + +func (w *serviceMonitorLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*v1.ServiceMonitor)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *serviceMonitorLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*v1.ServiceMonitor)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *serviceMonitorLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*v1.ServiceMonitor)) + if o == nil { + return nil, err + } + return o, err +} + +func NewServiceMonitorLifecycleAdapter(name string, clusterScoped bool, client ServiceMonitorInterface, l ServiceMonitorLifecycle) ServiceMonitorHandlerFunc { + adapter := &serviceMonitorLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *v1.ServiceMonitor) (runtime.Object, error) { + newObj, err := syncFn(key, obj) + if o, ok := newObj.(runtime.Object); ok { + return o, err + } + return nil, err + } +} diff --git a/apis/project.cattle.io/v3/zz_generated_deepcopy.go b/apis/project.cattle.io/v3/zz_generated_deepcopy.go index bc08f671..2989d33e 100644 --- a/apis/project.cattle.io/v3/zz_generated_deepcopy.go +++ b/apis/project.cattle.io/v3/zz_generated_deepcopy.go @@ -2384,3 +2384,19 @@ func (in *WorkloadList) DeepCopyObject() runtime.Object { } return nil } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadMetric) DeepCopyInto(out *WorkloadMetric) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadMetric. +func (in *WorkloadMetric) DeepCopy() *WorkloadMetric { + if in == nil { + return nil + } + out := new(WorkloadMetric) + in.DeepCopyInto(out) + return out +} diff --git a/client/management/v3/zz_generated_client.go b/client/management/v3/zz_generated_client.go index b03354bd..57e7f571 100644 --- a/client/management/v3/zz_generated_client.go +++ b/client/management/v3/zz_generated_client.go @@ -39,9 +39,13 @@ type Client struct { ProjectLogging ProjectLoggingOperations ListenConfig ListenConfigOperations Setting SettingOperations - Notifier NotifierOperations ClusterAlert ClusterAlertOperations ProjectAlert ProjectAlertOperations + Notifier NotifierOperations + ClusterAlertGroup ClusterAlertGroupOperations + ProjectAlertGroup ProjectAlertGroupOperations + ClusterAlertRule ClusterAlertRuleOperations + ProjectAlertRule ProjectAlertRuleOperations ComposeConfig ComposeConfigOperations ProjectCatalog ProjectCatalogOperations ClusterCatalog ClusterCatalogOperations @@ -49,6 +53,9 @@ type Client struct { GlobalDNS GlobalDNSOperations GlobalDNSProvider GlobalDNSProviderOperations KontainerDriver KontainerDriverOperations + MonitorMetric MonitorMetricOperations + ClusterMonitorGraph ClusterMonitorGraphOperations + ProjectMonitorGraph ProjectMonitorGraphOperations } func NewClient(opts *clientbase.ClientOpts) (*Client, error) { @@ -93,9 +100,13 @@ func NewClient(opts *clientbase.ClientOpts) (*Client, error) { client.ProjectLogging = newProjectLoggingClient(client) client.ListenConfig = newListenConfigClient(client) client.Setting = newSettingClient(client) - client.Notifier = newNotifierClient(client) client.ClusterAlert = newClusterAlertClient(client) client.ProjectAlert = newProjectAlertClient(client) + client.Notifier = newNotifierClient(client) + client.ClusterAlertGroup = newClusterAlertGroupClient(client) + client.ProjectAlertGroup = newProjectAlertGroupClient(client) + client.ClusterAlertRule = newClusterAlertRuleClient(client) + client.ProjectAlertRule = newProjectAlertRuleClient(client) client.ComposeConfig = newComposeConfigClient(client) client.ProjectCatalog = newProjectCatalogClient(client) client.ClusterCatalog = newClusterCatalogClient(client) @@ -103,6 +114,9 @@ func NewClient(opts *clientbase.ClientOpts) (*Client, error) { client.GlobalDNS = newGlobalDNSClient(client) client.GlobalDNSProvider = newGlobalDNSProviderClient(client) client.KontainerDriver = newKontainerDriverClient(client) + client.MonitorMetric = newMonitorMetricClient(client) + client.ClusterMonitorGraph = newClusterMonitorGraphClient(client) + client.ProjectMonitorGraph = newProjectMonitorGraphClient(client) return client, nil } diff --git a/client/management/v3/zz_generated_cluster.go b/client/management/v3/zz_generated_cluster.go index 5718dcec..741f1285 100644 --- a/client/management/v3/zz_generated_cluster.go +++ b/client/management/v3/zz_generated_cluster.go @@ -26,12 +26,15 @@ const ( ClusterFieldDesiredAgentImage = "desiredAgentImage" ClusterFieldDockerRootDir = "dockerRootDir" ClusterFieldDriver = "driver" + ClusterFieldEnableClusterAlerting = "enableClusterAlerting" + ClusterFieldEnableClusterMonitoring = "enableClusterMonitoring" ClusterFieldEnableNetworkPolicy = "enableNetworkPolicy" ClusterFieldFailedSpec = "failedSpec" ClusterFieldImportedConfig = "importedConfig" ClusterFieldInternal = "internal" ClusterFieldLabels = "labels" ClusterFieldLimits = "limits" + ClusterFieldMonitoringStatus = "monitoringStatus" ClusterFieldName = "name" ClusterFieldOwnerReferences = "ownerReferences" ClusterFieldRancherKubernetesEngineConfig = "rancherKubernetesEngineConfig" @@ -66,12 +69,15 @@ type Cluster struct { DesiredAgentImage string `json:"desiredAgentImage,omitempty" yaml:"desiredAgentImage,omitempty"` DockerRootDir string `json:"dockerRootDir,omitempty" yaml:"dockerRootDir,omitempty"` Driver string `json:"driver,omitempty" yaml:"driver,omitempty"` + EnableClusterAlerting bool `json:"enableClusterAlerting,omitempty" yaml:"enableClusterAlerting,omitempty"` + EnableClusterMonitoring bool `json:"enableClusterMonitoring,omitempty" yaml:"enableClusterMonitoring,omitempty"` EnableNetworkPolicy *bool `json:"enableNetworkPolicy,omitempty" yaml:"enableNetworkPolicy,omitempty"` FailedSpec *ClusterSpec `json:"failedSpec,omitempty" yaml:"failedSpec,omitempty"` ImportedConfig *ImportedConfig `json:"importedConfig,omitempty" yaml:"importedConfig,omitempty"` Internal bool `json:"internal,omitempty" yaml:"internal,omitempty"` Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` Limits map[string]string `json:"limits,omitempty" yaml:"limits,omitempty"` + MonitoringStatus *MonitoringStatus `json:"monitoringStatus,omitempty" yaml:"monitoringStatus,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"` RancherKubernetesEngineConfig *RancherKubernetesEngineConfig `json:"rancherKubernetesEngineConfig,omitempty" yaml:"rancherKubernetesEngineConfig,omitempty"` @@ -102,6 +108,10 @@ type ClusterOperations interface { ByID(id string) (*Cluster, error) Delete(container *Cluster) error + ActionDisableMonitoring(resource *Cluster) error + + ActionEnableMonitoring(resource *Cluster, input *MonitoringInput) error + ActionExportYaml(resource *Cluster) (*ExportOutput, error) ActionGenerateKubeconfig(resource *Cluster) (*GenerateKubeConfigOutput, error) @@ -160,6 +170,16 @@ func (c *ClusterClient) Delete(container *Cluster) error { return c.apiClient.Ops.DoResourceDelete(ClusterType, &container.Resource) } +func (c *ClusterClient) ActionDisableMonitoring(resource *Cluster) error { + err := c.apiClient.Ops.DoAction(ClusterType, "disableMonitoring", &resource.Resource, nil, nil) + return err +} + +func (c *ClusterClient) ActionEnableMonitoring(resource *Cluster, input *MonitoringInput) error { + err := c.apiClient.Ops.DoAction(ClusterType, "enableMonitoring", &resource.Resource, input, nil) + return err +} + func (c *ClusterClient) ActionExportYaml(resource *Cluster) (*ExportOutput, error) { resp := &ExportOutput{} err := c.apiClient.Ops.DoAction(ClusterType, "exportYaml", &resource.Resource, nil, resp) diff --git a/client/management/v3/zz_generated_cluster_alert.go b/client/management/v3/zz_generated_cluster_alert.go index 38f265d3..59d8bd16 100644 --- a/client/management/v3/zz_generated_cluster_alert.go +++ b/client/management/v3/zz_generated_cluster_alert.go @@ -6,12 +6,12 @@ import ( const ( ClusterAlertType = "clusterAlert" - ClusterAlertFieldAlertState = "alertState" ClusterAlertFieldAnnotations = "annotations" ClusterAlertFieldClusterID = "clusterId" ClusterAlertFieldCreated = "created" ClusterAlertFieldCreatorID = "creatorId" ClusterAlertFieldDescription = "description" + ClusterAlertFieldDisplayName = "displayName" ClusterAlertFieldInitialWaitSeconds = "initialWaitSeconds" ClusterAlertFieldLabels = "labels" ClusterAlertFieldName = "name" @@ -22,6 +22,7 @@ const ( ClusterAlertFieldRepeatIntervalSeconds = "repeatIntervalSeconds" ClusterAlertFieldSeverity = "severity" ClusterAlertFieldState = "state" + ClusterAlertFieldStatus = "status" ClusterAlertFieldTargetEvent = "targetEvent" ClusterAlertFieldTargetNode = "targetNode" ClusterAlertFieldTargetSystemService = "targetSystemService" @@ -32,12 +33,12 @@ const ( type ClusterAlert struct { types.Resource - AlertState string `json:"alertState,omitempty" yaml:"alertState,omitempty"` Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,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"` Description string `json:"description,omitempty" yaml:"description,omitempty"` + DisplayName string `json:"displayName,omitempty" yaml:"displayName,omitempty"` InitialWaitSeconds int64 `json:"initialWaitSeconds,omitempty" yaml:"initialWaitSeconds,omitempty"` Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` @@ -48,6 +49,7 @@ type ClusterAlert struct { RepeatIntervalSeconds int64 `json:"repeatIntervalSeconds,omitempty" yaml:"repeatIntervalSeconds,omitempty"` Severity string `json:"severity,omitempty" yaml:"severity,omitempty"` State string `json:"state,omitempty" yaml:"state,omitempty"` + Status *AlertStatus `json:"status,omitempty" yaml:"status,omitempty"` TargetEvent *TargetEvent `json:"targetEvent,omitempty" yaml:"targetEvent,omitempty"` TargetNode *TargetNode `json:"targetNode,omitempty" yaml:"targetNode,omitempty"` TargetSystemService *TargetSystemService `json:"targetSystemService,omitempty" yaml:"targetSystemService,omitempty"` @@ -73,14 +75,6 @@ type ClusterAlertOperations interface { Replace(existing *ClusterAlert) (*ClusterAlert, error) ByID(id string) (*ClusterAlert, error) Delete(container *ClusterAlert) error - - ActionActivate(resource *ClusterAlert) error - - ActionDeactivate(resource *ClusterAlert) error - - ActionMute(resource *ClusterAlert) error - - ActionUnmute(resource *ClusterAlert) error } func newClusterAlertClient(apiClient *Client) *ClusterAlertClient { @@ -133,23 +127,3 @@ func (c *ClusterAlertClient) ByID(id string) (*ClusterAlert, error) { func (c *ClusterAlertClient) Delete(container *ClusterAlert) error { return c.apiClient.Ops.DoResourceDelete(ClusterAlertType, &container.Resource) } - -func (c *ClusterAlertClient) ActionActivate(resource *ClusterAlert) error { - err := c.apiClient.Ops.DoAction(ClusterAlertType, "activate", &resource.Resource, nil, nil) - return err -} - -func (c *ClusterAlertClient) ActionDeactivate(resource *ClusterAlert) error { - err := c.apiClient.Ops.DoAction(ClusterAlertType, "deactivate", &resource.Resource, nil, nil) - return err -} - -func (c *ClusterAlertClient) ActionMute(resource *ClusterAlert) error { - err := c.apiClient.Ops.DoAction(ClusterAlertType, "mute", &resource.Resource, nil, nil) - return err -} - -func (c *ClusterAlertClient) ActionUnmute(resource *ClusterAlert) error { - err := c.apiClient.Ops.DoAction(ClusterAlertType, "unmute", &resource.Resource, nil, nil) - return err -} diff --git a/client/management/v3/zz_generated_cluster_alert_group.go b/client/management/v3/zz_generated_cluster_alert_group.go new file mode 100644 index 00000000..7e741883 --- /dev/null +++ b/client/management/v3/zz_generated_cluster_alert_group.go @@ -0,0 +1,121 @@ +package client + +import ( + "github.com/rancher/norman/types" +) + +const ( + ClusterAlertGroupType = "clusterAlertGroup" + ClusterAlertGroupFieldAlertState = "alertState" + ClusterAlertGroupFieldAnnotations = "annotations" + ClusterAlertGroupFieldClusterID = "clusterId" + ClusterAlertGroupFieldCreated = "created" + ClusterAlertGroupFieldCreatorID = "creatorId" + ClusterAlertGroupFieldDescription = "description" + ClusterAlertGroupFieldGroupIntervalSeconds = "groupIntervalSeconds" + ClusterAlertGroupFieldGroupWaitSeconds = "groupWaitSeconds" + ClusterAlertGroupFieldLabels = "labels" + ClusterAlertGroupFieldName = "name" + ClusterAlertGroupFieldNamespaceId = "namespaceId" + ClusterAlertGroupFieldOwnerReferences = "ownerReferences" + ClusterAlertGroupFieldRecipients = "recipients" + ClusterAlertGroupFieldRemoved = "removed" + ClusterAlertGroupFieldRepeatIntervalSeconds = "repeatIntervalSeconds" + ClusterAlertGroupFieldState = "state" + ClusterAlertGroupFieldTransitioning = "transitioning" + ClusterAlertGroupFieldTransitioningMessage = "transitioningMessage" + ClusterAlertGroupFieldUUID = "uuid" +) + +type ClusterAlertGroup struct { + types.Resource + AlertState string `json:"alertState,omitempty" yaml:"alertState,omitempty"` + Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,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"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + GroupIntervalSeconds int64 `json:"groupIntervalSeconds,omitempty" yaml:"groupIntervalSeconds,omitempty"` + GroupWaitSeconds int64 `json:"groupWaitSeconds,omitempty" yaml:"groupWaitSeconds,omitempty"` + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"` + Recipients []Recipient `json:"recipients,omitempty" yaml:"recipients,omitempty"` + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + RepeatIntervalSeconds int64 `json:"repeatIntervalSeconds,omitempty" yaml:"repeatIntervalSeconds,omitempty"` + State string `json:"state,omitempty" yaml:"state,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"` +} + +type ClusterAlertGroupCollection struct { + types.Collection + Data []ClusterAlertGroup `json:"data,omitempty"` + client *ClusterAlertGroupClient +} + +type ClusterAlertGroupClient struct { + apiClient *Client +} + +type ClusterAlertGroupOperations interface { + List(opts *types.ListOpts) (*ClusterAlertGroupCollection, error) + Create(opts *ClusterAlertGroup) (*ClusterAlertGroup, error) + Update(existing *ClusterAlertGroup, updates interface{}) (*ClusterAlertGroup, error) + Replace(existing *ClusterAlertGroup) (*ClusterAlertGroup, error) + ByID(id string) (*ClusterAlertGroup, error) + Delete(container *ClusterAlertGroup) error +} + +func newClusterAlertGroupClient(apiClient *Client) *ClusterAlertGroupClient { + return &ClusterAlertGroupClient{ + apiClient: apiClient, + } +} + +func (c *ClusterAlertGroupClient) Create(container *ClusterAlertGroup) (*ClusterAlertGroup, error) { + resp := &ClusterAlertGroup{} + err := c.apiClient.Ops.DoCreate(ClusterAlertGroupType, container, resp) + return resp, err +} + +func (c *ClusterAlertGroupClient) Update(existing *ClusterAlertGroup, updates interface{}) (*ClusterAlertGroup, error) { + resp := &ClusterAlertGroup{} + err := c.apiClient.Ops.DoUpdate(ClusterAlertGroupType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ClusterAlertGroupClient) Replace(obj *ClusterAlertGroup) (*ClusterAlertGroup, error) { + resp := &ClusterAlertGroup{} + err := c.apiClient.Ops.DoReplace(ClusterAlertGroupType, &obj.Resource, obj, resp) + return resp, err +} + +func (c *ClusterAlertGroupClient) List(opts *types.ListOpts) (*ClusterAlertGroupCollection, error) { + resp := &ClusterAlertGroupCollection{} + err := c.apiClient.Ops.DoList(ClusterAlertGroupType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ClusterAlertGroupCollection) Next() (*ClusterAlertGroupCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ClusterAlertGroupCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ClusterAlertGroupClient) ByID(id string) (*ClusterAlertGroup, error) { + resp := &ClusterAlertGroup{} + err := c.apiClient.Ops.DoByID(ClusterAlertGroupType, id, resp) + return resp, err +} + +func (c *ClusterAlertGroupClient) Delete(container *ClusterAlertGroup) error { + return c.apiClient.Ops.DoResourceDelete(ClusterAlertGroupType, &container.Resource) +} diff --git a/client/management/v3/zz_generated_cluster_alert_rule.go b/client/management/v3/zz_generated_cluster_alert_rule.go new file mode 100644 index 00000000..9aabb5c1 --- /dev/null +++ b/client/management/v3/zz_generated_cluster_alert_rule.go @@ -0,0 +1,157 @@ +package client + +import ( + "github.com/rancher/norman/types" +) + +const ( + ClusterAlertRuleType = "clusterAlertRule" + ClusterAlertRuleFieldAlertState = "alertState" + ClusterAlertRuleFieldAnnotations = "annotations" + ClusterAlertRuleFieldClusterID = "clusterId" + ClusterAlertRuleFieldCreated = "created" + ClusterAlertRuleFieldCreatorID = "creatorId" + ClusterAlertRuleFieldEventRule = "eventRule" + ClusterAlertRuleFieldGroupID = "groupId" + ClusterAlertRuleFieldGroupIntervalSeconds = "groupIntervalSeconds" + ClusterAlertRuleFieldGroupWaitSeconds = "groupWaitSeconds" + ClusterAlertRuleFieldLabels = "labels" + ClusterAlertRuleFieldMetricRule = "metricRule" + ClusterAlertRuleFieldName = "name" + ClusterAlertRuleFieldNamespaceId = "namespaceId" + ClusterAlertRuleFieldNodeRule = "nodeRule" + ClusterAlertRuleFieldOwnerReferences = "ownerReferences" + ClusterAlertRuleFieldRemoved = "removed" + ClusterAlertRuleFieldRepeatIntervalSeconds = "repeatIntervalSeconds" + ClusterAlertRuleFieldSeverity = "severity" + ClusterAlertRuleFieldState = "state" + ClusterAlertRuleFieldSystemServiceRule = "systemServiceRule" + ClusterAlertRuleFieldTransitioning = "transitioning" + ClusterAlertRuleFieldTransitioningMessage = "transitioningMessage" + ClusterAlertRuleFieldUUID = "uuid" +) + +type ClusterAlertRule struct { + types.Resource + AlertState string `json:"alertState,omitempty" yaml:"alertState,omitempty"` + Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,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"` + EventRule *EventRule `json:"eventRule,omitempty" yaml:"eventRule,omitempty"` + GroupID string `json:"groupId,omitempty" yaml:"groupId,omitempty"` + GroupIntervalSeconds int64 `json:"groupIntervalSeconds,omitempty" yaml:"groupIntervalSeconds,omitempty"` + GroupWaitSeconds int64 `json:"groupWaitSeconds,omitempty" yaml:"groupWaitSeconds,omitempty"` + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + MetricRule *MetricRule `json:"metricRule,omitempty" yaml:"metricRule,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"` + NodeRule *NodeRule `json:"nodeRule,omitempty" yaml:"nodeRule,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"` + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + RepeatIntervalSeconds int64 `json:"repeatIntervalSeconds,omitempty" yaml:"repeatIntervalSeconds,omitempty"` + Severity string `json:"severity,omitempty" yaml:"severity,omitempty"` + State string `json:"state,omitempty" yaml:"state,omitempty"` + SystemServiceRule *SystemServiceRule `json:"systemServiceRule,omitempty" yaml:"systemServiceRule,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"` +} + +type ClusterAlertRuleCollection struct { + types.Collection + Data []ClusterAlertRule `json:"data,omitempty"` + client *ClusterAlertRuleClient +} + +type ClusterAlertRuleClient struct { + apiClient *Client +} + +type ClusterAlertRuleOperations interface { + List(opts *types.ListOpts) (*ClusterAlertRuleCollection, error) + Create(opts *ClusterAlertRule) (*ClusterAlertRule, error) + Update(existing *ClusterAlertRule, updates interface{}) (*ClusterAlertRule, error) + Replace(existing *ClusterAlertRule) (*ClusterAlertRule, error) + ByID(id string) (*ClusterAlertRule, error) + Delete(container *ClusterAlertRule) error + + ActionActivate(resource *ClusterAlertRule) error + + ActionDeactivate(resource *ClusterAlertRule) error + + ActionMute(resource *ClusterAlertRule) error + + ActionUnmute(resource *ClusterAlertRule) error +} + +func newClusterAlertRuleClient(apiClient *Client) *ClusterAlertRuleClient { + return &ClusterAlertRuleClient{ + apiClient: apiClient, + } +} + +func (c *ClusterAlertRuleClient) Create(container *ClusterAlertRule) (*ClusterAlertRule, error) { + resp := &ClusterAlertRule{} + err := c.apiClient.Ops.DoCreate(ClusterAlertRuleType, container, resp) + return resp, err +} + +func (c *ClusterAlertRuleClient) Update(existing *ClusterAlertRule, updates interface{}) (*ClusterAlertRule, error) { + resp := &ClusterAlertRule{} + err := c.apiClient.Ops.DoUpdate(ClusterAlertRuleType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ClusterAlertRuleClient) Replace(obj *ClusterAlertRule) (*ClusterAlertRule, error) { + resp := &ClusterAlertRule{} + err := c.apiClient.Ops.DoReplace(ClusterAlertRuleType, &obj.Resource, obj, resp) + return resp, err +} + +func (c *ClusterAlertRuleClient) List(opts *types.ListOpts) (*ClusterAlertRuleCollection, error) { + resp := &ClusterAlertRuleCollection{} + err := c.apiClient.Ops.DoList(ClusterAlertRuleType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ClusterAlertRuleCollection) Next() (*ClusterAlertRuleCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ClusterAlertRuleCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ClusterAlertRuleClient) ByID(id string) (*ClusterAlertRule, error) { + resp := &ClusterAlertRule{} + err := c.apiClient.Ops.DoByID(ClusterAlertRuleType, id, resp) + return resp, err +} + +func (c *ClusterAlertRuleClient) Delete(container *ClusterAlertRule) error { + return c.apiClient.Ops.DoResourceDelete(ClusterAlertRuleType, &container.Resource) +} + +func (c *ClusterAlertRuleClient) ActionActivate(resource *ClusterAlertRule) error { + err := c.apiClient.Ops.DoAction(ClusterAlertRuleType, "activate", &resource.Resource, nil, nil) + return err +} + +func (c *ClusterAlertRuleClient) ActionDeactivate(resource *ClusterAlertRule) error { + err := c.apiClient.Ops.DoAction(ClusterAlertRuleType, "deactivate", &resource.Resource, nil, nil) + return err +} + +func (c *ClusterAlertRuleClient) ActionMute(resource *ClusterAlertRule) error { + err := c.apiClient.Ops.DoAction(ClusterAlertRuleType, "mute", &resource.Resource, nil, nil) + return err +} + +func (c *ClusterAlertRuleClient) ActionUnmute(resource *ClusterAlertRule) error { + err := c.apiClient.Ops.DoAction(ClusterAlertRuleType, "unmute", &resource.Resource, nil, nil) + return err +} diff --git a/client/management/v3/zz_generated_cluster_alert_rule_spec.go b/client/management/v3/zz_generated_cluster_alert_rule_spec.go new file mode 100644 index 00000000..52efc2af --- /dev/null +++ b/client/management/v3/zz_generated_cluster_alert_rule_spec.go @@ -0,0 +1,30 @@ +package client + +const ( + ClusterAlertRuleSpecType = "clusterAlertRuleSpec" + ClusterAlertRuleSpecFieldClusterID = "clusterId" + ClusterAlertRuleSpecFieldDisplayName = "displayName" + ClusterAlertRuleSpecFieldEventRule = "eventRule" + ClusterAlertRuleSpecFieldGroupID = "groupId" + ClusterAlertRuleSpecFieldGroupIntervalSeconds = "groupIntervalSeconds" + ClusterAlertRuleSpecFieldGroupWaitSeconds = "groupWaitSeconds" + ClusterAlertRuleSpecFieldMetricRule = "metricRule" + ClusterAlertRuleSpecFieldNodeRule = "nodeRule" + ClusterAlertRuleSpecFieldRepeatIntervalSeconds = "repeatIntervalSeconds" + ClusterAlertRuleSpecFieldSeverity = "severity" + ClusterAlertRuleSpecFieldSystemServiceRule = "systemServiceRule" +) + +type ClusterAlertRuleSpec struct { + ClusterID string `json:"clusterId,omitempty" yaml:"clusterId,omitempty"` + DisplayName string `json:"displayName,omitempty" yaml:"displayName,omitempty"` + EventRule *EventRule `json:"eventRule,omitempty" yaml:"eventRule,omitempty"` + GroupID string `json:"groupId,omitempty" yaml:"groupId,omitempty"` + GroupIntervalSeconds int64 `json:"groupIntervalSeconds,omitempty" yaml:"groupIntervalSeconds,omitempty"` + GroupWaitSeconds int64 `json:"groupWaitSeconds,omitempty" yaml:"groupWaitSeconds,omitempty"` + MetricRule *MetricRule `json:"metricRule,omitempty" yaml:"metricRule,omitempty"` + NodeRule *NodeRule `json:"nodeRule,omitempty" yaml:"nodeRule,omitempty"` + RepeatIntervalSeconds int64 `json:"repeatIntervalSeconds,omitempty" yaml:"repeatIntervalSeconds,omitempty"` + Severity string `json:"severity,omitempty" yaml:"severity,omitempty"` + SystemServiceRule *SystemServiceRule `json:"systemServiceRule,omitempty" yaml:"systemServiceRule,omitempty"` +} diff --git a/client/management/v3/zz_generated_cluster_group_spec.go b/client/management/v3/zz_generated_cluster_group_spec.go new file mode 100644 index 00000000..db154a9b --- /dev/null +++ b/client/management/v3/zz_generated_cluster_group_spec.go @@ -0,0 +1,22 @@ +package client + +const ( + ClusterGroupSpecType = "clusterGroupSpec" + ClusterGroupSpecFieldClusterID = "clusterId" + ClusterGroupSpecFieldDescription = "description" + ClusterGroupSpecFieldDisplayName = "displayName" + ClusterGroupSpecFieldGroupIntervalSeconds = "groupIntervalSeconds" + ClusterGroupSpecFieldGroupWaitSeconds = "groupWaitSeconds" + ClusterGroupSpecFieldRecipients = "recipients" + ClusterGroupSpecFieldRepeatIntervalSeconds = "repeatIntervalSeconds" +) + +type ClusterGroupSpec struct { + ClusterID string `json:"clusterId,omitempty" yaml:"clusterId,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + DisplayName string `json:"displayName,omitempty" yaml:"displayName,omitempty"` + GroupIntervalSeconds int64 `json:"groupIntervalSeconds,omitempty" yaml:"groupIntervalSeconds,omitempty"` + GroupWaitSeconds int64 `json:"groupWaitSeconds,omitempty" yaml:"groupWaitSeconds,omitempty"` + Recipients []Recipient `json:"recipients,omitempty" yaml:"recipients,omitempty"` + RepeatIntervalSeconds int64 `json:"repeatIntervalSeconds,omitempty" yaml:"repeatIntervalSeconds,omitempty"` +} diff --git a/client/management/v3/zz_generated_cluster_metric_names_input.go b/client/management/v3/zz_generated_cluster_metric_names_input.go new file mode 100644 index 00000000..e31a8242 --- /dev/null +++ b/client/management/v3/zz_generated_cluster_metric_names_input.go @@ -0,0 +1,10 @@ +package client + +const ( + ClusterMetricNamesInputType = "clusterMetricNamesInput" + ClusterMetricNamesInputFieldClusterName = "clusterId" +) + +type ClusterMetricNamesInput struct { + ClusterName string `json:"clusterId,omitempty" yaml:"clusterId,omitempty"` +} diff --git a/client/management/v3/zz_generated_cluster_monitor_graph.go b/client/management/v3/zz_generated_cluster_monitor_graph.go new file mode 100644 index 00000000..4d32e140 --- /dev/null +++ b/client/management/v3/zz_generated_cluster_monitor_graph.go @@ -0,0 +1,127 @@ +package client + +import ( + "github.com/rancher/norman/types" +) + +const ( + ClusterMonitorGraphType = "clusterMonitorGraph" + ClusterMonitorGraphFieldAnnotations = "annotations" + ClusterMonitorGraphFieldClusterID = "clusterId" + ClusterMonitorGraphFieldCreated = "created" + ClusterMonitorGraphFieldCreatorID = "creatorId" + ClusterMonitorGraphFieldDescription = "description" + ClusterMonitorGraphFieldDetailsMetricsSelector = "detailsMetricsSelector" + ClusterMonitorGraphFieldDisplayResourceType = "displayResourceType" + ClusterMonitorGraphFieldGraphType = "graphType" + ClusterMonitorGraphFieldLabels = "labels" + ClusterMonitorGraphFieldMetricsSelector = "metricsSelector" + ClusterMonitorGraphFieldName = "name" + ClusterMonitorGraphFieldNamespaceId = "namespaceId" + ClusterMonitorGraphFieldOwnerReferences = "ownerReferences" + ClusterMonitorGraphFieldPriority = "priority" + ClusterMonitorGraphFieldRemoved = "removed" + ClusterMonitorGraphFieldResourceType = "resourceType" + ClusterMonitorGraphFieldUUID = "uuid" + ClusterMonitorGraphFieldYAxis = "yAxis" +) + +type ClusterMonitorGraph struct { + types.Resource + Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,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"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + DetailsMetricsSelector map[string]string `json:"detailsMetricsSelector,omitempty" yaml:"detailsMetricsSelector,omitempty"` + DisplayResourceType string `json:"displayResourceType,omitempty" yaml:"displayResourceType,omitempty"` + GraphType string `json:"graphType,omitempty" yaml:"graphType,omitempty"` + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + MetricsSelector map[string]string `json:"metricsSelector,omitempty" yaml:"metricsSelector,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"` + Priority int64 `json:"priority,omitempty" yaml:"priority,omitempty"` + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + ResourceType string `json:"resourceType,omitempty" yaml:"resourceType,omitempty"` + UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + YAxis *YAxis `json:"yAxis,omitempty" yaml:"yAxis,omitempty"` +} + +type ClusterMonitorGraphCollection struct { + types.Collection + Data []ClusterMonitorGraph `json:"data,omitempty"` + client *ClusterMonitorGraphClient +} + +type ClusterMonitorGraphClient struct { + apiClient *Client +} + +type ClusterMonitorGraphOperations interface { + List(opts *types.ListOpts) (*ClusterMonitorGraphCollection, error) + Create(opts *ClusterMonitorGraph) (*ClusterMonitorGraph, error) + Update(existing *ClusterMonitorGraph, updates interface{}) (*ClusterMonitorGraph, error) + Replace(existing *ClusterMonitorGraph) (*ClusterMonitorGraph, error) + ByID(id string) (*ClusterMonitorGraph, error) + Delete(container *ClusterMonitorGraph) error + + CollectionActionQuery(resource *ClusterMonitorGraphCollection, input *QueryGraphInput) (*QueryClusterGraphOutput, error) +} + +func newClusterMonitorGraphClient(apiClient *Client) *ClusterMonitorGraphClient { + return &ClusterMonitorGraphClient{ + apiClient: apiClient, + } +} + +func (c *ClusterMonitorGraphClient) Create(container *ClusterMonitorGraph) (*ClusterMonitorGraph, error) { + resp := &ClusterMonitorGraph{} + err := c.apiClient.Ops.DoCreate(ClusterMonitorGraphType, container, resp) + return resp, err +} + +func (c *ClusterMonitorGraphClient) Update(existing *ClusterMonitorGraph, updates interface{}) (*ClusterMonitorGraph, error) { + resp := &ClusterMonitorGraph{} + err := c.apiClient.Ops.DoUpdate(ClusterMonitorGraphType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ClusterMonitorGraphClient) Replace(obj *ClusterMonitorGraph) (*ClusterMonitorGraph, error) { + resp := &ClusterMonitorGraph{} + err := c.apiClient.Ops.DoReplace(ClusterMonitorGraphType, &obj.Resource, obj, resp) + return resp, err +} + +func (c *ClusterMonitorGraphClient) List(opts *types.ListOpts) (*ClusterMonitorGraphCollection, error) { + resp := &ClusterMonitorGraphCollection{} + err := c.apiClient.Ops.DoList(ClusterMonitorGraphType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ClusterMonitorGraphCollection) Next() (*ClusterMonitorGraphCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ClusterMonitorGraphCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ClusterMonitorGraphClient) ByID(id string) (*ClusterMonitorGraph, error) { + resp := &ClusterMonitorGraph{} + err := c.apiClient.Ops.DoByID(ClusterMonitorGraphType, id, resp) + return resp, err +} + +func (c *ClusterMonitorGraphClient) Delete(container *ClusterMonitorGraph) error { + return c.apiClient.Ops.DoResourceDelete(ClusterMonitorGraphType, &container.Resource) +} + +func (c *ClusterMonitorGraphClient) CollectionActionQuery(resource *ClusterMonitorGraphCollection, input *QueryGraphInput) (*QueryClusterGraphOutput, error) { + resp := &QueryClusterGraphOutput{} + err := c.apiClient.Ops.DoCollectionAction(ClusterMonitorGraphType, "query", &resource.Collection, input, resp) + return resp, err +} diff --git a/client/management/v3/zz_generated_cluster_monitor_graph_spec.go b/client/management/v3/zz_generated_cluster_monitor_graph_spec.go new file mode 100644 index 00000000..79c730e2 --- /dev/null +++ b/client/management/v3/zz_generated_cluster_monitor_graph_spec.go @@ -0,0 +1,26 @@ +package client + +const ( + ClusterMonitorGraphSpecType = "clusterMonitorGraphSpec" + ClusterMonitorGraphSpecFieldClusterID = "clusterId" + ClusterMonitorGraphSpecFieldDescription = "description" + ClusterMonitorGraphSpecFieldDetailsMetricsSelector = "detailsMetricsSelector" + ClusterMonitorGraphSpecFieldDisplayResourceType = "displayResourceType" + ClusterMonitorGraphSpecFieldGraphType = "graphType" + ClusterMonitorGraphSpecFieldMetricsSelector = "metricsSelector" + ClusterMonitorGraphSpecFieldPriority = "priority" + ClusterMonitorGraphSpecFieldResourceType = "resourceType" + ClusterMonitorGraphSpecFieldYAxis = "yAxis" +) + +type ClusterMonitorGraphSpec struct { + ClusterID string `json:"clusterId,omitempty" yaml:"clusterId,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + DetailsMetricsSelector map[string]string `json:"detailsMetricsSelector,omitempty" yaml:"detailsMetricsSelector,omitempty"` + DisplayResourceType string `json:"displayResourceType,omitempty" yaml:"displayResourceType,omitempty"` + GraphType string `json:"graphType,omitempty" yaml:"graphType,omitempty"` + MetricsSelector map[string]string `json:"metricsSelector,omitempty" yaml:"metricsSelector,omitempty"` + Priority int64 `json:"priority,omitempty" yaml:"priority,omitempty"` + ResourceType string `json:"resourceType,omitempty" yaml:"resourceType,omitempty"` + YAxis *YAxis `json:"yAxis,omitempty" yaml:"yAxis,omitempty"` +} diff --git a/client/management/v3/zz_generated_cluster_spec.go b/client/management/v3/zz_generated_cluster_spec.go index 3833c600..7ed2802c 100644 --- a/client/management/v3/zz_generated_cluster_spec.go +++ b/client/management/v3/zz_generated_cluster_spec.go @@ -10,6 +10,8 @@ const ( ClusterSpecFieldDesiredAgentImage = "desiredAgentImage" ClusterSpecFieldDisplayName = "displayName" ClusterSpecFieldDockerRootDir = "dockerRootDir" + ClusterSpecFieldEnableClusterAlerting = "enableClusterAlerting" + ClusterSpecFieldEnableClusterMonitoring = "enableClusterMonitoring" ClusterSpecFieldEnableNetworkPolicy = "enableNetworkPolicy" ClusterSpecFieldGenericEngineConfig = "genericEngineConfig" ClusterSpecFieldGoogleKubernetesEngineConfig = "googleKubernetesEngineConfig" @@ -27,6 +29,8 @@ type ClusterSpec struct { DesiredAgentImage string `json:"desiredAgentImage,omitempty" yaml:"desiredAgentImage,omitempty"` DisplayName string `json:"displayName,omitempty" yaml:"displayName,omitempty"` DockerRootDir string `json:"dockerRootDir,omitempty" yaml:"dockerRootDir,omitempty"` + EnableClusterAlerting bool `json:"enableClusterAlerting,omitempty" yaml:"enableClusterAlerting,omitempty"` + EnableClusterMonitoring bool `json:"enableClusterMonitoring,omitempty" yaml:"enableClusterMonitoring,omitempty"` EnableNetworkPolicy *bool `json:"enableNetworkPolicy,omitempty" yaml:"enableNetworkPolicy,omitempty"` GenericEngineConfig map[string]interface{} `json:"genericEngineConfig,omitempty" yaml:"genericEngineConfig,omitempty"` GoogleKubernetesEngineConfig map[string]interface{} `json:"googleKubernetesEngineConfig,omitempty" yaml:"googleKubernetesEngineConfig,omitempty"` diff --git a/client/management/v3/zz_generated_cluster_status.go b/client/management/v3/zz_generated_cluster_status.go index 0716b26d..737b5727 100644 --- a/client/management/v3/zz_generated_cluster_status.go +++ b/client/management/v3/zz_generated_cluster_status.go @@ -16,6 +16,7 @@ const ( ClusterStatusFieldDriver = "driver" ClusterStatusFieldFailedSpec = "failedSpec" ClusterStatusFieldLimits = "limits" + ClusterStatusFieldMonitoringStatus = "monitoringStatus" ClusterStatusFieldRequested = "requested" ClusterStatusFieldVersion = "version" ) @@ -35,6 +36,7 @@ type ClusterStatus struct { Driver string `json:"driver,omitempty" yaml:"driver,omitempty"` FailedSpec *ClusterSpec `json:"failedSpec,omitempty" yaml:"failedSpec,omitempty"` Limits map[string]string `json:"limits,omitempty" yaml:"limits,omitempty"` + MonitoringStatus *MonitoringStatus `json:"monitoringStatus,omitempty" yaml:"monitoringStatus,omitempty"` Requested map[string]string `json:"requested,omitempty" yaml:"requested,omitempty"` Version *Info `json:"version,omitempty" yaml:"version,omitempty"` } diff --git a/client/management/v3/zz_generated_event_rule.go b/client/management/v3/zz_generated_event_rule.go new file mode 100644 index 00000000..03df6bd5 --- /dev/null +++ b/client/management/v3/zz_generated_event_rule.go @@ -0,0 +1,12 @@ +package client + +const ( + EventRuleType = "eventRule" + EventRuleFieldEventType = "eventType" + EventRuleFieldResourceKind = "resourceKind" +) + +type EventRule struct { + EventType string `json:"eventType,omitempty" yaml:"eventType,omitempty"` + ResourceKind string `json:"resourceKind,omitempty" yaml:"resourceKind,omitempty"` +} diff --git a/client/management/v3/zz_generated_metric_names_output.go b/client/management/v3/zz_generated_metric_names_output.go new file mode 100644 index 00000000..8af21048 --- /dev/null +++ b/client/management/v3/zz_generated_metric_names_output.go @@ -0,0 +1,12 @@ +package client + +const ( + MetricNamesOutputType = "metricNamesOutput" + MetricNamesOutputFieldNames = "names" + MetricNamesOutputFieldType = "type" +) + +type MetricNamesOutput struct { + Names []string `json:"names,omitempty" yaml:"names,omitempty"` + Type string `json:"type,omitempty" yaml:"type,omitempty"` +} diff --git a/client/management/v3/zz_generated_metric_rule.go b/client/management/v3/zz_generated_metric_rule.go new file mode 100644 index 00000000..d94557fb --- /dev/null +++ b/client/management/v3/zz_generated_metric_rule.go @@ -0,0 +1,22 @@ +package client + +const ( + MetricRuleType = "metricRule" + MetricRuleFieldComparison = "comparison" + MetricRuleFieldDescription = "description" + MetricRuleFieldDuration = "duration" + MetricRuleFieldExpression = "expression" + MetricRuleFieldLegendFormat = "legendFormat" + MetricRuleFieldStep = "step" + MetricRuleFieldThresholdValue = "thresholdValue" +) + +type MetricRule struct { + Comparison string `json:"comparison,omitempty" yaml:"comparison,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + Duration string `json:"duration,omitempty" yaml:"duration,omitempty"` + Expression string `json:"expression,omitempty" yaml:"expression,omitempty"` + LegendFormat string `json:"legendFormat,omitempty" yaml:"legendFormat,omitempty"` + Step int64 `json:"step,omitempty" yaml:"step,omitempty"` + ThresholdValue *float64 `json:"thresholdValue,omitempty" yaml:"thresholdValue,omitempty"` +} diff --git a/client/management/v3/zz_generated_monitor_metric.go b/client/management/v3/zz_generated_monitor_metric.go new file mode 100644 index 00000000..099b5f7b --- /dev/null +++ b/client/management/v3/zz_generated_monitor_metric.go @@ -0,0 +1,139 @@ +package client + +import ( + "github.com/rancher/norman/types" +) + +const ( + MonitorMetricType = "monitorMetric" + MonitorMetricFieldAnnotations = "annotations" + MonitorMetricFieldCreated = "created" + MonitorMetricFieldCreatorID = "creatorId" + MonitorMetricFieldDescription = "description" + MonitorMetricFieldExpression = "expression" + MonitorMetricFieldLabels = "labels" + MonitorMetricFieldLegendFormat = "legendFormat" + MonitorMetricFieldName = "name" + MonitorMetricFieldNamespaceId = "namespaceId" + MonitorMetricFieldOwnerReferences = "ownerReferences" + MonitorMetricFieldRemoved = "removed" + MonitorMetricFieldUUID = "uuid" +) + +type MonitorMetric struct { + types.Resource + Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` + Created string `json:"created,omitempty" yaml:"created,omitempty"` + CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + Expression string `json:"expression,omitempty" yaml:"expression,omitempty"` + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + LegendFormat string `json:"legendFormat,omitempty" yaml:"legendFormat,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"` + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type MonitorMetricCollection struct { + types.Collection + Data []MonitorMetric `json:"data,omitempty"` + client *MonitorMetricClient +} + +type MonitorMetricClient struct { + apiClient *Client +} + +type MonitorMetricOperations interface { + List(opts *types.ListOpts) (*MonitorMetricCollection, error) + Create(opts *MonitorMetric) (*MonitorMetric, error) + Update(existing *MonitorMetric, updates interface{}) (*MonitorMetric, error) + Replace(existing *MonitorMetric) (*MonitorMetric, error) + ByID(id string) (*MonitorMetric, error) + Delete(container *MonitorMetric) error + + CollectionActionListclustermetricname(resource *MonitorMetricCollection, input *ClusterMetricNamesInput) (*MetricNamesOutput, error) + + CollectionActionListprojectmetricname(resource *MonitorMetricCollection, input *ProjectMetricNamesInput) (*MetricNamesOutput, error) + + CollectionActionQuerycluster(resource *MonitorMetricCollection, input *QueryClusterMetricInput) (*QueryMetricOutput, error) + + CollectionActionQueryproject(resource *MonitorMetricCollection, input *QueryProjectMetricInput) (*QueryMetricOutput, error) +} + +func newMonitorMetricClient(apiClient *Client) *MonitorMetricClient { + return &MonitorMetricClient{ + apiClient: apiClient, + } +} + +func (c *MonitorMetricClient) Create(container *MonitorMetric) (*MonitorMetric, error) { + resp := &MonitorMetric{} + err := c.apiClient.Ops.DoCreate(MonitorMetricType, container, resp) + return resp, err +} + +func (c *MonitorMetricClient) Update(existing *MonitorMetric, updates interface{}) (*MonitorMetric, error) { + resp := &MonitorMetric{} + err := c.apiClient.Ops.DoUpdate(MonitorMetricType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *MonitorMetricClient) Replace(obj *MonitorMetric) (*MonitorMetric, error) { + resp := &MonitorMetric{} + err := c.apiClient.Ops.DoReplace(MonitorMetricType, &obj.Resource, obj, resp) + return resp, err +} + +func (c *MonitorMetricClient) List(opts *types.ListOpts) (*MonitorMetricCollection, error) { + resp := &MonitorMetricCollection{} + err := c.apiClient.Ops.DoList(MonitorMetricType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *MonitorMetricCollection) Next() (*MonitorMetricCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &MonitorMetricCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *MonitorMetricClient) ByID(id string) (*MonitorMetric, error) { + resp := &MonitorMetric{} + err := c.apiClient.Ops.DoByID(MonitorMetricType, id, resp) + return resp, err +} + +func (c *MonitorMetricClient) Delete(container *MonitorMetric) error { + return c.apiClient.Ops.DoResourceDelete(MonitorMetricType, &container.Resource) +} + +func (c *MonitorMetricClient) CollectionActionListclustermetricname(resource *MonitorMetricCollection, input *ClusterMetricNamesInput) (*MetricNamesOutput, error) { + resp := &MetricNamesOutput{} + err := c.apiClient.Ops.DoCollectionAction(MonitorMetricType, "listclustermetricname", &resource.Collection, input, resp) + return resp, err +} + +func (c *MonitorMetricClient) CollectionActionListprojectmetricname(resource *MonitorMetricCollection, input *ProjectMetricNamesInput) (*MetricNamesOutput, error) { + resp := &MetricNamesOutput{} + err := c.apiClient.Ops.DoCollectionAction(MonitorMetricType, "listprojectmetricname", &resource.Collection, input, resp) + return resp, err +} + +func (c *MonitorMetricClient) CollectionActionQuerycluster(resource *MonitorMetricCollection, input *QueryClusterMetricInput) (*QueryMetricOutput, error) { + resp := &QueryMetricOutput{} + err := c.apiClient.Ops.DoCollectionAction(MonitorMetricType, "querycluster", &resource.Collection, input, resp) + return resp, err +} + +func (c *MonitorMetricClient) CollectionActionQueryproject(resource *MonitorMetricCollection, input *QueryProjectMetricInput) (*QueryMetricOutput, error) { + resp := &QueryMetricOutput{} + err := c.apiClient.Ops.DoCollectionAction(MonitorMetricType, "queryproject", &resource.Collection, input, resp) + return resp, err +} diff --git a/client/management/v3/zz_generated_monitor_metric_spec.go b/client/management/v3/zz_generated_monitor_metric_spec.go new file mode 100644 index 00000000..f34a1d91 --- /dev/null +++ b/client/management/v3/zz_generated_monitor_metric_spec.go @@ -0,0 +1,14 @@ +package client + +const ( + MonitorMetricSpecType = "monitorMetricSpec" + MonitorMetricSpecFieldDescription = "description" + MonitorMetricSpecFieldExpression = "expression" + MonitorMetricSpecFieldLegendFormat = "legendFormat" +) + +type MonitorMetricSpec struct { + Description string `json:"description,omitempty" yaml:"description,omitempty"` + Expression string `json:"expression,omitempty" yaml:"expression,omitempty"` + LegendFormat string `json:"legendFormat,omitempty" yaml:"legendFormat,omitempty"` +} diff --git a/client/management/v3/zz_generated_monitoring_condition.go b/client/management/v3/zz_generated_monitoring_condition.go new file mode 100644 index 00000000..40c4f34f --- /dev/null +++ b/client/management/v3/zz_generated_monitoring_condition.go @@ -0,0 +1,20 @@ +package client + +const ( + MonitoringConditionType = "monitoringCondition" + MonitoringConditionFieldLastTransitionTime = "lastTransitionTime" + MonitoringConditionFieldLastUpdateTime = "lastUpdateTime" + MonitoringConditionFieldMessage = "message" + MonitoringConditionFieldReason = "reason" + MonitoringConditionFieldStatus = "status" + MonitoringConditionFieldType = "type" +) + +type MonitoringCondition struct { + LastTransitionTime string `json:"lastTransitionTime,omitempty" yaml:"lastTransitionTime,omitempty"` + LastUpdateTime string `json:"lastUpdateTime,omitempty" yaml:"lastUpdateTime,omitempty"` + Message string `json:"message,omitempty" yaml:"message,omitempty"` + Reason string `json:"reason,omitempty" yaml:"reason,omitempty"` + Status string `json:"status,omitempty" yaml:"status,omitempty"` + Type string `json:"type,omitempty" yaml:"type,omitempty"` +} diff --git a/client/management/v3/zz_generated_monitoring_input.go b/client/management/v3/zz_generated_monitoring_input.go new file mode 100644 index 00000000..7a5b0933 --- /dev/null +++ b/client/management/v3/zz_generated_monitoring_input.go @@ -0,0 +1,10 @@ +package client + +const ( + MonitoringInputType = "monitoringInput" + MonitoringInputFieldAnswers = "answers" +) + +type MonitoringInput struct { + Answers map[string]string `json:"answers,omitempty" yaml:"answers,omitempty"` +} diff --git a/client/management/v3/zz_generated_monitoring_status.go b/client/management/v3/zz_generated_monitoring_status.go new file mode 100644 index 00000000..3c52c7f0 --- /dev/null +++ b/client/management/v3/zz_generated_monitoring_status.go @@ -0,0 +1,12 @@ +package client + +const ( + MonitoringStatusType = "monitoringStatus" + MonitoringStatusFieldConditions = "conditions" + MonitoringStatusFieldGrafanaEndpoint = "grafanaEndpoint" +) + +type MonitoringStatus struct { + Conditions []MonitoringCondition `json:"conditions,omitempty" yaml:"conditions,omitempty"` + GrafanaEndpoint string `json:"grafanaEndpoint,omitempty" yaml:"grafanaEndpoint,omitempty"` +} diff --git a/client/management/v3/zz_generated_node_rule.go b/client/management/v3/zz_generated_node_rule.go new file mode 100644 index 00000000..0f8af13e --- /dev/null +++ b/client/management/v3/zz_generated_node_rule.go @@ -0,0 +1,18 @@ +package client + +const ( + NodeRuleType = "nodeRule" + NodeRuleFieldCPUThreshold = "cpuThreshold" + NodeRuleFieldCondition = "condition" + NodeRuleFieldMemThreshold = "memThreshold" + NodeRuleFieldNodeID = "nodeId" + NodeRuleFieldSelector = "selector" +) + +type NodeRule struct { + CPUThreshold int64 `json:"cpuThreshold,omitempty" yaml:"cpuThreshold,omitempty"` + Condition string `json:"condition,omitempty" yaml:"condition,omitempty"` + MemThreshold int64 `json:"memThreshold,omitempty" yaml:"memThreshold,omitempty"` + NodeID string `json:"nodeId,omitempty" yaml:"nodeId,omitempty"` + Selector map[string]string `json:"selector,omitempty" yaml:"selector,omitempty"` +} diff --git a/client/management/v3/zz_generated_pod_rule.go b/client/management/v3/zz_generated_pod_rule.go new file mode 100644 index 00000000..466be84c --- /dev/null +++ b/client/management/v3/zz_generated_pod_rule.go @@ -0,0 +1,16 @@ +package client + +const ( + PodRuleType = "podRule" + PodRuleFieldCondition = "condition" + PodRuleFieldPodID = "podId" + PodRuleFieldRestartIntervalSeconds = "restartIntervalSeconds" + PodRuleFieldRestartTimes = "restartTimes" +) + +type PodRule struct { + Condition string `json:"condition,omitempty" yaml:"condition,omitempty"` + PodID string `json:"podId,omitempty" yaml:"podId,omitempty"` + RestartIntervalSeconds int64 `json:"restartIntervalSeconds,omitempty" yaml:"restartIntervalSeconds,omitempty"` + RestartTimes int64 `json:"restartTimes,omitempty" yaml:"restartTimes,omitempty"` +} diff --git a/client/management/v3/zz_generated_project.go b/client/management/v3/zz_generated_project.go index 53d1f9b1..b0eb66d2 100644 --- a/client/management/v3/zz_generated_project.go +++ b/client/management/v3/zz_generated_project.go @@ -12,7 +12,9 @@ const ( ProjectFieldCreated = "created" ProjectFieldCreatorID = "creatorId" ProjectFieldDescription = "description" + ProjectFieldEnableProjectMonitoring = "enableProjectMonitoring" ProjectFieldLabels = "labels" + ProjectFieldMonitoringStatus = "monitoringStatus" ProjectFieldName = "name" ProjectFieldNamespaceDefaultResourceQuota = "namespaceDefaultResourceQuota" ProjectFieldNamespaceId = "namespaceId" @@ -34,7 +36,9 @@ type Project struct { Created string `json:"created,omitempty" yaml:"created,omitempty"` CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` + EnableProjectMonitoring bool `json:"enableProjectMonitoring,omitempty" yaml:"enableProjectMonitoring,omitempty"` Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + MonitoringStatus *MonitoringStatus `json:"monitoringStatus,omitempty" yaml:"monitoringStatus,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` NamespaceDefaultResourceQuota *NamespaceResourceQuota `json:"namespaceDefaultResourceQuota,omitempty" yaml:"namespaceDefaultResourceQuota,omitempty"` NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"` @@ -66,6 +70,10 @@ type ProjectOperations interface { ByID(id string) (*Project, error) Delete(container *Project) error + ActionDisableMonitoring(resource *Project) error + + ActionEnableMonitoring(resource *Project, input *MonitoringInput) error + ActionExportYaml(resource *Project) error ActionSetpodsecuritypolicytemplate(resource *Project, input *SetPodSecurityPolicyTemplateInput) (*Project, error) @@ -122,6 +130,16 @@ func (c *ProjectClient) Delete(container *Project) error { return c.apiClient.Ops.DoResourceDelete(ProjectType, &container.Resource) } +func (c *ProjectClient) ActionDisableMonitoring(resource *Project) error { + err := c.apiClient.Ops.DoAction(ProjectType, "disableMonitoring", &resource.Resource, nil, nil) + return err +} + +func (c *ProjectClient) ActionEnableMonitoring(resource *Project, input *MonitoringInput) error { + err := c.apiClient.Ops.DoAction(ProjectType, "enableMonitoring", &resource.Resource, input, nil) + return err +} + func (c *ProjectClient) ActionExportYaml(resource *Project) error { err := c.apiClient.Ops.DoAction(ProjectType, "exportYaml", &resource.Resource, nil, nil) return err diff --git a/client/management/v3/zz_generated_project_alert.go b/client/management/v3/zz_generated_project_alert.go index 2554b3ca..b108284e 100644 --- a/client/management/v3/zz_generated_project_alert.go +++ b/client/management/v3/zz_generated_project_alert.go @@ -6,11 +6,11 @@ import ( const ( ProjectAlertType = "projectAlert" - ProjectAlertFieldAlertState = "alertState" ProjectAlertFieldAnnotations = "annotations" ProjectAlertFieldCreated = "created" ProjectAlertFieldCreatorID = "creatorId" ProjectAlertFieldDescription = "description" + ProjectAlertFieldDisplayName = "displayName" ProjectAlertFieldInitialWaitSeconds = "initialWaitSeconds" ProjectAlertFieldLabels = "labels" ProjectAlertFieldName = "name" @@ -22,6 +22,7 @@ const ( ProjectAlertFieldRepeatIntervalSeconds = "repeatIntervalSeconds" ProjectAlertFieldSeverity = "severity" ProjectAlertFieldState = "state" + ProjectAlertFieldStatus = "status" ProjectAlertFieldTargetPod = "targetPod" ProjectAlertFieldTargetWorkload = "targetWorkload" ProjectAlertFieldTransitioning = "transitioning" @@ -31,11 +32,11 @@ const ( type ProjectAlert struct { types.Resource - AlertState string `json:"alertState,omitempty" yaml:"alertState,omitempty"` Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` Created string `json:"created,omitempty" yaml:"created,omitempty"` CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` + DisplayName string `json:"displayName,omitempty" yaml:"displayName,omitempty"` InitialWaitSeconds int64 `json:"initialWaitSeconds,omitempty" yaml:"initialWaitSeconds,omitempty"` Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` @@ -47,6 +48,7 @@ type ProjectAlert struct { RepeatIntervalSeconds int64 `json:"repeatIntervalSeconds,omitempty" yaml:"repeatIntervalSeconds,omitempty"` Severity string `json:"severity,omitempty" yaml:"severity,omitempty"` State string `json:"state,omitempty" yaml:"state,omitempty"` + Status *AlertStatus `json:"status,omitempty" yaml:"status,omitempty"` TargetPod *TargetPod `json:"targetPod,omitempty" yaml:"targetPod,omitempty"` TargetWorkload *TargetWorkload `json:"targetWorkload,omitempty" yaml:"targetWorkload,omitempty"` Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` @@ -71,14 +73,6 @@ type ProjectAlertOperations interface { Replace(existing *ProjectAlert) (*ProjectAlert, error) ByID(id string) (*ProjectAlert, error) Delete(container *ProjectAlert) error - - ActionActivate(resource *ProjectAlert) error - - ActionDeactivate(resource *ProjectAlert) error - - ActionMute(resource *ProjectAlert) error - - ActionUnmute(resource *ProjectAlert) error } func newProjectAlertClient(apiClient *Client) *ProjectAlertClient { @@ -131,23 +125,3 @@ func (c *ProjectAlertClient) ByID(id string) (*ProjectAlert, error) { func (c *ProjectAlertClient) Delete(container *ProjectAlert) error { return c.apiClient.Ops.DoResourceDelete(ProjectAlertType, &container.Resource) } - -func (c *ProjectAlertClient) ActionActivate(resource *ProjectAlert) error { - err := c.apiClient.Ops.DoAction(ProjectAlertType, "activate", &resource.Resource, nil, nil) - return err -} - -func (c *ProjectAlertClient) ActionDeactivate(resource *ProjectAlert) error { - err := c.apiClient.Ops.DoAction(ProjectAlertType, "deactivate", &resource.Resource, nil, nil) - return err -} - -func (c *ProjectAlertClient) ActionMute(resource *ProjectAlert) error { - err := c.apiClient.Ops.DoAction(ProjectAlertType, "mute", &resource.Resource, nil, nil) - return err -} - -func (c *ProjectAlertClient) ActionUnmute(resource *ProjectAlert) error { - err := c.apiClient.Ops.DoAction(ProjectAlertType, "unmute", &resource.Resource, nil, nil) - return err -} diff --git a/client/management/v3/zz_generated_project_alert_group.go b/client/management/v3/zz_generated_project_alert_group.go new file mode 100644 index 00000000..f0148ba1 --- /dev/null +++ b/client/management/v3/zz_generated_project_alert_group.go @@ -0,0 +1,121 @@ +package client + +import ( + "github.com/rancher/norman/types" +) + +const ( + ProjectAlertGroupType = "projectAlertGroup" + ProjectAlertGroupFieldAlertState = "alertState" + ProjectAlertGroupFieldAnnotations = "annotations" + ProjectAlertGroupFieldCreated = "created" + ProjectAlertGroupFieldCreatorID = "creatorId" + ProjectAlertGroupFieldDescription = "description" + ProjectAlertGroupFieldGroupIntervalSeconds = "groupIntervalSeconds" + ProjectAlertGroupFieldGroupWaitSeconds = "groupWaitSeconds" + ProjectAlertGroupFieldLabels = "labels" + ProjectAlertGroupFieldName = "name" + ProjectAlertGroupFieldNamespaceId = "namespaceId" + ProjectAlertGroupFieldOwnerReferences = "ownerReferences" + ProjectAlertGroupFieldProjectID = "projectId" + ProjectAlertGroupFieldRecipients = "recipients" + ProjectAlertGroupFieldRemoved = "removed" + ProjectAlertGroupFieldRepeatIntervalSeconds = "repeatIntervalSeconds" + ProjectAlertGroupFieldState = "state" + ProjectAlertGroupFieldTransitioning = "transitioning" + ProjectAlertGroupFieldTransitioningMessage = "transitioningMessage" + ProjectAlertGroupFieldUUID = "uuid" +) + +type ProjectAlertGroup struct { + types.Resource + AlertState string `json:"alertState,omitempty" yaml:"alertState,omitempty"` + Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` + Created string `json:"created,omitempty" yaml:"created,omitempty"` + CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + GroupIntervalSeconds int64 `json:"groupIntervalSeconds,omitempty" yaml:"groupIntervalSeconds,omitempty"` + GroupWaitSeconds int64 `json:"groupWaitSeconds,omitempty" yaml:"groupWaitSeconds,omitempty"` + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"` + ProjectID string `json:"projectId,omitempty" yaml:"projectId,omitempty"` + Recipients []Recipient `json:"recipients,omitempty" yaml:"recipients,omitempty"` + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + RepeatIntervalSeconds int64 `json:"repeatIntervalSeconds,omitempty" yaml:"repeatIntervalSeconds,omitempty"` + State string `json:"state,omitempty" yaml:"state,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"` +} + +type ProjectAlertGroupCollection struct { + types.Collection + Data []ProjectAlertGroup `json:"data,omitempty"` + client *ProjectAlertGroupClient +} + +type ProjectAlertGroupClient struct { + apiClient *Client +} + +type ProjectAlertGroupOperations interface { + List(opts *types.ListOpts) (*ProjectAlertGroupCollection, error) + Create(opts *ProjectAlertGroup) (*ProjectAlertGroup, error) + Update(existing *ProjectAlertGroup, updates interface{}) (*ProjectAlertGroup, error) + Replace(existing *ProjectAlertGroup) (*ProjectAlertGroup, error) + ByID(id string) (*ProjectAlertGroup, error) + Delete(container *ProjectAlertGroup) error +} + +func newProjectAlertGroupClient(apiClient *Client) *ProjectAlertGroupClient { + return &ProjectAlertGroupClient{ + apiClient: apiClient, + } +} + +func (c *ProjectAlertGroupClient) Create(container *ProjectAlertGroup) (*ProjectAlertGroup, error) { + resp := &ProjectAlertGroup{} + err := c.apiClient.Ops.DoCreate(ProjectAlertGroupType, container, resp) + return resp, err +} + +func (c *ProjectAlertGroupClient) Update(existing *ProjectAlertGroup, updates interface{}) (*ProjectAlertGroup, error) { + resp := &ProjectAlertGroup{} + err := c.apiClient.Ops.DoUpdate(ProjectAlertGroupType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ProjectAlertGroupClient) Replace(obj *ProjectAlertGroup) (*ProjectAlertGroup, error) { + resp := &ProjectAlertGroup{} + err := c.apiClient.Ops.DoReplace(ProjectAlertGroupType, &obj.Resource, obj, resp) + return resp, err +} + +func (c *ProjectAlertGroupClient) List(opts *types.ListOpts) (*ProjectAlertGroupCollection, error) { + resp := &ProjectAlertGroupCollection{} + err := c.apiClient.Ops.DoList(ProjectAlertGroupType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ProjectAlertGroupCollection) Next() (*ProjectAlertGroupCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ProjectAlertGroupCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ProjectAlertGroupClient) ByID(id string) (*ProjectAlertGroup, error) { + resp := &ProjectAlertGroup{} + err := c.apiClient.Ops.DoByID(ProjectAlertGroupType, id, resp) + return resp, err +} + +func (c *ProjectAlertGroupClient) Delete(container *ProjectAlertGroup) error { + return c.apiClient.Ops.DoResourceDelete(ProjectAlertGroupType, &container.Resource) +} diff --git a/client/management/v3/zz_generated_project_alert_rule.go b/client/management/v3/zz_generated_project_alert_rule.go new file mode 100644 index 00000000..89743709 --- /dev/null +++ b/client/management/v3/zz_generated_project_alert_rule.go @@ -0,0 +1,155 @@ +package client + +import ( + "github.com/rancher/norman/types" +) + +const ( + ProjectAlertRuleType = "projectAlertRule" + ProjectAlertRuleFieldAlertState = "alertState" + ProjectAlertRuleFieldAnnotations = "annotations" + ProjectAlertRuleFieldCreated = "created" + ProjectAlertRuleFieldCreatorID = "creatorId" + ProjectAlertRuleFieldGroupID = "groupId" + ProjectAlertRuleFieldGroupIntervalSeconds = "groupIntervalSeconds" + ProjectAlertRuleFieldGroupWaitSeconds = "groupWaitSeconds" + ProjectAlertRuleFieldLabels = "labels" + ProjectAlertRuleFieldMetricRule = "metricRule" + ProjectAlertRuleFieldName = "name" + ProjectAlertRuleFieldNamespaceId = "namespaceId" + ProjectAlertRuleFieldOwnerReferences = "ownerReferences" + ProjectAlertRuleFieldPodRule = "podRule" + ProjectAlertRuleFieldProjectID = "projectId" + ProjectAlertRuleFieldRemoved = "removed" + ProjectAlertRuleFieldRepeatIntervalSeconds = "repeatIntervalSeconds" + ProjectAlertRuleFieldSeverity = "severity" + ProjectAlertRuleFieldState = "state" + ProjectAlertRuleFieldTransitioning = "transitioning" + ProjectAlertRuleFieldTransitioningMessage = "transitioningMessage" + ProjectAlertRuleFieldUUID = "uuid" + ProjectAlertRuleFieldWorkloadRule = "workloadRule" +) + +type ProjectAlertRule struct { + types.Resource + AlertState string `json:"alertState,omitempty" yaml:"alertState,omitempty"` + Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` + Created string `json:"created,omitempty" yaml:"created,omitempty"` + CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"` + GroupID string `json:"groupId,omitempty" yaml:"groupId,omitempty"` + GroupIntervalSeconds int64 `json:"groupIntervalSeconds,omitempty" yaml:"groupIntervalSeconds,omitempty"` + GroupWaitSeconds int64 `json:"groupWaitSeconds,omitempty" yaml:"groupWaitSeconds,omitempty"` + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + MetricRule *MetricRule `json:"metricRule,omitempty" yaml:"metricRule,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"` + PodRule *PodRule `json:"podRule,omitempty" yaml:"podRule,omitempty"` + ProjectID string `json:"projectId,omitempty" yaml:"projectId,omitempty"` + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + RepeatIntervalSeconds int64 `json:"repeatIntervalSeconds,omitempty" yaml:"repeatIntervalSeconds,omitempty"` + Severity string `json:"severity,omitempty" yaml:"severity,omitempty"` + State string `json:"state,omitempty" yaml:"state,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"` + WorkloadRule *WorkloadRule `json:"workloadRule,omitempty" yaml:"workloadRule,omitempty"` +} + +type ProjectAlertRuleCollection struct { + types.Collection + Data []ProjectAlertRule `json:"data,omitempty"` + client *ProjectAlertRuleClient +} + +type ProjectAlertRuleClient struct { + apiClient *Client +} + +type ProjectAlertRuleOperations interface { + List(opts *types.ListOpts) (*ProjectAlertRuleCollection, error) + Create(opts *ProjectAlertRule) (*ProjectAlertRule, error) + Update(existing *ProjectAlertRule, updates interface{}) (*ProjectAlertRule, error) + Replace(existing *ProjectAlertRule) (*ProjectAlertRule, error) + ByID(id string) (*ProjectAlertRule, error) + Delete(container *ProjectAlertRule) error + + ActionActivate(resource *ProjectAlertRule) error + + ActionDeactivate(resource *ProjectAlertRule) error + + ActionMute(resource *ProjectAlertRule) error + + ActionUnmute(resource *ProjectAlertRule) error +} + +func newProjectAlertRuleClient(apiClient *Client) *ProjectAlertRuleClient { + return &ProjectAlertRuleClient{ + apiClient: apiClient, + } +} + +func (c *ProjectAlertRuleClient) Create(container *ProjectAlertRule) (*ProjectAlertRule, error) { + resp := &ProjectAlertRule{} + err := c.apiClient.Ops.DoCreate(ProjectAlertRuleType, container, resp) + return resp, err +} + +func (c *ProjectAlertRuleClient) Update(existing *ProjectAlertRule, updates interface{}) (*ProjectAlertRule, error) { + resp := &ProjectAlertRule{} + err := c.apiClient.Ops.DoUpdate(ProjectAlertRuleType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ProjectAlertRuleClient) Replace(obj *ProjectAlertRule) (*ProjectAlertRule, error) { + resp := &ProjectAlertRule{} + err := c.apiClient.Ops.DoReplace(ProjectAlertRuleType, &obj.Resource, obj, resp) + return resp, err +} + +func (c *ProjectAlertRuleClient) List(opts *types.ListOpts) (*ProjectAlertRuleCollection, error) { + resp := &ProjectAlertRuleCollection{} + err := c.apiClient.Ops.DoList(ProjectAlertRuleType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ProjectAlertRuleCollection) Next() (*ProjectAlertRuleCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ProjectAlertRuleCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ProjectAlertRuleClient) ByID(id string) (*ProjectAlertRule, error) { + resp := &ProjectAlertRule{} + err := c.apiClient.Ops.DoByID(ProjectAlertRuleType, id, resp) + return resp, err +} + +func (c *ProjectAlertRuleClient) Delete(container *ProjectAlertRule) error { + return c.apiClient.Ops.DoResourceDelete(ProjectAlertRuleType, &container.Resource) +} + +func (c *ProjectAlertRuleClient) ActionActivate(resource *ProjectAlertRule) error { + err := c.apiClient.Ops.DoAction(ProjectAlertRuleType, "activate", &resource.Resource, nil, nil) + return err +} + +func (c *ProjectAlertRuleClient) ActionDeactivate(resource *ProjectAlertRule) error { + err := c.apiClient.Ops.DoAction(ProjectAlertRuleType, "deactivate", &resource.Resource, nil, nil) + return err +} + +func (c *ProjectAlertRuleClient) ActionMute(resource *ProjectAlertRule) error { + err := c.apiClient.Ops.DoAction(ProjectAlertRuleType, "mute", &resource.Resource, nil, nil) + return err +} + +func (c *ProjectAlertRuleClient) ActionUnmute(resource *ProjectAlertRule) error { + err := c.apiClient.Ops.DoAction(ProjectAlertRuleType, "unmute", &resource.Resource, nil, nil) + return err +} diff --git a/client/management/v3/zz_generated_project_alert_rule_spec.go b/client/management/v3/zz_generated_project_alert_rule_spec.go new file mode 100644 index 00000000..3fcfce0b --- /dev/null +++ b/client/management/v3/zz_generated_project_alert_rule_spec.go @@ -0,0 +1,28 @@ +package client + +const ( + ProjectAlertRuleSpecType = "projectAlertRuleSpec" + ProjectAlertRuleSpecFieldDisplayName = "displayName" + ProjectAlertRuleSpecFieldGroupID = "groupId" + ProjectAlertRuleSpecFieldGroupIntervalSeconds = "groupIntervalSeconds" + ProjectAlertRuleSpecFieldGroupWaitSeconds = "groupWaitSeconds" + ProjectAlertRuleSpecFieldMetricRule = "metricRule" + ProjectAlertRuleSpecFieldPodRule = "podRule" + ProjectAlertRuleSpecFieldProjectID = "projectId" + ProjectAlertRuleSpecFieldRepeatIntervalSeconds = "repeatIntervalSeconds" + ProjectAlertRuleSpecFieldSeverity = "severity" + ProjectAlertRuleSpecFieldWorkloadRule = "workloadRule" +) + +type ProjectAlertRuleSpec struct { + DisplayName string `json:"displayName,omitempty" yaml:"displayName,omitempty"` + GroupID string `json:"groupId,omitempty" yaml:"groupId,omitempty"` + GroupIntervalSeconds int64 `json:"groupIntervalSeconds,omitempty" yaml:"groupIntervalSeconds,omitempty"` + GroupWaitSeconds int64 `json:"groupWaitSeconds,omitempty" yaml:"groupWaitSeconds,omitempty"` + MetricRule *MetricRule `json:"metricRule,omitempty" yaml:"metricRule,omitempty"` + PodRule *PodRule `json:"podRule,omitempty" yaml:"podRule,omitempty"` + ProjectID string `json:"projectId,omitempty" yaml:"projectId,omitempty"` + RepeatIntervalSeconds int64 `json:"repeatIntervalSeconds,omitempty" yaml:"repeatIntervalSeconds,omitempty"` + Severity string `json:"severity,omitempty" yaml:"severity,omitempty"` + WorkloadRule *WorkloadRule `json:"workloadRule,omitempty" yaml:"workloadRule,omitempty"` +} diff --git a/client/management/v3/zz_generated_project_group_spec.go b/client/management/v3/zz_generated_project_group_spec.go new file mode 100644 index 00000000..8c14f6e8 --- /dev/null +++ b/client/management/v3/zz_generated_project_group_spec.go @@ -0,0 +1,22 @@ +package client + +const ( + ProjectGroupSpecType = "projectGroupSpec" + ProjectGroupSpecFieldDescription = "description" + ProjectGroupSpecFieldDisplayName = "displayName" + ProjectGroupSpecFieldGroupIntervalSeconds = "groupIntervalSeconds" + ProjectGroupSpecFieldGroupWaitSeconds = "groupWaitSeconds" + ProjectGroupSpecFieldProjectID = "projectId" + ProjectGroupSpecFieldRecipients = "recipients" + ProjectGroupSpecFieldRepeatIntervalSeconds = "repeatIntervalSeconds" +) + +type ProjectGroupSpec struct { + Description string `json:"description,omitempty" yaml:"description,omitempty"` + DisplayName string `json:"displayName,omitempty" yaml:"displayName,omitempty"` + GroupIntervalSeconds int64 `json:"groupIntervalSeconds,omitempty" yaml:"groupIntervalSeconds,omitempty"` + GroupWaitSeconds int64 `json:"groupWaitSeconds,omitempty" yaml:"groupWaitSeconds,omitempty"` + ProjectID string `json:"projectId,omitempty" yaml:"projectId,omitempty"` + Recipients []Recipient `json:"recipients,omitempty" yaml:"recipients,omitempty"` + RepeatIntervalSeconds int64 `json:"repeatIntervalSeconds,omitempty" yaml:"repeatIntervalSeconds,omitempty"` +} diff --git a/client/management/v3/zz_generated_project_metric_names_input.go b/client/management/v3/zz_generated_project_metric_names_input.go new file mode 100644 index 00000000..f45cf07e --- /dev/null +++ b/client/management/v3/zz_generated_project_metric_names_input.go @@ -0,0 +1,10 @@ +package client + +const ( + ProjectMetricNamesInputType = "projectMetricNamesInput" + ProjectMetricNamesInputFieldProjectName = "projectId" +) + +type ProjectMetricNamesInput struct { + ProjectName string `json:"projectId,omitempty" yaml:"projectId,omitempty"` +} diff --git a/client/management/v3/zz_generated_project_monitor_graph.go b/client/management/v3/zz_generated_project_monitor_graph.go new file mode 100644 index 00000000..4b4e9386 --- /dev/null +++ b/client/management/v3/zz_generated_project_monitor_graph.go @@ -0,0 +1,127 @@ +package client + +import ( + "github.com/rancher/norman/types" +) + +const ( + ProjectMonitorGraphType = "projectMonitorGraph" + ProjectMonitorGraphFieldAnnotations = "annotations" + ProjectMonitorGraphFieldCreated = "created" + ProjectMonitorGraphFieldCreatorID = "creatorId" + ProjectMonitorGraphFieldDescription = "description" + ProjectMonitorGraphFieldDetailsMetricsSelector = "detailsMetricsSelector" + ProjectMonitorGraphFieldDisplayResourceType = "displayResourceType" + ProjectMonitorGraphFieldGraphType = "graphType" + ProjectMonitorGraphFieldLabels = "labels" + ProjectMonitorGraphFieldMetricsSelector = "metricsSelector" + ProjectMonitorGraphFieldName = "name" + ProjectMonitorGraphFieldNamespaceId = "namespaceId" + ProjectMonitorGraphFieldOwnerReferences = "ownerReferences" + ProjectMonitorGraphFieldPriority = "priority" + ProjectMonitorGraphFieldProjectID = "projectId" + ProjectMonitorGraphFieldRemoved = "removed" + ProjectMonitorGraphFieldResourceType = "resourceType" + ProjectMonitorGraphFieldUUID = "uuid" + ProjectMonitorGraphFieldYAxis = "yAxis" +) + +type ProjectMonitorGraph struct { + types.Resource + Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` + Created string `json:"created,omitempty" yaml:"created,omitempty"` + CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + DetailsMetricsSelector map[string]string `json:"detailsMetricsSelector,omitempty" yaml:"detailsMetricsSelector,omitempty"` + DisplayResourceType string `json:"displayResourceType,omitempty" yaml:"displayResourceType,omitempty"` + GraphType string `json:"graphType,omitempty" yaml:"graphType,omitempty"` + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + MetricsSelector map[string]string `json:"metricsSelector,omitempty" yaml:"metricsSelector,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"` + Priority int64 `json:"priority,omitempty" yaml:"priority,omitempty"` + ProjectID string `json:"projectId,omitempty" yaml:"projectId,omitempty"` + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + ResourceType string `json:"resourceType,omitempty" yaml:"resourceType,omitempty"` + UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` + YAxis *YAxis `json:"yAxis,omitempty" yaml:"yAxis,omitempty"` +} + +type ProjectMonitorGraphCollection struct { + types.Collection + Data []ProjectMonitorGraph `json:"data,omitempty"` + client *ProjectMonitorGraphClient +} + +type ProjectMonitorGraphClient struct { + apiClient *Client +} + +type ProjectMonitorGraphOperations interface { + List(opts *types.ListOpts) (*ProjectMonitorGraphCollection, error) + Create(opts *ProjectMonitorGraph) (*ProjectMonitorGraph, error) + Update(existing *ProjectMonitorGraph, updates interface{}) (*ProjectMonitorGraph, error) + Replace(existing *ProjectMonitorGraph) (*ProjectMonitorGraph, error) + ByID(id string) (*ProjectMonitorGraph, error) + Delete(container *ProjectMonitorGraph) error + + CollectionActionQuery(resource *ProjectMonitorGraphCollection, input *QueryGraphInput) (*QueryProjectGraphOutput, error) +} + +func newProjectMonitorGraphClient(apiClient *Client) *ProjectMonitorGraphClient { + return &ProjectMonitorGraphClient{ + apiClient: apiClient, + } +} + +func (c *ProjectMonitorGraphClient) Create(container *ProjectMonitorGraph) (*ProjectMonitorGraph, error) { + resp := &ProjectMonitorGraph{} + err := c.apiClient.Ops.DoCreate(ProjectMonitorGraphType, container, resp) + return resp, err +} + +func (c *ProjectMonitorGraphClient) Update(existing *ProjectMonitorGraph, updates interface{}) (*ProjectMonitorGraph, error) { + resp := &ProjectMonitorGraph{} + err := c.apiClient.Ops.DoUpdate(ProjectMonitorGraphType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ProjectMonitorGraphClient) Replace(obj *ProjectMonitorGraph) (*ProjectMonitorGraph, error) { + resp := &ProjectMonitorGraph{} + err := c.apiClient.Ops.DoReplace(ProjectMonitorGraphType, &obj.Resource, obj, resp) + return resp, err +} + +func (c *ProjectMonitorGraphClient) List(opts *types.ListOpts) (*ProjectMonitorGraphCollection, error) { + resp := &ProjectMonitorGraphCollection{} + err := c.apiClient.Ops.DoList(ProjectMonitorGraphType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ProjectMonitorGraphCollection) Next() (*ProjectMonitorGraphCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ProjectMonitorGraphCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ProjectMonitorGraphClient) ByID(id string) (*ProjectMonitorGraph, error) { + resp := &ProjectMonitorGraph{} + err := c.apiClient.Ops.DoByID(ProjectMonitorGraphType, id, resp) + return resp, err +} + +func (c *ProjectMonitorGraphClient) Delete(container *ProjectMonitorGraph) error { + return c.apiClient.Ops.DoResourceDelete(ProjectMonitorGraphType, &container.Resource) +} + +func (c *ProjectMonitorGraphClient) CollectionActionQuery(resource *ProjectMonitorGraphCollection, input *QueryGraphInput) (*QueryProjectGraphOutput, error) { + resp := &QueryProjectGraphOutput{} + err := c.apiClient.Ops.DoCollectionAction(ProjectMonitorGraphType, "query", &resource.Collection, input, resp) + return resp, err +} diff --git a/client/management/v3/zz_generated_project_monitor_graph_spec.go b/client/management/v3/zz_generated_project_monitor_graph_spec.go new file mode 100644 index 00000000..cd3d480e --- /dev/null +++ b/client/management/v3/zz_generated_project_monitor_graph_spec.go @@ -0,0 +1,26 @@ +package client + +const ( + ProjectMonitorGraphSpecType = "projectMonitorGraphSpec" + ProjectMonitorGraphSpecFieldDescription = "description" + ProjectMonitorGraphSpecFieldDetailsMetricsSelector = "detailsMetricsSelector" + ProjectMonitorGraphSpecFieldDisplayResourceType = "displayResourceType" + ProjectMonitorGraphSpecFieldGraphType = "graphType" + ProjectMonitorGraphSpecFieldMetricsSelector = "metricsSelector" + ProjectMonitorGraphSpecFieldPriority = "priority" + ProjectMonitorGraphSpecFieldProjectID = "projectId" + ProjectMonitorGraphSpecFieldResourceType = "resourceType" + ProjectMonitorGraphSpecFieldYAxis = "yAxis" +) + +type ProjectMonitorGraphSpec struct { + Description string `json:"description,omitempty" yaml:"description,omitempty"` + DetailsMetricsSelector map[string]string `json:"detailsMetricsSelector,omitempty" yaml:"detailsMetricsSelector,omitempty"` + DisplayResourceType string `json:"displayResourceType,omitempty" yaml:"displayResourceType,omitempty"` + GraphType string `json:"graphType,omitempty" yaml:"graphType,omitempty"` + MetricsSelector map[string]string `json:"metricsSelector,omitempty" yaml:"metricsSelector,omitempty"` + Priority int64 `json:"priority,omitempty" yaml:"priority,omitempty"` + ProjectID string `json:"projectId,omitempty" yaml:"projectId,omitempty"` + ResourceType string `json:"resourceType,omitempty" yaml:"resourceType,omitempty"` + YAxis *YAxis `json:"yAxis,omitempty" yaml:"yAxis,omitempty"` +} diff --git a/client/management/v3/zz_generated_project_spec.go b/client/management/v3/zz_generated_project_spec.go index 09c08548..acf59fa1 100644 --- a/client/management/v3/zz_generated_project_spec.go +++ b/client/management/v3/zz_generated_project_spec.go @@ -5,6 +5,7 @@ const ( ProjectSpecFieldClusterID = "clusterId" ProjectSpecFieldDescription = "description" ProjectSpecFieldDisplayName = "displayName" + ProjectSpecFieldEnableProjectMonitoring = "enableProjectMonitoring" ProjectSpecFieldNamespaceDefaultResourceQuota = "namespaceDefaultResourceQuota" ProjectSpecFieldResourceQuota = "resourceQuota" ) @@ -13,6 +14,7 @@ type ProjectSpec struct { ClusterID string `json:"clusterId,omitempty" yaml:"clusterId,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` DisplayName string `json:"displayName,omitempty" yaml:"displayName,omitempty"` + EnableProjectMonitoring bool `json:"enableProjectMonitoring,omitempty" yaml:"enableProjectMonitoring,omitempty"` NamespaceDefaultResourceQuota *NamespaceResourceQuota `json:"namespaceDefaultResourceQuota,omitempty" yaml:"namespaceDefaultResourceQuota,omitempty"` ResourceQuota *ProjectResourceQuota `json:"resourceQuota,omitempty" yaml:"resourceQuota,omitempty"` } diff --git a/client/management/v3/zz_generated_project_status.go b/client/management/v3/zz_generated_project_status.go index eb50e860..c50730d0 100644 --- a/client/management/v3/zz_generated_project_status.go +++ b/client/management/v3/zz_generated_project_status.go @@ -3,10 +3,12 @@ package client const ( ProjectStatusType = "projectStatus" ProjectStatusFieldConditions = "conditions" + ProjectStatusFieldMonitoringStatus = "monitoringStatus" ProjectStatusFieldPodSecurityPolicyTemplateName = "podSecurityPolicyTemplateId" ) type ProjectStatus struct { Conditions []ProjectCondition `json:"conditions,omitempty" yaml:"conditions,omitempty"` + MonitoringStatus *MonitoringStatus `json:"monitoringStatus,omitempty" yaml:"monitoringStatus,omitempty"` PodSecurityPolicyTemplateName string `json:"podSecurityPolicyTemplateId,omitempty" yaml:"podSecurityPolicyTemplateId,omitempty"` } diff --git a/client/management/v3/zz_generated_query_cluster_graph.go b/client/management/v3/zz_generated_query_cluster_graph.go new file mode 100644 index 00000000..f3494d5b --- /dev/null +++ b/client/management/v3/zz_generated_query_cluster_graph.go @@ -0,0 +1,12 @@ +package client + +const ( + QueryClusterGraphType = "queryClusterGraph" + QueryClusterGraphFieldGraphName = "graphID" + QueryClusterGraphFieldSeries = "series" +) + +type QueryClusterGraph struct { + GraphName string `json:"graphID,omitempty" yaml:"graphID,omitempty"` + Series []string `json:"series,omitempty" yaml:"series,omitempty"` +} diff --git a/client/management/v3/zz_generated_query_cluster_graph_output.go b/client/management/v3/zz_generated_query_cluster_graph_output.go new file mode 100644 index 00000000..78258045 --- /dev/null +++ b/client/management/v3/zz_generated_query_cluster_graph_output.go @@ -0,0 +1,12 @@ +package client + +const ( + QueryClusterGraphOutputType = "queryClusterGraphOutput" + QueryClusterGraphOutputFieldData = "data" + QueryClusterGraphOutputFieldType = "type" +) + +type QueryClusterGraphOutput struct { + Data []QueryClusterGraph `json:"data,omitempty" yaml:"data,omitempty"` + Type string `json:"type,omitempty" yaml:"type,omitempty"` +} diff --git a/client/management/v3/zz_generated_query_cluster_metric_input.go b/client/management/v3/zz_generated_query_cluster_metric_input.go new file mode 100644 index 00000000..716fdde5 --- /dev/null +++ b/client/management/v3/zz_generated_query_cluster_metric_input.go @@ -0,0 +1,18 @@ +package client + +const ( + QueryClusterMetricInputType = "queryClusterMetricInput" + QueryClusterMetricInputFieldClusterName = "clusterId" + QueryClusterMetricInputFieldExpr = "expr" + QueryClusterMetricInputFieldFrom = "from" + QueryClusterMetricInputFieldInterval = "interval" + QueryClusterMetricInputFieldTo = "to" +) + +type QueryClusterMetricInput struct { + ClusterName string `json:"clusterId,omitempty" yaml:"clusterId,omitempty"` + Expr string `json:"expr,omitempty" yaml:"expr,omitempty"` + From string `json:"from,omitempty" yaml:"from,omitempty"` + Interval string `json:"interval,omitempty" yaml:"interval,omitempty"` + To string `json:"to,omitempty" yaml:"to,omitempty"` +} diff --git a/client/management/v3/zz_generated_query_graph_input.go b/client/management/v3/zz_generated_query_graph_input.go new file mode 100644 index 00000000..2ec12878 --- /dev/null +++ b/client/management/v3/zz_generated_query_graph_input.go @@ -0,0 +1,20 @@ +package client + +const ( + QueryGraphInputType = "queryGraphInput" + QueryGraphInputFieldFilters = "filters" + QueryGraphInputFieldFrom = "from" + QueryGraphInputFieldInterval = "interval" + QueryGraphInputFieldIsDetails = "isDetails" + QueryGraphInputFieldMetricParams = "metricParams" + QueryGraphInputFieldTo = "to" +) + +type QueryGraphInput struct { + Filters map[string]string `json:"filters,omitempty" yaml:"filters,omitempty"` + From string `json:"from,omitempty" yaml:"from,omitempty"` + Interval string `json:"interval,omitempty" yaml:"interval,omitempty"` + IsDetails bool `json:"isDetails,omitempty" yaml:"isDetails,omitempty"` + MetricParams map[string]string `json:"metricParams,omitempty" yaml:"metricParams,omitempty"` + To string `json:"to,omitempty" yaml:"to,omitempty"` +} diff --git a/client/management/v3/zz_generated_query_metric_output.go b/client/management/v3/zz_generated_query_metric_output.go new file mode 100644 index 00000000..9f93276a --- /dev/null +++ b/client/management/v3/zz_generated_query_metric_output.go @@ -0,0 +1,12 @@ +package client + +const ( + QueryMetricOutputType = "queryMetricOutput" + QueryMetricOutputFieldSeries = "series" + QueryMetricOutputFieldType = "type" +) + +type QueryMetricOutput struct { + Series []string `json:"series,omitempty" yaml:"series,omitempty"` + Type string `json:"type,omitempty" yaml:"type,omitempty"` +} diff --git a/client/management/v3/zz_generated_query_project_graph.go b/client/management/v3/zz_generated_query_project_graph.go new file mode 100644 index 00000000..106f3426 --- /dev/null +++ b/client/management/v3/zz_generated_query_project_graph.go @@ -0,0 +1,12 @@ +package client + +const ( + QueryProjectGraphType = "queryProjectGraph" + QueryProjectGraphFieldGraphName = "graphID" + QueryProjectGraphFieldSeries = "series" +) + +type QueryProjectGraph struct { + GraphName string `json:"graphID,omitempty" yaml:"graphID,omitempty"` + Series []string `json:"series,omitempty" yaml:"series,omitempty"` +} diff --git a/client/management/v3/zz_generated_query_project_graph_output.go b/client/management/v3/zz_generated_query_project_graph_output.go new file mode 100644 index 00000000..0d4406c1 --- /dev/null +++ b/client/management/v3/zz_generated_query_project_graph_output.go @@ -0,0 +1,12 @@ +package client + +const ( + QueryProjectGraphOutputType = "queryProjectGraphOutput" + QueryProjectGraphOutputFieldData = "data" + QueryProjectGraphOutputFieldType = "type" +) + +type QueryProjectGraphOutput struct { + Data []QueryProjectGraph `json:"data,omitempty" yaml:"data,omitempty"` + Type string `json:"type,omitempty" yaml:"type,omitempty"` +} diff --git a/client/management/v3/zz_generated_query_project_metric_input.go b/client/management/v3/zz_generated_query_project_metric_input.go new file mode 100644 index 00000000..57972708 --- /dev/null +++ b/client/management/v3/zz_generated_query_project_metric_input.go @@ -0,0 +1,18 @@ +package client + +const ( + QueryProjectMetricInputType = "queryProjectMetricInput" + QueryProjectMetricInputFieldExpr = "expr" + QueryProjectMetricInputFieldFrom = "from" + QueryProjectMetricInputFieldInterval = "interval" + QueryProjectMetricInputFieldProjectName = "projectId" + QueryProjectMetricInputFieldTo = "to" +) + +type QueryProjectMetricInput struct { + Expr string `json:"expr,omitempty" yaml:"expr,omitempty"` + From string `json:"from,omitempty" yaml:"from,omitempty"` + Interval string `json:"interval,omitempty" yaml:"interval,omitempty"` + ProjectName string `json:"projectId,omitempty" yaml:"projectId,omitempty"` + To string `json:"to,omitempty" yaml:"to,omitempty"` +} diff --git a/client/management/v3/zz_generated_system_service_rule.go b/client/management/v3/zz_generated_system_service_rule.go new file mode 100644 index 00000000..c872b669 --- /dev/null +++ b/client/management/v3/zz_generated_system_service_rule.go @@ -0,0 +1,10 @@ +package client + +const ( + SystemServiceRuleType = "systemServiceRule" + SystemServiceRuleFieldCondition = "condition" +) + +type SystemServiceRule struct { + Condition string `json:"condition,omitempty" yaml:"condition,omitempty"` +} diff --git a/client/management/v3/zz_generated_time_series.go b/client/management/v3/zz_generated_time_series.go new file mode 100644 index 00000000..974cc7de --- /dev/null +++ b/client/management/v3/zz_generated_time_series.go @@ -0,0 +1,12 @@ +package client + +const ( + TimeSeriesType = "timeSeries" + TimeSeriesFieldName = "name" + TimeSeriesFieldPoints = "points" +) + +type TimeSeries struct { + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Points [][]float64 `json:"points,omitempty" yaml:"points,omitempty"` +} diff --git a/client/management/v3/zz_generated_workload_rule.go b/client/management/v3/zz_generated_workload_rule.go new file mode 100644 index 00000000..107ec70b --- /dev/null +++ b/client/management/v3/zz_generated_workload_rule.go @@ -0,0 +1,14 @@ +package client + +const ( + WorkloadRuleType = "workloadRule" + WorkloadRuleFieldAvailablePercentage = "availablePercentage" + WorkloadRuleFieldSelector = "selector" + WorkloadRuleFieldWorkloadID = "workloadId" +) + +type WorkloadRule struct { + AvailablePercentage int64 `json:"availablePercentage,omitempty" yaml:"availablePercentage,omitempty"` + Selector map[string]string `json:"selector,omitempty" yaml:"selector,omitempty"` + WorkloadID string `json:"workloadId,omitempty" yaml:"workloadId,omitempty"` +} diff --git a/client/management/v3/zz_generated_y_axis.go b/client/management/v3/zz_generated_y_axis.go new file mode 100644 index 00000000..f0976bc8 --- /dev/null +++ b/client/management/v3/zz_generated_y_axis.go @@ -0,0 +1,10 @@ +package client + +const ( + YAxisType = "yAxis" + YAxisFieldUnit = "unit" +) + +type YAxis struct { + Unit string `json:"unit,omitempty" yaml:"unit,omitempty"` +} diff --git a/client/project/v3/zz_generated_alerting_spec.go b/client/project/v3/zz_generated_alerting_spec.go new file mode 100644 index 00000000..ffdddbf4 --- /dev/null +++ b/client/project/v3/zz_generated_alerting_spec.go @@ -0,0 +1,10 @@ +package client + +const ( + AlertingSpecType = "alertingSpec" + AlertingSpecFieldAlertmanagers = "alertmanagers" +) + +type AlertingSpec struct { + Alertmanagers []AlertmanagerEndpoints `json:"alertmanagers,omitempty" yaml:"alertmanagers,omitempty"` +} diff --git a/client/project/v3/zz_generated_alertmanager.go b/client/project/v3/zz_generated_alertmanager.go new file mode 100644 index 00000000..fe4bb4e6 --- /dev/null +++ b/client/project/v3/zz_generated_alertmanager.go @@ -0,0 +1,159 @@ +package client + +import ( + "github.com/rancher/norman/types" +) + +const ( + AlertmanagerType = "alertmanager" + AlertmanagerFieldAdditionalPeers = "additionalPeers" + AlertmanagerFieldAffinity = "affinity" + AlertmanagerFieldAnnotations = "annotations" + AlertmanagerFieldBaseImage = "baseImage" + AlertmanagerFieldConfigMaps = "configMaps" + AlertmanagerFieldContainers = "containers" + AlertmanagerFieldCreated = "created" + AlertmanagerFieldCreatorID = "creatorId" + AlertmanagerFieldExternalURL = "externalUrl" + AlertmanagerFieldImagePullSecrets = "imagePullSecrets" + AlertmanagerFieldLabels = "labels" + AlertmanagerFieldListenLocal = "listenLocal" + AlertmanagerFieldLogLevel = "logLevel" + AlertmanagerFieldName = "name" + AlertmanagerFieldNamespaceId = "namespaceId" + AlertmanagerFieldNodeSelector = "nodeSelector" + AlertmanagerFieldOwnerReferences = "ownerReferences" + AlertmanagerFieldPaused = "paused" + AlertmanagerFieldPodMetadata = "podMetadata" + AlertmanagerFieldPriorityClassName = "priorityClassName" + AlertmanagerFieldProjectID = "projectId" + AlertmanagerFieldRemoved = "removed" + AlertmanagerFieldReplicas = "replicas" + AlertmanagerFieldResources = "resources" + AlertmanagerFieldRetention = "retention" + AlertmanagerFieldRoutePrefix = "routePrefix" + AlertmanagerFieldSHA = "sha" + AlertmanagerFieldSecrets = "secrets" + AlertmanagerFieldSecurityContext = "securityContext" + AlertmanagerFieldServiceAccountName = "serviceAccountName" + AlertmanagerFieldState = "state" + AlertmanagerFieldStorage = "storage" + AlertmanagerFieldTag = "tag" + AlertmanagerFieldTolerations = "tolerations" + AlertmanagerFieldTransitioning = "transitioning" + AlertmanagerFieldTransitioningMessage = "transitioningMessage" + AlertmanagerFieldUUID = "uuid" + AlertmanagerFieldVersion = "version" +) + +type Alertmanager struct { + types.Resource + AdditionalPeers []string `json:"additionalPeers,omitempty" yaml:"additionalPeers,omitempty"` + Affinity *Affinity `json:"affinity,omitempty" yaml:"affinity,omitempty"` + Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` + BaseImage string `json:"baseImage,omitempty" yaml:"baseImage,omitempty"` + ConfigMaps []string `json:"configMaps,omitempty" yaml:"configMaps,omitempty"` + Containers []Container `json:"containers,omitempty" yaml:"containers,omitempty"` + Created string `json:"created,omitempty" yaml:"created,omitempty"` + CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"` + ExternalURL string `json:"externalUrl,omitempty" yaml:"externalUrl,omitempty"` + ImagePullSecrets []LocalObjectReference `json:"imagePullSecrets,omitempty" yaml:"imagePullSecrets,omitempty"` + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + ListenLocal bool `json:"listenLocal,omitempty" yaml:"listenLocal,omitempty"` + LogLevel string `json:"logLevel,omitempty" yaml:"logLevel,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"` + NodeSelector map[string]string `json:"nodeSelector,omitempty" yaml:"nodeSelector,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"` + Paused bool `json:"paused,omitempty" yaml:"paused,omitempty"` + PodMetadata *ObjectMeta `json:"podMetadata,omitempty" yaml:"podMetadata,omitempty"` + PriorityClassName string `json:"priorityClassName,omitempty" yaml:"priorityClassName,omitempty"` + ProjectID string `json:"projectId,omitempty" yaml:"projectId,omitempty"` + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + Replicas *int64 `json:"replicas,omitempty" yaml:"replicas,omitempty"` + Resources *ResourceRequirements `json:"resources,omitempty" yaml:"resources,omitempty"` + Retention string `json:"retention,omitempty" yaml:"retention,omitempty"` + RoutePrefix string `json:"routePrefix,omitempty" yaml:"routePrefix,omitempty"` + SHA string `json:"sha,omitempty" yaml:"sha,omitempty"` + Secrets []string `json:"secrets,omitempty" yaml:"secrets,omitempty"` + SecurityContext *PodSecurityContext `json:"securityContext,omitempty" yaml:"securityContext,omitempty"` + ServiceAccountName string `json:"serviceAccountName,omitempty" yaml:"serviceAccountName,omitempty"` + State string `json:"state,omitempty" yaml:"state,omitempty"` + Storage *StorageSpec `json:"storage,omitempty" yaml:"storage,omitempty"` + Tag string `json:"tag,omitempty" yaml:"tag,omitempty"` + Tolerations []Toleration `json:"tolerations,omitempty" yaml:"tolerations,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"` + Version string `json:"version,omitempty" yaml:"version,omitempty"` +} + +type AlertmanagerCollection struct { + types.Collection + Data []Alertmanager `json:"data,omitempty"` + client *AlertmanagerClient +} + +type AlertmanagerClient struct { + apiClient *Client +} + +type AlertmanagerOperations interface { + List(opts *types.ListOpts) (*AlertmanagerCollection, error) + Create(opts *Alertmanager) (*Alertmanager, error) + Update(existing *Alertmanager, updates interface{}) (*Alertmanager, error) + Replace(existing *Alertmanager) (*Alertmanager, error) + ByID(id string) (*Alertmanager, error) + Delete(container *Alertmanager) error +} + +func newAlertmanagerClient(apiClient *Client) *AlertmanagerClient { + return &AlertmanagerClient{ + apiClient: apiClient, + } +} + +func (c *AlertmanagerClient) Create(container *Alertmanager) (*Alertmanager, error) { + resp := &Alertmanager{} + err := c.apiClient.Ops.DoCreate(AlertmanagerType, container, resp) + return resp, err +} + +func (c *AlertmanagerClient) Update(existing *Alertmanager, updates interface{}) (*Alertmanager, error) { + resp := &Alertmanager{} + err := c.apiClient.Ops.DoUpdate(AlertmanagerType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *AlertmanagerClient) Replace(obj *Alertmanager) (*Alertmanager, error) { + resp := &Alertmanager{} + err := c.apiClient.Ops.DoReplace(AlertmanagerType, &obj.Resource, obj, resp) + return resp, err +} + +func (c *AlertmanagerClient) List(opts *types.ListOpts) (*AlertmanagerCollection, error) { + resp := &AlertmanagerCollection{} + err := c.apiClient.Ops.DoList(AlertmanagerType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *AlertmanagerCollection) Next() (*AlertmanagerCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &AlertmanagerCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *AlertmanagerClient) ByID(id string) (*Alertmanager, error) { + resp := &Alertmanager{} + err := c.apiClient.Ops.DoByID(AlertmanagerType, id, resp) + return resp, err +} + +func (c *AlertmanagerClient) Delete(container *Alertmanager) error { + return c.apiClient.Ops.DoResourceDelete(AlertmanagerType, &container.Resource) +} diff --git a/client/project/v3/zz_generated_alertmanager_endpoints.go b/client/project/v3/zz_generated_alertmanager_endpoints.go new file mode 100644 index 00000000..3b5debb5 --- /dev/null +++ b/client/project/v3/zz_generated_alertmanager_endpoints.go @@ -0,0 +1,24 @@ +package client + +import "k8s.io/apimachinery/pkg/util/intstr" + +const ( + AlertmanagerEndpointsType = "alertmanagerEndpoints" + AlertmanagerEndpointsFieldBearerTokenFile = "bearerTokenFile" + AlertmanagerEndpointsFieldName = "name" + AlertmanagerEndpointsFieldNamespace = "namespace" + AlertmanagerEndpointsFieldPathPrefix = "pathPrefix" + AlertmanagerEndpointsFieldPort = "port" + AlertmanagerEndpointsFieldScheme = "scheme" + AlertmanagerEndpointsFieldTLSConfig = "tlsConfig" +) + +type AlertmanagerEndpoints struct { + BearerTokenFile string `json:"bearerTokenFile,omitempty" yaml:"bearerTokenFile,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"` + PathPrefix string `json:"pathPrefix,omitempty" yaml:"pathPrefix,omitempty"` + Port intstr.IntOrString `json:"port,omitempty" yaml:"port,omitempty"` + Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"` + TLSConfig *TLSConfig `json:"tlsConfig,omitempty" yaml:"tlsConfig,omitempty"` +} diff --git a/client/project/v3/zz_generated_alertmanager_spec.go b/client/project/v3/zz_generated_alertmanager_spec.go new file mode 100644 index 00000000..ba52dbea --- /dev/null +++ b/client/project/v3/zz_generated_alertmanager_spec.go @@ -0,0 +1,58 @@ +package client + +const ( + AlertmanagerSpecType = "alertmanagerSpec" + AlertmanagerSpecFieldAdditionalPeers = "additionalPeers" + AlertmanagerSpecFieldAffinity = "affinity" + AlertmanagerSpecFieldBaseImage = "baseImage" + AlertmanagerSpecFieldConfigMaps = "configMaps" + AlertmanagerSpecFieldContainers = "containers" + AlertmanagerSpecFieldExternalURL = "externalUrl" + AlertmanagerSpecFieldImagePullSecrets = "imagePullSecrets" + AlertmanagerSpecFieldListenLocal = "listenLocal" + AlertmanagerSpecFieldLogLevel = "logLevel" + AlertmanagerSpecFieldNodeSelector = "nodeSelector" + AlertmanagerSpecFieldPaused = "paused" + AlertmanagerSpecFieldPodMetadata = "podMetadata" + AlertmanagerSpecFieldPriorityClassName = "priorityClassName" + AlertmanagerSpecFieldReplicas = "replicas" + AlertmanagerSpecFieldResources = "resources" + AlertmanagerSpecFieldRetention = "retention" + AlertmanagerSpecFieldRoutePrefix = "routePrefix" + AlertmanagerSpecFieldSHA = "sha" + AlertmanagerSpecFieldSecrets = "secrets" + AlertmanagerSpecFieldSecurityContext = "securityContext" + AlertmanagerSpecFieldServiceAccountName = "serviceAccountName" + AlertmanagerSpecFieldStorage = "storage" + AlertmanagerSpecFieldTag = "tag" + AlertmanagerSpecFieldTolerations = "tolerations" + AlertmanagerSpecFieldVersion = "version" +) + +type AlertmanagerSpec struct { + AdditionalPeers []string `json:"additionalPeers,omitempty" yaml:"additionalPeers,omitempty"` + Affinity *Affinity `json:"affinity,omitempty" yaml:"affinity,omitempty"` + BaseImage string `json:"baseImage,omitempty" yaml:"baseImage,omitempty"` + ConfigMaps []string `json:"configMaps,omitempty" yaml:"configMaps,omitempty"` + Containers []Container `json:"containers,omitempty" yaml:"containers,omitempty"` + ExternalURL string `json:"externalUrl,omitempty" yaml:"externalUrl,omitempty"` + ImagePullSecrets []LocalObjectReference `json:"imagePullSecrets,omitempty" yaml:"imagePullSecrets,omitempty"` + ListenLocal bool `json:"listenLocal,omitempty" yaml:"listenLocal,omitempty"` + LogLevel string `json:"logLevel,omitempty" yaml:"logLevel,omitempty"` + NodeSelector map[string]string `json:"nodeSelector,omitempty" yaml:"nodeSelector,omitempty"` + Paused bool `json:"paused,omitempty" yaml:"paused,omitempty"` + PodMetadata *ObjectMeta `json:"podMetadata,omitempty" yaml:"podMetadata,omitempty"` + PriorityClassName string `json:"priorityClassName,omitempty" yaml:"priorityClassName,omitempty"` + Replicas *int64 `json:"replicas,omitempty" yaml:"replicas,omitempty"` + Resources *ResourceRequirements `json:"resources,omitempty" yaml:"resources,omitempty"` + Retention string `json:"retention,omitempty" yaml:"retention,omitempty"` + RoutePrefix string `json:"routePrefix,omitempty" yaml:"routePrefix,omitempty"` + SHA string `json:"sha,omitempty" yaml:"sha,omitempty"` + Secrets []string `json:"secrets,omitempty" yaml:"secrets,omitempty"` + SecurityContext *PodSecurityContext `json:"securityContext,omitempty" yaml:"securityContext,omitempty"` + ServiceAccountName string `json:"serviceAccountName,omitempty" yaml:"serviceAccountName,omitempty"` + Storage *StorageSpec `json:"storage,omitempty" yaml:"storage,omitempty"` + Tag string `json:"tag,omitempty" yaml:"tag,omitempty"` + Tolerations []Toleration `json:"tolerations,omitempty" yaml:"tolerations,omitempty"` + Version string `json:"version,omitempty" yaml:"version,omitempty"` +} diff --git a/client/project/v3/zz_generated_alertmanager_status.go b/client/project/v3/zz_generated_alertmanager_status.go new file mode 100644 index 00000000..abf2cadb --- /dev/null +++ b/client/project/v3/zz_generated_alertmanager_status.go @@ -0,0 +1,18 @@ +package client + +const ( + AlertmanagerStatusType = "alertmanagerStatus" + AlertmanagerStatusFieldAvailableReplicas = "availableReplicas" + AlertmanagerStatusFieldPaused = "paused" + AlertmanagerStatusFieldReplicas = "replicas" + AlertmanagerStatusFieldUnavailableReplicas = "unavailableReplicas" + AlertmanagerStatusFieldUpdatedReplicas = "updatedReplicas" +) + +type AlertmanagerStatus struct { + AvailableReplicas int64 `json:"availableReplicas,omitempty" yaml:"availableReplicas,omitempty"` + Paused bool `json:"paused,omitempty" yaml:"paused,omitempty"` + Replicas int64 `json:"replicas,omitempty" yaml:"replicas,omitempty"` + UnavailableReplicas int64 `json:"unavailableReplicas,omitempty" yaml:"unavailableReplicas,omitempty"` + UpdatedReplicas int64 `json:"updatedReplicas,omitempty" yaml:"updatedReplicas,omitempty"` +} diff --git a/client/project/v3/zz_generated_api_server_config.go b/client/project/v3/zz_generated_api_server_config.go new file mode 100644 index 00000000..da8e9c5a --- /dev/null +++ b/client/project/v3/zz_generated_api_server_config.go @@ -0,0 +1,18 @@ +package client + +const ( + APIServerConfigType = "apiServerConfig" + APIServerConfigFieldBasicAuth = "basicAuth" + APIServerConfigFieldBearerToken = "bearerToken" + APIServerConfigFieldBearerTokenFile = "bearerTokenFile" + APIServerConfigFieldHost = "host" + APIServerConfigFieldTLSConfig = "tlsConfig" +) + +type APIServerConfig struct { + BasicAuth *BasicAuth `json:"basicAuth,omitempty" yaml:"basicAuth,omitempty"` + BearerToken string `json:"bearerToken,omitempty" yaml:"bearerToken,omitempty"` + BearerTokenFile string `json:"bearerTokenFile,omitempty" yaml:"bearerTokenFile,omitempty"` + Host string `json:"host,omitempty" yaml:"host,omitempty"` + TLSConfig *TLSConfig `json:"tlsConfig,omitempty" yaml:"tlsConfig,omitempty"` +} diff --git a/client/project/v3/zz_generated_client.go b/client/project/v3/zz_generated_client.go index 08aea806..b58a2000 100644 --- a/client/project/v3/zz_generated_client.go +++ b/client/project/v3/zz_generated_client.go @@ -42,6 +42,10 @@ type Client struct { PipelineExecution PipelineExecutionOperations PipelineSetting PipelineSettingOperations SourceCodeRepository SourceCodeRepositoryOperations + Prometheus PrometheusOperations + ServiceMonitor ServiceMonitorOperations + PrometheusRule PrometheusRuleOperations + Alertmanager AlertmanagerOperations } func NewClient(opts *clientbase.ClientOpts) (*Client, error) { @@ -89,6 +93,10 @@ func NewClient(opts *clientbase.ClientOpts) (*Client, error) { client.PipelineExecution = newPipelineExecutionClient(client) client.PipelineSetting = newPipelineSettingClient(client) client.SourceCodeRepository = newSourceCodeRepositoryClient(client) + client.Prometheus = newPrometheusClient(client) + client.ServiceMonitor = newServiceMonitorClient(client) + client.PrometheusRule = newPrometheusRuleClient(client) + client.Alertmanager = newAlertmanagerClient(client) return client, nil } diff --git a/client/project/v3/zz_generated_cron_job.go b/client/project/v3/zz_generated_cron_job.go index 3dcb2aa7..89964e29 100644 --- a/client/project/v3/zz_generated_cron_job.go +++ b/client/project/v3/zz_generated_cron_job.go @@ -56,6 +56,7 @@ const ( CronJobFieldVolumes = "volumes" CronJobFieldWorkloadAnnotations = "workloadAnnotations" CronJobFieldWorkloadLabels = "workloadLabels" + CronJobFieldWorkloadMetrics = "workloadMetrics" ) type CronJob struct { @@ -110,6 +111,7 @@ type CronJob struct { Volumes []Volume `json:"volumes,omitempty" yaml:"volumes,omitempty"` WorkloadAnnotations map[string]string `json:"workloadAnnotations,omitempty" yaml:"workloadAnnotations,omitempty"` WorkloadLabels map[string]string `json:"workloadLabels,omitempty" yaml:"workloadLabels,omitempty"` + WorkloadMetrics []WorkloadMetric `json:"workloadMetrics,omitempty" yaml:"workloadMetrics,omitempty"` } type CronJobCollection struct { diff --git a/client/project/v3/zz_generated_daemon_set.go b/client/project/v3/zz_generated_daemon_set.go index 17a25c73..0e629dca 100644 --- a/client/project/v3/zz_generated_daemon_set.go +++ b/client/project/v3/zz_generated_daemon_set.go @@ -55,6 +55,7 @@ const ( DaemonSetFieldVolumes = "volumes" DaemonSetFieldWorkloadAnnotations = "workloadAnnotations" DaemonSetFieldWorkloadLabels = "workloadLabels" + DaemonSetFieldWorkloadMetrics = "workloadMetrics" ) type DaemonSet struct { @@ -108,6 +109,7 @@ type DaemonSet struct { Volumes []Volume `json:"volumes,omitempty" yaml:"volumes,omitempty"` WorkloadAnnotations map[string]string `json:"workloadAnnotations,omitempty" yaml:"workloadAnnotations,omitempty"` WorkloadLabels map[string]string `json:"workloadLabels,omitempty" yaml:"workloadLabels,omitempty"` + WorkloadMetrics []WorkloadMetric `json:"workloadMetrics,omitempty" yaml:"workloadMetrics,omitempty"` } type DaemonSetCollection struct { diff --git a/client/project/v3/zz_generated_deployment.go b/client/project/v3/zz_generated_deployment.go index 63b8126b..e57ee9fa 100644 --- a/client/project/v3/zz_generated_deployment.go +++ b/client/project/v3/zz_generated_deployment.go @@ -57,6 +57,7 @@ const ( DeploymentFieldVolumes = "volumes" DeploymentFieldWorkloadAnnotations = "workloadAnnotations" DeploymentFieldWorkloadLabels = "workloadLabels" + DeploymentFieldWorkloadMetrics = "workloadMetrics" ) type Deployment struct { @@ -112,6 +113,7 @@ type Deployment struct { Volumes []Volume `json:"volumes,omitempty" yaml:"volumes,omitempty"` WorkloadAnnotations map[string]string `json:"workloadAnnotations,omitempty" yaml:"workloadAnnotations,omitempty"` WorkloadLabels map[string]string `json:"workloadLabels,omitempty" yaml:"workloadLabels,omitempty"` + WorkloadMetrics []WorkloadMetric `json:"workloadMetrics,omitempty" yaml:"workloadMetrics,omitempty"` } type DeploymentCollection struct { diff --git a/client/project/v3/zz_generated_endpoint.go b/client/project/v3/zz_generated_endpoint.go new file mode 100644 index 00000000..6e3d154c --- /dev/null +++ b/client/project/v3/zz_generated_endpoint.go @@ -0,0 +1,24 @@ +package client + +import "k8s.io/apimachinery/pkg/util/intstr" + +const ( + EndpointType = "endpoint" + EndpointFieldInterval = "interval" + EndpointFieldParams = "params" + EndpointFieldPath = "path" + EndpointFieldRelabelConfigs = "relabelings" + EndpointFieldScheme = "scheme" + EndpointFieldScrapeTimeout = "scrapeTimeout" + EndpointFieldTargetPort = "targetPort" +) + +type Endpoint struct { + Interval string `json:"interval,omitempty" yaml:"interval,omitempty"` + Params map[string][]string `json:"params,omitempty" yaml:"params,omitempty"` + Path string `json:"path,omitempty" yaml:"path,omitempty"` + RelabelConfigs []RelabelConfig `json:"relabelings,omitempty" yaml:"relabelings,omitempty"` + Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"` + ScrapeTimeout string `json:"scrapeTimeout,omitempty" yaml:"scrapeTimeout,omitempty"` + TargetPort intstr.IntOrString `json:"targetPort,omitempty" yaml:"targetPort,omitempty"` +} diff --git a/client/project/v3/zz_generated_job.go b/client/project/v3/zz_generated_job.go index e4cbae8b..af5ff18e 100644 --- a/client/project/v3/zz_generated_job.go +++ b/client/project/v3/zz_generated_job.go @@ -56,6 +56,7 @@ const ( JobFieldVolumes = "volumes" JobFieldWorkloadAnnotations = "workloadAnnotations" JobFieldWorkloadLabels = "workloadLabels" + JobFieldWorkloadMetrics = "workloadMetrics" ) type Job struct { @@ -110,6 +111,7 @@ type Job struct { Volumes []Volume `json:"volumes,omitempty" yaml:"volumes,omitempty"` WorkloadAnnotations map[string]string `json:"workloadAnnotations,omitempty" yaml:"workloadAnnotations,omitempty"` WorkloadLabels map[string]string `json:"workloadLabels,omitempty" yaml:"workloadLabels,omitempty"` + WorkloadMetrics []WorkloadMetric `json:"workloadMetrics,omitempty" yaml:"workloadMetrics,omitempty"` } type JobCollection struct { diff --git a/client/project/v3/zz_generated_namespace_selector.go b/client/project/v3/zz_generated_namespace_selector.go new file mode 100644 index 00000000..f0606985 --- /dev/null +++ b/client/project/v3/zz_generated_namespace_selector.go @@ -0,0 +1,12 @@ +package client + +const ( + NamespaceSelectorType = "namespaceSelector" + NamespaceSelectorFieldAny = "any" + NamespaceSelectorFieldMatchNames = "matchNames" +) + +type NamespaceSelector struct { + Any bool `json:"any,omitempty" yaml:"any,omitempty"` + MatchNames []string `json:"matchNames,omitempty" yaml:"matchNames,omitempty"` +} diff --git a/client/project/v3/zz_generated_pod.go b/client/project/v3/zz_generated_pod.go index 245ceea9..1011c7a9 100644 --- a/client/project/v3/zz_generated_pod.go +++ b/client/project/v3/zz_generated_pod.go @@ -53,6 +53,7 @@ const ( PodFieldUid = "uid" PodFieldVolumes = "volumes" PodFieldWorkloadID = "workloadId" + PodFieldWorkloadMetrics = "workloadMetrics" ) type Pod struct { @@ -104,6 +105,7 @@ type Pod struct { Uid *int64 `json:"uid,omitempty" yaml:"uid,omitempty"` Volumes []Volume `json:"volumes,omitempty" yaml:"volumes,omitempty"` WorkloadID string `json:"workloadId,omitempty" yaml:"workloadId,omitempty"` + WorkloadMetrics []WorkloadMetric `json:"workloadMetrics,omitempty" yaml:"workloadMetrics,omitempty"` } type PodCollection struct { diff --git a/client/project/v3/zz_generated_prometheus.go b/client/project/v3/zz_generated_prometheus.go new file mode 100644 index 00000000..53de7abb --- /dev/null +++ b/client/project/v3/zz_generated_prometheus.go @@ -0,0 +1,179 @@ +package client + +import ( + "github.com/rancher/norman/types" +) + +const ( + PrometheusType = "prometheus" + PrometheusFieldAdditionalAlertManagerConfigs = "additionalAlertManagerConfigs" + PrometheusFieldAdditionalAlertRelabelConfigs = "additionalAlertRelabelConfigs" + PrometheusFieldAdditionalScrapeConfigs = "additionalScrapeConfigs" + PrometheusFieldAffinity = "affinity" + PrometheusFieldAlerting = "alerting" + PrometheusFieldAnnotations = "annotations" + PrometheusFieldBaseImage = "baseImage" + PrometheusFieldConfigMaps = "configMaps" + PrometheusFieldContainers = "containers" + PrometheusFieldCreated = "created" + PrometheusFieldCreatorID = "creatorId" + PrometheusFieldDescription = "description" + PrometheusFieldEvaluationInterval = "evaluationInterval" + PrometheusFieldExternalLabels = "externalLabels" + PrometheusFieldExternalURL = "externalUrl" + PrometheusFieldImagePullSecrets = "imagePullSecrets" + PrometheusFieldLabels = "labels" + PrometheusFieldListenLocal = "listenLocal" + PrometheusFieldLogLevel = "logLevel" + PrometheusFieldName = "name" + PrometheusFieldNamespaceId = "namespaceId" + PrometheusFieldNodeSelector = "nodeSelector" + PrometheusFieldOwnerReferences = "ownerReferences" + PrometheusFieldPodMetadata = "podMetadata" + PrometheusFieldPriorityClassName = "priorityClassName" + PrometheusFieldProjectID = "projectId" + PrometheusFieldRemoteRead = "remoteRead" + PrometheusFieldRemoteWrite = "remoteWrite" + PrometheusFieldRemoved = "removed" + PrometheusFieldReplicas = "replicas" + PrometheusFieldResources = "resources" + PrometheusFieldRetention = "retention" + PrometheusFieldRoutePrefix = "routePrefix" + PrometheusFieldRuleSelector = "ruleSelector" + PrometheusFieldSHA = "sha" + PrometheusFieldScrapeInterval = "scrapeInterval" + PrometheusFieldSecrets = "secrets" + PrometheusFieldSecurityContext = "securityContext" + PrometheusFieldServiceAccountName = "serviceAccountName" + PrometheusFieldServiceMonitorSelector = "serviceMonitorSelector" + PrometheusFieldState = "state" + PrometheusFieldStorage = "storage" + PrometheusFieldTag = "tag" + PrometheusFieldTolerations = "tolerations" + PrometheusFieldTransitioning = "transitioning" + PrometheusFieldTransitioningMessage = "transitioningMessage" + PrometheusFieldUUID = "uuid" + PrometheusFieldVersion = "version" +) + +type Prometheus struct { + types.Resource + AdditionalAlertManagerConfigs *SecretKeySelector `json:"additionalAlertManagerConfigs,omitempty" yaml:"additionalAlertManagerConfigs,omitempty"` + AdditionalAlertRelabelConfigs *SecretKeySelector `json:"additionalAlertRelabelConfigs,omitempty" yaml:"additionalAlertRelabelConfigs,omitempty"` + AdditionalScrapeConfigs *SecretKeySelector `json:"additionalScrapeConfigs,omitempty" yaml:"additionalScrapeConfigs,omitempty"` + Affinity *Affinity `json:"affinity,omitempty" yaml:"affinity,omitempty"` + Alerting *AlertingSpec `json:"alerting,omitempty" yaml:"alerting,omitempty"` + Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` + BaseImage string `json:"baseImage,omitempty" yaml:"baseImage,omitempty"` + ConfigMaps []string `json:"configMaps,omitempty" yaml:"configMaps,omitempty"` + Containers []Container `json:"containers,omitempty" yaml:"containers,omitempty"` + Created string `json:"created,omitempty" yaml:"created,omitempty"` + CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + EvaluationInterval string `json:"evaluationInterval,omitempty" yaml:"evaluationInterval,omitempty"` + ExternalLabels map[string]string `json:"externalLabels,omitempty" yaml:"externalLabels,omitempty"` + ExternalURL string `json:"externalUrl,omitempty" yaml:"externalUrl,omitempty"` + ImagePullSecrets []LocalObjectReference `json:"imagePullSecrets,omitempty" yaml:"imagePullSecrets,omitempty"` + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + ListenLocal bool `json:"listenLocal,omitempty" yaml:"listenLocal,omitempty"` + LogLevel string `json:"logLevel,omitempty" yaml:"logLevel,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"` + NodeSelector map[string]string `json:"nodeSelector,omitempty" yaml:"nodeSelector,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"` + PodMetadata *ObjectMeta `json:"podMetadata,omitempty" yaml:"podMetadata,omitempty"` + PriorityClassName string `json:"priorityClassName,omitempty" yaml:"priorityClassName,omitempty"` + ProjectID string `json:"projectId,omitempty" yaml:"projectId,omitempty"` + RemoteRead []RemoteReadSpec `json:"remoteRead,omitempty" yaml:"remoteRead,omitempty"` + RemoteWrite []RemoteWriteSpec `json:"remoteWrite,omitempty" yaml:"remoteWrite,omitempty"` + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + Replicas *int64 `json:"replicas,omitempty" yaml:"replicas,omitempty"` + Resources *ResourceRequirements `json:"resources,omitempty" yaml:"resources,omitempty"` + Retention string `json:"retention,omitempty" yaml:"retention,omitempty"` + RoutePrefix string `json:"routePrefix,omitempty" yaml:"routePrefix,omitempty"` + RuleSelector *LabelSelector `json:"ruleSelector,omitempty" yaml:"ruleSelector,omitempty"` + SHA string `json:"sha,omitempty" yaml:"sha,omitempty"` + ScrapeInterval string `json:"scrapeInterval,omitempty" yaml:"scrapeInterval,omitempty"` + Secrets []string `json:"secrets,omitempty" yaml:"secrets,omitempty"` + SecurityContext *PodSecurityContext `json:"securityContext,omitempty" yaml:"securityContext,omitempty"` + ServiceAccountName string `json:"serviceAccountName,omitempty" yaml:"serviceAccountName,omitempty"` + ServiceMonitorSelector *LabelSelector `json:"serviceMonitorSelector,omitempty" yaml:"serviceMonitorSelector,omitempty"` + State string `json:"state,omitempty" yaml:"state,omitempty"` + Storage *StorageSpec `json:"storage,omitempty" yaml:"storage,omitempty"` + Tag string `json:"tag,omitempty" yaml:"tag,omitempty"` + Tolerations []Toleration `json:"tolerations,omitempty" yaml:"tolerations,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"` + Version string `json:"version,omitempty" yaml:"version,omitempty"` +} + +type PrometheusCollection struct { + types.Collection + Data []Prometheus `json:"data,omitempty"` + client *PrometheusClient +} + +type PrometheusClient struct { + apiClient *Client +} + +type PrometheusOperations interface { + List(opts *types.ListOpts) (*PrometheusCollection, error) + Create(opts *Prometheus) (*Prometheus, error) + Update(existing *Prometheus, updates interface{}) (*Prometheus, error) + Replace(existing *Prometheus) (*Prometheus, error) + ByID(id string) (*Prometheus, error) + Delete(container *Prometheus) error +} + +func newPrometheusClient(apiClient *Client) *PrometheusClient { + return &PrometheusClient{ + apiClient: apiClient, + } +} + +func (c *PrometheusClient) Create(container *Prometheus) (*Prometheus, error) { + resp := &Prometheus{} + err := c.apiClient.Ops.DoCreate(PrometheusType, container, resp) + return resp, err +} + +func (c *PrometheusClient) Update(existing *Prometheus, updates interface{}) (*Prometheus, error) { + resp := &Prometheus{} + err := c.apiClient.Ops.DoUpdate(PrometheusType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *PrometheusClient) Replace(obj *Prometheus) (*Prometheus, error) { + resp := &Prometheus{} + err := c.apiClient.Ops.DoReplace(PrometheusType, &obj.Resource, obj, resp) + return resp, err +} + +func (c *PrometheusClient) List(opts *types.ListOpts) (*PrometheusCollection, error) { + resp := &PrometheusCollection{} + err := c.apiClient.Ops.DoList(PrometheusType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *PrometheusCollection) Next() (*PrometheusCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &PrometheusCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *PrometheusClient) ByID(id string) (*Prometheus, error) { + resp := &Prometheus{} + err := c.apiClient.Ops.DoByID(PrometheusType, id, resp) + return resp, err +} + +func (c *PrometheusClient) Delete(container *Prometheus) error { + return c.apiClient.Ops.DoResourceDelete(PrometheusType, &container.Resource) +} diff --git a/client/project/v3/zz_generated_prometheus_rule.go b/client/project/v3/zz_generated_prometheus_rule.go new file mode 100644 index 00000000..d13effd0 --- /dev/null +++ b/client/project/v3/zz_generated_prometheus_rule.go @@ -0,0 +1,105 @@ +package client + +import ( + "github.com/rancher/norman/types" +) + +const ( + PrometheusRuleType = "prometheusRule" + PrometheusRuleFieldAnnotations = "annotations" + PrometheusRuleFieldCreated = "created" + PrometheusRuleFieldCreatorID = "creatorId" + PrometheusRuleFieldGroups = "groups" + PrometheusRuleFieldLabels = "labels" + PrometheusRuleFieldName = "name" + PrometheusRuleFieldNamespaceId = "namespaceId" + PrometheusRuleFieldOwnerReferences = "ownerReferences" + PrometheusRuleFieldProjectID = "projectId" + PrometheusRuleFieldRemoved = "removed" + PrometheusRuleFieldUUID = "uuid" +) + +type PrometheusRule struct { + types.Resource + Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` + Created string `json:"created,omitempty" yaml:"created,omitempty"` + CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"` + Groups []RuleGroup `json:"groups,omitempty" yaml:"groups,omitempty"` + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"` + ProjectID string `json:"projectId,omitempty" yaml:"projectId,omitempty"` + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type PrometheusRuleCollection struct { + types.Collection + Data []PrometheusRule `json:"data,omitempty"` + client *PrometheusRuleClient +} + +type PrometheusRuleClient struct { + apiClient *Client +} + +type PrometheusRuleOperations interface { + List(opts *types.ListOpts) (*PrometheusRuleCollection, error) + Create(opts *PrometheusRule) (*PrometheusRule, error) + Update(existing *PrometheusRule, updates interface{}) (*PrometheusRule, error) + Replace(existing *PrometheusRule) (*PrometheusRule, error) + ByID(id string) (*PrometheusRule, error) + Delete(container *PrometheusRule) error +} + +func newPrometheusRuleClient(apiClient *Client) *PrometheusRuleClient { + return &PrometheusRuleClient{ + apiClient: apiClient, + } +} + +func (c *PrometheusRuleClient) Create(container *PrometheusRule) (*PrometheusRule, error) { + resp := &PrometheusRule{} + err := c.apiClient.Ops.DoCreate(PrometheusRuleType, container, resp) + return resp, err +} + +func (c *PrometheusRuleClient) Update(existing *PrometheusRule, updates interface{}) (*PrometheusRule, error) { + resp := &PrometheusRule{} + err := c.apiClient.Ops.DoUpdate(PrometheusRuleType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *PrometheusRuleClient) Replace(obj *PrometheusRule) (*PrometheusRule, error) { + resp := &PrometheusRule{} + err := c.apiClient.Ops.DoReplace(PrometheusRuleType, &obj.Resource, obj, resp) + return resp, err +} + +func (c *PrometheusRuleClient) List(opts *types.ListOpts) (*PrometheusRuleCollection, error) { + resp := &PrometheusRuleCollection{} + err := c.apiClient.Ops.DoList(PrometheusRuleType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *PrometheusRuleCollection) Next() (*PrometheusRuleCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &PrometheusRuleCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *PrometheusRuleClient) ByID(id string) (*PrometheusRule, error) { + resp := &PrometheusRule{} + err := c.apiClient.Ops.DoByID(PrometheusRuleType, id, resp) + return resp, err +} + +func (c *PrometheusRuleClient) Delete(container *PrometheusRule) error { + return c.apiClient.Ops.DoResourceDelete(PrometheusRuleType, &container.Resource) +} diff --git a/client/project/v3/zz_generated_prometheus_rule_spec.go b/client/project/v3/zz_generated_prometheus_rule_spec.go new file mode 100644 index 00000000..e4e74a71 --- /dev/null +++ b/client/project/v3/zz_generated_prometheus_rule_spec.go @@ -0,0 +1,10 @@ +package client + +const ( + PrometheusRuleSpecType = "prometheusRuleSpec" + PrometheusRuleSpecFieldGroups = "groups" +) + +type PrometheusRuleSpec struct { + Groups []RuleGroup `json:"groups,omitempty" yaml:"groups,omitempty"` +} diff --git a/client/project/v3/zz_generated_prometheus_spec.go b/client/project/v3/zz_generated_prometheus_spec.go new file mode 100644 index 00000000..0c954dda --- /dev/null +++ b/client/project/v3/zz_generated_prometheus_spec.go @@ -0,0 +1,76 @@ +package client + +const ( + PrometheusSpecType = "prometheusSpec" + PrometheusSpecFieldAdditionalAlertManagerConfigs = "additionalAlertManagerConfigs" + PrometheusSpecFieldAdditionalAlertRelabelConfigs = "additionalAlertRelabelConfigs" + PrometheusSpecFieldAdditionalScrapeConfigs = "additionalScrapeConfigs" + PrometheusSpecFieldAffinity = "affinity" + PrometheusSpecFieldAlerting = "alerting" + PrometheusSpecFieldBaseImage = "baseImage" + PrometheusSpecFieldConfigMaps = "configMaps" + PrometheusSpecFieldContainers = "containers" + PrometheusSpecFieldEvaluationInterval = "evaluationInterval" + PrometheusSpecFieldExternalLabels = "externalLabels" + PrometheusSpecFieldExternalURL = "externalUrl" + PrometheusSpecFieldImagePullSecrets = "imagePullSecrets" + PrometheusSpecFieldListenLocal = "listenLocal" + PrometheusSpecFieldLogLevel = "logLevel" + PrometheusSpecFieldNodeSelector = "nodeSelector" + PrometheusSpecFieldPodMetadata = "podMetadata" + PrometheusSpecFieldPriorityClassName = "priorityClassName" + PrometheusSpecFieldRemoteRead = "remoteRead" + PrometheusSpecFieldRemoteWrite = "remoteWrite" + PrometheusSpecFieldReplicas = "replicas" + PrometheusSpecFieldResources = "resources" + PrometheusSpecFieldRetention = "retention" + PrometheusSpecFieldRoutePrefix = "routePrefix" + PrometheusSpecFieldRuleSelector = "ruleSelector" + PrometheusSpecFieldSHA = "sha" + PrometheusSpecFieldScrapeInterval = "scrapeInterval" + PrometheusSpecFieldSecrets = "secrets" + PrometheusSpecFieldSecurityContext = "securityContext" + PrometheusSpecFieldServiceAccountName = "serviceAccountName" + PrometheusSpecFieldServiceMonitorSelector = "serviceMonitorSelector" + PrometheusSpecFieldStorage = "storage" + PrometheusSpecFieldTag = "tag" + PrometheusSpecFieldTolerations = "tolerations" + PrometheusSpecFieldVersion = "version" +) + +type PrometheusSpec struct { + AdditionalAlertManagerConfigs *SecretKeySelector `json:"additionalAlertManagerConfigs,omitempty" yaml:"additionalAlertManagerConfigs,omitempty"` + AdditionalAlertRelabelConfigs *SecretKeySelector `json:"additionalAlertRelabelConfigs,omitempty" yaml:"additionalAlertRelabelConfigs,omitempty"` + AdditionalScrapeConfigs *SecretKeySelector `json:"additionalScrapeConfigs,omitempty" yaml:"additionalScrapeConfigs,omitempty"` + Affinity *Affinity `json:"affinity,omitempty" yaml:"affinity,omitempty"` + Alerting *AlertingSpec `json:"alerting,omitempty" yaml:"alerting,omitempty"` + BaseImage string `json:"baseImage,omitempty" yaml:"baseImage,omitempty"` + ConfigMaps []string `json:"configMaps,omitempty" yaml:"configMaps,omitempty"` + Containers []Container `json:"containers,omitempty" yaml:"containers,omitempty"` + EvaluationInterval string `json:"evaluationInterval,omitempty" yaml:"evaluationInterval,omitempty"` + ExternalLabels map[string]string `json:"externalLabels,omitempty" yaml:"externalLabels,omitempty"` + ExternalURL string `json:"externalUrl,omitempty" yaml:"externalUrl,omitempty"` + ImagePullSecrets []LocalObjectReference `json:"imagePullSecrets,omitempty" yaml:"imagePullSecrets,omitempty"` + ListenLocal bool `json:"listenLocal,omitempty" yaml:"listenLocal,omitempty"` + LogLevel string `json:"logLevel,omitempty" yaml:"logLevel,omitempty"` + NodeSelector map[string]string `json:"nodeSelector,omitempty" yaml:"nodeSelector,omitempty"` + PodMetadata *ObjectMeta `json:"podMetadata,omitempty" yaml:"podMetadata,omitempty"` + PriorityClassName string `json:"priorityClassName,omitempty" yaml:"priorityClassName,omitempty"` + RemoteRead []RemoteReadSpec `json:"remoteRead,omitempty" yaml:"remoteRead,omitempty"` + RemoteWrite []RemoteWriteSpec `json:"remoteWrite,omitempty" yaml:"remoteWrite,omitempty"` + Replicas *int64 `json:"replicas,omitempty" yaml:"replicas,omitempty"` + Resources *ResourceRequirements `json:"resources,omitempty" yaml:"resources,omitempty"` + Retention string `json:"retention,omitempty" yaml:"retention,omitempty"` + RoutePrefix string `json:"routePrefix,omitempty" yaml:"routePrefix,omitempty"` + RuleSelector *LabelSelector `json:"ruleSelector,omitempty" yaml:"ruleSelector,omitempty"` + SHA string `json:"sha,omitempty" yaml:"sha,omitempty"` + ScrapeInterval string `json:"scrapeInterval,omitempty" yaml:"scrapeInterval,omitempty"` + Secrets []string `json:"secrets,omitempty" yaml:"secrets,omitempty"` + SecurityContext *PodSecurityContext `json:"securityContext,omitempty" yaml:"securityContext,omitempty"` + ServiceAccountName string `json:"serviceAccountName,omitempty" yaml:"serviceAccountName,omitempty"` + ServiceMonitorSelector *LabelSelector `json:"serviceMonitorSelector,omitempty" yaml:"serviceMonitorSelector,omitempty"` + Storage *StorageSpec `json:"storage,omitempty" yaml:"storage,omitempty"` + Tag string `json:"tag,omitempty" yaml:"tag,omitempty"` + Tolerations []Toleration `json:"tolerations,omitempty" yaml:"tolerations,omitempty"` + Version string `json:"version,omitempty" yaml:"version,omitempty"` +} diff --git a/client/project/v3/zz_generated_prometheus_status.go b/client/project/v3/zz_generated_prometheus_status.go new file mode 100644 index 00000000..438957b3 --- /dev/null +++ b/client/project/v3/zz_generated_prometheus_status.go @@ -0,0 +1,18 @@ +package client + +const ( + PrometheusStatusType = "prometheusStatus" + PrometheusStatusFieldAvailableReplicas = "availableReplicas" + PrometheusStatusFieldPaused = "paused" + PrometheusStatusFieldReplicas = "replicas" + PrometheusStatusFieldUnavailableReplicas = "unavailableReplicas" + PrometheusStatusFieldUpdatedReplicas = "updatedReplicas" +) + +type PrometheusStatus struct { + AvailableReplicas int64 `json:"availableReplicas,omitempty" yaml:"availableReplicas,omitempty"` + Paused bool `json:"paused,omitempty" yaml:"paused,omitempty"` + Replicas int64 `json:"replicas,omitempty" yaml:"replicas,omitempty"` + UnavailableReplicas int64 `json:"unavailableReplicas,omitempty" yaml:"unavailableReplicas,omitempty"` + UpdatedReplicas int64 `json:"updatedReplicas,omitempty" yaml:"updatedReplicas,omitempty"` +} diff --git a/client/project/v3/zz_generated_queue_config.go b/client/project/v3/zz_generated_queue_config.go new file mode 100644 index 00000000..785aa20b --- /dev/null +++ b/client/project/v3/zz_generated_queue_config.go @@ -0,0 +1,22 @@ +package client + +const ( + QueueConfigType = "queueConfig" + QueueConfigFieldBatchSendDeadline = "batchSendDeadline" + QueueConfigFieldCapacity = "capacity" + QueueConfigFieldMaxBackoff = "maxBackoff" + QueueConfigFieldMaxRetries = "maxRetries" + QueueConfigFieldMaxSamplesPerSend = "maxSamplesPerSend" + QueueConfigFieldMaxShards = "maxShards" + QueueConfigFieldMinBackoff = "minBackoff" +) + +type QueueConfig struct { + BatchSendDeadline string `json:"batchSendDeadline,omitempty" yaml:"batchSendDeadline,omitempty"` + Capacity int64 `json:"capacity,omitempty" yaml:"capacity,omitempty"` + MaxBackoff string `json:"maxBackoff,omitempty" yaml:"maxBackoff,omitempty"` + MaxRetries int64 `json:"maxRetries,omitempty" yaml:"maxRetries,omitempty"` + MaxSamplesPerSend int64 `json:"maxSamplesPerSend,omitempty" yaml:"maxSamplesPerSend,omitempty"` + MaxShards int64 `json:"maxShards,omitempty" yaml:"maxShards,omitempty"` + MinBackoff string `json:"minBackoff,omitempty" yaml:"minBackoff,omitempty"` +} diff --git a/client/project/v3/zz_generated_relabel_config.go b/client/project/v3/zz_generated_relabel_config.go new file mode 100644 index 00000000..d5acce3f --- /dev/null +++ b/client/project/v3/zz_generated_relabel_config.go @@ -0,0 +1,22 @@ +package client + +const ( + RelabelConfigType = "relabelConfig" + RelabelConfigFieldAction = "action" + RelabelConfigFieldModulus = "modulus" + RelabelConfigFieldRegex = "regex" + RelabelConfigFieldReplacement = "replacement" + RelabelConfigFieldSeparator = "separator" + RelabelConfigFieldSourceLabels = "sourceLabels" + RelabelConfigFieldTargetLabel = "targetLabel" +) + +type RelabelConfig struct { + Action string `json:"action,omitempty" yaml:"action,omitempty"` + Modulus int64 `json:"modulus,omitempty" yaml:"modulus,omitempty"` + Regex string `json:"regex,omitempty" yaml:"regex,omitempty"` + Replacement string `json:"replacement,omitempty" yaml:"replacement,omitempty"` + Separator string `json:"separator,omitempty" yaml:"separator,omitempty"` + SourceLabels []string `json:"sourceLabels,omitempty" yaml:"sourceLabels,omitempty"` + TargetLabel string `json:"targetLabel,omitempty" yaml:"targetLabel,omitempty"` +} diff --git a/client/project/v3/zz_generated_remote_read_spec.go b/client/project/v3/zz_generated_remote_read_spec.go new file mode 100644 index 00000000..d4f0c35d --- /dev/null +++ b/client/project/v3/zz_generated_remote_read_spec.go @@ -0,0 +1,26 @@ +package client + +const ( + RemoteReadSpecType = "remoteReadSpec" + RemoteReadSpecFieldBasicAuth = "basicAuth" + RemoteReadSpecFieldBearerToken = "bearerToken" + RemoteReadSpecFieldBearerTokenFile = "bearerTokenFile" + RemoteReadSpecFieldProxyURL = "proxyUrl" + RemoteReadSpecFieldReadRecent = "readRecent" + RemoteReadSpecFieldRemoteTimeout = "remoteTimeout" + RemoteReadSpecFieldRequiredMatchers = "requiredMatchers" + RemoteReadSpecFieldTLSConfig = "tlsConfig" + RemoteReadSpecFieldURL = "url" +) + +type RemoteReadSpec struct { + BasicAuth *BasicAuth `json:"basicAuth,omitempty" yaml:"basicAuth,omitempty"` + BearerToken string `json:"bearerToken,omitempty" yaml:"bearerToken,omitempty"` + BearerTokenFile string `json:"bearerTokenFile,omitempty" yaml:"bearerTokenFile,omitempty"` + ProxyURL string `json:"proxyUrl,omitempty" yaml:"proxyUrl,omitempty"` + ReadRecent bool `json:"readRecent,omitempty" yaml:"readRecent,omitempty"` + RemoteTimeout string `json:"remoteTimeout,omitempty" yaml:"remoteTimeout,omitempty"` + RequiredMatchers map[string]string `json:"requiredMatchers,omitempty" yaml:"requiredMatchers,omitempty"` + TLSConfig *TLSConfig `json:"tlsConfig,omitempty" yaml:"tlsConfig,omitempty"` + URL string `json:"url,omitempty" yaml:"url,omitempty"` +} diff --git a/client/project/v3/zz_generated_remote_write_spec.go b/client/project/v3/zz_generated_remote_write_spec.go new file mode 100644 index 00000000..7e0be04e --- /dev/null +++ b/client/project/v3/zz_generated_remote_write_spec.go @@ -0,0 +1,26 @@ +package client + +const ( + RemoteWriteSpecType = "remoteWriteSpec" + RemoteWriteSpecFieldBasicAuth = "basicAuth" + RemoteWriteSpecFieldBearerToken = "bearerToken" + RemoteWriteSpecFieldBearerTokenFile = "bearerTokenFile" + RemoteWriteSpecFieldProxyURL = "proxyUrl" + RemoteWriteSpecFieldQueueConfig = "queueConfig" + RemoteWriteSpecFieldRemoteTimeout = "remoteTimeout" + RemoteWriteSpecFieldTLSConfig = "tlsConfig" + RemoteWriteSpecFieldURL = "url" + RemoteWriteSpecFieldWriteRelabelConfigs = "writeRelabelConfigs" +) + +type RemoteWriteSpec struct { + BasicAuth *BasicAuth `json:"basicAuth,omitempty" yaml:"basicAuth,omitempty"` + BearerToken string `json:"bearerToken,omitempty" yaml:"bearerToken,omitempty"` + BearerTokenFile string `json:"bearerTokenFile,omitempty" yaml:"bearerTokenFile,omitempty"` + ProxyURL string `json:"proxyUrl,omitempty" yaml:"proxyUrl,omitempty"` + QueueConfig *QueueConfig `json:"queueConfig,omitempty" yaml:"queueConfig,omitempty"` + RemoteTimeout string `json:"remoteTimeout,omitempty" yaml:"remoteTimeout,omitempty"` + TLSConfig *TLSConfig `json:"tlsConfig,omitempty" yaml:"tlsConfig,omitempty"` + URL string `json:"url,omitempty" yaml:"url,omitempty"` + WriteRelabelConfigs []RelabelConfig `json:"writeRelabelConfigs,omitempty" yaml:"writeRelabelConfigs,omitempty"` +} diff --git a/client/project/v3/zz_generated_replica_set.go b/client/project/v3/zz_generated_replica_set.go index af1e66d2..b625d92a 100644 --- a/client/project/v3/zz_generated_replica_set.go +++ b/client/project/v3/zz_generated_replica_set.go @@ -56,6 +56,7 @@ const ( ReplicaSetFieldVolumes = "volumes" ReplicaSetFieldWorkloadAnnotations = "workloadAnnotations" ReplicaSetFieldWorkloadLabels = "workloadLabels" + ReplicaSetFieldWorkloadMetrics = "workloadMetrics" ) type ReplicaSet struct { @@ -110,6 +111,7 @@ type ReplicaSet struct { Volumes []Volume `json:"volumes,omitempty" yaml:"volumes,omitempty"` WorkloadAnnotations map[string]string `json:"workloadAnnotations,omitempty" yaml:"workloadAnnotations,omitempty"` WorkloadLabels map[string]string `json:"workloadLabels,omitempty" yaml:"workloadLabels,omitempty"` + WorkloadMetrics []WorkloadMetric `json:"workloadMetrics,omitempty" yaml:"workloadMetrics,omitempty"` } type ReplicaSetCollection struct { diff --git a/client/project/v3/zz_generated_replication_controller.go b/client/project/v3/zz_generated_replication_controller.go index fa3f0072..48be7124 100644 --- a/client/project/v3/zz_generated_replication_controller.go +++ b/client/project/v3/zz_generated_replication_controller.go @@ -56,6 +56,7 @@ const ( ReplicationControllerFieldVolumes = "volumes" ReplicationControllerFieldWorkloadAnnotations = "workloadAnnotations" ReplicationControllerFieldWorkloadLabels = "workloadLabels" + ReplicationControllerFieldWorkloadMetrics = "workloadMetrics" ) type ReplicationController struct { @@ -110,6 +111,7 @@ type ReplicationController struct { Volumes []Volume `json:"volumes,omitempty" yaml:"volumes,omitempty"` WorkloadAnnotations map[string]string `json:"workloadAnnotations,omitempty" yaml:"workloadAnnotations,omitempty"` WorkloadLabels map[string]string `json:"workloadLabels,omitempty" yaml:"workloadLabels,omitempty"` + WorkloadMetrics []WorkloadMetric `json:"workloadMetrics,omitempty" yaml:"workloadMetrics,omitempty"` } type ReplicationControllerCollection struct { diff --git a/client/project/v3/zz_generated_rule.go b/client/project/v3/zz_generated_rule.go new file mode 100644 index 00000000..5e100e53 --- /dev/null +++ b/client/project/v3/zz_generated_rule.go @@ -0,0 +1,22 @@ +package client + +import "k8s.io/apimachinery/pkg/util/intstr" + +const ( + RuleType = "rule" + RuleFieldAlert = "alert" + RuleFieldAnnotations = "annotations" + RuleFieldExpr = "expr" + RuleFieldFor = "for" + RuleFieldLabels = "labels" + RuleFieldRecord = "record" +) + +type Rule struct { + Alert string `json:"alert,omitempty" yaml:"alert,omitempty"` + Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` + Expr intstr.IntOrString `json:"expr,omitempty" yaml:"expr,omitempty"` + For string `json:"for,omitempty" yaml:"for,omitempty"` + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + Record string `json:"record,omitempty" yaml:"record,omitempty"` +} diff --git a/client/project/v3/zz_generated_rule_group.go b/client/project/v3/zz_generated_rule_group.go new file mode 100644 index 00000000..2457da14 --- /dev/null +++ b/client/project/v3/zz_generated_rule_group.go @@ -0,0 +1,14 @@ +package client + +const ( + RuleGroupType = "ruleGroup" + RuleGroupFieldInterval = "interval" + RuleGroupFieldName = "name" + RuleGroupFieldRules = "rules" +) + +type RuleGroup struct { + Interval string `json:"interval,omitempty" yaml:"interval,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Rules []Rule `json:"rules,omitempty" yaml:"rules,omitempty"` +} diff --git a/client/project/v3/zz_generated_service_monitor.go b/client/project/v3/zz_generated_service_monitor.go new file mode 100644 index 00000000..db96da98 --- /dev/null +++ b/client/project/v3/zz_generated_service_monitor.go @@ -0,0 +1,121 @@ +package client + +import ( + "github.com/rancher/norman/types" +) + +const ( + ServiceMonitorType = "serviceMonitor" + ServiceMonitorFieldAnnotations = "annotations" + ServiceMonitorFieldCreated = "created" + ServiceMonitorFieldCreatorID = "creatorId" + ServiceMonitorFieldEndpoints = "endpoints" + ServiceMonitorFieldJobLabel = "jobLabel" + ServiceMonitorFieldLabels = "labels" + ServiceMonitorFieldName = "name" + ServiceMonitorFieldNamespaceId = "namespaceId" + ServiceMonitorFieldNamespaceSelector = "namespaceSelector" + ServiceMonitorFieldOwnerReferences = "ownerReferences" + ServiceMonitorFieldPodTargetLabels = "podTargetLabels" + ServiceMonitorFieldProjectID = "projectId" + ServiceMonitorFieldRemoved = "removed" + ServiceMonitorFieldSampleLimit = "sampleLimit" + ServiceMonitorFieldSelector = "selector" + ServiceMonitorFieldTargetLabels = "targetLabels" + ServiceMonitorFieldTargetService = "targetService" + ServiceMonitorFieldTargetWorkload = "targetWorkload" + ServiceMonitorFieldUUID = "uuid" +) + +type ServiceMonitor struct { + types.Resource + Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` + Created string `json:"created,omitempty" yaml:"created,omitempty"` + CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"` + Endpoints []Endpoint `json:"endpoints,omitempty" yaml:"endpoints,omitempty"` + JobLabel string `json:"jobLabel,omitempty" yaml:"jobLabel,omitempty"` + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"` + NamespaceSelector []string `json:"namespaceSelector,omitempty" yaml:"namespaceSelector,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"` + PodTargetLabels []string `json:"podTargetLabels,omitempty" yaml:"podTargetLabels,omitempty"` + ProjectID string `json:"projectId,omitempty" yaml:"projectId,omitempty"` + Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` + SampleLimit int64 `json:"sampleLimit,omitempty" yaml:"sampleLimit,omitempty"` + Selector *LabelSelector `json:"selector,omitempty" yaml:"selector,omitempty"` + TargetLabels []string `json:"targetLabels,omitempty" yaml:"targetLabels,omitempty"` + TargetService string `json:"targetService,omitempty" yaml:"targetService,omitempty"` + TargetWorkload string `json:"targetWorkload,omitempty" yaml:"targetWorkload,omitempty"` + UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` +} + +type ServiceMonitorCollection struct { + types.Collection + Data []ServiceMonitor `json:"data,omitempty"` + client *ServiceMonitorClient +} + +type ServiceMonitorClient struct { + apiClient *Client +} + +type ServiceMonitorOperations interface { + List(opts *types.ListOpts) (*ServiceMonitorCollection, error) + Create(opts *ServiceMonitor) (*ServiceMonitor, error) + Update(existing *ServiceMonitor, updates interface{}) (*ServiceMonitor, error) + Replace(existing *ServiceMonitor) (*ServiceMonitor, error) + ByID(id string) (*ServiceMonitor, error) + Delete(container *ServiceMonitor) error +} + +func newServiceMonitorClient(apiClient *Client) *ServiceMonitorClient { + return &ServiceMonitorClient{ + apiClient: apiClient, + } +} + +func (c *ServiceMonitorClient) Create(container *ServiceMonitor) (*ServiceMonitor, error) { + resp := &ServiceMonitor{} + err := c.apiClient.Ops.DoCreate(ServiceMonitorType, container, resp) + return resp, err +} + +func (c *ServiceMonitorClient) Update(existing *ServiceMonitor, updates interface{}) (*ServiceMonitor, error) { + resp := &ServiceMonitor{} + err := c.apiClient.Ops.DoUpdate(ServiceMonitorType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ServiceMonitorClient) Replace(obj *ServiceMonitor) (*ServiceMonitor, error) { + resp := &ServiceMonitor{} + err := c.apiClient.Ops.DoReplace(ServiceMonitorType, &obj.Resource, obj, resp) + return resp, err +} + +func (c *ServiceMonitorClient) List(opts *types.ListOpts) (*ServiceMonitorCollection, error) { + resp := &ServiceMonitorCollection{} + err := c.apiClient.Ops.DoList(ServiceMonitorType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ServiceMonitorCollection) Next() (*ServiceMonitorCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ServiceMonitorCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ServiceMonitorClient) ByID(id string) (*ServiceMonitor, error) { + resp := &ServiceMonitor{} + err := c.apiClient.Ops.DoByID(ServiceMonitorType, id, resp) + return resp, err +} + +func (c *ServiceMonitorClient) Delete(container *ServiceMonitor) error { + return c.apiClient.Ops.DoResourceDelete(ServiceMonitorType, &container.Resource) +} diff --git a/client/project/v3/zz_generated_service_monitor_spec.go b/client/project/v3/zz_generated_service_monitor_spec.go new file mode 100644 index 00000000..c260c1c5 --- /dev/null +++ b/client/project/v3/zz_generated_service_monitor_spec.go @@ -0,0 +1,22 @@ +package client + +const ( + ServiceMonitorSpecType = "serviceMonitorSpec" + ServiceMonitorSpecFieldEndpoints = "endpoints" + ServiceMonitorSpecFieldJobLabel = "jobLabel" + ServiceMonitorSpecFieldNamespaceSelector = "namespaceSelector" + ServiceMonitorSpecFieldPodTargetLabels = "podTargetLabels" + ServiceMonitorSpecFieldSampleLimit = "sampleLimit" + ServiceMonitorSpecFieldSelector = "selector" + ServiceMonitorSpecFieldTargetLabels = "targetLabels" +) + +type ServiceMonitorSpec struct { + Endpoints []Endpoint `json:"endpoints,omitempty" yaml:"endpoints,omitempty"` + JobLabel string `json:"jobLabel,omitempty" yaml:"jobLabel,omitempty"` + NamespaceSelector []string `json:"namespaceSelector,omitempty" yaml:"namespaceSelector,omitempty"` + PodTargetLabels []string `json:"podTargetLabels,omitempty" yaml:"podTargetLabels,omitempty"` + SampleLimit int64 `json:"sampleLimit,omitempty" yaml:"sampleLimit,omitempty"` + Selector *LabelSelector `json:"selector,omitempty" yaml:"selector,omitempty"` + TargetLabels []string `json:"targetLabels,omitempty" yaml:"targetLabels,omitempty"` +} diff --git a/client/project/v3/zz_generated_stateful_set.go b/client/project/v3/zz_generated_stateful_set.go index 873c42f6..106aad66 100644 --- a/client/project/v3/zz_generated_stateful_set.go +++ b/client/project/v3/zz_generated_stateful_set.go @@ -56,6 +56,7 @@ const ( StatefulSetFieldVolumes = "volumes" StatefulSetFieldWorkloadAnnotations = "workloadAnnotations" StatefulSetFieldWorkloadLabels = "workloadLabels" + StatefulSetFieldWorkloadMetrics = "workloadMetrics" ) type StatefulSet struct { @@ -110,6 +111,7 @@ type StatefulSet struct { Volumes []Volume `json:"volumes,omitempty" yaml:"volumes,omitempty"` WorkloadAnnotations map[string]string `json:"workloadAnnotations,omitempty" yaml:"workloadAnnotations,omitempty"` WorkloadLabels map[string]string `json:"workloadLabels,omitempty" yaml:"workloadLabels,omitempty"` + WorkloadMetrics []WorkloadMetric `json:"workloadMetrics,omitempty" yaml:"workloadMetrics,omitempty"` } type StatefulSetCollection struct { diff --git a/client/project/v3/zz_generated_storage_spec.go b/client/project/v3/zz_generated_storage_spec.go new file mode 100644 index 00000000..85c1771c --- /dev/null +++ b/client/project/v3/zz_generated_storage_spec.go @@ -0,0 +1,12 @@ +package client + +const ( + StorageSpecType = "storageSpec" + StorageSpecFieldEmptyDir = "emptyDir" + StorageSpecFieldVolumeClaimTemplate = "volumeClaimTemplate" +) + +type StorageSpec struct { + EmptyDir *EmptyDirVolumeSource `json:"emptyDir,omitempty" yaml:"emptyDir,omitempty"` + VolumeClaimTemplate *PersistentVolumeClaim `json:"volumeClaimTemplate,omitempty" yaml:"volumeClaimTemplate,omitempty"` +} diff --git a/client/project/v3/zz_generated_thanos_gcsspec.go b/client/project/v3/zz_generated_thanos_gcsspec.go new file mode 100644 index 00000000..d00df867 --- /dev/null +++ b/client/project/v3/zz_generated_thanos_gcsspec.go @@ -0,0 +1,12 @@ +package client + +const ( + ThanosGCSSpecType = "thanosGCSSpec" + ThanosGCSSpecFieldBucket = "bucket" + ThanosGCSSpecFieldSecretKey = "credentials" +) + +type ThanosGCSSpec struct { + Bucket string `json:"bucket,omitempty" yaml:"bucket,omitempty"` + SecretKey *SecretKeySelector `json:"credentials,omitempty" yaml:"credentials,omitempty"` +} diff --git a/client/project/v3/zz_generated_thanos_s3spec.go b/client/project/v3/zz_generated_thanos_s3spec.go new file mode 100644 index 00000000..84f560d6 --- /dev/null +++ b/client/project/v3/zz_generated_thanos_s3spec.go @@ -0,0 +1,22 @@ +package client + +const ( + ThanosS3SpecType = "thanosS3Spec" + ThanosS3SpecFieldAccessKey = "accessKey" + ThanosS3SpecFieldBucket = "bucket" + ThanosS3SpecFieldEncryptSSE = "encryptsse" + ThanosS3SpecFieldEndpoint = "endpoint" + ThanosS3SpecFieldInsecure = "insecure" + ThanosS3SpecFieldSecretKey = "secretKey" + ThanosS3SpecFieldSignatureVersion2 = "signatureVersion2" +) + +type ThanosS3Spec struct { + AccessKey *SecretKeySelector `json:"accessKey,omitempty" yaml:"accessKey,omitempty"` + Bucket string `json:"bucket,omitempty" yaml:"bucket,omitempty"` + EncryptSSE *bool `json:"encryptsse,omitempty" yaml:"encryptsse,omitempty"` + Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"` + Insecure *bool `json:"insecure,omitempty" yaml:"insecure,omitempty"` + SecretKey *SecretKeySelector `json:"secretKey,omitempty" yaml:"secretKey,omitempty"` + SignatureVersion2 *bool `json:"signatureVersion2,omitempty" yaml:"signatureVersion2,omitempty"` +} diff --git a/client/project/v3/zz_generated_thanos_spec.go b/client/project/v3/zz_generated_thanos_spec.go new file mode 100644 index 00000000..e72315c1 --- /dev/null +++ b/client/project/v3/zz_generated_thanos_spec.go @@ -0,0 +1,24 @@ +package client + +const ( + ThanosSpecType = "thanosSpec" + ThanosSpecFieldBaseImage = "baseImage" + ThanosSpecFieldGCS = "gcs" + ThanosSpecFieldPeers = "peers" + ThanosSpecFieldResources = "resources" + ThanosSpecFieldS3 = "s3" + ThanosSpecFieldSHA = "sha" + ThanosSpecFieldTag = "tag" + ThanosSpecFieldVersion = "version" +) + +type ThanosSpec struct { + BaseImage string `json:"baseImage,omitempty" yaml:"baseImage,omitempty"` + GCS *ThanosGCSSpec `json:"gcs,omitempty" yaml:"gcs,omitempty"` + Peers string `json:"peers,omitempty" yaml:"peers,omitempty"` + Resources *ResourceRequirements `json:"resources,omitempty" yaml:"resources,omitempty"` + S3 *ThanosS3Spec `json:"s3,omitempty" yaml:"s3,omitempty"` + SHA string `json:"sha,omitempty" yaml:"sha,omitempty"` + Tag string `json:"tag,omitempty" yaml:"tag,omitempty"` + Version string `json:"version,omitempty" yaml:"version,omitempty"` +} diff --git a/client/project/v3/zz_generated_tls_config.go b/client/project/v3/zz_generated_tls_config.go new file mode 100644 index 00000000..118b5c50 --- /dev/null +++ b/client/project/v3/zz_generated_tls_config.go @@ -0,0 +1,18 @@ +package client + +const ( + TLSConfigType = "tlsConfig" + TLSConfigFieldCAFile = "caFile" + TLSConfigFieldCertFile = "certFile" + TLSConfigFieldInsecureSkipVerify = "insecureSkipVerify" + TLSConfigFieldKeyFile = "keyFile" + TLSConfigFieldServerName = "serverName" +) + +type TLSConfig struct { + CAFile string `json:"caFile,omitempty" yaml:"caFile,omitempty"` + CertFile string `json:"certFile,omitempty" yaml:"certFile,omitempty"` + InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify,omitempty"` + KeyFile string `json:"keyFile,omitempty" yaml:"keyFile,omitempty"` + ServerName string `json:"serverName,omitempty" yaml:"serverName,omitempty"` +} diff --git a/client/project/v3/zz_generated_workload.go b/client/project/v3/zz_generated_workload.go index 55783bc3..e2177315 100644 --- a/client/project/v3/zz_generated_workload.go +++ b/client/project/v3/zz_generated_workload.go @@ -70,6 +70,7 @@ const ( WorkloadFieldVolumes = "volumes" WorkloadFieldWorkloadAnnotations = "workloadAnnotations" WorkloadFieldWorkloadLabels = "workloadLabels" + WorkloadFieldWorkloadMetrics = "workloadMetrics" ) type Workload struct { @@ -138,6 +139,7 @@ type Workload struct { Volumes []Volume `json:"volumes,omitempty" yaml:"volumes,omitempty"` WorkloadAnnotations map[string]string `json:"workloadAnnotations,omitempty" yaml:"workloadAnnotations,omitempty"` WorkloadLabels map[string]string `json:"workloadLabels,omitempty" yaml:"workloadLabels,omitempty"` + WorkloadMetrics []WorkloadMetric `json:"workloadMetrics,omitempty" yaml:"workloadMetrics,omitempty"` } type WorkloadCollection struct { diff --git a/client/project/v3/zz_generated_workload_metric.go b/client/project/v3/zz_generated_workload_metric.go new file mode 100644 index 00000000..73888645 --- /dev/null +++ b/client/project/v3/zz_generated_workload_metric.go @@ -0,0 +1,14 @@ +package client + +const ( + WorkloadMetricType = "workloadMetric" + WorkloadMetricFieldPath = "path" + WorkloadMetricFieldPort = "port" + WorkloadMetricFieldSchema = "schema" +) + +type WorkloadMetric struct { + Path string `json:"path,omitempty" yaml:"path,omitempty"` + Port int64 `json:"port,omitempty" yaml:"port,omitempty"` + Schema string `json:"schema,omitempty" yaml:"schema,omitempty"` +} diff --git a/compose/zz_generated_compose.go b/compose/zz_generated_compose.go index 990e264b..71f758cb 100644 --- a/compose/zz_generated_compose.go +++ b/compose/zz_generated_compose.go @@ -38,9 +38,13 @@ type Config struct { ProjectLoggings map[string]managementClient.ProjectLogging `json:"projectLoggings,omitempty" yaml:"projectLoggings,omitempty"` ListenConfigs map[string]managementClient.ListenConfig `json:"listenConfigs,omitempty" yaml:"listenConfigs,omitempty"` Settings map[string]managementClient.Setting `json:"settings,omitempty" yaml:"settings,omitempty"` - Notifiers map[string]managementClient.Notifier `json:"notifiers,omitempty" yaml:"notifiers,omitempty"` ClusterAlerts map[string]managementClient.ClusterAlert `json:"clusterAlerts,omitempty" yaml:"clusterAlerts,omitempty"` ProjectAlerts map[string]managementClient.ProjectAlert `json:"projectAlerts,omitempty" yaml:"projectAlerts,omitempty"` + Notifiers map[string]managementClient.Notifier `json:"notifiers,omitempty" yaml:"notifiers,omitempty"` + ClusterAlertGroups map[string]managementClient.ClusterAlertGroup `json:"clusterAlertGroups,omitempty" yaml:"clusterAlertGroups,omitempty"` + ProjectAlertGroups map[string]managementClient.ProjectAlertGroup `json:"projectAlertGroups,omitempty" yaml:"projectAlertGroups,omitempty"` + ClusterAlertRules map[string]managementClient.ClusterAlertRule `json:"clusterAlertRules,omitempty" yaml:"clusterAlertRules,omitempty"` + ProjectAlertRules map[string]managementClient.ProjectAlertRule `json:"projectAlertRules,omitempty" yaml:"projectAlertRules,omitempty"` ComposeConfigs map[string]managementClient.ComposeConfig `json:"composeConfigs,omitempty" yaml:"composeConfigs,omitempty"` ProjectCatalogs map[string]managementClient.ProjectCatalog `json:"projectCatalogs,omitempty" yaml:"projectCatalogs,omitempty"` ClusterCatalogs map[string]managementClient.ClusterCatalog `json:"clusterCatalogs,omitempty" yaml:"clusterCatalogs,omitempty"` @@ -48,6 +52,9 @@ type Config struct { GlobalDNSs map[string]managementClient.GlobalDNS `json:"globalDnses,omitempty" yaml:"globalDnses,omitempty"` GlobalDNSProviders map[string]managementClient.GlobalDNSProvider `json:"globalDnsProviders,omitempty" yaml:"globalDnsProviders,omitempty"` KontainerDrivers map[string]managementClient.KontainerDriver `json:"kontainerDrivers,omitempty" yaml:"kontainerDrivers,omitempty"` + MonitorMetrics map[string]managementClient.MonitorMetric `json:"monitorMetrics,omitempty" yaml:"monitorMetrics,omitempty"` + ClusterMonitorGraphs map[string]managementClient.ClusterMonitorGraph `json:"clusterMonitorGraphs,omitempty" yaml:"clusterMonitorGraphs,omitempty"` + ProjectMonitorGraphs map[string]managementClient.ProjectMonitorGraph `json:"projectMonitorGraphs,omitempty" yaml:"projectMonitorGraphs,omitempty"` // Cluster Client Namespaces map[string]clusterClient.Namespace `json:"namespaces,omitempty" yaml:"namespaces,omitempty"` @@ -90,4 +97,8 @@ type Config struct { PipelineExecutions map[string]projectClient.PipelineExecution `json:"pipelineExecutions,omitempty" yaml:"pipelineExecutions,omitempty"` PipelineSettings map[string]projectClient.PipelineSetting `json:"pipelineSettings,omitempty" yaml:"pipelineSettings,omitempty"` SourceCodeRepositorys map[string]projectClient.SourceCodeRepository `json:"sourceCodeRepositories,omitempty" yaml:"sourceCodeRepositories,omitempty"` + Prometheuss map[string]projectClient.Prometheus `json:"prometheuses,omitempty" yaml:"prometheuses,omitempty"` + ServiceMonitors map[string]projectClient.ServiceMonitor `json:"serviceMonitors,omitempty" yaml:"serviceMonitors,omitempty"` + PrometheusRules map[string]projectClient.PrometheusRule `json:"prometheusRules,omitempty" yaml:"prometheusRules,omitempty"` + Alertmanagers map[string]projectClient.Alertmanager `json:"alertmanagers,omitempty" yaml:"alertmanagers,omitempty"` }