Pulse/internal/api/monitored_system_usage.go
rcourtman faefe6edc8 Remove 198 unreachable Go functions
Dead-code sweep. Functions flagged unreachable by golang.org/x/tools/cmd/deadcode
and confirmed unused across pulse, pulse-enterprise, pulse-pro and pulse-mobile by
adversarial cross-repo verification. Cross-module reachability was checked
explicitly (only pkg/ exported symbols are importable by other modules; internal/
packages and _test.go files are not). go build, go vet and test-compile all pass.
2026-06-03 12:29:37 +01:00

53 lines
1.4 KiB
Go

package api
import (
"net/http"
"strings"
"github.com/rcourtman/pulse-go-rewrite/internal/monitoring"
"github.com/rcourtman/pulse-go-rewrite/internal/unifiedresources"
)
func monitoredSystemCandidateStateFromEnabled(
enabled bool,
) unifiedresources.MonitoredSystemCandidateState {
if enabled {
return unifiedresources.MonitoredSystemCandidateStateActive
}
return unifiedresources.MonitoredSystemCandidateStateInactive
}
type monitoredSystemUsageSnapshot struct {
count int
readState unifiedresources.ReadState
available bool
unavailableReason string
}
func monitoredSystemUsage(monitor *monitoring.Monitor) monitoredSystemUsageSnapshot {
usage := monitor.MonitoredSystemUsage()
return monitoredSystemUsageSnapshot{
count: usage.Count,
readState: usage.ReadState,
available: usage.Available,
unavailableReason: usage.UnavailableReason,
}
}
func writeMonitoredSystemUsageUnavailable(w http.ResponseWriter, reason string) {
details := map[string]string{}
if trimmed := strings.TrimSpace(reason); trimmed != "" {
details["reason"] = trimmed
}
writeErrorResponse(
w,
http.StatusServiceUnavailable,
"monitored_system_usage_unavailable",
"Unable to verify monitored-system inventory right now",
details,
)
}
func legacyConnectionCountsFromReadState(rs unifiedresources.ReadState) legacyConnectionCountsModel {
return legacyConnectionCountsModel{}
}