Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Version = "0.1.0"
Version is set by the main package at startup.
Functions ¶
Types ¶
type ConfigProvider ¶
type ConfigProvider interface {
PluginConfig(name string) map[string]any
SetPluginConfig(plugin, key string, value any)
Save(path string) error
Path() string
}
ConfigProvider abstracts config persistence so the API can update plugin config and save to disk without importing the config package.
type ErrorBody ¶
type ErrorBody struct {
Code string `json:"code"`
Message string `json:"message"`
Details interface{} `json:"details"`
}
ErrorBody holds error details.
type ErrorResponse ¶
type ErrorResponse struct {
Error ErrorBody `json:"error"`
}
ErrorResponse is the standard error envelope.
type JobTriggerer ¶
type JobTriggerer interface {
TriggerJob(id string) error
TriggerJobAsync(id string) error
JobExists(id string) bool
Reschedule(id, cron string) error
LatestRun(id string) *scheduler.JobRun
ListRuns(id string, limit, offset int) ([]storage.RunRecord, error)
}
JobTriggerer is satisfied by the scheduler to trigger jobs by ID.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps an HTTP server that serves the CM Core API.
func NewServer ¶
func NewServer(host string, port int, sched JobTriggerer, cfg ConfigProvider, authToken string, webHandler http.Handler) *Server
NewServer creates a new API server with core and plugin routes mounted. When authToken is non-empty, all endpoints except /api/v1/health require a valid Bearer token. If webHandler is non-nil it is mounted at the root for the browser-based dashboard.
Click to show internal directories.
Click to hide internal directories.