소스 검색

fix(server): add user facing remove API

This was accidently removed as we refactored the standy stuff. Re-add this
user facing remove endpoint that matches the config endpoints.
Brandon Philips 11 년 전
부모
커밋
62560f9959
2개의 변경된 파일23개의 추가작업 그리고 0개의 파일을 삭제
  1. 22 0
      Documentation/api.md
  2. 1 0
      server/peer_server.go

+ 22 - 0
Documentation/api.md

@@ -1233,3 +1233,25 @@ curl -L http://127.0.0.1:7001/v2/admin/config
     "promoteDelay": 1800
 }
 ```
+
+## Remove Machines
+
+At times you may want to manually remove a machine. Using the machines endpoint
+you can find and remove machines.
+
+```sh
+curl -L http://127.0.0.1:7001/v2/admin/machines/peer2
+```
+
+```json
+{
+    "clientURL": "http://127.0.0.1:4002",
+    "name": "peer2",
+    "peerURL": "http://127.0.0.1:7002",
+    "state": "follower"
+}
+```
+
+```sh
+curl -L -XDELETE http://127.0.0.1:7001/v2/admin/machines/peer2
+```

+ 1 - 0
server/peer_server.go

@@ -355,6 +355,7 @@ func (s *PeerServer) HTTPHandler() http.Handler {
 	router.HandleFunc("/v2/admin/config", s.setClusterConfigHttpHandler).Methods("PUT")
 	router.HandleFunc("/v2/admin/machines", s.getMachinesHttpHandler).Methods("GET")
 	router.HandleFunc("/v2/admin/machines/{name}", s.getMachineHttpHandler).Methods("GET")
+	router.HandleFunc("/v2/admin/machines/{name}", s.RemoveHttpHandler).Methods("DELETE")
 
 	return router
 }