Documentation
¶
Index ¶
Constants ¶
const PathPrefix = "/e2b"
const RuntimePath = PathPrefix + "/runtime"
RuntimePath is the envd runtime proxy. It is the one /e2b route with no API principal: the sandbox's own envd token guards it (and nothing does when the caller created the sandbox with secure:false), so it sits on the registry test's public allowlist.
Variables ¶
This section is empty.
Functions ¶
func RegisterRoutes ¶
RegisterRoutes mounts the supported E2B control-plane compatibility surface.
func WriteError ¶
func WriteError(w http.ResponseWriter, status int, message string)
WriteError writes the E2B error envelope shape expected by the SDK.
func WriteErrorReason ¶ added in v0.6.8
func WriteErrorReason(w http.ResponseWriter, status int, message, reason string)
WriteErrorReason is WriteError with the D17 refusal reason in the body (omitted when empty). The API edge sets the matching WWW-Authenticate header before calling it.
Types ¶
type Deps ¶
type Deps struct {
Service *service.Service
Logger *slog.Logger
// Auth authenticates a request with the E2B credential headers
// (pkg/api). Routes never call it directly: Route composes it with the
// permission check.
Auth func(http.Handler) http.Handler
// Audit is the seam task T5 fills with kind "api" records
// (apihttp.AuditHook). nil records nothing.
Audit apihttp.AuditHook
// TemplateMapJSON maps template ids → images (SB_E2B_TEMPLATE_MAP_JSON),
// ClientID is the client id the SDK echoes (SB_E2B_CLIENT_ID). Both are
// read once in config; the facade parses TemplateMapJSON and applies its
// own defaults.
TemplateMapJSON string
ClientID string
// ListGate bounds the cluster-wide lists this node runs at once
// (clusterlist.Admit); nil admits every list. One gate is shared by v1
// and every facade: they cost the same fan-out.
ListGate *apihttp.Gate
}
Deps are the shared dependencies the E2B facade needs from the top-level API package.
func (Deps) Route ¶ added in v0.6.8
func (d Deps) Route(perm controlplane.Permission, h http.Handler) http.Handler
Route returns h behind authenticate → authorize(perm) → audit seam (plans/identity-and-access.md §5.3).