Documentation
¶
Overview ¶
Package api is the thin driving adapter between the generated strict HTTP server (package apigen) and the engine. Every handler follows the same shape: convert the request, call exactly one engine method, convert the result or classify the error into a Problem-shaped response. No business logic lives here.
Index ¶
- func Handler(e *engine.Engine) http.Handler
- func New(e *engine.Engine, deps Deps) http.Handler
- type Deps
- type Server
- func (s *Server) ApplyRef(ctx context.Context, request apigen.ApplyRefRequestObject) (apigen.ApplyRefResponseObject, error)
- func (s *Server) DeleteGoal(ctx context.Context, req apigen.DeleteGoalRequestObject) (apigen.DeleteGoalResponseObject, error)
- func (s *Server) DeleteManifest(ctx context.Context, req apigen.DeleteManifestRequestObject) (apigen.DeleteManifestResponseObject, error)
- func (s *Server) DiffManifest(ctx context.Context, req apigen.DiffManifestRequestObject) (apigen.DiffManifestResponseObject, error)
- func (s *Server) DiscardWorking(ctx context.Context, req apigen.DiscardWorkingRequestObject) (apigen.DiscardWorkingResponseObject, error)
- func (s *Server) GetCharterPdf(ctx context.Context, req apigen.GetCharterPdfRequestObject) (apigen.GetCharterPdfResponseObject, error)
- func (s *Server) GetFlow(_ context.Context, req apigen.GetFlowRequestObject) (apigen.GetFlowResponseObject, error)
- func (s *Server) GetGapChecks(ctx context.Context, req apigen.GetGapChecksRequestObject) (apigen.GetGapChecksResponseObject, error)
- func (s *Server) GetGapCoverage(ctx context.Context, req apigen.GetGapCoverageRequestObject) (apigen.GetGapCoverageResponseObject, error)
- func (s *Server) GetGoalChecks(ctx context.Context, req apigen.GetGoalChecksRequestObject) (apigen.GetGoalChecksResponseObject, error)
- func (s *Server) GetGoalTree(ctx context.Context, _ apigen.GetGoalTreeRequestObject) (apigen.GetGoalTreeResponseObject, error)
- func (s *Server) GetHealth(_ context.Context, _ apigen.GetHealthRequestObject) (apigen.GetHealthResponseObject, error)
- func (s *Server) GetManifest(ctx context.Context, req apigen.GetManifestRequestObject) (apigen.GetManifestResponseObject, error)
- func (s *Server) GetOperationCharterHtml(ctx context.Context, req apigen.GetOperationCharterHtmlRequestObject) (apigen.GetOperationCharterHtmlResponseObject, error)
- func (s *Server) GetOperationChecks(ctx context.Context, req apigen.GetOperationChecksRequestObject) (apigen.GetOperationChecksResponseObject, error)
- func (s *Server) GetProgrammeCharterHtml(ctx context.Context, req apigen.GetProgrammeCharterHtmlRequestObject) (apigen.GetProgrammeCharterHtmlResponseObject, error)
- func (s *Server) GetProgrammeChecks(ctx context.Context, req apigen.GetProgrammeChecksRequestObject) (apigen.GetProgrammeChecksResponseObject, error)
- func (s *Server) GetProjectCharterHtml(ctx context.Context, req apigen.GetProjectCharterHtmlRequestObject) (apigen.GetProjectCharterHtmlResponseObject, error)
- func (s *Server) GetProjectChecks(ctx context.Context, req apigen.GetProjectChecksRequestObject) (apigen.GetProjectChecksResponseObject, error)
- func (s *Server) GetProjectState(ctx context.Context, req apigen.GetProjectStateRequestObject) (apigen.GetProjectStateResponseObject, error)
- func (s *Server) GetReferences(ctx context.Context, req apigen.GetReferencesRequestObject) (apigen.GetReferencesResponseObject, error)
- func (s *Server) GetSchema(_ context.Context, req apigen.GetSchemaRequestObject) (apigen.GetSchemaResponseObject, error)
- func (s *Server) GetSettings(ctx context.Context, _ apigen.GetSettingsRequestObject) (apigen.GetSettingsResponseObject, error)
- func (s *Server) GetVault(ctx context.Context, _ apigen.GetVaultRequestObject) (apigen.GetVaultResponseObject, error)
- func (s *Server) GetVersion(ctx context.Context, req apigen.GetVersionRequestObject) (apigen.GetVersionResponseObject, error)
- func (s *Server) GetWorking(ctx context.Context, req apigen.GetWorkingRequestObject) (apigen.GetWorkingResponseObject, error)
- func (s *Server) ListExcluded(ctx context.Context, _ apigen.ListExcludedRequestObject) (apigen.ListExcludedResponseObject, error)
- func (s *Server) ListFlows(context.Context, apigen.ListFlowsRequestObject) (apigen.ListFlowsResponseObject, error)
- func (s *Server) ListKinds(_ context.Context, _ apigen.ListKindsRequestObject) (apigen.ListKindsResponseObject, error)
- func (s *Server) ListManifests(ctx context.Context, req apigen.ListManifestsRequestObject) (apigen.ListManifestsResponseObject, error)
- func (s *Server) ListSnapshots(ctx context.Context, req apigen.ListSnapshotsRequestObject) (apigen.ListSnapshotsResponseObject, error)
- func (s *Server) ListUnapplied(ctx context.Context, _ apigen.ListUnappliedRequestObject) (apigen.ListUnappliedResponseObject, error)
- func (s *Server) ListVersions(ctx context.Context, req apigen.ListVersionsRequestObject) (apigen.ListVersionsResponseObject, error)
- func (s *Server) PostSnapshot(ctx context.Context, req apigen.PostSnapshotRequestObject) (apigen.PostSnapshotResponseObject, error)
- func (s *Server) PutManifest(ctx context.Context, req apigen.PutManifestRequestObject) (apigen.PutManifestResponseObject, error)
- func (s *Server) PutWorking(ctx context.Context, req apigen.PutWorkingRequestObject) (apigen.PutWorkingResponseObject, error)
- func (s *Server) RecoverRef(ctx context.Context, request apigen.RecoverRefRequestObject) (apigen.RecoverRefResponseObject, error)
- func (s *Server) TransitionProjectState(ctx context.Context, req apigen.TransitionProjectStateRequestObject) (apigen.TransitionProjectStateResponseObject, error)
- func (s *Server) ValidateManifest(ctx context.Context, req apigen.ValidateManifestRequestObject) (apigen.ValidateManifestResponseObject, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Server ¶
Server implements apigen.StrictServerInterface over an *engine.Engine. Printer is the port a PDF goes through; nil means printer.None.
func (*Server) ApplyRef ¶
func (s *Server) ApplyRef(ctx context.Context, request apigen.ApplyRefRequestObject) (apigen.ApplyRefResponseObject, error)
ApplyRef includes one manifest, or many, in the live state. Many in one call, because one at a time was quadratic and felt it: the engine reloads and reindexes once for the batch.
func (*Server) DeleteGoal ¶
func (s *Server) DeleteGoal(ctx context.Context, req apigen.DeleteGoalRequestObject) (apigen.DeleteGoalResponseObject, error)
func (*Server) DeleteManifest ¶
func (s *Server) DeleteManifest(ctx context.Context, req apigen.DeleteManifestRequestObject) (apigen.DeleteManifestResponseObject, error)
DeleteManifest excludes a manifest from the live state (any kind).
func (*Server) DiffManifest ¶
func (s *Server) DiffManifest(ctx context.Context, req apigen.DiffManifestRequestObject) (apigen.DiffManifestResponseObject, error)
func (*Server) DiscardWorking ¶
func (s *Server) DiscardWorking(ctx context.Context, req apigen.DiscardWorkingRequestObject) (apigen.DiscardWorkingResponseObject, error)
PutWorking saves a manifest's working copy without creating a version (autosave). DiscardWorking throws away a staged draft. Nothing is returned: the caller reads the manifest back, and what comes back is whatever the vault holds — the saved file, or nothing if it was never saved.
func (*Server) GetCharterPdf ¶
func (s *Server) GetCharterPdf(ctx context.Context, req apigen.GetCharterPdfRequestObject) (apigen.GetCharterPdfResponseObject, error)
GetCharterPdf prints the charter of a project, programme or operation to PDF. A project prints its working copy when asked, otherwise its latest version, and its working copy when it has no version yet: somebody exporting a draft wants the draft, not a refusal.
func (*Server) GetFlow ¶
func (s *Server) GetFlow(_ context.Context, req apigen.GetFlowRequestObject) (apigen.GetFlowResponseObject, error)
func (*Server) GetGapChecks ¶
func (s *Server) GetGapChecks(ctx context.Context, req apigen.GetGapChecksRequestObject) (apigen.GetGapChecksResponseObject, error)
GetProgrammeChecks mirrors the goal's shape rather than the project's: a flat list, no blocking count, because none of a programme's checks blocks anything.
func (*Server) GetGapCoverage ¶
func (s *Server) GetGapCoverage(ctx context.Context, req apigen.GetGapCoverageRequestObject) (apigen.GetGapCoverageResponseObject, error)
func (*Server) GetGoalChecks ¶
func (s *Server) GetGoalChecks(ctx context.Context, req apigen.GetGoalChecksRequestObject) (apigen.GetGoalChecksResponseObject, error)
func (*Server) GetGoalTree ¶
func (s *Server) GetGoalTree(ctx context.Context, _ apigen.GetGoalTreeRequestObject) (apigen.GetGoalTreeResponseObject, error)
func (*Server) GetHealth ¶
func (s *Server) GetHealth(_ context.Context, _ apigen.GetHealthRequestObject) (apigen.GetHealthResponseObject, error)
func (*Server) GetManifest ¶
func (s *Server) GetManifest(ctx context.Context, req apigen.GetManifestRequestObject) (apigen.GetManifestResponseObject, error)
func (*Server) GetOperationCharterHtml ¶
func (s *Server) GetOperationCharterHtml( ctx context.Context, req apigen.GetOperationCharterHtmlRequestObject, ) (apigen.GetOperationCharterHtmlResponseObject, error)
GetOperationCharterHtml renders an operation as its service description.
func (*Server) GetOperationChecks ¶
func (s *Server) GetOperationChecks(ctx context.Context, req apigen.GetOperationChecksRequestObject) (apigen.GetOperationChecksResponseObject, error)
GetOperationChecks: the same flat, advisory shape as a programme's.
func (*Server) GetProgrammeCharterHtml ¶
func (s *Server) GetProgrammeCharterHtml( ctx context.Context, req apigen.GetProgrammeCharterHtmlRequestObject, ) (apigen.GetProgrammeCharterHtmlResponseObject, error)
GetProgrammeCharterHtml renders a programme as a document.
func (*Server) GetProgrammeChecks ¶
func (s *Server) GetProgrammeChecks(ctx context.Context, req apigen.GetProgrammeChecksRequestObject) (apigen.GetProgrammeChecksResponseObject, error)
func (*Server) GetProjectCharterHtml ¶
func (s *Server) GetProjectCharterHtml(ctx context.Context, req apigen.GetProjectCharterHtmlRequestObject) (apigen.GetProjectCharterHtmlResponseObject, error)
func (*Server) GetProjectChecks ¶
func (s *Server) GetProjectChecks(ctx context.Context, req apigen.GetProjectChecksRequestObject) (apigen.GetProjectChecksResponseObject, error)
func (*Server) GetProjectState ¶
func (s *Server) GetProjectState(ctx context.Context, req apigen.GetProjectStateRequestObject) (apigen.GetProjectStateResponseObject, error)
func (*Server) GetReferences ¶
func (s *Server) GetReferences(ctx context.Context, req apigen.GetReferencesRequestObject) (apigen.GetReferencesResponseObject, error)
func (*Server) GetSchema ¶
func (s *Server) GetSchema(_ context.Context, req apigen.GetSchemaRequestObject) (apigen.GetSchemaResponseObject, error)
func (*Server) GetSettings ¶
func (s *Server) GetSettings(ctx context.Context, _ apigen.GetSettingsRequestObject) (apigen.GetSettingsResponseObject, error)
func (*Server) GetVault ¶
func (s *Server) GetVault(ctx context.Context, _ apigen.GetVaultRequestObject) (apigen.GetVaultResponseObject, error)
GetVault returns the state manifest: what the live state includes.
func (*Server) GetVersion ¶
func (s *Server) GetVersion(ctx context.Context, req apigen.GetVersionRequestObject) (apigen.GetVersionResponseObject, error)
func (*Server) GetWorking ¶
func (s *Server) GetWorking(ctx context.Context, req apigen.GetWorkingRequestObject) (apigen.GetWorkingResponseObject, error)
GetWorking returns the working copy as last saved, decoded through the engine's codec, or 404 when the manifest has none.
func (*Server) ListExcluded ¶
func (s *Server) ListExcluded(ctx context.Context, _ apigen.ListExcludedRequestObject) (apigen.ListExcludedResponseObject, error)
ListExcluded lists every excluded manifest, newest first.
func (*Server) ListFlows ¶
func (s *Server) ListFlows(context.Context, apigen.ListFlowsRequestObject) (apigen.ListFlowsResponseObject, error)
func (*Server) ListKinds ¶
func (s *Server) ListKinds(_ context.Context, _ apigen.ListKindsRequestObject) (apigen.ListKindsResponseObject, error)
func (*Server) ListManifests ¶
func (s *Server) ListManifests(ctx context.Context, req apigen.ListManifestsRequestObject) (apigen.ListManifestsResponseObject, error)
func (*Server) ListSnapshots ¶
func (s *Server) ListSnapshots(ctx context.Context, req apigen.ListSnapshotsRequestObject) (apigen.ListSnapshotsResponseObject, error)
ListSnapshots returns every snapshot (version) across all kinds, newest first.
func (*Server) ListUnapplied ¶
func (s *Server) ListUnapplied(ctx context.Context, _ apigen.ListUnappliedRequestObject) (apigen.ListUnappliedResponseObject, error)
ListUnapplied lists manifests present but not in the live state.
func (*Server) ListVersions ¶
func (s *Server) ListVersions(ctx context.Context, req apigen.ListVersionsRequestObject) (apigen.ListVersionsResponseObject, error)
func (*Server) PostSnapshot ¶
func (s *Server) PostSnapshot(ctx context.Context, req apigen.PostSnapshotRequestObject) (apigen.PostSnapshotResponseObject, error)
PostSnapshot records an explicit version of a manifest's current content with a reason. Snapshots the working copy if one exists, otherwise the current version. The author is from Settings.spec.operator.
func (*Server) PutManifest ¶
func (s *Server) PutManifest(ctx context.Context, req apigen.PutManifestRequestObject) (apigen.PutManifestResponseObject, error)
func (*Server) PutWorking ¶
func (s *Server) PutWorking(ctx context.Context, req apigen.PutWorkingRequestObject) (apigen.PutWorkingResponseObject, error)
func (*Server) RecoverRef ¶
func (s *Server) RecoverRef(ctx context.Context, request apigen.RecoverRefRequestObject) (apigen.RecoverRefResponseObject, error)
RecoverRef re-includes an excluded manifest in the live state.
func (*Server) TransitionProjectState ¶
func (s *Server) TransitionProjectState(ctx context.Context, req apigen.TransitionProjectStateRequestObject) (apigen.TransitionProjectStateResponseObject, error)
func (*Server) ValidateManifest ¶
func (s *Server) ValidateManifest(ctx context.Context, req apigen.ValidateManifestRequestObject) (apigen.ValidateManifestResponseObject, error)