diff --git a/internal/services/configstore/action/org.go b/internal/services/configstore/action/org.go index 421b7aa..03bfe12 100644 --- a/internal/services/configstore/action/org.go +++ b/internal/services/configstore/action/org.go @@ -269,8 +269,8 @@ func (h *ActionHandler) AddOrgMember(ctx context.Context, orgRef, userRef string return orgmember, err } -// DeleteOrgMember deletes an org member. -func (h *ActionHandler) DeleteOrgMember(ctx context.Context, orgRef, userRef string) error { +// RemoveOrgMember removes an org member. +func (h *ActionHandler) RemoveOrgMember(ctx context.Context, orgRef, userRef string) error { var org *types.Organization var user *types.User var orgmember *types.OrganizationMember diff --git a/internal/services/configstore/api/client.go b/internal/services/configstore/api/client.go index beb6758..7cc0c2b 100644 --- a/internal/services/configstore/api/client.go +++ b/internal/services/configstore/api/client.go @@ -478,7 +478,7 @@ func (c *Client) AddOrgMember(ctx context.Context, orgRef, userRef string, role return orgmember, resp, err } -func (c *Client) DeleteOrgMember(ctx context.Context, orgRef, userRef string) (*http.Response, error) { +func (c *Client) RemoveOrgMember(ctx context.Context, orgRef, userRef string) (*http.Response, error) { return c.getResponse(ctx, "DELETE", fmt.Sprintf("/orgs/%s/members/%s", orgRef, userRef), nil, jsonContent, nil) } diff --git a/internal/services/configstore/api/org.go b/internal/services/configstore/api/org.go index e50f34d..0170a91 100644 --- a/internal/services/configstore/api/org.go +++ b/internal/services/configstore/api/org.go @@ -217,23 +217,23 @@ func (h *AddOrgMemberHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) } } -type DeleteOrgMemberHandler struct { +type RemoveOrgMemberHandler struct { log *zap.SugaredLogger ah *action.ActionHandler } -func NewDeleteOrgMemberHandler(logger *zap.Logger, ah *action.ActionHandler) *DeleteOrgMemberHandler { - return &DeleteOrgMemberHandler{log: logger.Sugar(), ah: ah} +func NewRemoveOrgMemberHandler(logger *zap.Logger, ah *action.ActionHandler) *RemoveOrgMemberHandler { + return &RemoveOrgMemberHandler{log: logger.Sugar(), ah: ah} } -func (h *DeleteOrgMemberHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { +func (h *RemoveOrgMemberHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { ctx := r.Context() vars := mux.Vars(r) orgRef := vars["orgref"] userRef := vars["userref"] - err := h.ah.DeleteOrgMember(ctx, orgRef, userRef) + err := h.ah.RemoveOrgMember(ctx, orgRef, userRef) if httpError(w, err) { h.log.Errorf("err: %+v", err) return diff --git a/internal/services/configstore/configstore.go b/internal/services/configstore/configstore.go index e8ed492..c46fdf7 100644 --- a/internal/services/configstore/configstore.go +++ b/internal/services/configstore/configstore.go @@ -165,7 +165,7 @@ func (s *Configstore) Run(ctx context.Context) error { deleteOrgHandler := api.NewDeleteOrgHandler(logger, s.ah) addOrgMemberHandler := api.NewAddOrgMemberHandler(logger, s.ah) - deleteOrgMemberHandler := api.NewDeleteOrgMemberHandler(logger, s.ah) + removeOrgMemberHandler := api.NewRemoveOrgMemberHandler(logger, s.ah) remoteSourceHandler := api.NewRemoteSourceHandler(logger, s.readDB) remoteSourcesHandler := api.NewRemoteSourcesHandler(logger, s.readDB) @@ -219,7 +219,7 @@ func (s *Configstore) Run(ctx context.Context) error { apirouter.Handle("/orgs", createOrgHandler).Methods("POST") apirouter.Handle("/orgs/{orgref}", deleteOrgHandler).Methods("DELETE") apirouter.Handle("/orgs/{orgref}/members/{userref}", addOrgMemberHandler).Methods("PUT") - apirouter.Handle("/orgs/{orgref}/members/{userref}", deleteOrgMemberHandler).Methods("DELETE") + apirouter.Handle("/orgs/{orgref}/members/{userref}", removeOrgMemberHandler).Methods("DELETE") apirouter.Handle("/remotesources/{remotesourceref}", remoteSourceHandler).Methods("GET") apirouter.Handle("/remotesources", remoteSourcesHandler).Methods("GET") diff --git a/internal/services/gateway/action/org.go b/internal/services/gateway/action/org.go index f48c8f4..7c540ca 100644 --- a/internal/services/gateway/action/org.go +++ b/internal/services/gateway/action/org.go @@ -139,7 +139,7 @@ func (h *ActionHandler) AddOrgMember(ctx context.Context, orgRef, userRef string }, nil } -func (h *ActionHandler) DeleteOrgMember(ctx context.Context, orgRef, userRef string) error { +func (h *ActionHandler) RemoveOrgMember(ctx context.Context, orgRef, userRef string) error { org, resp, err := h.configstoreClient.GetOrg(ctx, orgRef) if err != nil { return ErrFromRemote(resp, err) @@ -153,9 +153,9 @@ func (h *ActionHandler) DeleteOrgMember(ctx context.Context, orgRef, userRef str return util.NewErrForbidden(errors.Errorf("user not authorized")) } - resp, err = h.configstoreClient.DeleteOrgMember(ctx, orgRef, userRef) + resp, err = h.configstoreClient.RemoveOrgMember(ctx, orgRef, userRef) if err != nil { - return ErrFromRemote(resp, errors.Wrapf(err, "failed to add/update organization member")) + return ErrFromRemote(resp, errors.Wrapf(err, "failed to remove organization member")) } return nil diff --git a/internal/services/gateway/api/org.go b/internal/services/gateway/api/org.go index 61498c4..89777a3 100644 --- a/internal/services/gateway/api/org.go +++ b/internal/services/gateway/api/org.go @@ -253,23 +253,23 @@ func (h *AddOrgMemberHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) } } -type DeleteOrgMemberHandler struct { +type RemoveOrgMemberHandler struct { log *zap.SugaredLogger ah *action.ActionHandler } -func NewDeleteOrgMemberHandler(logger *zap.Logger, ah *action.ActionHandler) *DeleteOrgMemberHandler { - return &DeleteOrgMemberHandler{log: logger.Sugar(), ah: ah} +func NewRemoveOrgMemberHandler(logger *zap.Logger, ah *action.ActionHandler) *RemoveOrgMemberHandler { + return &RemoveOrgMemberHandler{log: logger.Sugar(), ah: ah} } -func (h *DeleteOrgMemberHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { +func (h *RemoveOrgMemberHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { ctx := r.Context() vars := mux.Vars(r) orgRef := vars["orgref"] userRef := vars["userref"] - err := h.ah.DeleteOrgMember(ctx, orgRef, userRef) + err := h.ah.RemoveOrgMember(ctx, orgRef, userRef) if httpError(w, err) { h.log.Errorf("err: %+v", err) return diff --git a/internal/services/gateway/gateway.go b/internal/services/gateway/gateway.go index 98f234b..eccaa3a 100644 --- a/internal/services/gateway/gateway.go +++ b/internal/services/gateway/gateway.go @@ -192,7 +192,7 @@ func (g *Gateway) Run(ctx context.Context) error { deleteOrgHandler := api.NewDeleteOrgHandler(logger, g.ah) addOrgMemberHandler := api.NewAddOrgMemberHandler(logger, g.ah) - deleteOrgMemberHandler := api.NewDeleteOrgMemberHandler(logger, g.ah) + removeOrgMemberHandler := api.NewRemoveOrgMemberHandler(logger, g.ah) runHandler := api.NewRunHandler(logger, g.ah) runsHandler := api.NewRunsHandler(logger, g.ah) @@ -273,7 +273,7 @@ func (g *Gateway) Run(ctx context.Context) error { apirouter.Handle("/orgs", authForcedHandler(createOrgHandler)).Methods("POST") apirouter.Handle("/orgs/{orgref}", authForcedHandler(deleteOrgHandler)).Methods("DELETE") apirouter.Handle("/orgs/{orgref}/members/{userref}", authForcedHandler(addOrgMemberHandler)).Methods("PUT") - apirouter.Handle("/orgs/{orgref}/members/{userref}", authForcedHandler(deleteOrgMemberHandler)).Methods("DELETE") + apirouter.Handle("/orgs/{orgref}/members/{userref}", authForcedHandler(removeOrgMemberHandler)).Methods("DELETE") apirouter.Handle("/runs/{runid}", authForcedHandler(runHandler)).Methods("GET") apirouter.Handle("/runs/{runid}/actions", authForcedHandler(runActionsHandler)).Methods("PUT")