agent: Skeleton for HTTP based service/check registration

This commit is contained in:
Armon Dadgar 2014-01-30 14:58:36 -08:00
parent d051d9cb23
commit f3e30eb932
3 changed files with 44 additions and 8 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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/<node> : Instructs the local agent to join a node
* /v1/agent/force-leave/<node>: 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/<name>
* /v1/agent/check/pass/<name>
* /v1/agent/check/warn/<name>
* /v1/agent/check/fail/<name>
* /v1/agent/service/register
* /v1/agent/service/deregister/<name>