Documentation
¶
Overview ¶
Package manifest produces the handler-manifest.v1 document the Celerity CLI discovers an application's handlers from.
The document is generated from the same registry the dispatcher routes against, so a handler that appears in it is by construction one the binary will serve. That is the property static analysis of a Go program cannot offer, and it is why extraction runs the binary.
What running cannot answer is which resources each handler reaches: that dependency is captured in a closure, and Go offers no reflection into one. It is filled in by the extraction tool's static pass over the same source.
Index ¶
Constants ¶
const ( AnnotationHTTP = "celerity.handler.http" AnnotationHTTPMethod = "celerity.handler.http.method" AnnotationHTTPPath = "celerity.handler.http.path" AnnotationWebSocket = "celerity.handler.websocket" AnnotationWebSocketRoute = "celerity.handler.websocket.route" AnnotationConsumer = "celerity.handler.consumer" AnnotationConsumerSource = "celerity.handler.consumer.source" AnnotationSchedule = "celerity.handler.schedule" AnnotationTag = "celerity.handler.tag" AnnotationGuardProtectedBy = "celerity.handler.guard.protectedBy" AnnotationPublic = "celerity.handler.public" // AnnotationResourceRef carries the blueprint resources a handler reaches, // which is what the CLI turns into IAM grants, environment wiring and // security group rules. AnnotationResourceRef = "celerity.handler.resource.ref" )
Annotation keys, matching what the Node and Python SDKs emit so that the CLI's blueprint transform needs no per-language handling.
const Version = "v1"
Version is the manifest format this package emits.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClassHandler ¶
type ClassHandler struct{}
ClassHandler is always empty for Go, and is present so the document shape matches what the CLI expects from every SDK.
type FunctionHandler ¶
type FunctionHandler struct {
ResourceName string `json:"resourceName"`
ExportName string `json:"exportName"`
SourceFile string `json:"sourceFile"`
Annotations map[string]any `json:"annotations,omitempty"`
Spec Spec `json:"spec"`
// FuncPath is the fully qualified name of the registered function, such as
// github.com/acme/app/orders.Create. The extraction tool's static pass roots
// its resource walk here, which is what ties the analysis to the function
// the binary will actually dispatch to.
//
// Written when the binary reports itself, since that is how the static pass
// learns what to walk, and cleared again before the manifest is handed to
// the CLI: what each handler reaches is in the annotations by then, and the
// path is an implementation detail of how it got there rather than part of
// the contract.
FuncPath string `json:"funcPath,omitempty"`
}
FunctionHandler describes one registered handler.
type GuardHandler ¶
type GuardHandler struct {
ResourceName string `json:"resourceName"`
GuardName string `json:"guardName"`
SourceFile string `json:"sourceFile"`
GuardType string `json:"guardType"`
ExportName string `json:"exportName,omitempty"`
Annotations map[string]any `json:"annotations"`
Spec Spec `json:"spec"`
}
GuardHandler describes one registered auth guard.
type Manifest ¶
type Manifest struct {
Version string `json:"version"`
Handlers []ClassHandler `json:"handlers"`
FunctionHandlers []FunctionHandler `json:"functionHandlers"`
GuardHandlers []GuardHandler `json:"guardHandlers"`
// LinkedAdapters and LinkedResourceProviders name the platform support
// compiled into the binary.
//
// Go links one artefact, so a deployment targeting a platform the binary
// carries no adapter for cannot be fixed by configuration. Reporting what is
// linked lets the CLI refuse that at build time, naming the import to add,
// rather than leaving it to the first invocation. Additive fields: an older
// CLI ignores them.
LinkedAdapters []string `json:"linkedAdapters,omitempty"`
LinkedResourceProviders []string `json:"linkedResourceProviders,omitempty"`
}
Manifest is the document the CLI reads.
Go populates FunctionHandlers only: ClassHandlers exists for the Node and Python SDKs, whose decorators sit on classes.