Files
pulse/internal/api/types.go
T
pulse-triage[bot] a571866c45 Report WebSocket state stalls without failing liveness
A WebSocket welcome can precede a stuck state build. Report when the current slot holder is overdue, without adding work or exposing shared workspace activity. Move the existing troubleshooting action before the sample response so operators can reach it on a phone, and keep the diagnostic limits with the response.

Refs #3107

Change-source: pulse-maintainer
2026-11-20 14:40:38 +00:00

74 lines
3.1 KiB
Go

package api
import "github.com/rcourtman/pulse-go-rewrite/internal/api/chartapi"
// Common response types for API endpoints
// HealthResponse represents the health check response
type HealthResponse struct {
Status string `json:"status"`
Timestamp int64 `json:"timestamp"`
Uptime float64 `json:"uptime"`
ProxyInstallScriptAvailable bool `json:"proxyInstallScriptAvailable,omitempty"`
DevModeSSH bool `json:"devModeSSH,omitempty"` // DEV/TEST ONLY: SSH keys allowed in containers
Dependencies map[string]bool `json:"dependencies"`
WebSocketStateStalled bool `json:"websocketStateStalled,omitempty"`
}
func EmptyHealthResponse() HealthResponse {
return HealthResponse{}.NormalizeCollections()
}
func (r HealthResponse) NormalizeCollections() HealthResponse {
if r.Dependencies == nil {
r.Dependencies = map[string]bool{}
}
return r
}
// VersionResponse represents version information
type VersionResponse struct {
Version string `json:"version"`
BuildTime string `json:"buildTime,omitempty"`
Build string `json:"build,omitempty"`
GoVersion string `json:"goVersion,omitempty"`
Runtime string `json:"runtime,omitempty"`
Channel string `json:"channel,omitempty"`
IsDocker bool `json:"isDocker"`
IsSourceBuild bool `json:"isSourceBuild"`
IsDevelopment bool `json:"isDevelopment"`
DeploymentType string `json:"deploymentType,omitempty"`
AgentUpdateTargetVersion string `json:"agentUpdateTargetVersion,omitempty"`
UpdateAvailable bool `json:"updateAvailable"`
LatestVersion string `json:"latestVersion,omitempty"`
Containerized bool `json:"containerized"`
ContainerID string `json:"containerId,omitempty"`
}
type ChartResponse = chartapi.ChartResponse
type InfrastructureChartsResponse = chartapi.InfrastructureChartsResponse
type WorkloadChartsResponse = chartapi.WorkloadChartsResponse
type ChartStats = chartapi.ChartStats
type ChartPointCounts = chartapi.ChartPointCounts
type VMChartData = chartapi.VMChartData
type NodeChartData = chartapi.NodeChartData
type StorageChartData = chartapi.StorageChartData
type StorageChartsResponse = chartapi.StorageChartsResponse
type StoragePoolChartData = chartapi.StoragePoolChartData
type StorageDiskChartData = chartapi.StorageDiskChartData
type MetricPoint = chartapi.MetricPoint
func EmptyChartResponse() ChartResponse { return chartapi.EmptyChartResponse() }
func EmptyInfrastructureChartsResponse() InfrastructureChartsResponse {
return chartapi.EmptyInfrastructureChartsResponse()
}
func EmptyWorkloadChartsResponse() WorkloadChartsResponse {
return chartapi.EmptyWorkloadChartsResponse()
}
func EmptyStorageChartsResponse() StorageChartsResponse { return chartapi.EmptyStorageChartsResponse() }
// AgentVersionResponse represents Docker / Podman module version information.
type AgentVersionResponse struct {
Version string `json:"version"`
}