Extract RESTHandler and allow API groupings

Prepare for running multiple API versions on the same HTTP server
by decoupling some of the mechanics of apiserver.  Define a new
APIGroup object which represents a version of the API.
This commit is contained in:
Clayton Coleman
2014-08-09 17:12:55 -04:00
parent aeea1b1e06
commit bbf3b55e76
10 changed files with 340 additions and 290 deletions

View File

@@ -20,6 +20,11 @@ import (
"net/http"
)
// mux is an interface describing the methods InstallHandler requires.
type mux interface {
HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
}
func init() {
http.HandleFunc("/healthz", handleHealthz)
}
@@ -31,6 +36,6 @@ func handleHealthz(w http.ResponseWriter, r *http.Request) {
}
// InstallHandler registers a handler for health checking on the path "/healthz" to mux.
func InstallHandler(mux *http.ServeMux) {
func InstallHandler(mux mux) {
mux.HandleFunc("/healthz", handleHealthz)
}