You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.0 KiB
37 lines
1.0 KiB
package api
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
)
|
|
|
|
func (r *Router) handleLogStorageStatus(w http.ResponseWriter, req *http.Request) {
|
|
ctx, ok := r.authorizeCommand(w, req, commandSpec{Action: "log.storage.read", Target: "logs", Permission: "config.write"})
|
|
if !ok {
|
|
return
|
|
}
|
|
source, ok := r.store.(interface {
|
|
LogStorageStatus(context.Context) (map[string]any, error)
|
|
})
|
|
if !ok {
|
|
writeError(w, 503, "service_unavailable", "log storage unavailable")
|
|
return
|
|
}
|
|
result, err := source.LogStorageStatus(ctx)
|
|
writeResult(w, result, err)
|
|
}
|
|
func (r *Router) handleRemoteSyslogStatus(w http.ResponseWriter, req *http.Request) {
|
|
ctx, ok := r.authorizeCommand(w, req, commandSpec{Action: "log.syslog.status", Target: "logs", Permission: "config.write"})
|
|
if !ok {
|
|
return
|
|
}
|
|
source, ok := r.store.(interface {
|
|
RemoteSyslogStatus(context.Context) (map[string]any, error)
|
|
})
|
|
if !ok {
|
|
writeError(w, 503, "service_unavailable", "syslog status unavailable")
|
|
return
|
|
}
|
|
result, err := source.RemoteSyslogStatus(ctx)
|
|
writeResult(w, result, err)
|
|
}
|
|
|