client

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package client_gen provides a generated HTTPS client for the HotAisle API

Index

Constants

View Source
const (
	// DefaultBaseURL is the default API base URL
	DefaultBaseURL = "https://admin.hotaisle.app/api"
	// DefaultTimeout is the default HTTP client timeout
	DefaultTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
}

APIError represents an API error response

func (*APIError) Error

func (e *APIError) Error() string

Error implements the error interface

type APIKeyTeam

type APIKeyTeam struct {
	Team
	Roles []string `json:"roles"`
}

APIKeyTeam represents a team that the API Key has access to

type AvailableBareMetalTypes

type AvailableBareMetalTypes struct {
	Quantity                  int64                `json:"Quantity"`
	MinimumReservationMinutes int64                `json:"MinimumReservationMinutes"`
	OnDemandPrice             int64                `json:"OnDemandPrice,omitempty"`
	Specs                     BareMetalServerSpecs `json:"Specs"`
}

AvailableBareMetalTypes is how many bare metal servers of a given type are available to be reserved

type AvailableVirtualMachineTypes

type AvailableVirtualMachineTypes struct {
	Quantity                  int64               `json:"Quantity"`
	MinimumReservationMinutes int64               `json:"MinimumReservationMinutes"`
	OnDemandPrice             int64               `json:"OnDemandPrice,omitempty"`
	Specs                     VirtualMachineSpecs `json:"Specs"`
}

AvailableVirtualMachineTypes is how many virtual machines of a given type are available to be deployed

type BalanceInfo

type BalanceInfo struct {
	AvailableBalance     int64      `json:"available_balance"`
	HourlyRate           int64      `json:"hourly_rate"`
	BareMetalServerCount int64      `json:"bare_metal_server_count"`
	VirtualMachineCount  int64      `json:"virtual_machine_count"`
	EstimatedRunoutTime  *time.Time `json:"estimated_runout_time,omitempty"`
	MinimumBalance       int64      `json:"minimum_balance,omitempty"`
}

BalanceInfo contains balance and estimated time until depletion

type BareMetalServer

type BareMetalServer struct {
	Name                 string           `json:"name"`
	IPAddress            string           `json:"ip_address"`
	Manufacturer         string           `json:"manufacturer"`
	Model                string           `json:"model"`
	Description          string           `json:"description,omitempty"`
	SSHAccess            *ExternalService `json:"ssh_access,omitempty"`
	SupportAccessEnabled bool             `json:"support_access_enabled,omitempty"`
}

BareMetalServer represents a bare metal server

type BareMetalServerConsoleURL

type BareMetalServerConsoleURL struct {
	URL string `json:"url"`
}

BareMetalServerConsoleURL has a temporary URL that can be used to access a local console

type BareMetalServerDetails

type BareMetalServerDetails struct {
	BareMetalServer
	BareMetalServerSpecs
	OSStatus *BareMetalServerlOSStatus `json:"os_status,omitempty"`
}

BareMetalServerDetails represents a bare metal server with detailed hardware specifications

type BareMetalServerPowerState

type BareMetalServerPowerState struct {
	State string `json:"state"`
}

BareMetalServerPowerState represents the current power status of a server

type BareMetalServerReservation

type BareMetalServerReservation struct {
	Description string               `json:"description,omitempty"`
	Specs       BareMetalServerSpecs `json:"specs"`
}

BareMetalServerReservation represents a request to reserve a bare metal server

type BareMetalServerReservationResponse

type BareMetalServerReservationResponse struct {
	BareMetalServer
	CPUCores      uint64                    `json:"cpu_cores"`
	RAMCapacity   uint64                    `json:"ram_capacity"`
	DiskCapacity  uint64                    `json:"disk_capacity"`
	CPUs          []CPUs                    `json:"cpus,omitempty"`
	Disks         []Disks                   `json:"disks,omitempty"`
	GPUs          []GPUs                    `json:"gpus,omitempty"`
	MemoryModules []MemoryModules           `json:"memory_modules,omitempty"`
	OSStatus      *BareMetalServerlOSStatus `json:"os_status,omitempty"`
}

BareMetalServerReservationResponse represents the response after successfully reserving a server

type BareMetalServerSpecs

type BareMetalServerSpecs struct {
	CPUCores      uint64          `json:"cpu_cores"`
	RAMCapacity   uint64          `json:"ram_capacity"`
	DiskCapacity  uint64          `json:"disk_capacity"`
	CPUs          []CPUs          `json:"cpus,omitempty"`
	Disks         []Disks         `json:"disks,omitempty"`
	GPUs          []GPUs          `json:"gpus,omitempty"`
	MemoryModules []MemoryModules `json:"memory_modules,omitempty"`
}

BareMetalServerSpecs contains the hardware specifications of a server

type BareMetalServerUpdate

type BareMetalServerUpdate struct {
	Description string `json:"description,omitempty"`
}

BareMetalServerUpdate represents a bare metal server update request

type BareMetalServerlOSStatus

type BareMetalServerlOSStatus struct {
	OSSelection       string    `json:"os_selection"`
	OSStatus          string    `json:"os_install_status"`
	LastImagingUpdate time.Time `json:"last_imaging_update"`
}

BareMetalServerlOSStatus represents the current state of OS installation on a server

type BareMetalService

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

BareMetalService handles bare metal server-related API operations

func (*BareMetalService) ACReset

func (s *BareMetalService) ACReset(ctx context.Context, teamHandle, serverName string) error

ACReset performs a complete AC reset of the server

func (*BareMetalService) ColdReboot

func (s *BareMetalService) ColdReboot(ctx context.Context, teamHandle, serverName string) error

ColdReboot turns off and then reboots the system

func (*BareMetalService) Delete

func (s *BareMetalService) Delete(ctx context.Context, teamHandle, serverName string) error

Delete releases a bare metal server back to the available pool

func (*BareMetalService) DisableSupportAccess

func (s *BareMetalService) DisableSupportAccess(ctx context.Context, teamHandle, serverName string) error

DisableSupportAccess revokes Hot Aisle support staff access to the server

func (*BareMetalService) EnableSupportAccess

func (s *BareMetalService) EnableSupportAccess(ctx context.Context, teamHandle, serverName string) error

EnableSupportAccess enables Hot Aisle support staff to access the server

func (*BareMetalService) ForceShutdown

func (s *BareMetalService) ForceShutdown(ctx context.Context, teamHandle, serverName string) error

ForceShutdown immediately powers off the server

func (*BareMetalService) Get

func (s *BareMetalService) Get(ctx context.Context, teamHandle, serverName string) (*BareMetalServerDetails, error)

Get retrieves detailed information about a specific bare metal server

func (*BareMetalService) GetAvailable

func (s *BareMetalService) GetAvailable(ctx context.Context, teamHandle string) ([]AvailableBareMetalTypes, error)

GetAvailable retrieves available bare metal server types

func (*BareMetalService) GetConsoleURL

func (s *BareMetalService) GetConsoleURL(ctx context.Context, teamHandle, serverName string) (*BareMetalServerConsoleURL, error)

GetConsoleURL generates a URL for bare metal console access

func (*BareMetalService) GetPowerState

func (s *BareMetalService) GetPowerState(ctx context.Context, teamHandle, serverName string) (*BareMetalServerPowerState, error)

GetPowerState retrieves the current power state of a server

func (*BareMetalService) GracefulShutdown

func (s *BareMetalService) GracefulShutdown(ctx context.Context, teamHandle, serverName string) error

GracefulShutdown sends an ACPI signal to initiate a clean shutdown

func (*BareMetalService) List

func (s *BareMetalService) List(ctx context.Context, teamHandle string) ([]BareMetalServerDetails, error)

List retrieves all bare metal servers for a team

func (*BareMetalService) PowerOn

func (s *BareMetalService) PowerOn(ctx context.Context, teamHandle, serverName string) error

PowerOn turns on a server

func (*BareMetalService) Reinstall

func (s *BareMetalService) Reinstall(ctx context.Context, teamHandle, serverName string) (*BareMetalServerDetails, error)

Reinstall resets BIOS settings, wipes all disks, and reinstalls the OS

func (*BareMetalService) Reserve

Reserve reserves a bare metal server for the team

func (*BareMetalService) Update

func (s *BareMetalService) Update(ctx context.Context, teamHandle, serverName string, update BareMetalServerUpdate) error

Update updates a bare metal server's description

func (*BareMetalService) WarmReboot

func (s *BareMetalService) WarmReboot(ctx context.Context, teamHandle, serverName string) error

WarmReboot reboots the system without turning the power off completely

type CPUs

type CPUs struct {
	Components
	Cores     uint64 `json:"cores"`
	Frequency uint64 `json:"frequency"`
}

CPUs represents processor information

type Client

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

Client is an HTTPS client for the HotAisle API

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new HotAisle API client

func (*Client) BareMetal

func (c *Client) BareMetal() *BareMetalService

BareMetal returns a new BareMetalService

func (*Client) SetToken

func (c *Client) SetToken(token string)

SetToken updates the authentication token

func (*Client) Teams

func (c *Client) Teams() *TeamsService

Teams returns a new TeamsService

func (*Client) User

func (c *Client) User() *UserService

User returns a new UserService

func (*Client) VirtualMachines

func (c *Client) VirtualMachines() *VirtualMachinesService

VirtualMachines returns a new VirtualMachinesService

type Components

type Components struct {
	Count        uint64 `json:"count"`
	Manufacturer string `json:"manufacturer"`
	Model        string `json:"model"`
}

Components represents common attributes for hardware components

type Disks

type Disks struct {
	Components
	Type     string `json:"type"`
	Capacity uint64 `json:"capacity"`
}

Disks represents storage device information

type ExternalService

type ExternalService struct {
	IPAddress string `json:"ip_address"`
	Port      int64  `json:"port"`
	DNSName   string `json:"dns_name,omitempty"`
}

ExternalService represents information about an externally accessible service

type GPUs

type GPUs struct {
	Count        uint64 `json:"count"`
	Manufacturer string `json:"manufacturer,omitempty"`
	Model        string `json:"model,omitempty"`
}

GPUs represents graphics processing unit information

type GetUserResponse

type GetUserResponse struct {
	User  User       `json:"user"`
	Teams []UserTeam `json:"teams"`
}

GetUserResponse represents information about the authenticated user and their teams

type MemoryModules

type MemoryModules struct {
	Components
	Capacity uint64 `json:"capacity"`
}

MemoryModules represents memory module information

type Option

type Option func(*Client)

Option is a function that configures a Client

func WithBaseURL

func WithBaseURL(baseURL string) Option

WithBaseURL sets a custom base URL

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient sets a custom HTTP client (primarily for testing)

func WithToken

func WithToken(token string) Option

WithToken sets the authentication token

func WithUserAgent

func WithUserAgent(ua string) Option

WithUserAgent sets a custom user agent

type PurchaseTeamCreditsRequest

type PurchaseTeamCreditsRequest struct {
	Cents int64 `json:"cents"`
}

PurchaseTeamCreditsRequest represents a request to purchase credits for a team

type PurchaseTeamCreditsResponse

type PurchaseTeamCreditsResponse struct {
	CheckoutURL string    `json:"checkout_url"`
	ExpiresAt   time.Time `json:"expires_at"`
}

PurchaseTeamCreditsResponse represents the response to a credits purchase request

type SSHKey

type SSHKey struct {
	Type        string `json:"type"`
	PublicKey   string `json:"public_key"`
	Fingerprint string `json:"fingerprint"`
	Comment     string `json:"comment,omitempty"`
}

SSHKey represents an SSH public key associated with a user

type SSHKeyRequest

type SSHKeyRequest struct {
	AuthorizedKey string `json:"authorized_key"`
}

SSHKeyRequest represents the data needed to add a new SSH key

type Team

type Team struct {
	Handle                  string `json:"handle"`
	Name                    string `json:"name"`
	Description             string `json:"description,omitempty"`
	MaximumVirtualMachines  int64  `json:"maximum_virtual_machines,omitempty"`
	MaximumBareMetalServers int64  `json:"maximum_bare_metal_servers,omitempty"`
}

Team represents a team

type TeamInvitationRequest

type TeamInvitationRequest struct {
	Name  string   `json:"name"`
	Email string   `json:"email"`
	Roles []string `json:"roles"`
}

TeamInvitationRequest contains the information needed to invite a user to a team

type TeamMember

type TeamMember struct {
	Name       string    `json:"name"`
	Email      string    `json:"email"`
	Created    time.Time `json:"created"`
	Roles      []string  `json:"roles"`
	Invitation bool      `json:"invitation,omitempty"`
}

TeamMember represents a team member or pending invitation

type TeamMemberUpdate

type TeamMemberUpdate struct {
	Roles []string `json:"roles"`
}

TeamMemberUpdate represents the data needed to update a team member's roles

type TeamUpdate

type TeamUpdate struct {
	Handle      string `json:"handle"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

TeamUpdate represents a team update request

type TeamsService

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

TeamsService handles team-related API operations

func (*TeamsService) AcceptInvitation

func (s *TeamsService) AcceptInvitation(ctx context.Context, teamHandle string) (*UserTeamWithMembers, error)

AcceptInvitation accepts a pending team invitation

func (*TeamsService) Create

func (s *TeamsService) Create(ctx context.Context, team Team) (*UserTeamWithMembers, error)

Create creates a new team

func (*TeamsService) Get

func (s *TeamsService) Get(ctx context.Context, teamHandle string) (*UserTeamDetails, error)

Get retrieves detailed information about a specific team

func (*TeamsService) GetBalance

func (s *TeamsService) GetBalance(ctx context.Context, teamHandle string) (*BalanceInfo, error)

GetBalance retrieves team balance information

func (*TeamsService) GetInvitations

func (s *TeamsService) GetInvitations(ctx context.Context) ([]UserTeam, error)

GetInvitations retrieves pending team invitations for the user

func (*TeamsService) GetTeamInvitations

func (s *TeamsService) GetTeamInvitations(ctx context.Context, teamHandle string) ([]TeamMember, error)

GetTeamInvitations retrieves pending invitations for a team

func (*TeamsService) InviteMember

func (s *TeamsService) InviteMember(ctx context.Context, teamHandle string, req TeamInvitationRequest) error

InviteMember invites a user to join the team

func (*TeamsService) List

func (s *TeamsService) List(ctx context.Context) ([]UserTeam, error)

List retrieves all teams the user belongs to

func (*TeamsService) PurchaseCredits

func (s *TeamsService) PurchaseCredits(ctx context.Context, teamHandle string, req PurchaseTeamCreditsRequest) (*PurchaseTeamCreditsResponse, error)

PurchaseCredits creates a Stripe checkout session for purchasing credits

func (*TeamsService) RemoveMember

func (s *TeamsService) RemoveMember(ctx context.Context, teamHandle, email string) error

RemoveMember removes a member from a team

func (*TeamsService) Update

func (s *TeamsService) Update(ctx context.Context, teamHandle string, update TeamUpdate) (*UserTeamWithMembers, error)

Update updates a team's information

func (*TeamsService) UpdateMember

func (s *TeamsService) UpdateMember(ctx context.Context, teamHandle, email string, update TeamMemberUpdate) (*TeamMember, error)

UpdateMember updates a team member's roles

type User

type User struct {
	Name    string    `json:"name"`
	Email   string    `json:"email"`
	Created time.Time `json:"created"`
}

User represents a registered user in the system

type UserAPIKey

type UserAPIKey struct {
	Prefix   string       `json:"prefix,omitempty"`
	Label    string       `json:"label,omitempty"`
	UserRole string       `json:"user_role"`
	Teams    []APIKeyTeam `json:"teams,omitempty"`
}

UserAPIKey represents a user's API key

type UserAPIKeyRequest

type UserAPIKeyRequest struct {
	Label    string                `json:"label,omitempty"`
	UserRole string                `json:"user_role,omitempty"`
	Teams    []UserAPIKeyTeamRoles `json:"teams,omitempty"`
}

UserAPIKeyRequest represents the data needed to create or update an API key

type UserAPIKeyTeamRoles

type UserAPIKeyTeamRoles struct {
	Team  string   `json:"team"`
	Roles []string `json:"roles"`
}

UserAPIKeyTeamRoles defines the permissions for an API key on a specific team

type UserAPIKeyWithToken

type UserAPIKeyWithToken struct {
	UserAPIKey
	Token string `json:"token,omitempty"`
}

UserAPIKeyWithToken represents an API key with its full token value

type UserService

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

UserService handles user-related API operations

func (*UserService) AddSSHKey

func (s *UserService) AddSSHKey(ctx context.Context, key SSHKeyRequest) (*SSHKey, error)

AddSSHKey adds a new SSH key to the user's account

func (*UserService) CreateAPIKey

func (s *UserService) CreateAPIKey(ctx context.Context, req UserAPIKeyRequest) (*UserAPIKeyWithToken, error)

CreateAPIKey creates a new API key with specified permissions

func (*UserService) DeleteAPIKey

func (s *UserService) DeleteAPIKey(ctx context.Context, prefix string) error

DeleteAPIKey permanently deletes an API key

func (*UserService) DeleteSSHKey

func (s *UserService) DeleteSSHKey(ctx context.Context, fingerprint string) error

DeleteSSHKey permanently deletes an SSH key from the user's account

func (*UserService) Get

Get retrieves information about the currently authenticated user

func (*UserService) GetAPIKey

func (s *UserService) GetAPIKey(ctx context.Context, prefix string) (*UserAPIKey, error)

GetAPIKey retrieves detailed information about a specific API key

func (*UserService) GetAPIKeys

func (s *UserService) GetAPIKeys(ctx context.Context) ([]UserAPIKey, error)

GetAPIKeys retrieves all API keys for the user

func (*UserService) GetSSHKeys

func (s *UserService) GetSSHKeys(ctx context.Context) ([]SSHKey, error)

GetSSHKeys retrieves all SSH keys for the user

func (*UserService) Update

func (s *UserService) Update(ctx context.Context, update UserUpdate) (*User, error)

Update updates the currently authenticated user profile

func (*UserService) UpdateAPIKey

func (s *UserService) UpdateAPIKey(ctx context.Context, prefix string, req UserAPIKeyRequest) (*UserAPIKey, error)

UpdateAPIKey updates an existing API key

type UserTeam

type UserTeam struct {
	Team
	Roles          []string `json:"roles"`
	EffectiveRoles []string `json:"effective_roles"`
	Invitation     bool     `json:"invitation,omitempty"`
}

UserTeam represents a team that the user belongs to

type UserTeamDetails

type UserTeamDetails struct {
	UserTeamWithMembers
	BareMetalServers []BareMetalServer `json:"bare_metal_servers,omitempty"`
	VirtualMachines  []VirtualMachine  `json:"virtual_machines,omitempty"`
}

UserTeamDetails represents a team with detailed information including members and resources

type UserTeamWithMembers

type UserTeamWithMembers struct {
	UserTeam
	Members []TeamMember `json:"members,omitempty"`
}

UserTeamWithMembers represents a team with detailed member information

type UserUpdate

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

UserUpdate represents the updateable fields for a user

type VMProvisionRequest

type VMProvisionRequest struct {
	VirtualMachineSpecs
	UserDataURL string `json:"user_data_url,omitempty"`
}

VMProvisionRequest represents a request to provision a virtual machine

type VMResetRequest

type VMResetRequest struct {
	UserDataURL string `json:"user_data_url,omitempty"`
}

VMResetRequest represents a request to reset/rebuild a virtual machine

type VirtualMachine

type VirtualMachine struct {
	Name        string           `json:"name"`
	IPAddress   string           `json:"ip_address"`
	Description string           `json:"description,omitempty"`
	SSHAccess   *ExternalService `json:"ssh_access,omitempty"`
}

VirtualMachine represents a virtual machine instance

type VirtualMachineDetails

type VirtualMachineDetails struct {
	VirtualMachine
	VirtualMachineSpecs
}

VirtualMachineDetails represents a virtual machine with detailed specifications

type VirtualMachineSpecs

type VirtualMachineSpecs struct {
	CPUCores     *uint64 `json:"cpu_cores,omitempty"`
	RAMCapacity  *uint64 `json:"ram_capacity,omitempty"`
	DiskCapacity *uint64 `json:"disk_capacity,omitempty"`
	CPUs         *CPUs   `json:"cpus,omitempty"`
	GPUs         []GPUs  `json:"gpus,omitempty"`
}

VirtualMachineSpecs contains the specifications of a virtual machine

type VirtualMachineState

type VirtualMachineState struct {
	State string `json:"state"`
	Host  string `json:"host"`
}

VirtualMachineState represents the current state of a virtual machine

type VirtualMachineUpdate

type VirtualMachineUpdate struct {
	Description string `json:"description,omitempty"`
}

VirtualMachineUpdate represents a virtual machine update request

type VirtualMachinesService

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

VirtualMachinesService handles virtual machine-related API operations

func (*VirtualMachinesService) Delete

func (s *VirtualMachinesService) Delete(ctx context.Context, teamHandle, vmName string) error

Delete completely deletes a virtual machine and all its resources

func (*VirtualMachinesService) Get

func (s *VirtualMachinesService) Get(ctx context.Context, teamHandle, vmName string) (*VirtualMachineDetails, error)

Get retrieves detailed information about a specific virtual machine

func (*VirtualMachinesService) GetAvailable

func (s *VirtualMachinesService) GetAvailable(ctx context.Context, teamHandle string) ([]AvailableVirtualMachineTypes, error)

GetAvailable retrieves available virtual machine types

func (*VirtualMachinesService) GetState

func (s *VirtualMachinesService) GetState(ctx context.Context, teamHandle, vmName string) (*VirtualMachineState, error)

GetState retrieves the current power state of a virtual machine

func (*VirtualMachinesService) HardReset

func (s *VirtualMachinesService) HardReset(ctx context.Context, teamHandle, vmName string) error

HardReset forcefully resets a running virtual machine

func (*VirtualMachinesService) List

List retrieves all virtual machines for a team

func (*VirtualMachinesService) Provision

Provision assigns and provisions a virtual machine

func (*VirtualMachinesService) Reboot

func (s *VirtualMachinesService) Reboot(ctx context.Context, teamHandle, vmName string) error

Reboot gracefully reboots a running virtual machine

func (*VirtualMachinesService) Rebuild

func (s *VirtualMachinesService) Rebuild(ctx context.Context, teamHandle, vmName string, req VMResetRequest) error

Rebuild performs a complete rebuild of the virtual machine to its initial state

func (*VirtualMachinesService) Shutdown

func (s *VirtualMachinesService) Shutdown(ctx context.Context, teamHandle, vmName string) error

Shutdown sends a graceful shutdown signal to a running virtual machine

func (*VirtualMachinesService) Start

func (s *VirtualMachinesService) Start(ctx context.Context, teamHandle, vmName string) error

Start starts a virtual machine that is currently stopped

func (*VirtualMachinesService) Stop

func (s *VirtualMachinesService) Stop(ctx context.Context, teamHandle, vmName string) error

Stop forcefully stops a running virtual machine

func (*VirtualMachinesService) Update

func (s *VirtualMachinesService) Update(ctx context.Context, teamHandle, vmName string, update VirtualMachineUpdate) error

Update updates a virtual machine's description

Jump to

Keyboard shortcuts

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