diff --git a/pkg/registry/auditor/siteinfo/storage.go b/pkg/registry/auditor/siteinfo/storage.go index 79d6aef8da..75690dd644 100644 --- a/pkg/registry/auditor/siteinfo/storage.go +++ b/pkg/registry/auditor/siteinfo/storage.go @@ -18,6 +18,7 @@ package SiteInfo import ( "context" + "strings" "time" "github.com/google/uuid" @@ -45,6 +46,7 @@ var ( _ rest.Scoper = &Storage{} _ rest.Storage = &Storage{} _ rest.Creater = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(cfg *restclient.Config, c client.Client) (*Storage, error) { @@ -77,6 +79,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(auditorv1alpha1.ResourceKindSiteInfo) +} + func (r *Storage) New() runtime.Object { return &auditorv1alpha1.SiteInfo{} } diff --git a/pkg/registry/core/genericresource/storage.go b/pkg/registry/core/genericresource/storage.go index 9cc9c4319c..e0b780c312 100644 --- a/pkg/registry/core/genericresource/storage.go +++ b/pkg/registry/core/genericresource/storage.go @@ -19,6 +19,7 @@ package genericresource import ( "context" "sort" + "strings" "kubeops.dev/ui-server/pkg/shared" @@ -54,6 +55,7 @@ var ( _ rest.Storage = &Storage{} _ rest.Getter = &Storage{} _ rest.Lister = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client, clusterID string, a authorizer.Authorizer) *Storage { @@ -76,6 +78,10 @@ func (r *Storage) NamespaceScoped() bool { return true } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rscoreapi.ResourceKindGenericResource) +} + func (r *Storage) New() runtime.Object { return &rscoreapi.GenericResource{} } diff --git a/pkg/registry/core/podview/storage.go b/pkg/registry/core/podview/storage.go index 7ba8f2f271..648bb64787 100644 --- a/pkg/registry/core/podview/storage.go +++ b/pkg/registry/core/podview/storage.go @@ -19,6 +19,7 @@ package podview import ( "context" "errors" + "strings" core "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -52,6 +53,7 @@ var ( _ rest.Storage = &Storage{} _ rest.Lister = &Storage{} _ rest.Getter = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client, a authorizer.Authorizer, builder *promclient.ClientBuilder) *Storage { @@ -79,6 +81,10 @@ func (r *Storage) NamespaceScoped() bool { return true } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rscoreapi.ResourceKindPodView) +} + func (r *Storage) New() runtime.Object { return &rscoreapi.PodView{} } diff --git a/pkg/registry/core/project/storage.go b/pkg/registry/core/project/storage.go index 30a6affd0a..e65669d104 100644 --- a/pkg/registry/core/project/storage.go +++ b/pkg/registry/core/project/storage.go @@ -54,6 +54,7 @@ var ( _ rest.Storage = &Storage{} _ rest.Lister = &Storage{} _ rest.Getter = &Storage{} + _ rest.SingularNameProvider = &Storage{} gr = schema.GroupResource{ Group: rscoreapi.SchemeGroupVersion.Group, @@ -77,6 +78,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rscoreapi.ResourceKindProject) +} + func (r *Storage) New() runtime.Object { return &rscoreapi.Project{} } diff --git a/pkg/registry/core/resourceservice/storage.go b/pkg/registry/core/resourceservice/storage.go index 29ee67e376..a997fd7bb2 100644 --- a/pkg/registry/core/resourceservice/storage.go +++ b/pkg/registry/core/resourceservice/storage.go @@ -66,6 +66,7 @@ var ( _ rest.Storage = &Storage{} _ rest.Getter = &Storage{} _ rest.Lister = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client, clusterID string, a authorizer.Authorizer) *Storage { @@ -88,6 +89,10 @@ func (r *Storage) NamespaceScoped() bool { return true } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rscoreapi.ResourceKindGenericResourceService) +} + func (r *Storage) New() runtime.Object { return &rscoreapi.GenericResourceService{} } diff --git a/pkg/registry/core/resourcesummary/storage.go b/pkg/registry/core/resourcesummary/storage.go index 03f00bd8ad..f24d5cfdc1 100644 --- a/pkg/registry/core/resourcesummary/storage.go +++ b/pkg/registry/core/resourcesummary/storage.go @@ -19,6 +19,7 @@ package ResourceSummary import ( "context" "sort" + "strings" "time" "kubeops.dev/ui-server/pkg/shared" @@ -55,6 +56,7 @@ var ( _ rest.Scoper = &Storage{} _ rest.Storage = &Storage{} _ rest.Lister = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client, clusterID string, a authorizer.Authorizer) *Storage { @@ -77,6 +79,10 @@ func (r *Storage) NamespaceScoped() bool { return true } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rscoreapi.ResourceKindResourceSummary) +} + func (r *Storage) New() runtime.Object { return &rscoreapi.ResourceSummary{} } diff --git a/pkg/registry/cost/reports/storage.go b/pkg/registry/cost/reports/storage.go index e5cfd196f1..a844051ac8 100644 --- a/pkg/registry/cost/reports/storage.go +++ b/pkg/registry/cost/reports/storage.go @@ -22,6 +22,7 @@ import ( "io" "net/http" "net/url" + "strings" costapi "kubeops.dev/ui-server/apis/cost/v1alpha1" @@ -51,6 +52,7 @@ var ( _ rest.Scoper = &Storage{} _ rest.Storage = &Storage{} _ rest.Creater = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client) *Storage { @@ -67,6 +69,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(costapi.ResourceKindCostReport) +} + func (r *Storage) New() runtime.Object { return &costapi.CostReport{} } diff --git a/pkg/registry/identity/whoami/storage.go b/pkg/registry/identity/whoami/storage.go index 658d6bc4b0..ae1584ec45 100644 --- a/pkg/registry/identity/whoami/storage.go +++ b/pkg/registry/identity/whoami/storage.go @@ -18,6 +18,7 @@ package whoami import ( "context" + "strings" identityv1alpha1 "kubeops.dev/ui-server/apis/identity/v1alpha1" @@ -36,6 +37,7 @@ var ( _ rest.Scoper = &Storage{} _ rest.Storage = &Storage{} _ rest.Creater = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage() *Storage { @@ -50,6 +52,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(identityv1alpha1.ResourceKindWhoAmI) +} + func (r *Storage) New() runtime.Object { return &identityv1alpha1.WhoAmI{} } diff --git a/pkg/registry/meta/chartpresetquery/storage.go b/pkg/registry/meta/chartpresetquery/storage.go index 155fd4d6b6..7dd5de50c2 100644 --- a/pkg/registry/meta/chartpresetquery/storage.go +++ b/pkg/registry/meta/chartpresetquery/storage.go @@ -18,6 +18,7 @@ package chartpresetquery import ( "context" + "strings" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -39,6 +40,7 @@ var ( _ rest.Scoper = &Storage{} _ rest.Storage = &Storage{} _ rest.Creater = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client) *Storage { @@ -55,6 +57,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rsapi.ResourceKindChartPresetQuery) +} + func (r *Storage) New() runtime.Object { return &rsapi.ChartPresetQuery{} } diff --git a/pkg/registry/meta/clusterstatus/storage.go b/pkg/registry/meta/clusterstatus/storage.go index 5f9aa0a93b..eda2968b37 100644 --- a/pkg/registry/meta/clusterstatus/storage.go +++ b/pkg/registry/meta/clusterstatus/storage.go @@ -18,6 +18,7 @@ package clusterstatus import ( "context" + "strings" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -37,6 +38,7 @@ var ( _ rest.Scoper = &Storage{} _ rest.Storage = &Storage{} _ rest.Creater = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client) *Storage { @@ -57,6 +59,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rsapi.ResourceKindClusterStatus) +} + func (r *Storage) New() runtime.Object { return &rsapi.ClusterStatus{} } diff --git a/pkg/registry/meta/render/storage.go b/pkg/registry/meta/render/storage.go index 6afd77579b..29b315c302 100644 --- a/pkg/registry/meta/render/storage.go +++ b/pkg/registry/meta/render/storage.go @@ -18,6 +18,7 @@ package render import ( "context" + "strings" "kubeops.dev/ui-server/pkg/graph" @@ -47,6 +48,7 @@ var ( _ rest.Scoper = &Storage{} _ rest.Storage = &Storage{} _ rest.Creater = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client, oc openvizcs.Interface, a authorizer.Authorizer) *Storage { @@ -65,6 +67,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rsapi.ResourceKindRender) +} + func (r *Storage) New() runtime.Object { return &rsapi.Render{} } diff --git a/pkg/registry/meta/renderdashboard/storage.go b/pkg/registry/meta/renderdashboard/storage.go index 297ef02045..893c42002a 100644 --- a/pkg/registry/meta/renderdashboard/storage.go +++ b/pkg/registry/meta/renderdashboard/storage.go @@ -19,6 +19,7 @@ package renderdashboard import ( "context" "fmt" + "strings" "kubeops.dev/ui-server/pkg/graph" @@ -46,6 +47,7 @@ var ( _ rest.Scoper = &Storage{} _ rest.Storage = &Storage{} _ rest.Creater = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client, oc openvizcs.Interface) *Storage { @@ -63,6 +65,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rsapi.ResourceKindRenderDashboard) +} + func (r *Storage) New() runtime.Object { return &rsapi.RenderDashboard{} } diff --git a/pkg/registry/meta/rendermenu/storage.go b/pkg/registry/meta/rendermenu/storage.go index e91817faa3..6ec4342e5a 100644 --- a/pkg/registry/meta/rendermenu/storage.go +++ b/pkg/registry/meta/rendermenu/storage.go @@ -18,6 +18,7 @@ package rendermenu import ( "context" + "strings" "kubeops.dev/ui-server/pkg/menu" @@ -43,6 +44,7 @@ var ( _ rest.Scoper = &Storage{} _ rest.Storage = &Storage{} _ rest.Creater = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client, disco discovery.ServerResourcesInterface, ns string) *Storage { @@ -61,6 +63,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rsapi.ResourceKindRenderMenu) +} + func (r *Storage) New() runtime.Object { return &rsapi.RenderMenu{} } diff --git a/pkg/registry/meta/renderrawgraph/storage.go b/pkg/registry/meta/renderrawgraph/storage.go index 69595ac0e7..c12f911ea0 100644 --- a/pkg/registry/meta/renderrawgraph/storage.go +++ b/pkg/registry/meta/renderrawgraph/storage.go @@ -18,6 +18,7 @@ package renderrawgraph import ( "context" + "strings" "kubeops.dev/ui-server/pkg/graph" @@ -40,6 +41,7 @@ var ( _ rest.Scoper = &Storage{} _ rest.Storage = &Storage{} _ rest.Creater = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client) *Storage { @@ -56,6 +58,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rsapi.ResourceKindRenderRawGraph) +} + func (r *Storage) New() runtime.Object { return &rsapi.RenderRawGraph{} } diff --git a/pkg/registry/meta/resourceblockdefinition/storage.go b/pkg/registry/meta/resourceblockdefinition/storage.go index 2751d84839..08a0b4f056 100644 --- a/pkg/registry/meta/resourceblockdefinition/storage.go +++ b/pkg/registry/meta/resourceblockdefinition/storage.go @@ -20,6 +20,7 @@ import ( "context" "fmt" "strconv" + "strings" kerr "k8s.io/apimachinery/pkg/api/errors" metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion" @@ -43,6 +44,7 @@ var ( _ rest.Storage = &Storage{} _ rest.Getter = &Storage{} _ rest.Lister = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage() *Storage { @@ -62,6 +64,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rsapi.ResourceKindResourceBlockDefinition) +} + // Getter func (r *Storage) New() runtime.Object { return &rsapi.ResourceBlockDefinition{} diff --git a/pkg/registry/meta/resourcecalculator/storage.go b/pkg/registry/meta/resourcecalculator/storage.go index bfc1526e99..93a4602eae 100644 --- a/pkg/registry/meta/resourcecalculator/storage.go +++ b/pkg/registry/meta/resourcecalculator/storage.go @@ -19,6 +19,7 @@ package resourcecalculator import ( "context" "fmt" + "strings" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -49,6 +50,7 @@ var ( _ rest.Scoper = &Storage{} _ rest.Storage = &Storage{} _ rest.Creater = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client, clusterID string, a authorizer.Authorizer) *Storage { @@ -71,6 +73,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rsapi.ResourceKindResourceCalculator) +} + func (r *Storage) New() runtime.Object { return &rsapi.ResourceCalculator{} } diff --git a/pkg/registry/meta/resourcedescriptor/storage.go b/pkg/registry/meta/resourcedescriptor/storage.go index 436769837d..6c5a669242 100644 --- a/pkg/registry/meta/resourcedescriptor/storage.go +++ b/pkg/registry/meta/resourcedescriptor/storage.go @@ -20,6 +20,7 @@ import ( "context" "fmt" "strconv" + "strings" kerr "k8s.io/apimachinery/pkg/api/errors" metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion" @@ -43,6 +44,7 @@ var ( _ rest.Storage = &Storage{} _ rest.Getter = &Storage{} _ rest.Lister = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage() *Storage { @@ -62,6 +64,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rsapi.ResourceKindResourceDescriptor) +} + // Getter func (r *Storage) New() runtime.Object { return &rsapi.ResourceDescriptor{} diff --git a/pkg/registry/meta/resourceeditor/storage.go b/pkg/registry/meta/resourceeditor/storage.go index c83ff5817a..5613f8cb0c 100644 --- a/pkg/registry/meta/resourceeditor/storage.go +++ b/pkg/registry/meta/resourceeditor/storage.go @@ -20,6 +20,7 @@ import ( "context" "fmt" "strconv" + "strings" kerr "k8s.io/apimachinery/pkg/api/errors" metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion" @@ -44,6 +45,7 @@ var ( _ rest.Storage = &Storage{} _ rest.Getter = &Storage{} _ rest.Lister = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage() *Storage { @@ -63,6 +65,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(uiapi.ResourceKindResourceEditor) +} + // Getter func (r *Storage) New() runtime.Object { return &uiapi.ResourceEditor{} diff --git a/pkg/registry/meta/resourcegraph/storage.go b/pkg/registry/meta/resourcegraph/storage.go index 88507ff1fe..e093a4e7a7 100644 --- a/pkg/registry/meta/resourcegraph/storage.go +++ b/pkg/registry/meta/resourcegraph/storage.go @@ -18,6 +18,7 @@ package resourcegraph import ( "context" + "strings" "kubeops.dev/ui-server/pkg/graph" @@ -40,6 +41,7 @@ var ( _ rest.Scoper = &Storage{} _ rest.Storage = &Storage{} _ rest.Creater = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client) *Storage { @@ -56,6 +58,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rsapi.ResourceKindResourceGraph) +} + func (r *Storage) New() runtime.Object { return &rsapi.ResourceGraph{} } diff --git a/pkg/registry/meta/resourcelayout/storage.go b/pkg/registry/meta/resourcelayout/storage.go index a7d864bff2..fdfd6a0d70 100644 --- a/pkg/registry/meta/resourcelayout/storage.go +++ b/pkg/registry/meta/resourcelayout/storage.go @@ -20,6 +20,7 @@ import ( "context" "fmt" "strconv" + "strings" kerr "k8s.io/apimachinery/pkg/api/errors" metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion" @@ -46,6 +47,7 @@ var ( _ rest.Storage = &Storage{} _ rest.Getter = &Storage{} _ rest.Lister = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client) *Storage { @@ -59,13 +61,17 @@ func NewStorage(kc client.Client) *Storage { } func (r *Storage) GroupVersionKind(_ schema.GroupVersion) schema.GroupVersionKind { - return rsapi.SchemeGroupVersion.WithKind(rsapi.ResourceKindResourceLayout) + return rsapi.SchemeGroupVersion.WithKind(rsapi.ResourceKindResourceOutline) } func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower("ResourceLayout") +} + // Getter func (r *Storage) New() runtime.Object { return &rsapi.ResourceLayout{} diff --git a/pkg/registry/meta/resourceoutline/storage.go b/pkg/registry/meta/resourceoutline/storage.go index 4484d3244d..49f0178bad 100644 --- a/pkg/registry/meta/resourceoutline/storage.go +++ b/pkg/registry/meta/resourceoutline/storage.go @@ -20,6 +20,7 @@ import ( "context" "fmt" "strconv" + "strings" kerr "k8s.io/apimachinery/pkg/api/errors" metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion" @@ -43,6 +44,7 @@ var ( _ rest.Storage = &Storage{} _ rest.Getter = &Storage{} _ rest.Lister = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage() *Storage { @@ -62,6 +64,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rsapi.ResourceKindResourceOutline) +} + // Getter func (r *Storage) New() runtime.Object { return &rsapi.ResourceOutline{} diff --git a/pkg/registry/meta/resourcequery/storage.go b/pkg/registry/meta/resourcequery/storage.go index 70e627ab4e..afdd5f9ccf 100644 --- a/pkg/registry/meta/resourcequery/storage.go +++ b/pkg/registry/meta/resourcequery/storage.go @@ -19,6 +19,7 @@ package resourcequery import ( "context" "fmt" + "strings" "kubeops.dev/ui-server/pkg/graph" @@ -47,6 +48,7 @@ var ( _ rest.Scoper = &Storage{} _ rest.Storage = &Storage{} _ rest.Creater = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client, a authorizer.Authorizer) *Storage { @@ -64,6 +66,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rsapi.ResourceKindResourceQuery) +} + func (r *Storage) New() runtime.Object { return &rsapi.ResourceQuery{} } diff --git a/pkg/registry/meta/resourcetabledefinition/storage.go b/pkg/registry/meta/resourcetabledefinition/storage.go index 63b5b3be66..b8f1ee99ed 100644 --- a/pkg/registry/meta/resourcetabledefinition/storage.go +++ b/pkg/registry/meta/resourcetabledefinition/storage.go @@ -20,6 +20,7 @@ import ( "context" "fmt" "strconv" + "strings" kerr "k8s.io/apimachinery/pkg/api/errors" metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion" @@ -43,6 +44,7 @@ var ( _ rest.Storage = &Storage{} _ rest.Getter = &Storage{} _ rest.Lister = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage() *Storage { @@ -62,6 +64,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rsapi.ResourceKindResourceTableDefinition) +} + // Getter func (r *Storage) New() runtime.Object { return &rsapi.ResourceTableDefinition{} diff --git a/pkg/registry/meta/usermenu/storage.go b/pkg/registry/meta/usermenu/storage.go index f9e29563be..0d5329c2ef 100644 --- a/pkg/registry/meta/usermenu/storage.go +++ b/pkg/registry/meta/usermenu/storage.go @@ -18,6 +18,7 @@ package usermenu import ( "context" + "strings" "kubeops.dev/ui-server/pkg/menu" @@ -48,6 +49,7 @@ var ( _ rest.Getter = &Storage{} _ rest.CreaterUpdater = &Storage{} _ rest.GracefulDeleter = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client, disco discovery.ServerResourcesInterface, ns string) *Storage { @@ -70,6 +72,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rsapi.ResourceKindMenu) +} + func (r *Storage) New() runtime.Object { return &rsapi.Menu{} } diff --git a/pkg/registry/meta/vendormenu/storage.go b/pkg/registry/meta/vendormenu/storage.go index 9587cd3d76..23bfeb945a 100644 --- a/pkg/registry/meta/vendormenu/storage.go +++ b/pkg/registry/meta/vendormenu/storage.go @@ -18,6 +18,7 @@ package vendormenu import ( "context" + "strings" "kubeops.dev/ui-server/pkg/menu" @@ -44,6 +45,7 @@ var ( _ rest.Storage = &Storage{} _ rest.Getter = &Storage{} _ rest.Lister = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client, disco discovery.ServerResourcesInterface) *Storage { @@ -65,6 +67,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(rsapi.ResourceKindMenu) +} + // Getter func (r *Storage) New() runtime.Object { return &rsapi.Menu{} diff --git a/pkg/registry/policy/reports/storage.go b/pkg/registry/policy/reports/storage.go index 2a4c1f90b9..178bf1dfbb 100644 --- a/pkg/registry/policy/reports/storage.go +++ b/pkg/registry/policy/reports/storage.go @@ -49,6 +49,7 @@ var ( _ rest.Scoper = &Storage{} _ rest.Storage = &Storage{} _ rest.Creater = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client) *Storage { @@ -65,6 +66,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(policyapi.ResourceKindPolicyReport) +} + func (r *Storage) New() runtime.Object { return &policyapi.PolicyReport{} } diff --git a/pkg/registry/scanner/image/storage.go b/pkg/registry/scanner/image/storage.go index 5c7a6e804d..8247421a53 100644 --- a/pkg/registry/scanner/image/storage.go +++ b/pkg/registry/scanner/image/storage.go @@ -19,6 +19,7 @@ package image import ( "context" "sort" + "strings" reportsapi "kubeops.dev/scanner/apis/reports/v1alpha1" "kubeops.dev/ui-server/pkg/graph" @@ -44,6 +45,7 @@ var ( _ rest.Scoper = &Storage{} _ rest.Storage = &Storage{} _ rest.Creater = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client) *Storage { @@ -60,6 +62,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(reportsapi.ResourceKindImage) +} + func (r *Storage) New() runtime.Object { return &reportsapi.Image{} } diff --git a/pkg/registry/scanner/reports/storage.go b/pkg/registry/scanner/reports/storage.go index 1de67595bb..2c17d5f734 100644 --- a/pkg/registry/scanner/reports/storage.go +++ b/pkg/registry/scanner/reports/storage.go @@ -19,6 +19,7 @@ package reports import ( "context" "sort" + "strings" reportsapi "kubeops.dev/scanner/apis/reports/v1alpha1" scannerapi "kubeops.dev/scanner/apis/scanner/v1alpha1" @@ -48,6 +49,7 @@ var ( _ rest.Scoper = &Storage{} _ rest.Storage = &Storage{} _ rest.Creater = &Storage{} + _ rest.SingularNameProvider = &Storage{} ) func NewStorage(kc client.Client) *Storage { @@ -64,6 +66,10 @@ func (r *Storage) NamespaceScoped() bool { return false } +func (r *Storage) GetSingularName() string { + return strings.ToLower(reportsapi.ResourceKindCVEReport) +} + func (r *Storage) New() runtime.Object { return &reportsapi.CVEReport{} }