cmd

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Copyright © 2025 Hyperbolic Labs

Copyright © 2025 Hyperbolic Labs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func GetAPIKey

func GetAPIKey() (string, error)

GetAPIKey returns the stored API key

func SaveConfig

func SaveConfig(config *Config) error

SaveConfig saves the configuration to disk

Types

type APIClient added in v0.0.2

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

APIClient represents the HTTP client for making API requests

func NewAPIClient added in v0.0.2

func NewAPIClient() *APIClient

NewAPIClient creates a new API client

func (*APIClient) Get added in v0.0.2

func (c *APIClient) Get(path string, queryParams map[string]string) (*http.Response, error)

Get makes a GET request to the API

func (*APIClient) Post added in v0.0.2

func (c *APIClient) Post(path string, body interface{}) (*http.Response, error)

Post makes a POST request to the API

type BalanceResponse

type BalanceResponse struct {
	Credits int `json:"credits"`
}

Balance response structure

type BareMetalNetworkOption

type BareMetalNetworkOption struct {
	GPUCount    int     `json:"gpuCount"`
	CostPerHour float64 `json:"costPerHour"`
}

BareMetalNetworkOption represents network configuration for bare metal instances

type BareMetalOptions

type BareMetalOptions struct {
	Ethernet   BareMetalNetworkOption `json:"ethernet"`
	Infiniband BareMetalNetworkOption `json:"infiniband"`
}

BareMetalOptions represents the response from /v2/marketplace/bare-metal-options

type BareMetalRentalRequest

type BareMetalRentalRequest struct {
	ConfigID    string `json:"configId"`
	NetworkType string `json:"networkType"`
	GPUCount    int    `json:"gpuCount"`
}

type CPU

type CPU struct {
	Model        string `json:"model"`
	VirtualCores int    `json:"virtual_cores"`
}

type Config

type Config struct {
	APIKey string `json:"api_key"`
}

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig loads the configuration from disk

type ExchangeTokenResponse added in v0.0.2

type ExchangeTokenResponse struct {
	APIKey string `json:"apiKey"`
	User   struct {
		ID    string  `json:"id"`
		Email *string `json:"email"`
		Name  *string `json:"name"`
	} `json:"user"`
}

type GPU

type GPU struct {
	Model     string `json:"model"`
	RAM       int    `json:"ram"`
	Interface string `json:"interface"`
}

type Hardware

type Hardware struct {
	CPUs    []CPU     `json:"cpus"`
	GPUs    []GPU     `json:"gpus"`
	Storage []Storage `json:"storage"`
	RAM     []RAM     `json:"ram"`
}

type Image

type Image struct {
	Name  string `json:"name"`
	Ports []int  `json:"ports,omitempty"`
}

type Instance

type Instance struct {
	ID           string   `json:"id"`
	Status       string   `json:"status"`
	Hardware     Hardware `json:"hardware"`
	GpusTotal    int      `json:"gpus_total"`
	GpusReserved int      `json:"gpus_reserved"`
	Location     Location `json:"location"`
	Pricing      Pricing  `json:"pricing"`
	ClusterName  string   `json:"cluster_name"`
	SupplierID   string   `json:"supplier_id"`
}

type InstancesResponse

type InstancesResponse struct {
	Instances []UserInstance `json:"instances"`
}

Response structure for the Hyperbolic Instances API (spot instances)

type Location

type Location struct {
	Region string `json:"region"`
}

type MarketplaceResponse

type MarketplaceResponse struct {
	Instances []Instance `json:"instances"`
}

Response structure for the Hyperbolic API

type OnDemandGPU

type OnDemandGPU struct {
	Count int `json:"count"`
}

type OnDemandInstance

type OnDemandInstance struct {
	ID             int                  `json:"id"`
	CreatedAt      string               `json:"createdAt"`
	UpdatedAt      *string              `json:"updatedAt"`
	DeletedAt      *string              `json:"deletedAt"`
	UserID         string               `json:"userId"`
	StartedAt      string               `json:"startedAt"`
	TerminatedAt   *string              `json:"terminatedAt"`
	ExternalID     string               `json:"externalId"`
	RentalProvider string               `json:"rentalProvider"`
	CostPerHour    int                  `json:"costPerHour"`
	Status         string               `json:"status"`
	Meta           OnDemandInstanceMeta `json:"meta"`
}

On-demand instance structures

type OnDemandInstanceForTerminate

type OnDemandInstanceForTerminate struct {
	ID int `json:"id"`
}

Lightweight struct for termination - only need ID

type OnDemandInstanceMeta

type OnDemandInstanceMeta struct {
	Name              string                     `json:"name"`
	Tags              []string                   `json:"tags,omitempty"`
	Type              string                     `json:"type,omitempty"`
	PublicIP          string                     `json:"public_ip,omitempty"`
	GPUCount          int                        `json:"gpu_count,omitempty"`
	Resources         *OnDemandInstanceResources `json:"resources,omitempty"`
	HostnodeID        string                     `json:"hostnode_id,omitempty"`
	InternalIP        string                     `json:"internal_ip,omitempty"`
	RentalType        string                     `json:"rental_type"`
	SSHCommand        string                     `json:"ssh_command,omitempty"`
	PortForwards      []OnDemandPortForward      `json:"port_forwards,omitempty"`
	OperatingSystem   string                     `json:"operating_system,omitempty"`
	TimestampCreation string                     `json:"timestamp_creation,omitempty"`
	// Bare metal specific fields
	SubOrder          *string                `json:"sub_order,omitempty"`
	NodeCount         int                    `json:"node_count,omitempty"`
	NetworkType       string                 `json:"network_type,omitempty"`
	SpecsPerNode      *OnDemandInstanceSpecs `json:"specs_per_node,omitempty"`
	Username          string                 `json:"username,omitempty"`
	NodeNetworking    []OnDemandNetworking   `json:"node_networking,omitempty"`
	CreationTimestamp string                 `json:"creation_timestamp,omitempty"`
}

type OnDemandInstanceResources

type OnDemandInstanceResources struct {
	RAMGb     int                    `json:"ram_gb"`
	StorageGb int                    `json:"storage_gb"`
	VCPUCount int                    `json:"vcpu_count"`
	GPUs      map[string]OnDemandGPU `json:"gpus"`
}

type OnDemandInstanceSpecs

type OnDemandInstanceSpecs struct {
	RAMGb     int    `json:"ram_gb"`
	CPUCount  int    `json:"cpu_count"`
	CPUModel  string `json:"cpu_model"`
	GPUCount  int    `json:"gpu_count"`
	GPUModel  string `json:"gpu_model"`
	StorageGb int    `json:"storage_gb"`
}

type OnDemandNetworking

type OnDemandNetworking struct {
	PublicIP  string `json:"public_ip"`
	PrivateIP string `json:"private_ip"`
}

type OnDemandPortForward

type OnDemandPortForward struct {
	ExternalPort int `json:"external_port"`
	InternalPort int `json:"internal_port"`
}

type OnDemandRentResponse

type OnDemandRentResponse struct {
	ID          int    `json:"id"`
	ExternalID  string `json:"externalId"`
	CostPerHour int    `json:"costPerHour"`
	Meta        struct {
		Name        string `json:"name"`
		GPUCount    int    `json:"gpu_count"`
		RentalType  string `json:"rental_type"`
		NetworkType string `json:"network_type"`
	} `json:"meta"`
}

type OnDemandTerminateRequest

type OnDemandTerminateRequest struct {
	RentalID int `json:"rentalId"`
}

type PortMapping

type PortMapping struct {
	Domain   string `json:"domain"`
	Protocol string `json:"protocol"`
	Port     int    `json:"port"`
}

type Price

type Price struct {
	Amount int    `json:"amount"`
	Period string `json:"period"`
	Agent  string `json:"agent"`
}

type Pricing

type Pricing struct {
	Price Price `json:"price"`
}

type RAM

type RAM struct {
	Capacity int `json:"capacity"`
}

type RentRequest

type RentRequest struct {
	ClusterName string `json:"cluster_name"`
	NodeName    string `json:"node_name"`
	GpuCount    int    `json:"gpu_count"`
	Image       *Image `json:"image,omitempty"`
}

type SpotRentResponse

type SpotRentResponse struct {
	InstanceID string `json:"instance_id"`
	Status     string `json:"status"`
	Message    string `json:"message"`
}

Response structures

type Storage

type Storage struct {
	Capacity int `json:"capacity"`
}

type TempTokenResponse added in v0.0.2

type TempTokenResponse struct {
	TempToken string `json:"tempToken"`
	LoginURL  string `json:"loginUrl"`
	ExpiresAt string `json:"expiresAt"`
}

Response structures for the CLI login API

type TerminateRequest

type TerminateRequest struct {
	ID string `json:"id"`
}

type TokenStatusResponse added in v0.0.2

type TokenStatusResponse struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

type UserInstance

type UserInstance struct {
	ID           string              `json:"id"`
	Start        string              `json:"start"`
	End          *string             `json:"end"`
	Created      string              `json:"created"`
	SSHCommand   string              `json:"sshCommand"`
	PortMappings []PortMapping       `json:"portMappings"`
	Instance     UserInstanceDetails `json:"instance"`
}

type UserInstanceDetails

type UserInstanceDetails struct {
	ID       string               `json:"id"`
	Status   string               `json:"status"`
	Hardware UserInstanceHardware `json:"hardware"`
	Pricing  UserInstancePricing  `json:"pricing"`
	GPUCount int                  `json:"gpu_count"`
}

type UserInstanceGPU

type UserInstanceGPU struct {
	Model string `json:"model"`
	RAM   int    `json:"ram"`
}

type UserInstanceHardware

type UserInstanceHardware struct {
	GPUs []UserInstanceGPU `json:"gpus"`
}

type UserInstancePrice

type UserInstancePrice struct {
	Amount float64 `json:"amount"`
	Period string  `json:"period"`
}

type UserInstancePricing

type UserInstancePricing struct {
	Price UserInstancePrice `json:"price"`
}

type UserResponse

type UserResponse struct {
	Email           string        `json:"email"`
	Picture         interface{}   `json:"picture"`
	Provider        string        `json:"provider"`
	EmailVerified   bool          `json:"email_verified"`
	Name            string        `json:"name"`
	PublicKey       string        `json:"public_key"`
	OnboardedAt     time.Time     `json:"onboarded_at"`
	OnboardedFor    string        `json:"onboarded_for"`
	Meta            interface{}   `json:"meta"`
	ReferralCode    string        `json:"referral_code"`
	ID              string        `json:"id"`
	IsActive        bool          `json:"is_active"`
	APIKey          string        `json:"api_key"`
	Role            string        `json:"role"`
	CreatedAt       time.Time     `json:"created_at"`
	UpdatedAt       time.Time     `json:"updated_at"`
	CompletedPromos []interface{} `json:"completed_promos"`
	Roles           []interface{} `json:"roles"`
}

type VirtualMachineOption

type VirtualMachineOption struct {
	GPUCount    int     `json:"gpuCount"`
	CostPerHour float64 `json:"costPerHour"`
}

VirtualMachineOption represents a VM option from the API

type VirtualMachineOptions

type VirtualMachineOptions []VirtualMachineOption

VirtualMachineOptions represents the response from /v2/marketplace/virtual-machine-options

type VirtualMachineRentalRequest

type VirtualMachineRentalRequest struct {
	ConfigID string `json:"configId"`
	GPUCount string `json:"gpuCount"`
}

OnDemand request structures

Jump to

Keyboard shortcuts

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