Documentation
¶
Index ¶
- Variables
- func AgentInfo(w http.ResponseWriter, r *http.Request)
- func IsSupportedOrigin(origin string) bool
- func Ping(w http.ResponseWriter, _ *http.Request)
- func RegisterDatatugHandlers(pathPrefix string, router *httprouter.Router, mode RegisterMode, wrap wrapper, ...)
- func RegisterDatatugHandlersWithCapabilities(pathPrefix string, router *httprouter.Router, mode RegisterMode, wrap wrapper, ...)
- type Capabilities
- type ErrorResponse
- type Handler
- type ProjectAgentEndpoints
- type ProjectEndpoints
- type RegisterMode
- type VerifyRequest
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidQueriesRoot = errors.New("invalid queries root")
ErrInvalidQueriesRoot is handleError's INVALID_REQUEST trigger (field "root") for an unrecognized ?root= value — the same {code,field} shape api.ErrUnknownStoreID/ErrAmbiguousStore already give ?storage=.
Functions ¶
func AgentInfo ¶
func AgentInfo(w http.ResponseWriter, r *http.Request)
AgentInfo is GET agent-info's exact contract envelope (api-contract.md "Endpoint table"): principal with explicit roles/groups, securityContextId, the projects this process serves, and its capabilities. It replaces the old ad-hoc {version, uptimeMinutes, principal} shape (pkg/api.GetAgentInfo/AgentInfo) — Task 12 item 3.
version reports buildinfo.Get("datatug").Version — see buildInfoFunc. The contract (api-contract.md "Endpoint table", `agent-info` row) defines only `version` on this envelope; commit and build date are deliberately not added here, even though buildinfo.Info carries them, to avoid introducing fields the contract doesn't define.
func IsSupportedOrigin ¶
IsSupportedOrigin check provided origin is allowed. 127.0.0.1 is accepted interchangeably with localhost (lane C5, datatug-apps PR #59, verified with curl: a dev server or UI addressing the agent via 127.0.0.1 was refused even though the equivalent localhost origin was already allowed).
func RegisterDatatugHandlers ¶
func RegisterDatatugHandlers( pathPrefix string, router *httprouter.Router, mode RegisterMode, wrap wrapper, contextProvider func(r *http.Request) (context.Context, error), handler Handler, )
RegisterDatatugHandlers registers datatug HTTP handlers with every write route closed (Capabilities{}) — kept for callers (this package's own tests) that do not need write access. Real `datatug serve` startup uses RegisterDatatugHandlersWithCapabilities.
func RegisterDatatugHandlersWithCapabilities ¶ added in v0.20.0
func RegisterDatatugHandlersWithCapabilities( pathPrefix string, router *httprouter.Router, mode RegisterMode, wrap wrapper, contextProvider func(r *http.Request) (context.Context, error), handler Handler, caps Capabilities, )
RegisterDatatugHandlersWithCapabilities is RegisterDatatugHandlers plus an explicit Capabilities gate for this process's mutation routes.
Types ¶
type Capabilities ¶ added in v0.20.0
type Capabilities struct {
AllowWrites bool
}
Capabilities gates whether this process's mutation routes register at all (api-contract.md "Security and errors": "this read journey must not expose an unauthenticated mutation endpoint as a side effect" — REQ:principal-selection: "Unneeded write endpoints MUST fail closed"). AllowWrites defaults false: a `datatug serve` process serving the Phase 1 read journey registers every mutation route behind requireWriteCapability (write_capability.go), which refuses with ACCESS_DENIED before any project file is touched, unless the caller explicitly opted in (see cmd_serve.go's --allow-writes flag).
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
Code string `json:"code,omitempty"`
Field string `json:"field,omitempty"`
}
ErrorResponse defines format of error response body. Code is set for a structured refusal (currently only "ACCESS_DENIED"); Field is reserved for a future per-field validation error and is not populated yet.
type Handler ¶
type Handler = func( w http.ResponseWriter, r *http.Request, requestDTO apicore.RequestDTO, verifyOptions verify.RequestOptions, successStatusCode int, getContext apicore.ContextProvider, handler apicore.Worker, )
Handler is responsible for creating context and call `handler()` func that should use provided context along with `requestDTO` that was populated from request body Its is exposed publicly so it can be replaced with custom implementation
type ProjectAgentEndpoints ¶
type ProjectAgentEndpoints struct {
}
ProjectAgentEndpoints defines project endpoints
type ProjectEndpoints ¶
type ProjectEndpoints interface {
CreateProject(w http.ResponseWriter, r *http.Request)
DeleteProject(w http.ResponseWriter, r *http.Request)
}
ProjectEndpoints defines project endpoints
type RegisterMode ¶
type RegisterMode = int
const ( RegisterWriteOnlyHandlers RegisterMode = iota RegisterAllHandlers )
type VerifyRequest ¶
VerifyRequest implements VerifyRequestOptions
func (VerifyRequest) AuthenticationRequired ¶
func (v VerifyRequest) AuthenticationRequired() bool
AuthenticationRequired specifies if authentication is mandatory
func (VerifyRequest) MaximumContentLength ¶
func (v VerifyRequest) MaximumContentLength() int64
MaximumContentLength defines max content length, if < 0 no limit
func (VerifyRequest) MinimumContentLength ¶
func (v VerifyRequest) MinimumContentLength() int64
MinimumContentLength defines min content length
Source Files
¶
- 0_interface.go
- agent_info_endpoint.go
- board_endpoints.go
- catalog_tables_endpoint.go
- chat_interpret.go
- common.go
- compare.go
- compare_facts.go
- compare_incident.go
- compare_key.go
- compare_sides.go
- constants.go
- contract_decode.go
- contract_error.go
- contract_errors.go
- contract_result.go
- contract_scope.go
- dbserver_databases.go
- dbservers_endpoints.go
- entity_endpoints.go
- environment_endpoints.go
- exec_run_query.go
- execute_endpoints.go
- execution_recording.go
- executions.go
- folder_endpoints.go
- incidents.go
- legacy_query_write_response.go
- ping_pong.go
- project_endpoints.go
- project_full.go
- projects.go
- query_capture.go
- query_capture_store.go
- query_capture_store_revisioned.go
- query_capture_validate.go
- query_endpoints.go
- recordsets_endpoints.go
- register.go
- routes.go
- semantic_applicable.go
- semantic_columns.go
- semantic_project.go
- semantic_related.go
- semantic_schema.go
- typed_value_convert.go
- util_error_handling.go
- util_json.go
- validators.go
- write_capability.go