zdravko/internal/activities/healthcheck.go
2024-02-21 14:16:22 +01:00

45 lines
848 B
Go

package activities
import (
"context"
"log/slog"
"net/http"
"code.tjo.space/mentos1386/zdravko/pkg/k6"
)
type HealtcheckParam struct {
Script string
}
type HealthcheckResult struct {
StatusCode int
}
func Healthcheck(ctx context.Context, param HealtcheckParam) (*HealthcheckResult, error) {
statusCode := http.StatusOK // FIXME
execution := k6.NewExecution(slog.Default(), param.Script)
err := execution.Run(ctx)
if err != nil {
return nil, err
}
return &HealthcheckResult{StatusCode: statusCode}, nil
}
type HealtcheckAddToHistoryParam struct {
Id string
Success bool
StatusCode int
}
type HealthcheckAddToHistoryResult struct {
}
func HealthcheckAddToHistory(ctx context.Context, param HealtcheckAddToHistoryParam) (*HealthcheckAddToHistoryResult, error) {
return &HealthcheckAddToHistoryResult{}, nil
}