From 959ea3d5ec406cacbfcb6878d03ffbe28bdc0c14 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Thu, 30 Jan 2014 14:58:36 -0800 Subject: [PATCH] agent: Skeleton for HTTP based service/check registration --- command/agent/agent_endpoint.go | 28 ++++++++++++++++++++++++++++ command/agent/http.go | 9 +++++++++ command/agent/http_api.md | 15 +++++++-------- 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/command/agent/agent_endpoint.go b/command/agent/agent_endpoint.go index 06f9d359a9..fdac0fadfa 100644 --- a/command/agent/agent_endpoint.go +++ b/command/agent/agent_endpoint.go @@ -50,3 +50,31 @@ func (s *HTTPServer) AgentForceLeave(resp http.ResponseWriter, req *http.Request addr := strings.TrimPrefix(req.URL.Path, "/v1/agent/force-leave/") return s.agent.ForceLeave(addr), nil } + +func (s *HTTPServer) AgentRegisterCheck(resp http.ResponseWriter, req *http.Request) (interface{}, error) { + return nil, nil +} + +func (s *HTTPServer) AgentDeregisterCheck(resp http.ResponseWriter, req *http.Request) (interface{}, error) { + return nil, nil +} + +func (s *HTTPServer) AgentCheckPass(resp http.ResponseWriter, req *http.Request) (interface{}, error) { + return nil, nil +} + +func (s *HTTPServer) AgentCheckWarn(resp http.ResponseWriter, req *http.Request) (interface{}, error) { + return nil, nil +} + +func (s *HTTPServer) AgentCheckFail(resp http.ResponseWriter, req *http.Request) (interface{}, error) { + return nil, nil +} + +func (s *HTTPServer) AgentRegisterService(resp http.ResponseWriter, req *http.Request) (interface{}, error) { + return nil, nil +} + +func (s *HTTPServer) AgentDeregisterService(resp http.ResponseWriter, req *http.Request) (interface{}, error) { + return nil, nil +} diff --git a/command/agent/http.go b/command/agent/http.go index 415fbffeaa..afc4829682 100644 --- a/command/agent/http.go +++ b/command/agent/http.go @@ -75,6 +75,15 @@ func (s *HTTPServer) registerHandlers() { s.mux.HandleFunc("/v1/agent/members", s.wrap(s.AgentMembers)) s.mux.HandleFunc("/v1/agent/join/", s.wrap(s.AgentJoin)) s.mux.HandleFunc("/v1/agent/force-leave/", s.wrap(s.AgentForceLeave)) + + s.mux.HandleFunc("/v1/agent/check/register", s.wrap(s.AgentRegisterCheck)) + s.mux.HandleFunc("/v1/agent/check/deregister", s.wrap(s.AgentDeregisterCheck)) + s.mux.HandleFunc("/v1/agent/check/pass/", s.wrap(s.AgentCheckPass)) + s.mux.HandleFunc("/v1/agent/check/warn/", s.wrap(s.AgentCheckWarn)) + s.mux.HandleFunc("/v1/agent/check/fail/", s.wrap(s.AgentCheckFail)) + + s.mux.HandleFunc("/v1/agent/service/register", s.wrap(s.AgentRegisterService)) + s.mux.HandleFunc("/v1/agent/service/deregister", s.wrap(s.AgentDeregisterService)) } // wrap is used to wrap functions to make them more convenient diff --git a/command/agent/http_api.md b/command/agent/http_api.md index 73f66fbe7f..1ac2f5ae33 100644 --- a/command/agent/http_api.md +++ b/command/agent/http_api.md @@ -30,11 +30,10 @@ The current URLs supported are: * /v1/agent/members : Returns the members as seen by the local serf agent * /v1/agent/join/ : Instructs the local agent to join a node * /v1/agent/force-leave/: Instructs the agent to force a node into the left state - -## Future (interacts with local state?) -* /v1/health/register : Registers a new health check -* /v1/health/deregister : Deregisters a health check -* /v1/health/pass: Pass a health check -* /v1/health/warn: Warn on a health check -* /v1/health/fail: Fail a health check - +* /v1/agent/check/register +* /v1/agent/check/deregister/ +* /v1/agent/check/pass/ +* /v1/agent/check/warn/ +* /v1/agent/check/fail/ +* /v1/agent/service/register +* /v1/agent/service/deregister/