Skip to content

Commit

Permalink
naming
Browse files Browse the repository at this point in the history
  • Loading branch information
parametalol committed Jan 26, 2024
1 parent ef30a4d commit f13d042
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions internal/dinosaur/pkg/handlers/admin_dinosaur.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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"]
Expand All @@ -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"]
Expand All @@ -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"]
Expand Down
6 changes: 3 additions & 3 deletions internal/dinosaur/pkg/routes/route_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit f13d042

Please sign in to comment.