Pulse/internal/api/monitored_system_usage.go
rcourtman 81b31e4d3b Remove monitored-system volume caps
Retire runtime/API/UI monitored-system volume enforcement now that infrastructure monitoring is no longer capped.

Keep only legacy metadata scrubbing and purchase-start compatibility for old max_monitored_systems references.

Rename the remaining preview surface to monitored-system impact and make previews explanatory rather than save-blocking.

Update subsystem contracts and RA7 evidence for the caps-retired invariant.
2026-05-05 12:59:59 +01:00

57 lines
1.5 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 legacyConnectionCounts(monitor *monitoring.Monitor) legacyConnectionCountsModel {
return legacyConnectionCountsModel{}
}
func legacyConnectionCountsFromReadState(rs unifiedresources.ReadState) legacyConnectionCountsModel {
return legacyConnectionCountsModel{}
}