Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

3.0 KB
Raw Blame
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"`
}

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"`
}