From 4db7b7e356838c63381c7b6a7236a9c8425277d8 Mon Sep 17 00:00:00 2001 From: deviantony Date: Sat, 9 Nov 2024 18:26:45 +0000 Subject: [PATCH] feat: introduce shortnames for all resources --- internal/api/apis/apps/apps.go | 1 + internal/api/apis/batch/batch.go | 1 + internal/api/apis/storage.k8s.io/storage.go | 2 +- internal/api/core/v1/v1.go | 4 ++++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/api/apis/apps/apps.go b/internal/api/apis/apps/apps.go index 613096c..cae4827 100644 --- a/internal/api/apis/apps/apps.go +++ b/internal/api/apis/apps/apps.go @@ -43,6 +43,7 @@ func (svc AppsService) ListAPIResources(r *restful.Request, w *restful.Response) Name: "deployments", Verbs: []string{"create", "list", "delete", "get", "patch"}, Namespaced: true, + ShortNames: []string{"deploy"}, }, }, } diff --git a/internal/api/apis/batch/batch.go b/internal/api/apis/batch/batch.go index df77131..e520a64 100644 --- a/internal/api/apis/batch/batch.go +++ b/internal/api/apis/batch/batch.go @@ -43,6 +43,7 @@ func (svc BatchService) ListAPIResources(r *restful.Request, w *restful.Response Name: "jobs", Verbs: []string{"create", "list", "delete", "get", "patch"}, Namespaced: true, + ShortNames: []string{"job"}, }, }, } diff --git a/internal/api/apis/storage.k8s.io/storage.go b/internal/api/apis/storage.k8s.io/storage.go index 9dd1204..3fbac5f 100644 --- a/internal/api/apis/storage.k8s.io/storage.go +++ b/internal/api/apis/storage.k8s.io/storage.go @@ -40,9 +40,9 @@ func (svc StorageService) ListAPIResources(r *restful.Request, w *restful.Respon Kind: "StorageClass", SingularName: "", Name: "storageclasses", - ShortNames: []string{"sc"}, Verbs: []string{"list", "get"}, Namespaced: false, + ShortNames: []string{"sc"}, }, }, } diff --git a/internal/api/core/v1/v1.go b/internal/api/core/v1/v1.go index f07342f..3cccde8 100644 --- a/internal/api/core/v1/v1.go +++ b/internal/api/core/v1/v1.go @@ -75,6 +75,7 @@ func (svc V1Service) ListAPIResources(r *restful.Request, w *restful.Response) { Name: "events", Verbs: []string{"list"}, Namespaced: false, + ShortNames: []string{"ev"}, }, { Kind: "Namespace", @@ -90,6 +91,7 @@ func (svc V1Service) ListAPIResources(r *restful.Request, w *restful.Response) { Name: "nodes", Verbs: []string{"list", "get"}, Namespaced: false, + ShortNames: []string{"no"}, }, { Kind: "PersistentVolume", @@ -113,6 +115,7 @@ func (svc V1Service) ListAPIResources(r *restful.Request, w *restful.Response) { Name: "pods", Verbs: []string{"create", "list", "delete", "get", "patch"}, Namespaced: true, + ShortNames: []string{"po"}, }, { Kind: "Secret", @@ -120,6 +123,7 @@ func (svc V1Service) ListAPIResources(r *restful.Request, w *restful.Response) { Name: "secrets", Verbs: []string{"create", "list", "delete", "get", "patch"}, Namespaced: true, + ShortNames: []string{"sec"}, }, { Kind: "Service",