checker: adopt unified ReportContext reporter signature
Follow the checker-sdk-go interface consolidation: reporter methods now take sdk.ReportContext and read the payload via ctx.Data() instead of the raw json.RawMessage parameter. Backed by the same underlying logic — this is a signature migration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
aae1452e12
commit
df4a7a89d1
9 changed files with 480 additions and 32 deletions
|
|
@ -18,7 +18,19 @@ func Definition() *sdk.CheckerDefinition {
|
|||
Name: "CalDAV server",
|
||||
Version: Version,
|
||||
Availability: sdk.CheckerAvailability{
|
||||
// The probe itself only needs a domain name (discovery runs on
|
||||
// the whole domain via /.well-known + SRV), so the checker is
|
||||
// always offered at domain scope.
|
||||
ApplyToDomain: true,
|
||||
|
||||
// Also offered at service scope so alerts — including the TLS
|
||||
// alerts derived from the endpoints we publish — surface on a
|
||||
// dedicated "CalDAV" service page rather than on the domain
|
||||
// page. The abstract.CalDAV service type does not exist in the
|
||||
// happyDomain service catalog yet; until it does, this has no
|
||||
// visible effect, but makes the intent explicit.
|
||||
ApplyToService: true,
|
||||
LimitToServices: []string{"abstract.CalDAV"},
|
||||
},
|
||||
ObservationKeys: []sdk.ObservationKey{ObservationKey},
|
||||
Options: sdk.CheckerOptionsDocumentation{
|
||||
|
|
|
|||
|
|
@ -4,19 +4,26 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
sdk "git.happydns.org/checker-sdk-go/checker"
|
||||
|
||||
"git.happydns.org/checker-dav/internal/dav"
|
||||
)
|
||||
|
||||
// GetHTMLReport implements sdk.CheckerHTMLReporter on *caldavProvider.
|
||||
//
|
||||
// The actual rendering is delegated to the shared renderer in internal/dav so
|
||||
// CalDAV and CardDAV produce visually identical reports; the only difference
|
||||
// is the title and the set of phases rendered (CalDAV includes Scheduling).
|
||||
func (p *caldavProvider) GetHTMLReport(raw json.RawMessage) (string, error) {
|
||||
// Delegated to the shared renderer in internal/dav so CalDAV and CardDAV
|
||||
// produce visually identical reports; the only differences are the title
|
||||
// and the set of phases (CalDAV includes Scheduling).
|
||||
//
|
||||
// Downstream TLS probes published for the endpoints we discovered are read
|
||||
// via ctx.Related(dav.TLSRelatedKey) and folded into the report (callouts +
|
||||
// dedicated TLS phase) — per
|
||||
// happydomain3/docs/checker-discovery-endpoint.md.
|
||||
func (p *caldavProvider) GetHTMLReport(ctx sdk.ReportContext) (string, error) {
|
||||
var d dav.Observation
|
||||
if err := json.Unmarshal(raw, &d); err != nil {
|
||||
if err := json.Unmarshal(ctx.Data(), &d); err != nil {
|
||||
return "", fmt.Errorf("failed to unmarshal caldav report: %w", err)
|
||||
}
|
||||
d.Kind = dav.KindCalDAV
|
||||
return dav.RenderReport(&d, "CalDAV Server")
|
||||
return dav.RenderReport(&d, "CalDAV Server", ctx.Related(dav.TLSRelatedKey))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue