api

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBaseURL = "https://cloud.lambdalabs.com/api/v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Error struct {
		Code    string `json:"code"`
		Message string `json:"message"`
	} `json:"error"`
}

type AddSSHKeyRequest

type AddSSHKeyRequest struct {
	Name      string `json:"name"`
	PublicKey string `json:"public_key,omitempty"`
}

AddSSHKeyRequest represents a request to add an SSH key

type Client

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

func NewClient

func NewClient(apiKey string) *Client

func (*Client) AddSSHKey

func (c *Client) AddSSHKey(req *AddSSHKeyRequest) (*SSHKey, error)

AddSSHKey adds a new SSH key

func (*Client) DeleteSSHKey

func (c *Client) DeleteSSHKey(id string) error

DeleteSSHKey deletes an SSH key

func (*Client) GetInstance

func (c *Client) GetInstance(id string) (*Instance, error)

GetInstance returns details for a specific instance

func (*Client) LaunchInstance

func (c *Client) LaunchInstance(req *LaunchRequest) (*LaunchResponse, error)

LaunchInstance launches a new instance

func (*Client) ListInstanceTypes

func (c *Client) ListInstanceTypes() ([]*InstanceTypeAvailability, error)

ListInstanceTypes returns all available instance types

func (*Client) ListInstances

func (c *Client) ListInstances() ([]*Instance, error)

ListInstances returns all running instances

func (*Client) ListSSHKeys

func (c *Client) ListSSHKeys() ([]*SSHKey, error)

ListSSHKeys returns all SSH keys

func (*Client) RenameInstance added in v0.3.0

func (c *Client) RenameInstance(instanceID, name string) error

RenameInstance renames an instance

func (*Client) TerminateInstance

func (c *Client) TerminateInstance(instanceIDs []string) (*TerminateResponse, error)

TerminateInstance terminates instances

type Instance

type Instance struct {
	ID              string        `json:"id"`
	Name            string        `json:"name"`
	IP              string        `json:"ip"`
	Status          string        `json:"status"`
	SSHKeyNames     []string      `json:"ssh_key_names"`
	FileSystemNames []string      `json:"file_system_names"`
	Region          *Region       `json:"region"`
	InstanceType    *InstanceType `json:"instance_type"`
	Hostname        string        `json:"hostname"`
	JupyterToken    string        `json:"jupyter_token"`
	JupyterURL      string        `json:"jupyter_url"`
}

Instance represents a Lambda Cloud instance

type InstanceSpecs

type InstanceSpecs struct {
	VCPUs      int    `json:"vcpus"`
	MemoryGiB  int    `json:"memory_gib"`
	StorageGiB int    `json:"storage_gib"`
	GPUs       int    `json:"gpus"`
	GPUType    string `json:"gpu_type"`
}

InstanceSpecs represents the hardware specs of an instance type

type InstanceType

type InstanceType struct {
	Name              string         `json:"name"`
	Description       string         `json:"description"`
	PriceCentsPerHour int            `json:"price_cents_per_hour"`
	Specs             *InstanceSpecs `json:"specs"`
}

InstanceType represents a Lambda Cloud instance type

type InstanceTypeAvailability

type InstanceTypeAvailability struct {
	InstanceType        *InstanceType `json:"instance_type"`
	RegionsWithCapacity []*Region     `json:"regions_with_capacity_available"`
}

InstanceTypeAvailability represents availability of an instance type

type LaunchRequest

type LaunchRequest struct {
	RegionName       string   `json:"region_name"`
	InstanceTypeName string   `json:"instance_type_name"`
	SSHKeyNames      []string `json:"ssh_key_names"`
	FileSystemNames  []string `json:"file_system_names,omitempty"`
	Quantity         int      `json:"quantity,omitempty"`
	Name             string   `json:"name,omitempty"`
	UserData         string   `json:"user_data,omitempty"`
}

LaunchRequest represents a request to launch instances

type LaunchResponse

type LaunchResponse struct {
	InstanceIDs []string `json:"instance_ids"`
}

LaunchResponse represents the response from launching instances

type Region

type Region struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

Region represents a Lambda Cloud region

type RenameInstanceRequest added in v0.3.0

type RenameInstanceRequest struct {
	Name string `json:"name"`
}

RenameInstanceRequest represents a request to rename an instance

type SSHKey

type SSHKey struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	PublicKey string `json:"public_key"`
}

SSHKey represents an SSH key

type TerminateRequest

type TerminateRequest struct {
	InstanceIDs []string `json:"instance_ids"`
}

TerminateRequest represents a request to terminate instances

type TerminateResponse

type TerminateResponse struct {
	TerminatedInstances []*Instance `json:"terminated_instances"`
}

TerminateResponse represents the response from terminating instances

Jump to

Keyboard shortcuts

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