Documentation
¶
Overview ¶
Package api owns the versioned loopback management HTTP boundary. It exposes only generated transport DTOs and delegates durable authority to Backend.
Index ¶
Constants ¶
const ( Prefix = "/api/v1" MaximumRequestBodyBytes = int64(16 << 20) DefaultAuditPageSize = 100 MaximumAuditPageSize = 500 )
Variables ¶
Functions ¶
Types ¶
type AuditInput ¶
type AuditInput struct {
Actor string
Action string
Outcome string
ResourceType string
ResourceID string
ErrorCode string
RequestID string
}
AuditInput deliberately has no raw detail, body, header, or credential field.
type AuditPage ¶
type AuditPage struct {
Events []gen.AuditEvent
NextAfter *uint64
ResumeAfter *uint64
}
type Backend ¶
type Backend interface {
RecordAudit(context.Context, AuditInput) error
AuditHealthy() bool
Setup(context.Context) (gen.Setup, error)
Overview(context.Context) (gen.Overview, error)
Nodes(context.Context) ([]gen.Node, gen.Revision, error)
Targets(context.Context) ([]gen.Target, gen.Revision, error)
Runs(context.Context) ([]gen.Run, error)
AuditEvents(context.Context, uint64, int) (AuditPage, error)
ReadConfiguration(context.Context) (gen.Configuration, error)
ApplyConfiguration(context.Context, uint64, string, []byte, string) (gen.Configuration, error)
ExportConfiguration(context.Context) ([]byte, gen.Revision, error)
CreateJoinCode(context.Context, []string, string) (tokenID, code string, err error)
CancelJoinCode(context.Context, string, string) error
SetNodeAdministrativeState(context.Context, domain.NodeID, domain.NodeAdministrativeState, uint64, string) (gen.Node, gen.Revision, error)
CurrentRevision(context.Context) (gen.Revision, error)
}
Backend is the sole authority used by the HTTP adapter. Implementations keep database transactions, GitHub verification, and reconciliation out of handlers.
type CommittedMutationError ¶
type CommittedMutationError struct {
Current uint64
}
CommittedMutationError means SQLite and audit authority advanced, but the live projection or response could not be confirmed. The revision lets clients reload instead of blindly retrying an operation that may already have effect.
func (*CommittedMutationError) Error ¶
func (committed *CommittedMutationError) Error() string
type EventBus ¶
type EventBus struct {
// contains filtered or unexported fields
}
EventBus coalesces invalidations for each slow subscriber. It retains no event history; an unknown cursor is handled by a level-triggered reset.
func NewEventBus ¶
func NewEventBus() *EventBus
func (*EventBus) Generation ¶
Generation returns the current process-local invalidation high-water mark. It is safe for health fan-in verification and carries no event payload.
type FieldViolation ¶
FieldViolation is an allowlisted transport validation error.
type GitHubBackend ¶
type GitHubBackend interface {
StartGitHubAppManifest(context.Context, string, string) (gen.GitHubManifestStart, error)
CompleteGitHubAppManifest(context.Context, string, string) error
ListGitHubInstallations(context.Context) (gen.GitHubInstallationList, error)
CreateGitHubTarget(context.Context, uint64, gen.CreateGitHubTargetRequest, string) (gen.GitHubTargetMutation, error)
}
GitHubBackend is optional so existing embedders and focused API tests do not need to implement provider operations. A Controller enables it only after the credential-store and signed Manifest boundaries are initialized.
type RevisionConflict ¶
RevisionConflict is the safe optimistic-lock failure returned by a Backend.
func (*RevisionConflict) Error ¶
func (conflict *RevisionConflict) Error() string
type ValidationError ¶
type ValidationError struct {
Violations []FieldViolation
}
ValidationError contains no raw request or provider error.
func (*ValidationError) Error ¶
func (validation *ValidationError) Error() string