api

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2026 License: GPL-3.0 Imports: 43 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIAuth added in v0.0.2

func APIAuth(srv *server.Server) func(http.Handler) http.Handler

APIAuth returns a chi middleware that authenticates control-plane requests.

Authentication sources tried in order:

  1. Session cookie (OIDC session)
  2. PAT (Authorization: Bearer by_...)
  3. Reject (401)

func AddAppTag added in v0.0.2

func AddAppTag(srv *server.Server) http.HandlerFunc

AddAppTag attaches a tag to an app. Requires owner/collaborator/admin.

@Summary		Add tag to app
@Description	Attach a tag to an app. Requires owner, collaborator, or admin role.
@Tags			tags
@Accept			json
@Param			id		path	string			true	"App ID (UUID) or name"
@Param			body	body	addAppTagRequest	true	"Tag to attach"
@Success		204		"Tag attached"
@Failure		400		{object}	errorResponse
@Failure		404		{object}	errorResponse
@Failure		500		{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id}/tags [post]

func AppIDFromContext added in v0.0.3

func AppIDFromContext(ctx context.Context) string

AppIDFromContext extracts the app ID set by WorkerAuth middleware.

func AppLogs

func AppLogs(srv *server.Server) http.HandlerFunc

AppLogs streams logs from the LogStore for a specific worker.

@Summary		Stream app logs
@Description	Stream worker logs for an app. Returns buffered output immediately; streams live lines unless stream=false.
@Tags			apps
@Produce		plain
@Param			id			path	string	true	"App ID (UUID) or name"
@Param			worker_id	query	string	true	"Worker ID"
@Param			stream		query	string	false	"Set to 'false' to return buffered logs only"
@Success		200			"Log output (text/plain, chunked)"
@Failure		400			{object}	errorResponse
@Failure		404			{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id}/logs [get]

func CatalogHandler added in v0.0.2

func CatalogHandler(srv *server.Server) http.HandlerFunc

CatalogHandler returns GET /api/v1/catalog — a paginated, RBAC-filtered listing of apps with metadata, tags, and search/filter support.

@Summary		List catalog
@Description	Paginated, RBAC-filtered app listing with tags and search. Deprecated — use GET /apps with search/tag params.
@Tags			catalog
@Produce		json
@Param			search		query		string	false	"Search by name/title"
@Param			tag			query		string	false	"Filter by tag name"
@Param			page		query		int		false	"Page number"	default(1)
@Param			per_page	query		int		false	"Items per page (1-100)"	default(20)
@Success		200			{object}	catalogResponse
@Failure		500			{object}	errorResponse
@Security		BearerAuth
@Deprecated
@Router			/catalog [get]

func CheckIDP added in v0.0.3

func CheckIDP(ctx context.Context, srv *server.Server) error

CheckIDP verifies the IdP's discovery endpoint is reachable.

func CreateApp

func CreateApp(srv *server.Server) http.HandlerFunc

CreateApp creates a new application.

@Summary		Create app
@Description	Create a new application owned by the caller.
@Tags			apps
@Accept			json
@Produce		json
@Param			body	body		createAppRequest	true	"App name"
@Success		201		{object}	AppResponse
@Failure		400		{object}	errorResponse
@Failure		403		{object}	errorResponse
@Failure		409		{object}	errorResponse
@Failure		500		{object}	errorResponse
@Security		BearerAuth
@Router			/apps [post]

func CreateTag added in v0.0.2

func CreateTag(srv *server.Server) http.HandlerFunc

CreateTag creates a new tag (admin only).

@Summary		Create tag
@Description	Create a new tag. Admin only. Name must be a lowercase slug.
@Tags			tags
@Accept			json
@Produce		json
@Param			body	body		createTagRequest	true	"Tag name"
@Success		201		{object}	tagResponse
@Failure		400		{object}	errorResponse
@Failure		404		{object}	errorResponse
@Failure		409		{object}	errorResponse
@Failure		500		{object}	errorResponse
@Security		BearerAuth
@Router			/tags [post]

func CreateToken added in v0.0.2

func CreateToken(srv *server.Server) http.HandlerFunc

CreateToken handles POST /api/v1/users/me/tokens — create a new PAT. Session-only: PATs cannot create other PATs.

@Summary		Create personal access token
@Description	Create a new PAT. Can only be called via browser session (not via another PAT). The token value is returned only once.
@Tags			tokens
@Accept			json
@Produce		json
@Param			body	body		createTokenRequest	true	"Token name and optional expiry"
@Success		201		{object}	createTokenResponse
@Failure		400		{object}	errorResponse
@Failure		401		{object}	errorResponse
@Failure		403		{object}	errorResponse
@Failure		500		{object}	errorResponse
@Security		BearerAuth
@Router			/users/me/tokens [post]

func DeleteApp

func DeleteApp(srv *server.Server) http.HandlerFunc

DeleteApp soft-deletes an application (or hard-deletes with ?purge=true, admin only).

@Summary		Delete app
@Description	Soft-delete an app, stopping all workers. Use ?purge=true for permanent deletion (admin only, app must be soft-deleted first).
@Tags			apps
@Param			id		path	string	true	"App ID (UUID) or name"
@Param			purge	query	bool	false	"Permanently delete (admin only)"
@Success		204		"Deleted"
@Failure		403		{object}	errorResponse
@Failure		404		{object}	errorResponse
@Failure		409		{object}	errorResponse
@Failure		500		{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id} [delete]

func DeleteTag added in v0.0.2

func DeleteTag(srv *server.Server) http.HandlerFunc

DeleteTag deletes a tag by ID (admin only). Cascades to app_tags.

@Summary		Delete tag
@Description	Delete a tag. Admin only. Cascades to all app-tag associations.
@Tags			tags
@Param			tagID	path	string	true	"Tag ID"
@Success		204		"Deleted"
@Failure		404		{object}	errorResponse
@Failure		500		{object}	errorResponse
@Security		BearerAuth
@Router			/tags/{tagID} [delete]

func DisableApp added in v0.0.3

func DisableApp(srv *server.Server) http.HandlerFunc

DisableApp handles POST /api/v1/apps/{id}/disable.

@Summary		Disable app
@Description	Disable an app, draining active sessions and stopping all workers.
@Tags			apps
@Produce		json
@Param			id	path		string	true	"App ID (UUID) or name"
@Success		200	{object}	appResponseV2JSON
@Failure		404	{object}	errorResponse
@Failure		500	{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id}/disable [post]

func EnableApp added in v0.0.3

func EnableApp(srv *server.Server) http.HandlerFunc

EnableApp handles POST /api/v1/apps/{id}/enable.

@Summary		Enable app
@Description	Enable an app, allowing it to accept traffic and start workers.
@Tags			apps
@Produce		json
@Param			id	path		string	true	"App ID (UUID) or name"
@Success		200	{object}	appResponseV2JSON
@Failure		404	{object}	errorResponse
@Failure		500	{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id}/enable [post]

func EnrollCredential added in v0.0.2

func EnrollCredential(srv *server.Server) http.HandlerFunc

EnrollCredential handles POST /api/v1/users/me/credentials/{service}. Stores a user's credential in the vault 's KV v2 store.

@Summary		Enroll credential
@Description	Store a credential (API key) for an external service in the vault.
@Tags			credentials
@Accept			json
@Param			service	path	string	true	"Service name (alphanumeric, hyphens, underscores)"
@Success		204		"Credential stored"
@Failure		400		{object}	errorResponse
@Failure		401		{object}	errorResponse
@Failure		500		{object}	errorResponse
@Failure		503		{object}	errorResponse
@Security		BearerAuth
@Router			/users/me/credentials/{service} [post]

func ExchangeBootstrapToken added in v0.0.3

func ExchangeBootstrapToken(srv *server.Server) http.HandlerFunc

ExchangeBootstrapToken handles POST /api/v1/bootstrap.

Exchanges a one-time bootstrap token for a real PAT. The bootstrap token is burned after the first successful exchange.

func ExchangeVaultCredential added in v0.0.2

func ExchangeVaultCredential(srv *server.Server) http.HandlerFunc

ExchangeVaultCredential handles POST /api/v1/credentials/vault. Accepts a session reference token (as Bearer auth), validates it, and returns a scoped vault token.

This endpoint does NOT use the standard API bearer token auth. The session reference token is its own authentication — it proves the caller was routed through the proxy to a specific worker.

@Summary		Exchange vault credential
@Description	Exchange a proxy session reference token for a scoped vault token. Used internally by workers.
@Tags			credentials
@Produce		json
@Success		200	{object}	vaultExchangeResponse
@Failure		401	{object}	errorResponse
@Failure		502	{object}	errorResponse
@Failure		503	{object}	errorResponse
@Router			/credentials/vault [post]

func GetApp

func GetApp(srv *server.Server) http.HandlerFunc

GetApp returns a single application by ID or name.

@Summary		Get app
@Description	Get a single application by UUID or name. Returns 404 if not found or caller has no access.
@Tags			apps
@Produce		json
@Param			id	path		string	true	"App ID (UUID) or name"
@Success		200	{object}	appResponseV2JSON
@Failure		404	{object}	errorResponse
@Failure		500	{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id} [get]

func GetAppRuntime added in v0.0.3

func GetAppRuntime(srv *server.Server) http.HandlerFunc

GetAppRuntime returns live operational data for an app (collaborator+).

@Summary		Get app runtime
@Description	Returns live workers, sessions, container stats, and activity metrics for an app.
@Tags			apps
@Produce		json
@Param			id	path		string	true	"App ID (UUID) or name"
@Success		200	{object}	runtimeResponse
@Failure		404	{object}	errorResponse
@Failure		500	{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id}/runtime [get]

func GetCurrentUser added in v0.0.3

func GetCurrentUser(srv *server.Server) http.HandlerFunc

GetCurrentUser returns GET /api/v1/users/me — caller's own profile.

@Summary		Get current user
@Description	Returns the authenticated caller's profile (sub, email, name, role).
@Tags			users
@Produce		json
@Success		200	{object}	currentUserResponse
@Failure		401	{object}	errorResponse
@Failure		500	{object}	errorResponse
@Security		BearerAuth
@Router			/users/me [get]

func GetSystemChecks added in v0.0.3

func GetSystemChecks(srv *server.Server) http.HandlerFunc

GetSystemChecks returns the latest cached system check report.

@Summary      Get system check report
@Description  Returns the latest cached system check report. Admin only.
@Tags         system
@Produce      json
@Success      200  {object}  preflight.Report
@Failure      403  {object}  errorResponse
@Router       /api/v1/system/checks [get]

func GetTaskStatus

func GetTaskStatus(srv *server.Server) http.HandlerFunc

GetTaskStatus returns the status of a background task.

@Summary		Get task status
@Description	Returns the current status (running, completed, failed) of a background task.
@Tags			tasks
@Produce		json
@Param			taskID	path		string	true	"Task ID"
@Success		200		{object}	taskStatusResponse
@Failure		404		{object}	errorResponse
@Security		BearerAuth
@Router			/tasks/{taskID} [get]

func GetUser added in v0.0.2

func GetUser(srv *server.Server) http.HandlerFunc

GetUser handles GET /api/v1/users/{sub} — get a single user.

@Summary		Get user
@Description	Get a single user by sub. Admin only.
@Tags			users
@Produce		json
@Param			sub	path		string	true	"User sub (OIDC subject)"
@Success		200	{object}	db.UserRow
@Failure		403	{object}	errorResponse
@Failure		404	{object}	errorResponse
@Failure		500	{object}	errorResponse
@Security		BearerAuth
@Router			/users/{sub} [get]

func GrantAccess added in v0.0.2

func GrantAccess(srv *server.Server) http.HandlerFunc

GrantAccess grants access to an app for a user.

@Summary		Grant access
@Description	Grant a user viewer or collaborator access to an app. Requires owner or admin role.
@Tags			access
@Accept			json
@Param			id		path	string			true	"App ID (UUID) or name"
@Param			body	body	grantRequest	true	"Access grant"
@Success		204		"Access granted"
@Failure		400		{object}	errorResponse
@Failure		404		{object}	errorResponse
@Failure		500		{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id}/access [post]

func HardDeleteApp added in v0.0.3

func HardDeleteApp(srv *server.Server, purge bool, w http.ResponseWriter, r *http.Request,
	caller *auth.CallerIdentity, id string)

HardDeleteApp handles DELETE /api/v1/apps/{id}?purge=true — admin-only permanent deletion.

func ListAccess added in v0.0.2

func ListAccess(srv *server.Server) http.HandlerFunc

ListAccess lists all access grants for an app.

@Summary		List access grants
@Description	List all ACL entries for an app. Requires owner or admin role.
@Tags			access
@Produce		json
@Param			id	path		string	true	"App ID (UUID) or name"
@Success		200	{array}		accessGrantResponse
@Failure		404	{object}	errorResponse
@Failure		500	{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id}/access [get]

func ListAppSessions added in v0.0.3

func ListAppSessions(srv *server.Server) http.HandlerFunc

ListAppSessions returns GET /api/v1/apps/{id}/sessions — list sessions for an app.

@Summary		List app sessions
@Description	List sessions for an app. Supports filtering by user and status.
@Tags			apps
@Produce		json
@Param			id		path		string	true	"App ID (UUID) or name"
@Param			user	query		string	false	"Filter by user sub"
@Param			status	query		string	false	"Filter by status (active, ended)"
@Param			limit	query		int		false	"Max results (1-200)"	default(50)
@Success		200		{object}	sessionListResponse
@Failure		404		{object}	errorResponse
@Failure		500		{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id}/sessions [get]

func ListAppTags added in v0.0.3

func ListAppTags(srv *server.Server) http.HandlerFunc

ListAppTags returns GET /api/v1/apps/{id}/tags — list tags for an app.

@Summary		List app tags
@Description	List all tags attached to an app.
@Tags			tags
@Produce		json
@Param			id	path		string	true	"App ID (UUID) or name"
@Success		200	{object}	appTagListResponse
@Failure		404	{object}	errorResponse
@Failure		500	{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id}/tags [get]

func ListApps

func ListApps(srv *server.Server) http.HandlerFunc

func ListAppsV2 added in v0.0.3

func ListAppsV2(srv *server.Server) http.HandlerFunc

ListAppsV2 handles GET /api/v1/apps — consolidated with catalog, paginated.

@Summary		List apps
@Description	List apps with RBAC filtering, search, tag filter, and pagination. Use ?deleted=true for soft-deleted apps (admin only).
@Tags			apps
@Produce		json
@Param			search		query		string	false	"Search by name/title"
@Param			tag			query		string	false	"Filter by tag name"
@Param			deleted		query		bool	false	"Show soft-deleted apps (admin only)"
@Param			page		query		int		false	"Page number"	default(1)
@Param			per_page	query		int		false	"Items per page (1-100)"	default(25)
@Success		200			{object}	appListResponse
@Failure		403			{object}	errorResponse
@Failure		500			{object}	errorResponse
@Security		BearerAuth
@Router			/apps [get]

func ListBundles

func ListBundles(srv *server.Server) http.HandlerFunc

ListBundles lists all bundles for an app.

@Summary		List bundles
@Description	List all bundles for an app, ordered by upload time.
@Tags			bundles
@Produce		json
@Param			id	path		string	true	"App ID (UUID) or name"
@Success		200	{object}	bundleListResponse
@Failure		404	{object}	errorResponse
@Failure		500	{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id}/bundles [get]

func ListDeployments added in v0.0.3

func ListDeployments(srv *server.Server) http.HandlerFunc

ListDeployments returns GET /api/v1/deployments — cross-app deployment listing.

@Summary		List deployments
@Description	List bundle deployments across all apps. Supports search, status filter, and pagination.
@Tags			deployments
@Produce		json
@Param			search		query		string	false	"Search by app name"
@Param			status		query		string	false	"Filter by status (e.g. ready, pending, failed)"
@Param			page		query		int		false	"Page number"	default(1)
@Param			per_page	query		int		false	"Items per page (1-100)"	default(25)
@Success		200			{object}	deploymentsResponse
@Failure		403			{object}	errorResponse
@Failure		500			{object}	errorResponse
@Security		BearerAuth
@Router			/deployments [get]

func ListTags added in v0.0.2

func ListTags(srv *server.Server) http.HandlerFunc

ListTags returns all tags, sorted by name.

@Summary		List tags
@Description	List all tags, sorted alphabetically.
@Tags			tags
@Produce		json
@Success		200	{array}		tagResponse
@Failure		500	{object}	errorResponse
@Security		BearerAuth
@Router			/tags [get]

func ListTokens added in v0.0.2

func ListTokens(srv *server.Server) http.HandlerFunc

ListTokens handles GET /api/v1/users/me/tokens — list caller's PATs.

@Summary		List personal access tokens
@Description	List all PATs for the authenticated user.
@Tags			tokens
@Produce		json
@Success		200	{array}		db.PATRow
@Failure		401	{object}	errorResponse
@Failure		500	{object}	errorResponse
@Security		BearerAuth
@Router			/users/me/tokens [get]

func ListUsers added in v0.0.2

func ListUsers(srv *server.Server) http.HandlerFunc

ListUsers handles GET /api/v1/users — list all users.

@Summary		List users
@Description	List all users. Admin only.
@Tags			users
@Produce		json
@Success		200	{array}		db.UserRow
@Failure		403	{object}	errorResponse
@Failure		500	{object}	errorResponse
@Security		BearerAuth
@Router			/users [get]

func NewManagementRouter added in v0.0.2

func NewManagementRouter(srv *server.Server) http.Handler

NewManagementRouter creates the HTTP handler for the management listener. It serves /healthz, /readyz, and /metrics without authentication. This listener is intended to bind to an internal-only address.

func NewRouter

func NewRouter(srv *server.Server, startBG func(), orch *orchestrator.Orchestrator, bgCtx context.Context) http.Handler

func PostPackages added in v0.0.3

func PostPackages(srv *server.Server) http.HandlerFunc

PostPackages handles runtime package installation requests from workers.

func PostRefresh added in v0.0.3

func PostRefresh(srv *server.Server) http.HandlerFunc

PostRefresh starts a dependency refresh for an unpinned deployment.

@Summary		Refresh dependencies
@Description	Start a background dependency refresh for the active bundle. Fails if the bundle was deployed with pinned dependencies.
@Tags			refresh
@Produce		json
@Param			id	path		string	true	"App ID (UUID) or name"
@Success		202	{object}	asyncTaskResponse
@Failure		404	{object}	errorResponse
@Failure		409	{object}	errorResponse
@Failure		500	{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id}/refresh [post]

func PostRefreshRollback added in v0.0.3

func PostRefreshRollback(srv *server.Server) http.HandlerFunc

PostRefreshRollback rolls back to a previous refresh or the original build.

@Summary		Rollback refresh
@Description	Roll back to the previous refresh or the original build (?target=build). Starts a background task.
@Tags			refresh
@Produce		json
@Param			id		path		string	true	"App ID (UUID) or name"
@Param			target	query		string	false	"Rollback target: 'build' for original deploy, omit for previous refresh"
@Success		202		{object}	asyncTaskResponse
@Failure		404		{object}	errorResponse
@Failure		409		{object}	errorResponse
@Failure		500		{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id}/refresh/rollback [post]

func RemoveAppTag added in v0.0.2

func RemoveAppTag(srv *server.Server) http.HandlerFunc

RemoveAppTag detaches a tag from an app. Requires owner/collaborator/admin.

@Summary		Remove tag from app
@Description	Detach a tag from an app. Requires owner, collaborator, or admin role.
@Tags			tags
@Param			id		path	string	true	"App ID (UUID) or name"
@Param			tagID	path	string	true	"Tag ID"
@Success		204		"Tag removed"
@Failure		404		{object}	errorResponse
@Failure		500		{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id}/tags/{tagID} [delete]

func RenameTag added in v0.0.3

func RenameTag(srv *server.Server) http.HandlerFunc

RenameTag updates a tag's name. Requires admin/publisher.

@Summary		Rename tag
@Description	Update a tag's name. Requires admin or publisher role.
@Tags			tags
@Accept			json
@Param			tagID	path	string				true	"Tag ID"
@Param			body	body	renameTagRequest	true	"New tag name"
@Success		200		{object}	tagResponse
@Failure		400		{object}	errorResponse
@Failure		404		{object}	errorResponse
@Failure		409		{object}	errorResponse
@Failure		500		{object}	errorResponse
@Security		BearerAuth
@Router			/tags/{tagID} [patch]

func RestoreApp added in v0.0.3

func RestoreApp(srv *server.Server) http.HandlerFunc

RestoreApp restores a soft-deleted application.

@Summary		Restore deleted app
@Description	Restore a soft-deleted app. Only admins and the original owner can restore.
@Tags			apps
@Produce		json
@Param			id	path		string	true	"App ID (UUID) or name"
@Success		200	{object}	AppResponse
@Failure		404	{object}	errorResponse
@Failure		409	{object}	errorResponse
@Failure		500	{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id}/restore [post]

func RevokeAccess added in v0.0.2

func RevokeAccess(srv *server.Server) http.HandlerFunc

RevokeAccess revokes a user's access to an app.

@Summary		Revoke access
@Description	Remove a specific access grant from an app. Requires owner or admin role.
@Tags			access
@Param			id			path	string	true	"App ID (UUID) or name"
@Param			kind		path	string	true	"Grant kind (e.g. 'user')"
@Param			principal	path	string	true	"User sub"
@Success		204			"Access revoked"
@Failure		404			{object}	errorResponse
@Failure		500			{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id}/access/{kind}/{principal} [delete]

func RevokeAllTokens added in v0.0.2

func RevokeAllTokens(srv *server.Server) http.HandlerFunc

RevokeAllTokens handles DELETE /api/v1/users/me/tokens — revoke all PATs.

@Summary		Revoke all tokens
@Description	Revoke all personal access tokens for the authenticated user.
@Tags			tokens
@Success		204		"All tokens revoked"
@Failure		401		{object}	errorResponse
@Failure		500		{object}	errorResponse
@Security		BearerAuth
@Router			/users/me/tokens [delete]

func RevokeToken added in v0.0.2

func RevokeToken(srv *server.Server) http.HandlerFunc

RevokeToken handles DELETE /api/v1/users/me/tokens/{tokenID} — revoke a single PAT.

@Summary		Revoke token
@Description	Revoke a single personal access token by ID.
@Tags			tokens
@Param			tokenID	path	string	true	"Token ID"
@Success		204		"Token revoked"
@Failure		401		{object}	errorResponse
@Failure		404		{object}	errorResponse
@Failure		500		{object}	errorResponse
@Security		BearerAuth
@Router			/users/me/tokens/{tokenID} [delete]

func RollbackApp added in v0.0.3

func RollbackApp(srv *server.Server) http.HandlerFunc

RollbackApp switches an app to a previous bundle.

@Summary		Rollback app bundle
@Description	Switch an app's active bundle to a previous one. Stops running workers and activates the target bundle.
@Tags			apps
@Accept			json
@Produce		json
@Param			id		path		string			true	"App ID (UUID) or name"
@Param			body	body		rollbackRequest	true	"Target bundle"
@Success		200		{object}	AppResponse
@Failure		400		{object}	errorResponse
@Failure		404		{object}	errorResponse
@Failure		500		{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id}/rollback [post]

func RunSystemChecks added in v0.0.3

func RunSystemChecks(srv *server.Server) http.HandlerFunc

RunSystemChecks triggers a new dynamic check run and returns the full report.

@Summary      Run system checks
@Description  Triggers a new dynamic check run and returns the combined report. Admin only.
@Tags         system
@Produce      json
@Success      200  {object}  preflight.Report
@Failure      403  {object}  errorResponse
@Router       /api/v1/system/checks/run [post]

func StartApp

func StartApp(srv *server.Server) http.HandlerFunc

func StopApp

func StopApp(srv *server.Server) http.HandlerFunc

func TaskLogs

func TaskLogs(srv *server.Server) http.HandlerFunc

TaskLogs streams the log output of a background task.

@Summary		Stream task logs
@Description	Stream log output for a background task (e.g. bundle restore). Returns buffered output, then follows live lines until task completes.
@Tags			tasks
@Produce		plain
@Param			taskID	path	string	true	"Task ID"
@Success		200		"Log output (text/plain, chunked)"
@Failure		404		{object}	errorResponse
@Security		BearerAuth
@Router			/tasks/{taskID}/logs [get]

func UpdateApp

func UpdateApp(srv *server.Server) http.HandlerFunc

UpdateApp updates an application's configuration.

@Summary		Update app
@Description	Update an application's settings. All fields are optional. Changing access_type requires owner/admin.
@Tags			apps
@Accept			json
@Produce		json
@Param			id		path		string				true	"App ID (UUID) or name"
@Param			body	body		updateAppRequest	true	"Fields to update"
@Success		200		{object}	appResponseV2JSON
@Failure		400		{object}	errorResponse
@Failure		404		{object}	errorResponse
@Failure		500		{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id} [patch]

func UpdateUser added in v0.0.2

func UpdateUser(srv *server.Server) http.HandlerFunc

UpdateUser handles PATCH /api/v1/users/{sub} — update a user's role or active status.

@Summary		Update user
@Description	Update a user's role or active status. Admin only. Cannot modify own account.
@Tags			users
@Accept			json
@Produce		json
@Param			sub		path		string				true	"User sub (OIDC subject)"
@Param			body	body		updateUserRequest	true	"Fields to update"
@Success		200		{object}	db.UserRow
@Failure		400		{object}	errorResponse
@Failure		403		{object}	errorResponse
@Failure		404		{object}	errorResponse
@Failure		500		{object}	errorResponse
@Security		BearerAuth
@Router			/users/{sub} [patch]

func UploadBundle

func UploadBundle(srv *server.Server) http.HandlerFunc

UploadBundle uploads a new bundle archive for an app.

@Summary		Upload bundle
@Description	Upload a tar.gz bundle archive. Triggers async restore (package installation). Track progress via the returned task_id.
@Tags			bundles
@Accept			application/gzip
@Produce		json
@Param			id	path		string	true	"App ID (UUID) or name"
@Success		202	{object}	uploadBundleResponse
@Failure		400	{object}	errorResponse
@Failure		404	{object}	errorResponse
@Failure		413	{object}	errorResponse
@Failure		500	{object}	errorResponse
@Security		BearerAuth
@Router			/apps/{id}/bundles [post]

func UserAuth added in v0.0.2

func UserAuth(srv *server.Server) func(http.Handler) http.Handler

UserAuth returns a middleware that authenticates via session cookie or PAT bearer token. Produces a CallerIdentity in context either way. Used for /api/v1/users/me/ routes where both app-plane and control-plane users need access.

func WorkerAuth added in v0.0.3

func WorkerAuth(signingKey *auth.SigningKey) func(http.Handler) http.Handler

WorkerAuth validates the worker HMAC token and injects worker/app IDs into the request context.

func WorkerIDFromContext added in v0.0.3

func WorkerIDFromContext(ctx context.Context) string

WorkerIDFromContext extracts the worker ID set by WorkerAuth middleware.

Types

type AppResponse

type AppResponse struct {
	ID                   string   `json:"id"`
	Name                 string   `json:"name"`
	Owner                string   `json:"owner"`
	AccessType           string   `json:"access_type"`
	ActiveBundle         *string  `json:"active_bundle"`
	MaxWorkersPerApp     *int     `json:"max_workers_per_app"`
	MaxSessionsPerWorker int      `json:"max_sessions_per_worker"`
	MemoryLimit          *string  `json:"memory_limit"`
	CPULimit             *float64 `json:"cpu_limit"`
	Title                *string  `json:"title"`
	Description          *string  `json:"description"`
	PreWarmedSessions    int      `json:"pre_warmed_sessions"`
	CreatedAt            string   `json:"created_at"`
	UpdatedAt            string   `json:"updated_at"`
	DeletedAt            *string  `json:"deleted_at,omitempty"`
	Status               string   `json:"status"`
	Workers              []string `json:"workers"`
}

AppResponse wraps an AppRow with a derived runtime status.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL