SetupControlAPIHandlers registers control API handlers.
(m *mux.Router)
| 176 | |
| 177 | // SetupControlAPIHandlers registers control API handlers. |
| 178 | func (s *Server) SetupControlAPIHandlers(m *mux.Router) { |
| 179 | // server control API, requires authentication as `server-control` and no CSRF token. |
| 180 | m.HandleFunc("/api/v1/control/sources", s.handleServerControlAPI(handleSourcesList)).Methods(http.MethodGet) |
| 181 | m.HandleFunc("/api/v1/control/status", s.handleServerControlAPIPossiblyNotConnected(handleRepoStatus)).Methods(http.MethodGet) |
| 182 | m.HandleFunc("/api/v1/control/flush", s.handleServerControlAPI(handleFlush)).Methods(http.MethodPost) |
| 183 | m.HandleFunc("/api/v1/control/refresh", s.handleServerControlAPI(handleRefresh)).Methods(http.MethodPost) |
| 184 | m.HandleFunc("/api/v1/control/shutdown", s.handleServerControlAPIPossiblyNotConnected(handleShutdown)).Methods(http.MethodPost) |
| 185 | m.HandleFunc("/api/v1/control/trigger-snapshot", s.handleServerControlAPI(handleUpload)).Methods(http.MethodPost) |
| 186 | m.HandleFunc("/api/v1/control/cancel-snapshot", s.handleServerControlAPI(handleCancel)).Methods(http.MethodPost) |
| 187 | m.HandleFunc("/api/v1/control/pause-source", s.handleServerControlAPI(handlePause)).Methods(http.MethodPost) |
| 188 | m.HandleFunc("/api/v1/control/resume-source", s.handleServerControlAPI(handleResume)).Methods(http.MethodPost) |
| 189 | m.HandleFunc("/api/v1/control/throttle", s.handleServerControlAPI(handleRepoGetThrottle)).Methods(http.MethodGet) |
| 190 | m.HandleFunc("/api/v1/control/throttle", s.handleServerControlAPI(handleRepoSetThrottle)).Methods(http.MethodPut) |
| 191 | } |
| 192 | |
| 193 | func (s *Server) rootContext() context.Context { |
| 194 | return s.rootctx |
no test coverage detected