MCPcopy Index your code
hub / github.com/kopia/kopia / SetupControlAPIHandlers

Method SetupControlAPIHandlers

internal/server/server.go:178–191  ·  view source on GitHub ↗

SetupControlAPIHandlers registers control API handlers.

(m *mux.Router)

Source from the content-addressed store, hash-verified

176
177// SetupControlAPIHandlers registers control API handlers.
178func (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
193func (s *Server) rootContext() context.Context {
194 return s.rootctx

Callers 2

setupHandlersMethod · 0.80
StartServerContextFunction · 0.80

Tested by

no test coverage detected