func (s *httpServer) v1Router(w http.ResponseWriter, req *http.Request) error { switch req.URL.Path { case "/ping": s.pingHandler(w, req) case "/lookup": util.NegotiateAPIResponseWrapper(w, req, func() (interface{}, error) { return s.doLookup(req) }) case "/topics": util.NegotiateAPIResponseWrapper(w, req, func() (interface{}, error) { return s.doTopics(req) }) case "/channels": util.NegotiateAPIResponseWrapper(w, req, func() (interface{}, error) { return s.doChannels(req) }) case "/nodes": util.NegotiateAPIResponseWrapper(w, req, func() (interface{}, error) { return s.doNodes(req) }) case "/topic/create": util.V1APIResponseWrapper(w, req, util.POSTRequired(req, func() (interface{}, error) { return s.doCreateTopic(req) })) case "/topic/delete": util.V1APIResponseWrapper(w, req, util.POSTRequired(req, func() (interface{}, error) { return s.doDeleteTopic(req) })) case "/topic/tombstone": util.V1APIResponseWrapper(w, req, util.POSTRequired(req, func() (interface{}, error) { return s.doTombstoneTopicProducer(req) })) case "/channel/create": util.V1APIResponseWrapper(w, req, util.POSTRequired(req, func() (interface{}, error) { return s.doCreateChannel(req) })) case "/channel/delete": util.V1APIResponseWrapper(w, req, util.POSTRequired(req, func() (interface{}, error) { return s.doDeleteChannel(req) })) default: return errors.New(fmt.Sprintf("404 %s", req.URL.Path)) } return nil }
func (s *httpServer) v1Router(w http.ResponseWriter, req *http.Request) error { switch req.URL.Path { case "/pub": util.NegotiateAPIResponseWrapper(w, req, util.POSTRequired(req, func() (interface{}, error) { return s.doPUB(req) })) case "/mpub": util.NegotiateAPIResponseWrapper(w, req, util.POSTRequired(req, func() (interface{}, error) { return s.doMPUB(req) })) case "/stats": util.NegotiateAPIResponseWrapper(w, req, func() (interface{}, error) { return s.doStats(req) }) case "/ping": s.pingHandler(w, req) case "/topic/create": util.V1APIResponseWrapper(w, req, util.POSTRequired(req, func() (interface{}, error) { return s.doCreateTopic(req) })) case "/topic/delete": util.V1APIResponseWrapper(w, req, util.POSTRequired(req, func() (interface{}, error) { return s.doDeleteTopic(req) })) case "/topic/empty": util.V1APIResponseWrapper(w, req, util.POSTRequired(req, func() (interface{}, error) { return s.doEmptyTopic(req) })) case "/topic/pause": fallthrough case "/topic/unpause": util.V1APIResponseWrapper(w, req, util.POSTRequired(req, func() (interface{}, error) { return s.doPauseTopic(req) })) case "/channel/create": util.V1APIResponseWrapper(w, req, util.POSTRequired(req, func() (interface{}, error) { return s.doCreateChannel(req) })) case "/channel/delete": util.V1APIResponseWrapper(w, req, util.POSTRequired(req, func() (interface{}, error) { return s.doDeleteChannel(req) })) case "/channel/empty": util.V1APIResponseWrapper(w, req, util.POSTRequired(req, func() (interface{}, error) { return s.doEmptyChannel(req) })) case "/channel/pause": fallthrough case "/channel/unpause": util.V1APIResponseWrapper(w, req, util.POSTRequired(req, func() (interface{}, error) { return s.doPauseChannel(req) })) default: return errors.New(fmt.Sprintf("404 %s", req.URL.Path)) } return nil }