Files
vctp2/server/models/api_responses.go
T
nathan ae3e2be89a
continuous-integration/drone/push Build is passing
add auth support
2026-04-17 13:19:08 +10:00

94 lines
3.2 KiB
Go

package models
// StatusResponse represents a simple status-only JSON response.
type StatusResponse struct {
Status string `json:"status"`
}
// StatusMessageResponse represents a status + message JSON response.
type StatusMessageResponse struct {
Status string `json:"status"`
Message string `json:"message"`
}
// ErrorResponse represents a standard error JSON response.
type ErrorResponse struct {
Status string `json:"status"`
Message string `json:"message"`
}
// AuthLoginRequest represents login payload for LDAP/JWT authentication.
type AuthLoginRequest struct {
Username string `json:"username"`
Password string `json:"password"`
}
// AuthLoginResponse represents successful auth login response.
type AuthLoginResponse struct {
AccessToken string `json:"access_token"`
ExpiresAt int64 `json:"expires_at"`
TokenType string `json:"token_type"`
}
// SnapshotMigrationStats mirrors the snapshot registry migration stats payload.
type SnapshotMigrationStats struct {
HourlyRenamed int `json:"HourlyRenamed"`
HourlyRegistered int `json:"HourlyRegistered"`
DailyRegistered int `json:"DailyRegistered"`
MonthlyRegistered int `json:"MonthlyRegistered"`
Errors int `json:"Errors"`
}
// SnapshotMigrationResponse captures snapshot registry migration results.
type SnapshotMigrationResponse struct {
Status string `json:"status"`
Error string `json:"error,omitempty"`
Stats SnapshotMigrationStats `json:"stats"`
}
// SnapshotRegenerateReportsResponse describes the hourly report regeneration response.
type SnapshotRegenerateReportsResponse struct {
Status string `json:"status"`
Total int `json:"total"`
Regenerated int `json:"regenerated"`
Skipped int `json:"skipped"`
Errors int `json:"errors"`
ReportsDir string `json:"reports_dir"`
SnapshotType string `json:"snapshotType"`
}
// SnapshotRepairResponse describes the daily snapshot repair response.
type SnapshotRepairResponse struct {
Status string `json:"status"`
Repaired string `json:"repaired"`
Failed string `json:"failed"`
}
// SnapshotRepairSuiteResponse describes the full repair suite response.
type SnapshotRepairSuiteResponse struct {
Status string `json:"status"`
DailyRepaired string `json:"daily_repaired"`
DailyFailed string `json:"daily_failed"`
MonthlyRefined string `json:"monthly_refined"`
MonthlyFailed string `json:"monthly_failed"`
}
// VcenterCacheRebuildResult describes rebuild results for a single vCenter.
type VcenterCacheRebuildResult struct {
Vcenter string `json:"vcenter"`
FolderEntries int `json:"folder_entries"`
ResourcePoolEntries int `json:"resource_pool_entries"`
HostEntries int `json:"host_entries"`
DurationSeconds float64 `json:"duration_seconds"`
Error string `json:"error,omitempty"`
}
// VcenterCacheRebuildResponse describes the vCenter object cache rebuild response.
type VcenterCacheRebuildResponse struct {
Status string `json:"status"`
Total int `json:"total"`
Succeeded int `json:"succeeded"`
Failed int `json:"failed"`
Results []VcenterCacheRebuildResult `json:"results"`
}