refactor(coderd): move healthcheck report structs to codersdk (#12279)

Moves healthcheck report-related structs from coderd/healthcheck to codersdk
This prevents an import cycle when adding a codersdk.Client method to hit /api/v2/debug/health.
This commit is contained in:
Cian Johnston
2024-02-23 13:13:28 +00:00
committed by GitHub
parent aa7a9f5cc4
commit 2cb9bfd517
21 changed files with 2314 additions and 2298 deletions

View File

@ -20,21 +20,7 @@ import (
"github.com/coder/coder/v2/provisionerd/proto"
)
// @typescript-generate ProvisionerDaemonsReport
type ProvisionerDaemonsReport struct {
Severity health.Severity `json:"severity"`
Warnings []health.Message `json:"warnings"`
Dismissed bool `json:"dismissed"`
Error *string `json:"error"`
Items []ProvisionerDaemonsReportItem `json:"items"`
}
// @typescript-generate ProvisionerDaemonsReportItem
type ProvisionerDaemonsReportItem struct {
codersdk.ProvisionerDaemon `json:"provisioner_daemon"`
Warnings []health.Message `json:"warnings"`
}
type ProvisionerDaemonsReport codersdk.ProvisionerDaemonsReport
type ProvisionerDaemonsReportDeps struct {
// Required
@ -54,7 +40,7 @@ type ProvisionerDaemonsStore interface {
}
func (r *ProvisionerDaemonsReport) Run(ctx context.Context, opts *ProvisionerDaemonsReportDeps) {
r.Items = make([]ProvisionerDaemonsReportItem, 0)
r.Items = make([]codersdk.ProvisionerDaemonsReportItem, 0)
r.Severity = health.SeverityOK
r.Warnings = make([]health.Message, 0)
r.Dismissed = opts.Dismissed
@ -109,7 +95,7 @@ func (r *ProvisionerDaemonsReport) Run(ctx context.Context, opts *ProvisionerDae
continue
}
it := ProvisionerDaemonsReportItem{
it := codersdk.ProvisionerDaemonsReportItem{
ProvisionerDaemon: db2sdk.ProvisionerDaemon(daemon),
Warnings: make([]health.Message, 0),
}