From f13d0425c4a2abd2861a8556db5948844da9f248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Petrov?= Date: Fri, 26 Jan 2024 14:47:42 +0100 Subject: [PATCH] naming --- .../dinosaur/pkg/handlers/admin_dinosaur.go | 18 +++++++++--------- internal/dinosaur/pkg/routes/route_loader.go | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/dinosaur/pkg/handlers/admin_dinosaur.go b/internal/dinosaur/pkg/handlers/admin_dinosaur.go index 501fb40238..519e4cd91c 100644 --- a/internal/dinosaur/pkg/handlers/admin_dinosaur.go +++ b/internal/dinosaur/pkg/handlers/admin_dinosaur.go @@ -50,12 +50,12 @@ type AdminCentralHandler interface { // a tenant. In particular, avoid two Central CRs appearing in the same // tenant namespace. This may cause conflicts due to mixed resource ownership. PatchName(w http.ResponseWriter, r *http.Request) - // GetCentralTrait tells wheter a central has the trait - GetCentralTrait(w http.ResponseWriter, r *http.Request) - // GetCentralTraits returns all central traits - GetCentralTraits(w http.ResponseWriter, r *http.Request) - // PatchCentralTrait adds a trait to a central - PatchCentralTrait(w http.ResponseWriter, r *http.Request) + // ListTraits returns all central traits + ListTraits(w http.ResponseWriter, r *http.Request) + // GetTrait tells wheter a central has the trait + GetTrait(w http.ResponseWriter, r *http.Request) + // PatchTraits adds a trait to the set of central traits + PatchTraits(w http.ResponseWriter, r *http.Request) // DeleteTrait deletes a trait from a central DeleteTrait(w http.ResponseWriter, r *http.Request) } @@ -313,7 +313,7 @@ func (h adminCentralHandler) PatchName(w http.ResponseWriter, r *http.Request) { handlers.Handle(w, r, cfg, http.StatusOK) } -func (h adminCentralHandler) GetCentralTraits(w http.ResponseWriter, r *http.Request) { +func (h adminCentralHandler) ListTraits(w http.ResponseWriter, r *http.Request) { cfg := &handlers.HandlerConfig{ Action: func() (i interface{}, serviceError *errors.ServiceError) { id := mux.Vars(r)["id"] @@ -330,7 +330,7 @@ func (h adminCentralHandler) GetCentralTraits(w http.ResponseWriter, r *http.Req handlers.HandleGet(w, r, cfg) } -func (h adminCentralHandler) GetCentralTrait(w http.ResponseWriter, r *http.Request) { +func (h adminCentralHandler) GetTrait(w http.ResponseWriter, r *http.Request) { cfg := &handlers.HandlerConfig{ Action: func() (i interface{}, serviceError *errors.ServiceError) { id := mux.Vars(r)["id"] @@ -348,7 +348,7 @@ func (h adminCentralHandler) GetCentralTrait(w http.ResponseWriter, r *http.Requ handlers.HandleGet(w, r, cfg) } -func (h adminCentralHandler) PatchCentralTrait(w http.ResponseWriter, r *http.Request) { +func (h adminCentralHandler) PatchTraits(w http.ResponseWriter, r *http.Request) { cfg := &handlers.HandlerConfig{ Action: func() (i interface{}, serviceError *errors.ServiceError) { id := mux.Vars(r)["id"] diff --git a/internal/dinosaur/pkg/routes/route_loader.go b/internal/dinosaur/pkg/routes/route_loader.go index b3f87a25ab..2baa286fc3 100644 --- a/internal/dinosaur/pkg/routes/route_loader.go +++ b/internal/dinosaur/pkg/routes/route_loader.go @@ -262,13 +262,13 @@ func (s *options) buildAPIBaseRouter(mainRouter *mux.Router, basePath string, op Name(logger.NewLogEvent("admin-name", "[admin] set `name` central property").ToString()). Methods(http.MethodPatch) - adminCentralsRouter.HandleFunc("/{id}/traits", adminCentralHandler.GetCentralTraits). + adminCentralsRouter.HandleFunc("/{id}/traits", adminCentralHandler.ListTraits). Name(logger.NewLogEvent("admin-get-traits", "[admin] get central traits").ToString()). Methods(http.MethodGet) - adminCentralsRouter.HandleFunc("/{id}/traits/{trait}", adminCentralHandler.GetCentralTrait). + adminCentralsRouter.HandleFunc("/{id}/traits/{trait}", adminCentralHandler.GetTrait). Name(logger.NewLogEvent("admin-get-trait", "[admin] check existence of a central trait").ToString()). Methods(http.MethodGet) - adminCentralsRouter.HandleFunc("/{id}/traits/{trait}", adminCentralHandler.PatchCentralTrait). + adminCentralsRouter.HandleFunc("/{id}/traits/{trait}", adminCentralHandler.PatchTraits). Name(logger.NewLogEvent("admin-patch-traits", "[admin] set central trait").ToString()). Methods(http.MethodPatch) adminCentralsRouter.HandleFunc("/{id}/traits/{trait}", adminCentralHandler.DeleteTrait).