agent: Rename acl delete to destroy

pull/291/head
Armon Dadgar 2014-08-18 12:05:01 -07:00
parent 34e018e471
commit 343f69504b
3 changed files with 7 additions and 7 deletions

View File

@ -19,7 +19,7 @@ func aclDisabled(resp http.ResponseWriter, req *http.Request) (interface{}, erro
return nil, nil return nil, nil
} }
func (s *HTTPServer) ACLDelete(resp http.ResponseWriter, req *http.Request) (interface{}, error) { func (s *HTTPServer) ACLDestroy(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
args := structs.ACLRequest{ args := structs.ACLRequest{
Datacenter: s.agent.config.ACLDatacenter, Datacenter: s.agent.config.ACLDatacenter,
Op: structs.ACLDelete, Op: structs.ACLDelete,
@ -27,7 +27,7 @@ func (s *HTTPServer) ACLDelete(resp http.ResponseWriter, req *http.Request) (int
s.parseToken(req, &args.Token) s.parseToken(req, &args.Token)
// Pull out the acl id // Pull out the acl id
args.ACL.ID = strings.TrimPrefix(req.URL.Path, "/v1/acl/delete/") args.ACL.ID = strings.TrimPrefix(req.URL.Path, "/v1/acl/destroy/")
if args.ACL.ID == "" { if args.ACL.ID == "" {
resp.WriteHeader(400) resp.WriteHeader(400)
resp.Write([]byte("Missing ACL")) resp.Write([]byte("Missing ACL"))

View File

@ -62,12 +62,12 @@ func TestACLUpdate(t *testing.T) {
}) })
} }
func TestACLDelete(t *testing.T) { func TestACLDestroy(t *testing.T) {
httpTest(t, func(srv *HTTPServer) { httpTest(t, func(srv *HTTPServer) {
id := makeTestACL(t, srv) id := makeTestACL(t, srv)
req, err := http.NewRequest("PUT", "/v1/session/delete/"+id, nil) req, err := http.NewRequest("PUT", "/v1/session/destroy/"+id, nil)
resp := httptest.NewRecorder() resp := httptest.NewRecorder()
obj, err := srv.ACLDelete(resp, req) obj, err := srv.ACLDestroy(resp, req)
if err != nil { if err != nil {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
} }

View File

@ -102,14 +102,14 @@ func (s *HTTPServer) registerHandlers(enableDebug bool) {
if s.agent.config.ACLDatacenter != "" { if s.agent.config.ACLDatacenter != "" {
s.mux.HandleFunc("/v1/acl/create", s.wrap(s.ACLCreate)) s.mux.HandleFunc("/v1/acl/create", s.wrap(s.ACLCreate))
s.mux.HandleFunc("/v1/acl/update", s.wrap(s.ACLUpdate)) s.mux.HandleFunc("/v1/acl/update", s.wrap(s.ACLUpdate))
s.mux.HandleFunc("/v1/acl/delete/", s.wrap(s.ACLDelete)) s.mux.HandleFunc("/v1/acl/destroy/", s.wrap(s.ACLDestroy))
s.mux.HandleFunc("/v1/acl/info/", s.wrap(s.ACLGet)) s.mux.HandleFunc("/v1/acl/info/", s.wrap(s.ACLGet))
s.mux.HandleFunc("/v1/acl/clone/", s.wrap(s.ACLClone)) s.mux.HandleFunc("/v1/acl/clone/", s.wrap(s.ACLClone))
s.mux.HandleFunc("/v1/acl/list", s.wrap(s.ACLList)) s.mux.HandleFunc("/v1/acl/list", s.wrap(s.ACLList))
} else { } else {
s.mux.HandleFunc("/v1/acl/create", s.wrap(aclDisabled)) s.mux.HandleFunc("/v1/acl/create", s.wrap(aclDisabled))
s.mux.HandleFunc("/v1/acl/update", s.wrap(aclDisabled)) s.mux.HandleFunc("/v1/acl/update", s.wrap(aclDisabled))
s.mux.HandleFunc("/v1/acl/delete/", s.wrap(aclDisabled)) s.mux.HandleFunc("/v1/acl/destroy/", s.wrap(aclDisabled))
s.mux.HandleFunc("/v1/acl/info/", s.wrap(aclDisabled)) s.mux.HandleFunc("/v1/acl/info/", s.wrap(aclDisabled))
s.mux.HandleFunc("/v1/acl/clone/", s.wrap(aclDisabled)) s.mux.HandleFunc("/v1/acl/clone/", s.wrap(aclDisabled))
s.mux.HandleFunc("/v1/acl/list", s.wrap(aclDisabled)) s.mux.HandleFunc("/v1/acl/list", s.wrap(aclDisabled))