{"modulePath":"github.com/labstack/pitot","version":"v0.0.0-20261123231833-0301fe8e3bdc","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package api\n\n## Constants\n\n```go\nconst (\n\tRoutePolicyPublic            = \"public\"\n\tRoutePolicyAuthenticated     = \"authenticated\"\n\tRoutePolicyCapability        = \"capability\"\n\tRoutePolicyServiceCredential = \"service-credential\"\n\tRoutePolicyProtocol          = \"protocol\"\n\tRoutePolicySCIM              = \"scim\"\n)\n```\nRoutePolicyPublic and friends name the policy kinds in the form the documentation uses. The internal constants are an unexported iota, which is right for a switch and useless in a table.\n\n## Functions\n\n```go\nfunc AllCapabilities() []string\n```\nAllCapabilities lists every capability the middleware knows, sorted. Derived from the role table rather than restated, so a capability that exists but is granted to nobody cannot appear here and a new one needs no edit.\n\n```go\nfunc AuthMiddleware(users *auth.UserStore, sessions *auth.BrowserSessions, cfg config.Config) echo.MiddlewareFunc\n```\n\n```go\nfunc ConfigureClientIP(e *echo.Echo, rawCIDRs string) error\n```\nConfigureClientIP trusts forwarded client addresses only from explicitly configured proxy networks. Direct clients cannot opt themselves into trust.\n\n```go\nfunc GetCurrentUser(c *echo.Context) *auth.User\n```\n\n```go\nfunc HTTPErrorHandler(c *echo.Context, err error)\n```\nHTTPErrorHandler is the product error boundary, including router failures. Protocol handlers and operational probes write their own responses.\n\n```go\nfunc HasCapability(user auth.User, capability Capability) bool\n```\n\n```go\nfunc RegisterAlertRoutes(e *echo.Echo, store *alert.Store, engine *alert.Engine)\n```\nRegisterAlertRoutes registers alert management REST endpoints.\n\n```go\nfunc RegisterAnnotationRoutes(e *echo.Echo, service AnnotationReader)\n```\n\n```go\nfunc RegisterAuthMiddleware(e *echo.Echo, users *auth.UserStore, sessions *auth.BrowserSessions, audit *auth.AuditStore, cfg config.Config)\n```\n\n```go\nfunc RegisterAuthRoutes(e *echo.Echo, users *auth.UserStore, codes *auth.CodeStore, setup *auth.Setup, settingsStore *settings.Store, sessions *auth.BrowserSessions, audit *auth.AuditStore, smtp auth.SMTPConfig, cfg config.Config)\n```\n\n```go\nfunc RegisterDashboardRoutes(e *echo.Echo, dashboards *dashboard.Service)\n```\n\n```go\nfunc RegisterHealthRoutes(e *echo.Echo, duck *engine.Duck, cfg config.Config, oidc *OIDCDiscovery)\n```\nRegisterHealthRoutes registers health check endpoints\n\n```go\nfunc RegisterIntelligenceRoutes(e *echo.Echo, snapshots IntelligenceSnapshots)\n```\nRegisterIntelligenceRoutes exposes the detector's latest completed snapshot.\n\n```go\nfunc RegisterPitotQLRoutes(e *echo.Echo, parser query.Parser, engine QueryEngine)\n```\n\n```go\nfunc RegisterQueryRoutes(e *echo.Echo, engine QueryEngine)\n```\n\n```go\nfunc RegisterSCIMRoutes(e *echo.Echo, cfg config.Config, users *appauth.UserStore, identities *appauth.IdentityStore)\n```\nRegisterSCIMRoutes registers the routes only when a token is configured.\n\n```go\nfunc RegisterSettingsRoutes(e *echo.Echo, cfg config.Config, store *settings.Store)\n```\n\n```go\nfunc RegisterTraceRoutes(e *echo.Echo, queries TraceQueries, retentionDays int)\n```\n\n```go\nfunc RegisterUserRoutes(e *echo.Echo, users *auth.UserStore, smtp auth.SMTPConfig, cfg config.Config)\n```\nRegisterUserRoutes registers user management endpoints.\n\n```go\nfunc RequestLogger() echo.MiddlewareFunc\n```\nRequestLogger logs each request without credentials or directory lookups.\n\n```go\nfunc RequestOwner(c *echo.Context) (string, error)\n```\n\n```go\nfunc RequireCapability(capability Capability) echo.MiddlewareFunc\n```\n\n```go\nfunc RoleCapabilities() map[string][]string\n```\nRoleCapabilities returns each role's capabilities, sorted, in the string form a table wants. The underlying map is a set of empty structs keyed by type, which is the right shape for a lookup and the wrong shape for a document.\n\n## Types\n\n```go\ntype AnnotationReader interface {\n\tRead(context.Context, annotations.Request) (annotations.Response, error)\n}\n```\n\n```go\ntype AuthHandler struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (h *AuthHandler) LoginLink(c *echo.Context) error\n```\n\n```go\nfunc (h *AuthHandler) Logout(c *echo.Context) error\n```\n\n```go\nfunc (h *AuthHandler) Me(c *echo.Context) error\n```\n\n```go\nfunc (h *AuthHandler) Setup(c *echo.Context) error\n```\n\n```go\nfunc (h *AuthHandler) Start(c *echo.Context) error\n```\n\n```go\nfunc (h *AuthHandler) Status(c *echo.Context) error\n```\n\n```go\nfunc (h *AuthHandler) Verify(c *echo.Context) error\n```\n\n```go\ntype Capability string\n```\n\n```go\nconst (\n\tReadTelemetry       Capability = \"telemetry:read\"\n\tManageOwnDashboards Capability = \"dashboards:manage-own\"\n\tManageAlerts        Capability = \"alerts:manage\"\n\tRunAgent            Capability = \"agent:run\"\n\tReadIngestMetadata  Capability = \"ingest:read-metadata\"\n\tManageIngest        Capability = \"ingest:manage\"\n\tManageUsers         Capability = \"users:manage\"\n\tReadOperations      Capability = \"operations:read\"\n)\n```\n\n```go\ntype CheckResult struct {\n\tStatus    string `json:\"status\"`\n\tLatencyMs int64  `json:\"latency_ms,omitempty\"`\n\tError     string `json:\"error,omitempty\"`\n\tDetail    string `json:\"detail,omitempty\"`\n\tUpdatedAt string `json:\"updated_at,omitempty\"`\n}\n```\nCheckResult represents a single health check result\n\n```go\ntype DashboardHandler struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\ntype HealthHandler struct {\n\t// contains filtered or unexported fields\n}\n```\nHealthHandler handles health check endpoints\n\n```go\nfunc NewHealthHandler(duck *engine.Duck, cfg config.Config) *HealthHandler\n```\nNewHealthHandler creates a new health handler\n\n```go\nfunc (h *HealthHandler) Liveness(c *echo.Context) error\n```\nLiveness returns 200 while the process can serve (Kubernetes liveness probe). It fails only for a stall in Pitot's own work that a restart would free: a Parquet publication holding reads out past its bound, or an idle engine that cannot answer a ping. An overloaded engine, however saturated, is alive, and so is one running a costly query past its deadline: a restart would only let the query run again.\n\n```go\nfunc (h *HealthHandler) Readiness(c *echo.Context) error\n```\nReadiness checks all dependencies (Kubernetes readiness probe)\n\n```go\ntype HealthResponse struct {\n\tStatus        string                 `json:\"status\"`\n\tChecks        map[string]CheckResult `json:\"checks\"`\n\tRuntimeSizing config.RuntimeSizing   `json:\"runtime_sizing\"`\n}\n```\nHealthResponse represents the full health check response\n\n```go\ntype IntelligenceSnapshots interface {\n\tLatestSnapshot() *intelligence.Snapshot\n}\n```\nIntelligenceSnapshots is the read side of the detector used by HTTP and other consumers. Keeping the interface narrow makes the endpoint independent of how snapshots are generated or retained.\n\n```go\ntype MCPAuthorization struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewMCPAuthorization(store *appauth.OAuthStore, users *appauth.UserStore, resourceURL string) (*MCPAuthorization, error)\n```\n\n```go\nfunc (h *MCPAuthorization) AuthorizationServerMetadata(c *echo.Context) error\n```\n\n```go\nfunc (h *MCPAuthorization) Authorize(c *echo.Context) error\n```\n\n```go\nfunc (h *MCPAuthorization) ListConnections(c *echo.Context) error\n```\n\n```go\nfunc (h *MCPAuthorization) ProtectBrowserMCP(sessions *appauth.BrowserSessions, next http.Handler) echo.HandlerFunc\n```\nProtectBrowserMCP adapts an already-authenticated browser session to the standard MCP transport identity consumed by the SDK. The public /mcp route remains OAuth bearer-only; this adapter is used only by the same-origin /api/mcp route after AuthMiddleware has validated the session and CSRF header.\n\n```go\nfunc (h *MCPAuthorization) ProtectMCP(next http.Handler) http.Handler\n```\n\n```go\nfunc (h *MCPAuthorization) ProtectedResourceMetadata(c *echo.Context) error\n```\n\n```go\nfunc (h *MCPAuthorization) Register(e *echo.Echo)\n```\n\n```go\nfunc (h *MCPAuthorization) RegisterClient(c *echo.Context) error\n```\n\n```go\nfunc (h *MCPAuthorization) RevokeConnection(c *echo.Context) error\n```\n\n```go\nfunc (h *MCPAuthorization) Token(c *echo.Context) error\n```\n\n```go\ntype OIDCDiscovery struct {\n\t// contains filtered or unexported fields\n}\n```\nOIDCDiscovery resolves the identity provider's metadata. An unreachable provider must not take ingest and existing sessions down with it, so a failed startup attempt is retried in the background while the login routes answer 503.\n\n```go\nfunc RegisterOIDCRoutes(ctx context.Context, e *echo.Echo, cfg config.Config, users *appauth.UserStore, identities *appauth.IdentityStore, sessions *appauth.BrowserSessions, audit *appauth.AuditStore) (*OIDCDiscovery, error)\n```\nRegisterOIDCRoutes makes one bounded discovery attempt and registers the login routes. It fails only on invalid configuration; if the provider is merely unavailable the routes answer 503 while discovery retries until ctx ends. The returned discovery is nil outside OIDC mode.\n\n```go\ntype OIDCHandler struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (h *OIDCHandler) Callback(c *echo.Context) error\n```\n\n```go\nfunc (h *OIDCHandler) Start(c *echo.Context) error\n```\n\n```go\ntype PitotQLHandler struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\ntype QueryEngine interface {\n\tExemplars(context.Context, query.ExemplarRequest) (query.ExemplarResponse, error)\n\tRun(context.Context, query.RunRequest) ([]query.Result, error)\n\tStream(context.Context, query.RunRequest, func(query.Result)) error\n\tResolveVariables(context.Context, query.ResolveRequest) (map[string][]query.Option, error)\n\tSchema(context.Context, query.SchemaRequest) (*query.Schema, error)\n}\n```\n\n```go\ntype QueryHandler struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\ntype RouteDoc struct {\n\tMethod string\n\tPath   string\n\t// Policy is one of the RoutePolicy* constants above.\n\tPolicy string\n\t// Capability is set only when Policy is RoutePolicyCapability or\n\t// RoutePolicyServiceCredential; empty otherwise.\n\tCapability string\n}\n```\nRouteDoc is what a reader needs to know before calling a route: whether it needs a credential, and if so which capability that credential must carry.\n\n```go\nfunc DescribeRoute(method, path string) (RouteDoc, bool)\n```\nDescribeRoute reports how the middleware would classify this method and path. The second return is false when the pair reaches no case — which for a registered route means the method is not permitted on it.\n\n```go\ntype SCIMHandler struct {\n\t// contains filtered or unexported fields\n}\n```\nSCIMHandler serves the narrow SCIM 2.0 subset used to provision accounts: create, look up, and patch a user. Requests are authenticated by the route policy in AuthMiddleware before they reach it.\n\n```go\ntype SettingsHandler struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (h *SettingsHandler) CreateIngestToken(c *echo.Context) error\n```\nCreateIngestToken issues a named token. The plaintext appears only in this response, which must never be cached.\n\n```go\nfunc (h *SettingsHandler) GetIngest(c *echo.Context) error\n```\nGetIngest returns connection metadata and whether any token is active. Token names and hints are not part of it.\n\n```go\nfunc (h *SettingsHandler) ListIngestTokens(c *echo.Context) error\n```\nListIngestTokens returns active tokens only: revoked rows are kept for audit and for the seed rule, but no longer identify anything an administrator can act on.\n\n```go\nfunc (h *SettingsHandler) RevokeIngestToken(c *echo.Context) error\n```\nRevokeIngestToken stops one token. Revoking the last active token is allowed; the browser warns first because ingest then rejects every export.\n\n```go\ntype TraceHandler struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\ntype TraceQueries interface {\n\tTrace(context.Context, observability.Scope, string, string, int) (observability.Result[observability.TraceDetail], error)\n}\n```\n\n```go\ntype UserHandler struct {\n\t// contains filtered or unexported fields\n}\n```\nUserHandler handles admin user management endpoints.\n\n```go\nfunc (h *UserHandler) CreateUser(c *echo.Context) error\n```\nCreateUser adds a new user (admin only).\n\n```go\nfunc (h *UserHandler) DeleteUser(c *echo.Context) error\n```\nDeleteUser removes a user (admin only).\n\n```go\nfunc (h *UserHandler) ListUsers(c *echo.Context) error\n```\nListUsers returns all users.\n\n```go\nfunc (h *UserHandler) RevokeAccess(c *echo.Context) error\n```\nRevokeAccess invalidates existing browser sessions and OAuth tokens. The account remains active and can sign in again.\n\n```go\nfunc (h *UserHandler) UpdateRole(c *echo.Context) error\n```\nUpdateRole modifies a user's role (admin only).\n\n```go\nfunc (h *UserHandler) UpdateStatus(c *echo.Context) error\n```\nUpdateStatus modifies a user's status (admin only).\n\n```go\nfunc (h *UserHandler) UpdateUser(c *echo.Context) error\n```\nUpdateUser modifies only a user's profile (admin only).\n\n","path":"github.com/labstack/pitot/internal/api","name":"api","synopsis":"","isRedistributable":true}
