Documentation
¶
Overview ¶
Package admin is the operator's view of the fleet: orgs, users, roles, spend and system health.
It mounts the god-mode surface (/v1/admin/*) the Hanzo Admin Console (admin.hanzo.ai, apps/operator) calls, per the api.ts contract.
It is an AGGREGATOR, not a new store: identity (orgs/users/roles/applications/audit/me) is read from IAM, the money panels (spend/tokens/credits) from commerce, and System Health from o11y — every one a real upstream. The facade fans out over HTTP, shaping the reads into the /v1 envelope { status, msg, data, total } the operator's transport decodes.
The subsystem is decomposed into a shared kernel (clients/admin/core) plus one package per handler domain (audit/customer/revenue/finance). This file is the Mount: it builds the ONE core.State from Deps, then registers each domain's routes alongside the top-level reads (me/overview/orgs/users/usage/roles/applications/products/compute/o11y/ analytics/bases + the flags/waitlist control plane).
SECURITY — TWO tiers off ONE identity predicate, both fail-closed. PLATFORM ops are SuperAdmin ONLY (core.Admit). ORG-SCOPED ops (me/overview/orgs/users/usage/analytics/ bases) call core.AdmitScoped: a SuperAdmin sees EVERY tenant; any other validated admin caller is HARD-limited to their OWN org subtree by core.ResolveScope/ScopedOrgs.
SHAPE — every route is a zip TYPED op (zip.Get[In, Out]), so the /v1/admin surface is ONE registry with N projections: REST, the OpenAPI document, the MCP tool list and the CLI all derive from these declarations. Out is the /v1 envelope as a Go type, so the operator's contract is checked by the compiler instead of restated by hand.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Mount ¶
Mount registers the /v1/admin/* surface on app. Every handler gates on the validated identity first (via core.Admit/AdmitScoped), then aggregates real upstream data.
The state is built from Deps fields NOT on cloud.Base (deps.Audit, deps.IAMIssuer), so it constructs the cloud.Service value directly (cloud.NewBase + &cloud.Service[core.State]{…}) rather than via cloud.Mount.
Types ¶
type MoneyOut ¶
type MoneyOut struct {
Status string `json:"status"`
Msg string `json:"msg"`
Data *moneyBoard `json:"data,omitempty"`
}
MoneyOut is the GET /v1/admin/money envelope.
type SubsystemsIn ¶
type SubsystemsIn struct {
// Range bounds the telemetry window: 24h, 7d or 30d. Anything else, including
// empty, resolves to the default through the same o11yRange the o11y board uses.
Range string `json:"range"`
}
SubsystemsIn is the GET /v1/admin/subsystems filter.
type SubsystemsOut ¶
type SubsystemsOut struct {
Status string `json:"status"`
Msg string `json:"msg"`
Data *subsystemBoard `json:"data,omitempty"`
}
SubsystemsOut is the GET /v1/admin/subsystems envelope.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package audit is the /v1/admin/audit query surface, wired to cloud's REAL tamper-evident audit store (the audit.Recorder Serve builds and hands over via deps.Audit).
|
Package audit is the /v1/admin/audit query surface, wired to cloud's REAL tamper-evident audit store (the audit.Recorder Serve builds and hands over via deps.Audit). |
|
Package commerce is the admin cockpit's typed reader for the commerce billing plane.
|
Package commerce is the admin cockpit's typed reader for the commerce billing plane. |
|
Package core is the shared kernel of the admin subsystem: the resolved upstream clients (State) plus the one-copy business primitives every admin domain composes — the two-tier gate, the /v1 envelope writers, the tenant-scope predicate, the IAM fan-in, the single credit-grant path, the tamper-evident audit emit, and the fleet activity/time-series model.
|
Package core is the shared kernel of the admin subsystem: the resolved upstream clients (State) plus the one-copy business primitives every admin domain composes — the two-tier gate, the /v1 envelope writers, the tenant-scope predicate, the IAM fan-in, the single credit-grant path, the tamper-evident audit emit, and the fleet activity/time-series model. |
|
Package customer is the CUSTOMER management surface (/v1/admin/customers*) — the operator cockpit's core: the live fleet customer list (incl.
|
Package customer is the CUSTOMER management surface (/v1/admin/customers*) — the operator cockpit's core: the live fleet customer list (incl. |
|
Package digitalocean reads DigitalOcean's billing and infrastructure APIs.
|
Package digitalocean reads DigitalOcean's billing and infrastructure APIs. |
|
Package finance is the SaaS business/finance dashboard (/v1/admin/finance) — the profitability panel: what we pay every vendor (COGS), what we earn, the gross margin, how fast we're burning the DigitalOcean promo credit, and the runway that credit + burn imply.
|
Package finance is the SaaS business/finance dashboard (/v1/admin/finance) — the profitability panel: what we pay every vendor (COGS), what we earn, the gross margin, how fast we're burning the DigitalOcean promo credit, and the runway that credit + burn imply. |
|
Package health probes an upstream's health endpoint (e.g.
|
Package health probes an upstream's health endpoint (e.g. |
|
Package iam is the admin cockpit's typed reader for the Hanzo IAM management surface (/v1/iam/ native routes).
|
Package iam is the admin cockpit's typed reader for the Hanzo IAM management surface (/v1/iam/ native routes). |
|
Package infra is the platform's DigitalOcean fleet board: the physical inventory (DOKS clusters, droplets, block-storage volumes, load balancers) cross-referenced against what every cluster's Kubernetes actually claims, with the cost of each and an orphan analysis that is safe BY CONSTRUCTION.
|
Package infra is the platform's DigitalOcean fleet board: the physical inventory (DOKS clusters, droplets, block-storage volumes, load balancers) cross-referenced against what every cluster's Kubernetes actually claims, with the cost of each and an orphan analysis that is safe BY CONSTRUCTION. |
|
Package invoices is the fleet INVOICE view (/v1/admin/invoices) — every issued invoice across every tenant: number, org, amount, status, issue + due date, plus the id a future detail view fetches /v1/billing/invoices/:id with.
|
Package invoices is the fleet INVOICE view (/v1/admin/invoices) — every issued invoice across every tenant: number, org, amount, status, issue + due date, plus the id a future detail view fetches /v1/billing/invoices/:id with. |
|
Package metrics is the fleet SaaS-operations god-view (/v1/admin/metrics) — the operator's business dashboard: MRR/ARR, net-new vs churned MRR, the plan/category mix, the top customers, and the recent subscription movements.
|
Package metrics is the fleet SaaS-operations god-view (/v1/admin/metrics) — the operator's business dashboard: MRR/ARR, net-new vs churned MRR, the plan/category mix, the top customers, and the recent subscription movements. |
|
Package money is the admin cockpit's one billing unit: USD cents as a typed value, so no field or method anywhere has to spell "Cents" again and a dollar amount can never be silently passed where cents are meant.
|
Package money is the admin cockpit's one billing unit: USD cents as a typed value, so no field or method anywhere has to spell "Cents" again and a dollar amount can never be silently passed where cents are meant. |
|
Package revenue is the fleet REVENUE aggregate (/v1/admin/revenue) — the operator's money board: total prepaid balances held, total realized spend, MRR, a per-customer revenue table, ARPU, and a real spend trend.
|
Package revenue is the fleet REVENUE aggregate (/v1/admin/revenue) — the operator's money board: total prepaid balances held, total realized spend, MRR, a per-customer revenue table, ARPU, and a real spend trend. |
|
Package subscriptions is the fleet SUBSCRIPTION view (/v1/admin/subscriptions) — every tenant's plan subscription: customer/org, plan, status, monthly-normalized MRR, and the current-period start/renews.
|
Package subscriptions is the fleet SUBSCRIPTION view (/v1/admin/subscriptions) — every tenant's plan subscription: customer/org, plan, status, monthly-normalized MRR, and the current-period start/renews. |