Documentation
¶
Overview ¶
Package httpapi exposes the HTTP adapter for DeltaScope. input: parsed HTTP audit requests, shared metadata-preparation helpers, and public audit execution functions output: additive HTTP audit context including offline existence caveats plus offline or registry-based metadata-aware audit execution results pos: HTTP adapter glue between request-scoped metadata inputs and the public DeltaScope audit API note: if this file changes, update this header and module README.md.
Package httpapi exposes the HTTP adapter for DeltaScope. input: HTTP requests carrying SQL audit payloads plus service-level config/version wiring output: JSON audit, partial audit error results, named invalid_request envelopes for rejected connection/connection_ref fields, rule-catalog, capability, health, readiness, version, and structured access log lines pos: interface adapter between net/http and the public DeltaScope audit API note: if this file changes, update this header and module README.md.
Package httpapi exposes the HTTP adapter for DeltaScope. input: query-access JSON requests, catalog/schema hints, authorized runtime connection configuration, and the unified public online query access API output: bounded offline or alias-bound identity-routed online query-access JSON responses with stable identity error mapping and unchanged logging contracts pos: HTTP query-access adapter above offline analysis and the opaque unified online session boundary note: if this file changes, update this header and module README.md.
Package httpapi exposes the HTTP adapter for DeltaScope. input: HTTP rule-discovery requests plus shipped catalog and capability metadata output: JSON rule-list, rule-detail, and capability payloads including offline existence context_fields and stable online identity errors for the HTTP adapter pos: HTTP discovery helpers above the domain rule catalog and shared JSON writers note: if this file changes, update this header and module README.md.
Package httpapi exposes the HTTP adapter for DeltaScope. input: listen addresses plus service-level config/version wiring output: ready-to-run HTTP server instances for the JSON audit service pos: long-running net/http server assembly for the HTTP interface milestone note: if this file changes, update this header and module README.md.
Index ¶
- func NewHandler(configPath, version string, opts ...HandlerOption) (http.Handler, error)
- func NewServer(addr, configPath, version string, opts ...HandlerOption) (*http.Server, error)
- func PrincipalIDFromContext(ctx context.Context) string
- type AuthConfig
- type HandlerOption
- func WithAuditFunc(fn func(context.Context, deltascope.Request) (deltascope.Result, error)) HandlerOption
- func WithAuthConfig(cfg AuthConfig) HandlerOption
- func WithMetadataConfig(cfg MetadataConfig) HandlerOption
- func WithMiddlewareConfig(cfg MiddlewareConfig) HandlerOption
- func WithRegistry(reg *runtimeconfig.Registry) HandlerOption
- func WithSlogLogger(sl *slog.Logger) HandlerOption
- type MetadataConfig
- type MiddlewareConfig
- type RateLimitConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
func NewHandler(configPath, version string, opts ...HandlerOption) (http.Handler, error)
NewHandler returns the JSON HTTP adapter for DeltaScope.
func NewServer ¶
func NewServer(addr, configPath, version string, opts ...HandlerOption) (*http.Server, error)
NewServer builds the DeltaScope HTTP service.
func PrincipalIDFromContext ¶ added in v0.420.0
PrincipalIDFromContext returns the authenticated principal ID from the request context. Returns empty string when auth is disabled or the request is unauthenticated.
Types ¶
type AuthConfig ¶ added in v0.10.0
AuthConfig controls API-key authentication on the HTTP adapter.
type HandlerOption ¶ added in v0.10.0
type HandlerOption func(*handlerOptions)
HandlerOption configures NewHandler behavior.
func WithAuditFunc ¶ added in v0.10.0
func WithAuditFunc(fn func(context.Context, deltascope.Request) (deltascope.Result, error)) HandlerOption
WithAuditFunc overrides the audit execution function (primarily for tests).
func WithAuthConfig ¶ added in v0.10.0
func WithAuthConfig(cfg AuthConfig) HandlerOption
WithAuthConfig enables API-key authentication on selected routes.
func WithMetadataConfig ¶ added in v0.63.0
func WithMetadataConfig(cfg MetadataConfig) HandlerOption
WithMetadataConfig sets runtime-level metadata defaults for the HTTP adapter.
func WithMiddlewareConfig ¶ added in v0.10.0
func WithMiddlewareConfig(cfg MiddlewareConfig) HandlerOption
WithMiddlewareConfig overrides default middleware settings.
func WithRegistry ¶ added in v0.420.0
func WithRegistry(reg *runtimeconfig.Registry) HandlerOption
func WithSlogLogger ¶ added in v0.62.0
func WithSlogLogger(sl *slog.Logger) HandlerOption
WithSlogLogger sets the structured logger. The slog.Logger is bridged to a *log.Logger for use by existing recovery and access-log middleware. If sl is nil the option is a no-op and the default log.Default() logger is used.
type MetadataConfig ¶ added in v0.63.0
MetadataConfig carries runtime-level metadata defaults for the HTTP adapter.
type MiddlewareConfig ¶ added in v0.10.0
type MiddlewareConfig struct {
RequestTimeout time.Duration
Logger *log.Logger
RateLimit RateLimitConfig
MetricsEnabled *bool
TrustedProxies []string
}
MiddlewareConfig controls default middleware behavior.