open-nomad/command/agent/http_oss.go

45 lines
1.3 KiB
Go
Raw Normal View History

2020-02-18 15:29:28 +00:00
// +build !ent
2017-09-07 23:56:15 +00:00
package agent
2020-03-27 13:01:54 +00:00
import (
"net/http"
)
2017-09-19 14:47:10 +00:00
2017-09-07 23:56:15 +00:00
// registerEnterpriseHandlers is a no-op for the oss release
2017-09-19 14:47:10 +00:00
func (s *HTTPServer) registerEnterpriseHandlers() {
s.mux.HandleFunc("/v1/sentinel/policies", s.wrap(s.entOnly))
s.mux.HandleFunc("/v1/sentinel/policy/", s.wrap(s.entOnly))
2017-10-13 21:36:02 +00:00
s.mux.HandleFunc("/v1/quotas", s.wrap(s.entOnly))
s.mux.HandleFunc("/v1/quota-usages", s.wrap(s.entOnly))
s.mux.HandleFunc("/v1/quota/", s.wrap(s.entOnly))
s.mux.HandleFunc("/v1/quota", s.wrap(s.entOnly))
s.mux.HandleFunc("/v1/operator/license", s.wrap(s.entOnly))
s.mux.HandleFunc("/v1/recommendation", s.wrap(s.entOnly))
s.mux.HandleFunc("/v1/recommendations", s.wrap(s.entOnly))
s.mux.HandleFunc("/v1/recommendations/apply", s.wrap(s.entOnly))
s.mux.HandleFunc("/v1/recommendation/", s.wrap(s.entOnly))
2017-09-19 14:47:10 +00:00
}
func (s *HTTPServer) entOnly(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
return nil, CodedError(501, ErrEntOnly)
}
2020-03-27 13:01:54 +00:00
// auditHandler wraps the passed handlerFn
func (s *HTTPServer) auditHandler(h handlerFn) handlerFn {
return h
}
2020-03-27 13:01:54 +00:00
// auditHTTPHandler wraps the passed handlerByteFn
func (s *HTTPServer) auditNonJSONHandler(h handlerByteFn) handlerByteFn {
return h
}
2020-03-27 13:01:54 +00:00
// auditHTTPHandler wraps the passed http.Handler
func (s *HTTPServer) auditHTTPHandler(h http.Handler) http.Handler {
return h
}