controllers

package
v1.108.24 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

compute.go is the canonical /v1 resell compute surface: the cached DigitalOcean catalog (regions/sizes/GPUs, resale-priced) and per-org machine operations backed by Hanzo's house DO account. Every machine endpoint is scoped to the caller's org, which is derived from the authenticated IAM identity (never trusted from a client-supplied field). Beneath org, an OPTIONAL app > project scope (from the gateway-threaded tenant context, or the launch body as a fallback) sharpens the analytics rollup without ever gating a launch. Launch is metered through commerce (per-org debit); a dryRun returns a price quote and spends nothing.

A "fleet" is not a separate entity — it is just N machines launched in one batch (count>1) named "<name>-000", "<name>-001", … and grouped by the ?name= (prefix) / ?kind= / ?project= list filters. There is exactly ONE way a machine is launched, billed and destroyed (launchMetered), whether alone or as one of a batch.

node_pool.go serves a node pool's lifecycle, and every handler here takes its tenant from ONE place: resolveComputeOrg, the same principal rule the machine and cluster surfaces run.

It used to take it from two. The authorization filter derives the object's owner from `?id=` or the request BODY, while these handlers read `?owner=` — so `POST /v1/create-node-pool?owner=hanzo` with a body naming `acme` cleared authorization against acme and then provisioned against hanzo's cloud credentials, hanzo's balance and hanzo's invoice. A tenant read from a different field than the one authorization judged is not a second opinion, it is a house account.

volume.go serves a volume's lifecycle, and every handler here takes its tenant from ONE place: resolveComputeOrg, the same principal rule the node-pool, machine and cluster surfaces run.

It used to take it from two. The authorization filter derives the object's owner from `?id=` or the request BODY, while these handlers read `?owner=` — so `POST /v1/create-volume?owner=victim` with a body naming the caller cleared authorization against the caller and then provisioned against the victim's cloud credentials, onto the victim's invoice. The reads had the same split by a different field: authorization keys a GET on `?id=`, which a caller could point at its own org while `?owner=` pointed the handler at another's.

Index

Constants

View Source
const (
	TunnelClosed       int = -1
	Normal             int = 0
	SessionNotFound    int = 800
	NewTunnelError     int = 801
	ForcedDisconnect   int = 802
	AssetNotActive     int = 803
	ParametersError    int = 804
	AssetNotFound      int = 805
	SessionUpdateError int = 806
)

Variables

View Source
var JwtPublicKey string
View Source
var UpGrader = websocket.FastHTTPUpgrader{
	ReadBufferSize:  4096,
	WriteBufferSize: 4096,
	CheckOrigin: func(ctx *fasthttp.RequestCtx) bool {
		return true
	},
	Subprotocols: []string{"guacamole"},
}

Functions

func BindAgent added in v1.108.24

func BindAgent(_ context.Context, in *AgentBind) (*object.AgentBinding, error)

BindAgent binds a cloud Agent to one of the caller org's machines: the machine is marked as running that Agent's @hanzo/bot runtime. The owning org is the validated tenant, never a client field.

Idempotent — PUT, because re-binding the same agent to the same machine is the state the caller asked for, not a second binding; binding a DIFFERENT agent replaces the prior one, since a machine hosts exactly one agent's bot.

It does not itself install the runtime: that is the machine's launch cloud-init. This records the agent↔machine relation and answers with the honest, reconciled convergence state.

Example: {"agentName": "bot-a", "botVersion": "1.4.0"} Response: {"owner": "acme", "name": "drop-a", "machineId": "acme/drop-a", "agentName": "bot-a", "status": "Pending"}

func GetAgent added in v1.108.24

func GetAgent(_ context.Context, in *AgentRef) (*object.AgentBinding, error)

GetAgent returns the agent binding of one of the caller org's machines, its status re-reconciled against live machine state, or 404 when the machine runs no bot runtime.

Response: {"owner": "acme", "name": "drop-a", "machineId": "acme/drop-a", "agentName": "bot-a", "status": "Bound"}

func GetUserName

func GetUserName(user *iamsdk.User) string

func InitAuthConfig

func InitAuthConfig()

func UnbindAgent added in v1.108.24

func UnbindAgent(_ context.Context, in *AgentRef) (*struct{}, error)

UnbindAgent detaches the agent runtime from one of the caller org's machines and answers 204. The machine stays — this halts the bot, it does not terminate the compute, so the two lifecycles stay orthogonal.

Idempotent: a machine that was not bound is already in the asked-for state, so it answers 204 too. The old wire said "Affected"/"Unaffected" in a 200 body, which made every caller parse prose to learn a distinction none of them acted on.

Types

type AgentBind added in v1.108.24

type AgentBind struct {
	// Id is the machine to bind, from the URL path.
	Id string `json:"id"`
	// AgentName is the Agent in cloud's /v1/agents registry this machine runs.
	AgentName string `json:"agentName" validate:"required"`
	// BotVersion pins the @hanzo/bot npm version; empty tracks the machine's
	// launch default.
	BotVersion string `json:"botVersion"`
	// contains filtered or unexported fields
}

AgentBind binds a cloud Agent to a machine.

type AgentRef added in v1.108.24

type AgentRef struct {
	// Id is the machine's name within the caller's org, from the URL path. The
	// OWNER half of the machine id is never taken from the caller — see machine.
	Id string `json:"id"`
	// contains filtered or unexported fields
}

AgentRef addresses one machine's agent binding.

type Agents added in v1.108.24

type Agents struct {
	// AgentBindings is one row per bound machine, newest first.
	AgentBindings []*object.AgentBinding `json:"agentBindings"`
}

Agents is every agent binding the caller org owns.

func ListAgents added in v1.108.24

func ListAgents(_ context.Context, in *Scope) (*Agents, error)

ListAgents returns every agent↔machine binding in the caller's org — which machines run which cloud Agent, newest first, each with its reconciled status.

Response: {"agentBindings": [{"owner": "acme", "name": "drop-a", "agentName": "bot-a", "status": "Bound"}]}

type ApiController

type ApiController struct {
	Ctx  *zip.Ctx
	Data map[string]interface{}
}

ApiController is the ZAP-native controller base. It carries the request context (zip.Ctx) and the buffered JSON response body (Data["json"]) the record filter reads back. It replaces the Beego controller one-for-one: handlers keep their method receiver, but the framework underneath is zip over fiber/fasthttp — no cookie or server-side session. A caller authenticates statelessly with a forwarded IAM Bearer JWT (object.GetBearerUser); the resolved Principal is the ONE identity seam.

func New added in v1.108.15

func New(c *zip.Ctx) *ApiController

New builds a controller bound to a request context, with its response buffer ready. This is the ONE construction path the route wrappers use.

func (*ApiController) AddAsset

func (c *ApiController) AddAsset()

AddAsset @Title AddAsset @Tag Asset API @Description add a asset @Param body body object.Asset true "The details of the asset" @Success 200 {object} controllers.Response The Response object @router /add-asset [post]

func (*ApiController) AddAssetTunnel

func (c *ApiController) AddAssetTunnel()

AddAssetTunnel @Title AddAssetTunnel @Tag Session API @Description add session @Param assetId query string true "The id of asset" @Success 200 {object} Response @router /add-asset-tunnel [get]

func (*ApiController) AddMachine

func (c *ApiController) AddMachine()

AddMachine @Title AddMachine @Tag Machine API @Description add a machine @Param body body object.Machine true "The details of the machine" @Success 200 {object} controllers.Response The Response object @router /add-machine [post]

func (*ApiController) AddPlan

func (c *ApiController) AddPlan()

AddPlan @Title AddPlan @Tag Plan API @Description add a plan @Param body body object.Plan true "The plan" @Success 200 {object} controllers.Response @router /add-plan [post]

func (*ApiController) AddProvider

func (c *ApiController) AddProvider()

AddProvider @Title AddProvider @Tag Provider API @Description add a provider @Param body body object.Provider true "The details of the provider" @Success 200 {object} controllers.Response The Response object @router /add-provider [post]

func (*ApiController) AddRecord

func (c *ApiController) AddRecord()

AddRecord @Title AddRecord @Tag Record API @Description add a record @Param body body object.Record true "The details of the record" @Success 200 {object} controllers.Response The Response object @router /add-record [post]

func (*ApiController) AddSession

func (c *ApiController) AddSession()

AddSession @Title AddSession @Tag Session API @Description add session @Param body body object.Session true "The session object" @Success 200 {object} Response @router /add-session [post]

func (*ApiController) AttachVolume

func (c *ApiController) AttachVolume()

AttachVolume @Title AttachVolume @Tag Volume API @Description attach a volume to a machine @router /attach-volume [post]

func (*ApiController) CommitRecord

func (c *ApiController) CommitRecord()

CommitRecord @Title CommitRecord @Tag Record API @Description commit a record @Param body body object.Record true "The details of the record" @Success 200 {object} controllers.Response The Response object @router /commit-record [post]

func (*ApiController) CreateComputeKubernetesCluster

func (c *ApiController) CreateComputeKubernetesCluster()

CreateComputeKubernetesCluster @Title CreateComputeKubernetesCluster @Tag Compute API @Description provision a DOKS cluster for the caller org (body: name, region, version, nodePool{size,count}) @router /k8s/clusters [post]

func (*ApiController) CreateImage

func (c *ApiController) CreateImage()

CreateImage @Title CreateImage @Tag Compute API @Description upload/register a custom image from a URL (org-scoped, async) @router /images [post]

func (*ApiController) CreateNodePool

func (c *ApiController) CreateNodePool()

CreateNodePool @Title CreateNodePool @Tag NodePool API @Description create a new node pool in DOKS @Param provider query string true "The provider name" @Param clusterId query string false "The DOKS cluster ID (optional, uses provider default)" @Param body body service.CreateNodePoolSpec true "The spec for the node pool" @Success 200 {object} object.NodePool The Response object @router /create-node-pool [post]

func (*ApiController) CreateVolume

func (c *ApiController) CreateVolume()

CreateVolume @Title CreateVolume @Tag Volume API @Description create a block storage volume via a provider @Param provider query string true "The provider name" @Param body body service.CreateVolumeSpec true "The volume spec" @Success 200 {object} object.Volume @router /create-volume [post]

func (*ApiController) DeleteAsset

func (c *ApiController) DeleteAsset()

DeleteAsset @Title DeleteAsset @Tag Asset API @Description delete a asset @Param body body object.Asset true "The details of the asset" @Success 200 {object} controllers.Response The Response object @router /delete-asset [post]

func (*ApiController) DeleteComputeKubernetesCluster

func (c *ApiController) DeleteComputeKubernetesCluster()

DeleteComputeKubernetesCluster @Title DeleteComputeKubernetesCluster @Tag Compute API @Description delete one of the caller org's DOKS clusters by id @router /k8s/clusters/:id [delete]

func (*ApiController) DeleteComputeMachine

func (c *ApiController) DeleteComputeMachine()

DeleteComputeMachine @Title DeleteComputeMachine @Tag Compute API @Description delete one of the caller org's machines by id @router /machines/:id [delete]

func (*ApiController) DeleteMachine

func (c *ApiController) DeleteMachine()

DeleteMachine @Title DeleteMachine @Tag Machine API @Description delete a machine @Param body body object.Machine true "The details of the machine" @Success 200 {object} controllers.Response The Response object @router /delete-machine [post]

func (*ApiController) DeleteNodePool

func (c *ApiController) DeleteNodePool()

DeleteNodePool @Title DeleteNodePool @Tag NodePool API @Description delete a node pool from DOKS and DB @Param body body object.NodePool true "The details of the node pool" @Success 200 {object} controllers.Response The Response object @router /delete-node-pool [post]

func (*ApiController) DeletePlan

func (c *ApiController) DeletePlan()

DeletePlan @Title DeletePlan @Tag Plan API @Description delete a plan @Param body body object.Plan true "The plan" @Success 200 {object} controllers.Response @router /delete-plan [post]

func (*ApiController) DeleteProvider

func (c *ApiController) DeleteProvider()

DeleteProvider @Title DeleteProvider @Tag Provider API @Description delete a provider @Param body body object.Provider true "The details of the provider" @Success 200 {object} controllers.Response The Response object @router /delete-provider [post]

func (*ApiController) DeleteRecord

func (c *ApiController) DeleteRecord()

DeleteRecord @Title DeleteRecord @Tag Record API @Description delete a record @Param body body object.Record true "The details of the record" @Success 200 {object} controllers.Response The Response object @router /delete-record [post]

func (*ApiController) DeleteSession

func (c *ApiController) DeleteSession()

DeleteSession @Title DeleteSession @Tag Session API @Description delete session @Param id query string true "The id of session" @Success 200 {object} Response @router /delete-session [post]

func (*ApiController) DeleteVolume

func (c *ApiController) DeleteVolume()

DeleteVolume @Title DeleteVolume @Tag Volume API @Description delete a volume @Param provider query string true "The provider name" @Param name query string true "The volume cloud ID" @Success 200 {object} controllers.Response @router /delete-volume [post]

func (*ApiController) DetachVolume

func (c *ApiController) DetachVolume()

DetachVolume @Title DetachVolume @Tag Volume API @Description detach a volume from its machine @router /detach-volume [post]

func (*ApiController) GetAccount

func (c *ApiController) GetAccount()

func (*ApiController) GetAsset

func (c *ApiController) GetAsset()

GetAsset @Title GetAsset @Tag Asset API @Description get asset @Param id query string true "The id ( owner/name ) of the asset" @Success 200 {object} object.Asset The Response object @router /get-asset [get]

func (*ApiController) GetAssetTunnel

func (c *ApiController) GetAssetTunnel()

func (*ApiController) GetAssets

func (c *ApiController) GetAssets()

GetAssets @Title GetAssets @Tag Asset API @Description get all assets @Param pageSize query string true "The size of each page" @Param p query string true "The number of the page" @Success 200 {object} object.Asset The Response object @router /get-assets [get]

func (*ApiController) GetComputeGPUs

func (c *ApiController) GetComputeGPUs()

GetComputeGPUs @Title GetComputeGPUs @Tag Compute API @Description list resale-priced GPU sizes (cached) @Success 200 {object} controllers.Response @router /gpus [get]

func (*ApiController) GetComputeKubernetesCluster

func (c *ApiController) GetComputeKubernetesCluster()

GetComputeKubernetesCluster @Title GetComputeKubernetesCluster @Tag Compute API @Description get one of the caller org's DOKS clusters by id — detail incl. node pools and worker nodes @router /k8s/clusters/:id [get]

func (*ApiController) GetComputeMachine

func (c *ApiController) GetComputeMachine()

GetComputeMachine @Title GetComputeMachine @Tag Compute API @Description get one of the caller org's machines by id @router /machines/:id [get]

func (*ApiController) GetComputeRegions

func (c *ApiController) GetComputeRegions()

GetComputeRegions @Title GetComputeRegions @Tag Compute API @Description list DigitalOcean regions (cached) @Success 200 {object} controllers.Response @router /regions [get]

func (*ApiController) GetComputeSizes

func (c *ApiController) GetComputeSizes()

GetComputeSizes @Title GetComputeSizes @Tag Compute API @Description list resale-priced sizes (cached) @Success 200 {object} controllers.Response @router /sizes [get]

func (*ApiController) GetConnSession

func (c *ApiController) GetConnSession()

GetConnSession @Title GetConnSession @Tag Session API @Description get session @Param id query string true "The id of session" @Success 200 {object} object.Session @router /get-session [get]

func (*ApiController) GetMachine

func (c *ApiController) GetMachine()

GetMachine @Title GetMachine @Tag Machine API @Description get machine @Param id query string true "The id ( owner/name ) of the machine" @Success 200 {object} object.Machine The Response object @router /get-machine [get]

func (*ApiController) GetMachines

func (c *ApiController) GetMachines()

GetMachines @Title GetMachines @Tag Machine API @Description get all machines @Param pageSize query string true "The size of each page" @Param p query string true "The number of the page" @Success 200 {object} object.Machine The Response object @router /get-machines [get]

func (*ApiController) GetNodePool

func (c *ApiController) GetNodePool()

GetNodePool @Title GetNodePool @Tag NodePool API @Description get a node pool @Param id query string true "The id ( owner/name ) of the node pool" @Success 200 {object} object.NodePool The Response object @router /get-node-pool [get]

func (*ApiController) GetNodePools

func (c *ApiController) GetNodePools()

GetNodePools @Title GetNodePools @Tag NodePool API @Description get all node pools @Param pageSize query string false "The size of each page" @Param p query string false "The number of the page" @Success 200 {object} object.NodePool The Response object @router /get-node-pools [get]

func (*ApiController) GetPlan

func (c *ApiController) GetPlan()

GetPlan @Title GetPlan @Tag Plan API @Description get a single plan @Param owner query string true "The owner" @Param name query string true "The plan name" @Success 200 {object} object.Plan @router /get-plan [get]

func (*ApiController) GetPlans

func (c *ApiController) GetPlans()

GetPlans @Title GetPlans @Tag Plan API @Description get active plans for a given owner @Param owner query string true "The owner" @Success 200 {array} object.Plan @router /get-plans [get]

func (*ApiController) GetProvider

func (c *ApiController) GetProvider()

GetProvider @Title GetProvider @Tag Provider API @Description get provider @Param id query string true "The id ( owner/name ) of the provider" @Success 200 {object} object.Provider The Response object @router /get-provider [get]

func (*ApiController) GetProviders

func (c *ApiController) GetProviders()

GetProviders @Title GetProviders @Tag Provider API @Description get all providers @Param pageSize query string true "The size of each page" @Param p query string true "The number of the page" @Success 200 {object} object.Provider The Response object @router /get-providers [get]

func (*ApiController) GetRecord

func (c *ApiController) GetRecord()

GetRecord @Title GetRecord @Tag Record API @Description get record @Param id query string true "The id ( owner/name ) of the record" @Success 200 {object} object.Record The Response object @router /get-record [get]

func (*ApiController) GetRecords

func (c *ApiController) GetRecords()

GetRecords @Title GetRecords @Tag Record API @Description get all records @Param pageSize query string true "The size of each page" @Param p query string true "The number of the page" @Success 200 {object} object.Record The Response object @router /get-records [get]

func (*ApiController) GetSessionClaims

func (c *ApiController) GetSessionClaims() *iamsdk.Claims

GetSessionClaims parses the forwarded IAM Bearer JWT into its claims — the stateless replacement for the Beego cookie session. Signature is verified by iamsdk.ParseJwtToken; brand/issuer binding is enforced by the ApiFilter (via object.GetBearerUser) before any handler runs, so this is a plain decode.

func (*ApiController) GetSessionUser

func (c *ApiController) GetSessionUser() *iamsdk.User

GetSessionUser resolves the authenticated user from the forwarded IAM Bearer JWT (brand/issuer-bound in object.GetBearerUser), or nil.

func (*ApiController) GetSessionUsername

func (c *ApiController) GetSessionUsername() string

func (*ApiController) GetSessions

func (c *ApiController) GetSessions()

GetSessions @Title GetSessions @Tag Session API @Description get all sessions @Param pageSize query string true "The size of each page" @Param p query string true "The number of the page" @Success 200 {object} object.Session The Response object @router /get-sessions [get]

func (*ApiController) GetVolume

func (c *ApiController) GetVolume()

GetVolume @Title GetVolume @Tag Volume API @Description get a single volume @Param name query string true "The volume name" @Success 200 {object} object.Volume @router /get-volume [get]

func (*ApiController) GetVolumes

func (c *ApiController) GetVolumes()

GetVolumes @Title GetVolumes @Tag Volume API @Description get all volumes for an owner @Success 200 {array} object.Volume @router /get-volumes [get]

func (*ApiController) GetWhitelabel

func (c *ApiController) GetWhitelabel()

GetWhitelabel returns branding config based on the request Host header. @Title GetWhitelabel @Tag Whitelabel API @Description Get white-label branding config for the current hostname @Success 200 {object} controllers.Response @router /get-whitelabel [get]

func (*ApiController) LaunchComputeMachine

func (c *ApiController) LaunchComputeMachine()

LaunchComputeMachine @Title LaunchComputeMachine @Tag Compute API @Description quote (dryRun) or launch a metered, per-org machine; count>1 launches a batch of <name>-NNN @router /machines/launch [post]

func (*ApiController) LaunchMachine

func (c *ApiController) LaunchMachine()

LaunchMachine @Title LaunchMachine @Tag Machine API @Description launch a new cloud machine instance via a provider @Param body body service.CreateMachineSpec true "The spec for the machine to launch" @Param provider query string true "The provider name" @Success 200 {object} object.Machine The Response object @router /launch-machine [post]

func (*ApiController) ListComputeKubernetesClusters

func (c *ApiController) ListComputeKubernetesClusters()

ListComputeKubernetesClusters @Title ListComputeKubernetesClusters @Tag Compute API @Description list the caller org's DOKS clusters (house account, hanzo-org tag) @Success 200 {object} controllers.Response @router /k8s/clusters [get]

func (*ApiController) ListComputeMachines

func (c *ApiController) ListComputeMachines()

ListComputeMachines @Title ListComputeMachines @Tag Compute API @Description list the caller org's machines, optionally filtered by ?kind=, ?name= (prefix) and ?project= @Success 200 {object} controllers.Response @router /machines [get]

func (*ApiController) ListImages

func (c *ApiController) ListImages()

ListImages @Title ListImages @Tag Compute API @Description list selectable images (distributions, applications, org customs) @router /images [get]

func (*ApiController) QueryRecord

func (c *ApiController) QueryRecord()

QueryRecord @Title QueryRecord @Tag Record API @Description query record @Param id query string true "The id ( owner/name ) of the record" @Success 200 {object} object.Record The Response object @router /query-record [get]

func (*ApiController) RequireSignedIn

func (c *ApiController) RequireSignedIn() bool

func (*ApiController) ResizeVolume

func (c *ApiController) ResizeVolume()

ResizeVolume @Title ResizeVolume @Tag Volume API @Description resize a volume @router /resize-volume [post]

func (*ApiController) ResponseError

func (c *ApiController) ResponseError(error string, data ...interface{})

func (*ApiController) ResponseOk

func (c *ApiController) ResponseOk(data ...interface{})

func (*ApiController) ScaleNodePool

func (c *ApiController) ScaleNodePool()

ScaleNodePool @Title ScaleNodePool @Tag NodePool API @Description quick-scale a node pool (just count) @Param provider query string true "The provider name" @Param clusterId query string false "The DOKS cluster ID" @Param poolId query string true "The DOKS node pool ID" @Param count query string true "The desired node count" @Success 200 {object} object.NodePool The Response object @router /scale-node-pool [post]

func (*ApiController) ServeJSON added in v1.108.15

func (c *ApiController) ServeJSON()

ServeJSON writes the buffered Data["json"] payload — the Beego-shaped spelling the handlers use for the wrapActionResponse path.

func (*ApiController) SetSessionClaims

func (c *ApiController) SetSessionClaims(claims *iamsdk.Claims)

SetSessionClaims is a no-op in the stateless model: there is no server-side session to write. Signin returns the claims (and access token) to the client, which then carries the token as a Bearer on every subsequent request.

func (*ApiController) SetSessionUser

func (c *ApiController) SetSessionUser(user *iamsdk.User)

SetSessionUser is a no-op in the stateless model (see SetSessionClaims).

func (*ApiController) Signin

func (c *ApiController) Signin()

func (*ApiController) Signout

func (c *ApiController) Signout()

func (*ApiController) StartSession

func (c *ApiController) StartSession()

func (*ApiController) StopSession

func (c *ApiController) StopSession()

func (*ApiController) TunnelMonitor

func (c *ApiController) TunnelMonitor()

func (*ApiController) UpdateAsset

func (c *ApiController) UpdateAsset()

UpdateAsset @Title UpdateAsset @Tag Asset API @Description update asset @Param id query string true "The id ( owner/name ) of the asset" @Param body body object.Asset true "The details of the asset" @Success 200 {object} controllers.Response The Response object @router /update-asset [post]

func (*ApiController) UpdateMachine

func (c *ApiController) UpdateMachine()

UpdateMachine @Title UpdateMachine @Tag Machine API @Description update machine @Param id query string true "The id ( owner/name ) of the machine" @Param body body object.Machine true "The details of the machine" @Success 200 {object} controllers.Response The Response object @router /update-machine [post]

func (*ApiController) UpdateNodePool

func (c *ApiController) UpdateNodePool()

UpdateNodePool @Title UpdateNodePool @Tag NodePool API @Description update a node pool @Param id query string true "The id ( owner/name ) of the node pool" @Param body body object.NodePool true "The details of the node pool" @Success 200 {object} controllers.Response The Response object @router /update-node-pool [post]

func (*ApiController) UpdatePlan

func (c *ApiController) UpdatePlan()

UpdatePlan @Title UpdatePlan @Tag Plan API @Description update a plan @Param owner query string true "The owner" @Param name query string true "The plan name" @Param body body object.Plan true "The plan" @Success 200 {object} controllers.Response @router /update-plan [post]

func (*ApiController) UpdateProvider

func (c *ApiController) UpdateProvider()

UpdateProvider @Title UpdateProvider @Tag Provider API @Description update provider @Param id query string true "The id ( owner/name ) of the provider" @Param body body object.Provider true "The details of the provider" @Success 200 {object} controllers.Response The Response object @router /update-provider [post]

func (*ApiController) UpdateRecord

func (c *ApiController) UpdateRecord()

UpdateRecord @Title UpdateRecord @Tag Record API @Description update record @Param id query string true "The id ( owner/name ) of the record" @Param body body object.Record true "The details of the record" @Success 200 {object} controllers.Response The Response object @router /update-record [post]

func (*ApiController) UpdateSession

func (c *ApiController) UpdateSession()

UpdateSession @Title UpdateSession @Tag Session API @Description update session @Param id query string true "The id of session" @Param body body object.Session true "The session object" @Success 200 {object} Response @router /update-session [post]

type GuacamoleHandler

type GuacamoleHandler struct {
	// contains filtered or unexported fields
}

func NewGuacamoleHandler

func NewGuacamoleHandler(ws *wsx.Conn, tunnel *guacamole.Tunnel) *GuacamoleHandler

func (GuacamoleHandler) Start

func (r GuacamoleHandler) Start()

func (GuacamoleHandler) Stop

func (r GuacamoleHandler) Stop()

type LaunchQuote

type LaunchQuote struct {
	Org          string           `json:"org"`
	Size         string           `json:"size"`
	Region       string           `json:"region"`
	Currency     string           `json:"currency"`
	PriceHourly  float64          `json:"priceHourly"`
	PriceMonthly float64          `json:"priceMonthly"`
	GPU          *service.GPUSpec `json:"gpu,omitempty"`
}

LaunchQuote is the resale price quote for a size in a region (Hanzo price only — wholesale/provider never surfaced).

type Nodes added in v1.108.24

type Nodes struct {
	Nodes []*service.Machine `json:"nodes"`
}

Nodes is an org's managed-Kubernetes worker inventory, one row per node.

The field is ALWAYS an array on the wire, never null and never absent: a reader tells "this service does not serve this op" from "this org has no nodes" by whether the field arrived at all, and that distinction is the only thing between a version skew and a fleet that silently reads as empty.

func ListNodes added in v1.108.24

func ListNodes(_ context.Context, in *Scope) (*Nodes, error)

ListNodes lists the caller org's DOKS worker nodes as machines: the deduped union of the house account (clusters carrying the hanzo-org tag) and BYOC providers (clusters named by Provider.ClusterID). A DOKS node's droplet carries k8s tags rather than a hanzo-org droplet tag, so it appears on no other list — this op is how a cluster's workers are visible as machines at all.

The two sources are independent, and the house one needs the house DO token: an unconfigured compute deployment skips it rather than failing the whole read and hiding the BYOC nodes behind an error.

type Response

type Response struct {
	Status string      `json:"status"`
	Msg    string      `json:"msg"`
	Data   interface{} `json:"data"`
	Data2  interface{} `json:"data2"`
}

type Scope added in v1.108.24

type Scope struct {
	// contains filtered or unexported fields
}

Scope is the whole input of a read whose collection IS the caller's org: the caller, and nothing else to address. Shared by every such op (the agent list here, the k8s worker nodes in compute.go) because it is one shape, and one shape published under two names is two schemas a generated client must learn.

Jump to

Keyboard shortcuts

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