nodes

package
v0.1.0-preview Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package nodes is the resource module for tenant-node management.

Tenant nodes are per-customer provisioning environments — each customer has at least one, and SDK calls target one specific node at a time.

All endpoints in this module live on the Infinity control plane (api.vxcloud.io), not on a tenant node, because the node registry is a control-plane concern.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	T           *transport.Transport
	InfinityURL string
}

Client is the nodes resource module facade. Constructed by the parent vxsdk.Client; callers obtain it from c.Nodes().

func (*Client) Default

func (c *Client) Default(ctx context.Context) (*Node, error)

Default returns the node currently marked as the workspace default, or nil if none exists.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, id int) error

Delete removes a node record. Only deletes the row — the caller is responsible for terminating any underlying VM first.

Endpoint: DELETE {InfinityURL}/api/v1/auth/nodes/{id}.

func (*Client) List

func (c *Client) List(ctx context.Context) ([]Node, error)

List returns all tenant nodes registered to the authenticated principal.

Endpoint: GET {InfinityURL}/api/v1/auth/nodes/.

Note: vxcli's `node list` command returned 401 for some tokens during preview testing. The SDK's auto-refresh-on-401 handles that case transparently when an API key is configured on the Client.

func (*Client) RegisterSelfHosted

func (c *Client) RegisterSelfHosted(ctx context.Context, in RegisterSelfHostedInput) (*Node, error)

RegisterSelfHosted registers a vxnode container the caller is running themselves (BYO hardware). No VM is provisioned on our side — the row is created with cloud_provider=self-hosted, status=active.

Endpoint: POST {InfinityURL}/api/v1/auth/nodes/self-hosted.

func (*Client) SetDefault

func (c *Client) SetDefault(ctx context.Context, id int) error

SetDefault marks the given node ID as the user's default. Subsequent API key exchanges will resolve this node as the tenant target.

Endpoint: POST {InfinityURL}/api/v1/auth/nodes/{id}/set-default.

func (*Client) Update

func (c *Client) Update(ctx context.Context, id int, in UpdateInput) (*Node, error)

Update partial-updates an existing node record. Only fields set in `in` are sent. Endpoint: PATCH {InfinityURL}/api/v1/auth/nodes/{id}.

type Node

type Node struct {
	ID               int     `json:"id"`
	UserID           int     `json:"user_id,omitempty"`
	OrganizationID   string  `json:"organization_id,omitempty"`
	Hostname         string  `json:"hostname"`
	Status           string  `json:"status"`
	IsDefaultNode    bool    `json:"is_default_node"`
	PublicIP         string  `json:"public_ip,omitempty"`
	PrivateIP        string  `json:"private_ip,omitempty"`
	InstanceID       string  `json:"instance_id,omitempty"`
	LoadBalancer     string  `json:"load_balancer,omitempty"`
	CustomDomainName string  `json:"custom_domain_name,omitempty"`
	OSType           string  `json:"os_type,omitempty"`
	BoxType          string  `json:"box_type,omitempty"`
	StorageGB        float64 `json:"storage_gb,omitempty"`
	Category         string  `json:"category,omitempty"`
	License          string  `json:"license,omitempty"`
	SessionID        string  `json:"session_id,omitempty"`
	StatePath        string  `json:"state_path,omitempty"`
	CreatedAt        string  `json:"created_at,omitempty"`
	UpdatedAt        string  `json:"updated_at,omitempty"`
}

Node mirrors infinity's NodeResponse pydantic model.

func (Node) BaseURL

func (n Node) BaseURL() string

BaseURL returns the resolved https URL for the node, with the same priority order vxcli and the frontend use: custom_domain_name → load_balancer → public_ip.

Returns "" if the node has no addressable hostname yet.

func (Node) Label

func (n Node) Label() string

Label is a short user-facing identifier.

type RegisterSelfHostedInput

type RegisterSelfHostedInput struct {
	Hostname              string `json:"hostname"`
	CustomDomainName      string `json:"custom_domain_name"`
	Port                  int    `json:"port,omitempty"`
	PublicIP              string `json:"public_ip,omitempty"`
	PrivateIP             string `json:"private_ip,omitempty"`
	TunnelProvider        string `json:"tunnel_provider,omitempty"`
	KeyPairName           string `json:"key_pair_name,omitempty"`
	IDEConnectionToken    string `json:"ide_connection_token,omitempty"`
	Agent1ConnectionToken string `json:"agent1_connection_token,omitempty"`
	StorageType           string `json:"storage_type,omitempty"`
	StorageBackupMode     string `json:"storage_backup_mode,omitempty"`
	Description           string `json:"description,omitempty"`
	SSHUsername           string `json:"ssh_username,omitempty"`
}

RegisterSelfHostedInput mirrors SelfHostedNodeRegisterRequest in app/auth/node.py:772 — the dashboard's "Self-Hosted" form payload.

type UpdateInput

type UpdateInput struct {
	Hostname              *string                  `json:"hostname,omitempty"`
	CustomDomainName      *string                  `json:"custom_domain_name,omitempty"`
	LoadBalancer          *string                  `json:"load_balancer,omitempty"`
	PrivateIP             *string                  `json:"private_ip,omitempty"`
	Status                *string                  `json:"status,omitempty"`
	IsDefaultNode         *bool                    `json:"is_default_node,omitempty"`
	ProviderComputeType   *string                  `json:"provider_compute_type,omitempty"`
	StorageType           *string                  `json:"storage_type,omitempty"`
	StorageBackupMode     *string                  `json:"storage_backup_mode,omitempty"`
	StorageBackupAddress  *string                  `json:"storage_backup_address,omitempty"`
	InstallationChecklist []map[string]interface{} `json:"installation_checklist,omitempty"`
	EnabledFeatures       []interface{}            `json:"enabled_features,omitempty"`
	VPNAccessDetails      map[string]interface{}   `json:"vpn_access_details,omitempty"`
	TunnelVM              map[string]interface{}   `json:"tunnel_vm,omitempty"`
}

UpdateInput mirrors NodeUpdateRequest in app/auth/node.py:81. All fields are pointer/slice/map so the zero value can be distinguished from "not set" — only non-nil fields are sent in the PATCH body. Backend rejects any field not in its EDITABLE_FIELDS whitelist (public_ip is read-only).

Jump to

Keyboard shortcuts

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