REST API: add events search

This commit is contained in:
Nicola Murino
2021-10-23 15:47:21 +02:00
parent 97d0a48557
commit 74fc3aaf37
25 changed files with 1708 additions and 55 deletions

View File

@@ -8,7 +8,6 @@ import (
"fmt"
"net"
"net/http"
"net/url"
"path"
"path/filepath"
"runtime"
@@ -77,6 +76,8 @@ const (
userProfilePath = "/api/v2/user/profile"
retentionBasePath = "/api/v2/retention/users"
retentionChecksPath = "/api/v2/retention/users/checks"
fsEventsPath = "/api/v2/events/fs"
providerEventsPath = "/api/v2/events/provider"
healthzPath = "/healthz"
webRootPathDefault = "/"
webBasePathDefault = "/web"
@@ -490,15 +491,6 @@ func getServicesStatus() ServicesStatus {
return status
}
func getURLParam(r *http.Request, key string) string {
v := chi.URLParam(r, key)
unescaped, err := url.PathUnescape(v)
if err != nil {
return v
}
return unescaped
}
func fileServer(r chi.Router, path string, root http.FileSystem) {
if path != "/" && path[len(path)-1] != '/' {
r.Get(path, http.RedirectHandler(path+"/", http.StatusMovedPermanently).ServeHTTP)