Documentation
¶
Overview ¶
Package hyperbolic is the Go SDK for the Hyperbolic API.
Its operations and types are generated from the API's published OpenAPI spec (https://api.hyperbolic.ai/v2/openapi.json). A Client groups them by area: Client.Rentals, Client.StorageVolumes, Client.SSHKeys, Client.Balances, Client.APIKeys and Client.Users. Each method takes a context.Context and, when the operation has inputs, a ...Params struct.
Getting started ¶
client, err := hyperbolic.NewClient(os.Getenv("HYPERBOLIC_API_KEY"))
if err != nil { ... }
created, err := client.Rentals.Create(ctx, hyperbolic.CreateRentalParams{
RentalType: hyperbolic.RentalTypeVirtualMachine,
GPUType: hyperbolic.Ptr(hyperbolic.GPUTypeH100),
GPUCount: 1,
})
Things the API does that are easy to get wrong ¶
- Creating a rental is not idempotent and the API has no idempotency key. See "Create safety" below.
- A rental is identified by its string RentalID, which terminate, reboot and the lookup take.
- Money is in cents, including CostPerHour on a rental's current term (3192 == $31.92/hr).
- A create returns the rental without its live status. Status, instances and SSH endpoints come from RentalsService.Get or from listing.
- There are no webhooks. Status is observed by polling.
Create safety ¶
If a call that is not safe to repeat, such as creating a rental, fails in a way that leaves its outcome unknown (a 5xx response, a timeout, or a dropped connection after the request was sent), it may have taken effect even though it returned an error. The client never retries it in that situation. Instead it returns an error matching ErrOutcomeUnknown:
created, err := client.Rentals.Create(ctx, params)
if errors.Is(err, hyperbolic.ErrOutcomeUnknown) {
// Look the rental up (for example by label) before trying again.
}
Calls that are safe to repeat are retried on transient failures according to the client's RetryPolicy. Calls the server provably did not process (HTTP 429, or a connection that was never made) are retried for every kind of call.
Types ¶
Optional request fields are pointers. Set them with Ptr. Nullable response fields are nullable.Nullable values from github.com/oapi-codegen/nullable. Unions have a Discriminator method and an As method per variant. Enums are typed strings, and a value the SDK does not know yet still decodes.
Testing ¶
Package hyperbolictest is an in-memory fake of the API with fault injection, for testing code that uses this package.
Example ¶
Print the balance and the virtual machines that can be rented now. Neither call spends money. The README's quick start is this example.
package main
import (
"context"
"fmt"
"log"
"os"
hyperbolic "github.com/HyperbolicLabs/hyperbolic-go"
)
func main() {
ctx := context.Background()
client, err := hyperbolic.NewClient(os.Getenv("HYPERBOLIC_API_KEY"))
if err != nil {
log.Fatal(err)
}
balance, err := client.Balances.Get(ctx)
if err != nil {
log.Fatal(err)
}
fmt.Printf("balance: $%.2f\n", balance.BalanceCents/100)
options, err := client.Rentals.Options(ctx)
if err != nil {
log.Fatal(err)
}
for _, o := range options {
v, err := o.ValueByDiscriminator()
if err != nil {
continue // a machine type this version of the SDK does not know
}
if vm, ok := v.(hyperbolic.VirtualMachineOption); ok && vm.Enabled {
fmt.Printf("%d x %s in %s: $%.2f/hour\n", vm.GPUCount, vm.GPUType, vm.Region, vm.CostPerHourCents/100)
}
}
}
Output:
Index ¶
- Constants
- Variables
- func HasCode(err error, code string) bool
- func IsNotFound(err error) bool
- func IsOutcomeUnknown(err error) bool
- func IsRateLimited(err error) bool
- func IsUnauthorized(err error) bool
- func Ptr[T any](v T) *T
- func StatusCode(err error) int
- type APIError
- type APIKey
- type APIKeysService
- type AccountBalance
- type ActiveRentalLookup
- type ActiveRentalLookupState
- type ActiveRentalSummary
- type ActiveRentalSummaryByTermType
- type ActiveRentalsPage
- type AttachSSHKeyParams
- type AttachStorageVolumeParams
- type AttachStorageVolumeResponse
- type AttachedStorage
- type BalancesService
- type BareMetalOption
- type BareMetalOptionMachineType
- type Client
- type ConnectionType
- type ConvertRentalToReservedParams
- type CreateRentalParams
- type CreateRentalParamsCUDAVersion
- type CreateRentalParamsNetworkType
- type CreateSSHKeyParams
- type CreateStorageVolumeParams
- type CreatedStorageVolume
- type CurrentUser
- type CurrentUserRole
- type DeleteSSHKeyParams
- type DeletedSSHKey
- type DetachSSHKeyParams
- type EthernetVariant
- type ExistingStorageVolume
- type ExistingStorageVolumeIsNew
- type ExtendReservedRentalParams
- type GPUFormFactor
- type GPUType
- type GetRentalParams
- type GetReservationExtensionQuoteParams
- type GetReservedConversionQuoteParams
- type HasRentalHistoryParams
- type HistoricalRental
- type ListActiveRentalsParams
- type ListRentalHistoryParams
- type ListRentalSSHKeysParams
- type ListReserveOptionsParams
- type ManagedClusterRef
- type NetworkInterface
- type NewStorageVolume
- type NewStorageVolumeIsNew
- type OnDemandTerm
- type OnDemandTermTermType
- type Option
- type OrganizationMember
- type OrganizationMemberRole
- type OutcomeUnknownError
- type PortMapping
- type PrivateCloudTerm
- type PrivateCloudTermTermType
- type PrivateCluster
- type PrivateClusterNode
- type PrivateClusterNodeRole
- type RebootRentalInstanceParams
- type Rental
- type RentalCreator
- type RentalHistoryPage
- type RentalInstance
- type RentalInstanceReboot
- type RentalInstanceResources
- type RentalLookup
- func (t RentalLookup) AsActiveRentalLookup() (ActiveRentalLookup, error)
- func (t RentalLookup) AsTerminatedRentalLookup() (TerminatedRentalLookup, error)
- func (t RentalLookup) Discriminator() (string, error)
- func (t *RentalLookup) FromActiveRentalLookup(v ActiveRentalLookup) error
- func (t *RentalLookup) FromTerminatedRentalLookup(v TerminatedRentalLookup) error
- func (t RentalLookup) MarshalJSON() ([]byte, error)
- func (t *RentalLookup) MergeActiveRentalLookup(v ActiveRentalLookup) error
- func (t *RentalLookup) MergeTerminatedRentalLookup(v TerminatedRentalLookup) error
- func (t *RentalLookup) UnmarshalJSON(b []byte) error
- func (t RentalLookup) ValueByDiscriminator() (interface{}, error)
- type RentalNode
- type RentalOption
- func (t RentalOption) AsBareMetalOption() (BareMetalOption, error)
- func (t RentalOption) AsVirtualMachineOption() (VirtualMachineOption, error)
- func (t RentalOption) Discriminator() (string, error)
- func (t *RentalOption) FromBareMetalOption(v BareMetalOption) error
- func (t *RentalOption) FromVirtualMachineOption(v VirtualMachineOption) error
- func (t RentalOption) MarshalJSON() ([]byte, error)
- func (t *RentalOption) MergeBareMetalOption(v BareMetalOption) error
- func (t *RentalOption) MergeVirtualMachineOption(v VirtualMachineOption) error
- func (t *RentalOption) UnmarshalJSON(b []byte) error
- func (t RentalOption) ValueByDiscriminator() (interface{}, error)
- type RentalStatus
- type RentalTerm
- func (t RentalTerm) AsOnDemandTerm() (OnDemandTerm, error)
- func (t RentalTerm) AsPrivateCloudTerm() (PrivateCloudTerm, error)
- func (t RentalTerm) AsReservedTerm() (ReservedTerm, error)
- func (t RentalTerm) Discriminator() (string, error)
- func (t *RentalTerm) FromOnDemandTerm(v OnDemandTerm) error
- func (t *RentalTerm) FromPrivateCloudTerm(v PrivateCloudTerm) error
- func (t *RentalTerm) FromReservedTerm(v ReservedTerm) error
- func (t RentalTerm) MarshalJSON() ([]byte, error)
- func (t *RentalTerm) MergeOnDemandTerm(v OnDemandTerm) error
- func (t *RentalTerm) MergePrivateCloudTerm(v PrivateCloudTerm) error
- func (t *RentalTerm) MergeReservedTerm(v ReservedTerm) error
- func (t *RentalTerm) UnmarshalJSON(b []byte) error
- func (t RentalTerm) ValueByDiscriminator() (interface{}, error)
- type RentalTermTypeSummary
- type RentalTermination
- type RentalType
- type RentalWithStatus
- type RentalsService
- func (s *RentalsService) ActiveSummary(ctx context.Context) (*ActiveRentalSummary, error)
- func (s *RentalsService) AttachSSHKey(ctx context.Context, params AttachSSHKeyParams) (*SuccessResponse, error)
- func (s *RentalsService) ConversionQuote(ctx context.Context, params GetReservedConversionQuoteParams) (*ReservedConversionQuote, error)
- func (s *RentalsService) ConvertToReserved(ctx context.Context, params ConvertRentalToReservedParams) (*ReservedRentalConversion, error)
- func (s *RentalsService) Create(ctx context.Context, params CreateRentalParams) (*Rental, error)
- func (s *RentalsService) DetachSSHKey(ctx context.Context, params DetachSSHKeyParams) (*SuccessResponse, error)
- func (s *RentalsService) ExtendReserved(ctx context.Context, params ExtendReservedRentalParams) (*ReservedRentalExtension, error)
- func (s *RentalsService) ExtensionQuote(ctx context.Context, params GetReservationExtensionQuoteParams) (*ReservationExtensionQuote, error)
- func (s *RentalsService) Get(ctx context.Context, params GetRentalParams) (*RentalLookup, error)
- func (s *RentalsService) HasHistory(ctx context.Context, params HasRentalHistoryParams) (bool, error)
- func (s *RentalsService) ListActive(ctx context.Context, params ListActiveRentalsParams) (*ActiveRentalsPage, error)
- func (s *RentalsService) ListActiveAll(ctx context.Context, params ListActiveRentalsParams) iter.Seq2[RentalWithStatus, error]
- func (s *RentalsService) ListHistory(ctx context.Context, params ListRentalHistoryParams) (*RentalHistoryPage, error)
- func (s *RentalsService) ListHistoryAll(ctx context.Context, params ListRentalHistoryParams) iter.Seq2[HistoricalRental, error]
- func (s *RentalsService) Options(ctx context.Context) ([]RentalOption, error)
- func (s *RentalsService) RebootInstance(ctx context.Context, params RebootRentalInstanceParams) (*RentalInstanceReboot, error)
- func (s *RentalsService) RequestReservation(ctx context.Context, params RequestReservationParams) (*ReservationRequest, error)
- func (s *RentalsService) ReserveOptions(ctx context.Context, params ListReserveOptionsParams) (*ReserveOptions, error)
- func (s *RentalsService) Terminate(ctx context.Context, params TerminateRentalParams) (*RentalTermination, error)
- func (s *RentalsService) Update(ctx context.Context, params UpdateRentalParams) (*Rental, error)
- type RequestReservationParams
- type ReservationExtensionOption
- type ReservationExtensionQuote
- type ReservationRequest
- type ReserveOptions
- type ReservedConversionOption
- type ReservedConversionQuote
- type ReservedRentalConversion
- type ReservedRentalExtension
- type ReservedTerm
- type ReservedTermTermType
- type RetryPolicy
- type SSHEndpoint
- type SSHKey
- type SSHKeyCreator
- type SSHKeyWithLiveRentalCount
- type SSHKeysService
- func (s *SSHKeysService) Create(ctx context.Context, params CreateSSHKeyParams) (*SSHKey, error)
- func (s *SSHKeysService) Delete(ctx context.Context, params DeleteSSHKeyParams) (*DeletedSSHKey, error)
- func (s *SSHKeysService) List(ctx context.Context) ([]SSHKeyWithLiveRentalCount, error)
- func (s *SSHKeysService) ListForRental(ctx context.Context, params ListRentalSSHKeysParams) ([]SSHKey, error)
- func (s *SSHKeysService) Update(ctx context.Context, params UpdateSSHKeyParams) (*SSHKey, error)
- type StorageVolume
- type StorageVolumeChoice
- func (t StorageVolumeChoice) AsExistingStorageVolume() (ExistingStorageVolume, error)
- func (t StorageVolumeChoice) AsNewStorageVolume() (NewStorageVolume, error)
- func (t *StorageVolumeChoice) FromExistingStorageVolume(v ExistingStorageVolume) error
- func (t *StorageVolumeChoice) FromNewStorageVolume(v NewStorageVolume) error
- func (t StorageVolumeChoice) MarshalJSON() ([]byte, error)
- func (t *StorageVolumeChoice) MergeExistingStorageVolume(v ExistingStorageVolume) error
- func (t *StorageVolumeChoice) MergeNewStorageVolume(v NewStorageVolume) error
- func (t *StorageVolumeChoice) UnmarshalJSON(b []byte) error
- type StorageVolumeOption
- type StorageVolumeStatus
- type StorageVolumesService
- func (s *StorageVolumesService) Attach(ctx context.Context, params AttachStorageVolumeParams) (*AttachStorageVolumeResponse, error)
- func (s *StorageVolumesService) Create(ctx context.Context, params CreateStorageVolumeParams) (*CreatedStorageVolume, error)
- func (s *StorageVolumesService) List(ctx context.Context) ([]StorageVolume, error)
- func (s *StorageVolumesService) Options(ctx context.Context) ([]StorageVolumeOption, error)
- func (s *StorageVolumesService) Terminate(ctx context.Context, params TerminateStorageVolumeParams) (*TerminateStorageVolumeResponse, error)
- func (s *StorageVolumesService) Update(ctx context.Context, params UpdateStorageVolumeParams) (*UpdateStorageVolumeResponse, error)
- type SuccessResponse
- type TermType
- type TerminateRentalParams
- type TerminateStorageVolumeParams
- type TerminateStorageVolumeResponse
- type TerminatedRentalLookup
- type TerminatedRentalLookupState
- type UpdateCurrentUserParams
- type UpdateRentalParams
- type UpdateSSHKeyParams
- type UpdateStorageVolumeParams
- type UpdateStorageVolumeResponse
- type User
- type UserMutationResponse
- type UsersService
- func (s *UsersService) DeleteMe(ctx context.Context) (*SuccessResponse, error)
- func (s *UsersService) Me(ctx context.Context) (*CurrentUser, error)
- func (s *UsersService) UpdateMe(ctx context.Context, params UpdateCurrentUserParams) (*UserMutationResponse, error)
- func (s *UsersService) VerifyPhoneNumber(ctx context.Context, params VerifyPhoneNumberParams) (*SuccessResponse, error)
- type VerifyPhoneNumberParams
- type VirtualMachineOption
- type VirtualMachineOptionMachineType
Examples ¶
Constants ¶
const ( CodeInsufficientBalance = "INSUFFICIENT_BALANCE" CodeNoPublicKey = "NO_PUBLIC_KEY" CodeRegionDisabled = "REGION_DISABLED" CodeCustomPortsNotSupportedForRegion = "CUSTOM_PORTS_NOT_SUPPORTED_FOR_REGION" // CodeFailedToCalculateCostPerHour is what the API returns when no // offering matches the requested shape, fabric and region. CodeFailedToCalculateCostPerHour = "FAILED_TO_CALCULATE_COST_PER_HOUR" CodeRentalNotFound = "RENTAL_NOT_FOUND" CodeAlreadyTerminated = "ALREADY_TERMINATED" CodeNotFound = "NOT_FOUND" // The SSH key codes are documented by the spec. Saving a key the account // already has, with the same type and body, returns // SSH_PUBLIC_KEY_ALREADY_EXISTS. For deleting a key that a live rental // uses, the spec documents SSH_PUBLIC_KEY_IN_USE, but the live API // answers 409 with code CONFLICT, so check the status as well. CodeSSHPublicKeyAlreadyExists = "SSH_PUBLIC_KEY_ALREADY_EXISTS" CodeSSHPublicKeyInUse = "SSH_PUBLIC_KEY_IN_USE" CodeSSHPublicKeyNotFound = "SSH_PUBLIC_KEY_NOT_FOUND" )
Error codes returned by the API. The first five were observed against the live API while building the operator prototype. RENTAL_NOT_FOUND and ALREADY_TERMINATED are handled defensively and still need confirming with the platform team.
const DefaultBaseURL = "https://api.hyperbolic.ai"
DefaultBaseURL is the production Hyperbolic API.
Variables ¶
var ErrNotFound = errors.New("hyperbolic: not found")
ErrNotFound is returned (wrapped) when a requested object does not exist.
var ErrOutcomeUnknown = errors.New("hyperbolic: outcome unknown")
ErrOutcomeUnknown matches errors from non-idempotent calls (such as creating a rental) whose effect is unknown: the server may or may not have applied the request. Callers must look up the result before retrying.
Functions ¶
func IsNotFound ¶
IsNotFound reports whether err means the object does not exist.
func IsOutcomeUnknown ¶
IsOutcomeUnknown is shorthand for errors.Is(err, ErrOutcomeUnknown).
func IsRateLimited ¶
IsRateLimited reports whether the request was rejected by rate limiting.
func IsUnauthorized ¶
IsUnauthorized reports whether the API key was rejected.
func Ptr ¶
func Ptr[T any](v T) *T
Ptr returns a pointer to v, for setting optional request fields:
params.Label = hyperbolic.Ptr("training")
func StatusCode ¶
StatusCode returns the HTTP status of an API error, or 0.
Types ¶
type APIError ¶
type APIError struct {
Method string
Path string
StatusCode int
// Code is the machine-readable error code (for example
// INSUFFICIENT_BALANCE), when the API provided one.
Code string
Message string
// Issues lists what the API said was wrong with the request, if anything.
Issues []string
// RetryAfter is the server's Retry-After hint, if any.
RetryAfter time.Duration
// Body is the raw response body, truncated.
Body string
}
APIError is a non-2xx response from the API.
type APIKey ¶
type APIKey struct {
CreatedAt time.Time `json:"createdAt"`
Last4 string `json:"last4"`
OrgID nullable.Nullable[string] `json:"orgId"`
// OrganizationMember The organization member an API key belongs to.
OrganizationMember *OrganizationMember `json:"organizationMember,omitempty"`
PublicID string `json:"publicId"`
RevokedAt nullable.Nullable[time.Time] `json:"revokedAt"`
UserID string `json:"userId"`
}
APIKey An issued API key. The secret itself is only ever returned at creation.
type APIKeysService ¶
type APIKeysService struct {
// contains filtered or unexported fields
}
APIKeysService lists the account's API keys.
type AccountBalance ¶
type AccountBalance struct {
BalanceCents float64 `json:"balanceCents"`
MaxOverdraftCents float64 `json:"maxOverdraftCents"`
}
AccountBalance The authenticated account's credit balance.
type ActiveRentalLookup ¶
type ActiveRentalLookup struct {
// Rental A GPU rental with its live status.
Rental RentalWithStatus `json:"rental"`
State ActiveRentalLookupState `json:"state"`
}
ActiveRentalLookup A rental lookup that found a running rental.
type ActiveRentalLookupState ¶
type ActiveRentalLookupState string
ActiveRentalLookupState defines model for ActiveRentalLookup.State.
const (
ActiveRentalLookupStateActive ActiveRentalLookupState = "active"
)
Defines values for ActiveRentalLookupState.
func (ActiveRentalLookupState) Valid ¶
func (e ActiveRentalLookupState) Valid() bool
Valid indicates whether the value is a known member of the ActiveRentalLookupState enum.
type ActiveRentalSummary ¶
type ActiveRentalSummary struct {
// ByTermType Active rental totals for each term type.
ByTermType ActiveRentalSummaryByTermType `json:"byTermType"`
CostPerHourCents int `json:"costPerHourCents"`
Count int `json:"count"`
}
ActiveRentalSummary How many rentals the caller has active, and their summed hourly cost in cents.
type ActiveRentalSummaryByTermType ¶
type ActiveRentalSummaryByTermType struct {
// OnDemand How many active rentals are on one term type, and their summed hourly cost in cents.
OnDemand RentalTermTypeSummary `json:"on-demand"`
// PrivateCloud How many active rentals are on one term type, and their summed hourly cost in cents.
PrivateCloud RentalTermTypeSummary `json:"private-cloud"`
// Reserved How many active rentals are on one term type, and their summed hourly cost in cents.
Reserved RentalTermTypeSummary `json:"reserved"`
}
ActiveRentalSummaryByTermType Active rental totals for each term type.
type ActiveRentalsPage ¶
type ActiveRentalsPage struct {
Items []RentalWithStatus `json:"items"`
Page int `json:"page"`
PageSize int `json:"pageSize"`
Total int `json:"total"`
TotalPages int `json:"totalPages"`
}
ActiveRentalsPage One numbered page of active rentals, most recently started first.
type AttachSSHKeyParams ¶
type AttachSSHKeyParams struct {
RentalID string `json:"rentalId"`
SSHPublicKeyID int `json:"sshPublicKeyId"`
}
AttachSSHKeyParams defines model for AttachSSHKeyParams.
type AttachStorageVolumeParams ¶
type AttachStorageVolumeParams struct {
RentalIds []string `json:"rentalIds"`
StorageVolumeID string `json:"storageVolumeId"`
}
AttachStorageVolumeParams defines model for AttachStorageVolumeParams.
type AttachStorageVolumeResponse ¶
type AttachStorageVolumeResponse struct {
AttachedRentalIds []string `json:"attachedRentalIds"`
Message string `json:"message"`
StorageVolumeID string `json:"storageVolumeId"`
}
AttachStorageVolumeResponse Confirmation that a storage volume is being attached.
type AttachedStorage ¶
type AttachedStorage struct {
CostPerHourCents float64 `json:"costPerHourCents"`
Label string `json:"label"`
SizeInGb int `json:"sizeInGb"`
StorageVolumeID string `json:"storageVolumeId"`
VirtualIP string `json:"virtualIp"`
}
AttachedStorage A storage volume as seen from a rental it is attached to.
type BalancesService ¶
type BalancesService struct {
// contains filtered or unexported fields
}
BalancesService reads the account's credit balance.
func (*BalancesService) Get ¶
func (s *BalancesService) Get(ctx context.Context) (*AccountBalance, error)
Get calls GET /v2/customer/balance: get the current user or organization account's balance.
Get the current account's balance
type BareMetalOption ¶
type BareMetalOption struct {
ConnectionType ConnectionType `json:"connectionType"`
CostPerHourCents float64 `json:"costPerHourCents"`
Enabled bool `json:"enabled"`
EthernetVariant *EthernetVariant `json:"ethernetVariant,omitempty"`
GPUCount int `json:"gpuCount"`
GPUFormFactor GPUFormFactor `json:"gpuFormFactor"`
GPUType GPUType `json:"gpuType"`
MachineType BareMetalOptionMachineType `json:"machineType"`
Nodes []struct {
CPUCount int `json:"cpuCount"`
CPUModel string `json:"cpuModel"`
GPUCount int `json:"gpuCount"`
RAMGb int `json:"ramGb"`
StorageGb int `json:"storageGb"`
} `json:"nodes"`
Region string `json:"region"`
SupportsCustomPorts bool `json:"supportsCustomPorts"`
SupportsMultipleSSHKeys bool `json:"supportsMultipleSshKeys"`
SupportsSSHKeyUpdates bool `json:"supportsSshKeyUpdates"`
TotalAvailable *int `json:"totalAvailable,omitempty"`
}
BareMetalOption defines model for BareMetalOption.
type BareMetalOptionMachineType ¶
type BareMetalOptionMachineType string
BareMetalOptionMachineType defines model for BareMetalOption.MachineType.
const (
BareMetalOptionMachineTypeBareMetal BareMetalOptionMachineType = "bare-metal"
)
Defines values for BareMetalOptionMachineType.
func (BareMetalOptionMachineType) Valid ¶
func (e BareMetalOptionMachineType) Valid() bool
Valid indicates whether the value is a known member of the BareMetalOptionMachineType enum.
type Client ¶
type Client struct {
// APIKeys lists the account's API keys.
APIKeys *APIKeysService
// Balances reads the account's credit balance.
Balances *BalancesService
// Rentals manages on-demand and reserved GPU rentals.
Rentals *RentalsService
// SSHKeys manages the SSH public keys saved on the account.
SSHKeys *SSHKeysService
// StorageVolumes manages network storage volumes and their attachments.
StorageVolumes *StorageVolumesService
// Users reads and updates the signed-in user.
Users *UsersService
// contains filtered or unexported fields
}
Client is a Hyperbolic API client. Create one with NewClient. It is safe for concurrent use. Each field groups related API operations.
func NewClient ¶
NewClient returns a client authenticated with apiKey. A few operations, such as listing rental options, work without a key. The rest need one.
type ConnectionType ¶
type ConnectionType string
ConnectionType defines model for ConnectionType.
const ( ConnectionTypeEthernet ConnectionType = "ethernet" ConnectionTypeInfiniband ConnectionType = "infiniband" )
Defines values for ConnectionType.
func (ConnectionType) Valid ¶
func (e ConnectionType) Valid() bool
Valid indicates whether the value is a known member of the ConnectionType enum.
type ConvertRentalToReservedParams ¶
type ConvertRentalToReservedParams struct {
ExpectedTotalPriceCents int `json:"expectedTotalPriceCents"`
RentalID string `json:"rentalId"`
TermPeriodDays int `json:"termPeriodDays"`
}
ConvertRentalToReservedParams defines model for ConvertRentalToReservedParams.
type CreateRentalParams ¶
type CreateRentalParams struct {
ConvertToOnDemandOnExpiry *bool `json:"convertToOnDemandOnExpiry,omitempty"`
// CUDAVersion Bare metal only.
CUDAVersion *CreateRentalParamsCUDAVersion `json:"cudaVersion,omitempty"`
// CustomPorts Virtual machines only.
CustomPorts *[]int `json:"customPorts,omitempty"`
DiscountPercentage *float64 `json:"discountPercentage,omitempty"`
// GPUCount GPUs to rent. Bare metal rents whole nodes, so a multiple of 8.
GPUCount int `json:"gpuCount"`
GPUType *GPUType `json:"gpuType,omitempty"`
Label *string `json:"label,omitempty"`
MonitoringEnabled *bool `json:"monitoringEnabled,omitempty"`
// NetworkType Required for bare metal. Virtual machines default to `ethernet`.
NetworkType *CreateRentalParamsNetworkType `json:"networkType,omitempty"`
// Region A region that offers the chosen machine type.
Region *string `json:"region,omitempty"`
RentalType RentalType `json:"rentalType"`
// SSHPublicKeyID The saved SSH key to authorize on the rental. Defaults to the most recently added key.
SSHPublicKeyID *int `json:"sshPublicKeyId,omitempty"`
// SSHPublicKeyIds The saved SSH keys to authorize on the rental.
SSHPublicKeyIds *[]int `json:"sshPublicKeyIds,omitempty"`
// StorageVolume Bare metal only.
StorageVolume *StorageVolumeChoice `json:"storageVolume,omitempty"`
TermPeriodDays *int `json:"termPeriodDays,omitempty"`
TermType *TermType `json:"termType,omitempty"`
}
CreateRentalParams defines model for CreateRentalParams.
type CreateRentalParamsCUDAVersion ¶
type CreateRentalParamsCUDAVersion string
CreateRentalParamsCUDAVersion Bare metal only.
const ( CreateRentalParamsCUDAVersionCuda128 CreateRentalParamsCUDAVersion = "cuda12.8" CreateRentalParamsCUDAVersionCuda129 CreateRentalParamsCUDAVersion = "cuda12.9" )
Defines values for CreateRentalParamsCUDAVersion.
func (CreateRentalParamsCUDAVersion) Valid ¶
func (e CreateRentalParamsCUDAVersion) Valid() bool
Valid indicates whether the value is a known member of the CreateRentalParamsCUDAVersion enum.
type CreateRentalParamsNetworkType ¶
type CreateRentalParamsNetworkType string
CreateRentalParamsNetworkType Required for bare metal. Virtual machines default to `ethernet`.
const ( CreateRentalParamsNetworkTypeEthernet CreateRentalParamsNetworkType = "ethernet" CreateRentalParamsNetworkTypeInfiniband CreateRentalParamsNetworkType = "infiniband" )
Defines values for CreateRentalParamsNetworkType.
func (CreateRentalParamsNetworkType) Valid ¶
func (e CreateRentalParamsNetworkType) Valid() bool
Valid indicates whether the value is a known member of the CreateRentalParamsNetworkType enum.
type CreateSSHKeyParams ¶
type CreateSSHKeyParams struct {
Name *string `json:"name,omitempty"`
PublicKey string `json:"publicKey"`
}
CreateSSHKeyParams defines model for CreateSSHKeyParams.
type CreateStorageVolumeParams ¶
type CreateStorageVolumeParams struct {
Label string `json:"label"`
Region string `json:"region"`
RentalIds *[]string `json:"rentalIds,omitempty"`
SizeInGb int `json:"sizeInGb"`
}
CreateStorageVolumeParams defines model for CreateStorageVolumeParams.
type CreatedStorageVolume ¶
type CreatedStorageVolume struct {
AttachedRentalIds []string `json:"attachedRentalIds"`
Label string `json:"label"`
Message string `json:"message"`
Region string `json:"region"`
SizeInGb int `json:"sizeInGb"`
Status StorageVolumeStatus `json:"status"`
StorageVolumeID string `json:"storageVolumeId"`
}
CreatedStorageVolume A newly created storage volume.
type CurrentUser ¶
type CurrentUser struct {
CompletedPromos []string `json:"completedPromos"`
CreatedAt time.Time `json:"createdAt"`
Email string `json:"email"`
EmailVerified nullable.Nullable[bool] `json:"emailVerified"`
HasPurchasedCredits bool `json:"hasPurchasedCredits"`
ID string `json:"id"`
IsActive nullable.Nullable[bool] `json:"isActive"`
Name nullable.Nullable[string] `json:"name"`
OnboardedAt nullable.Nullable[time.Time] `json:"onboardedAt"`
OnboardedFor nullable.Nullable[string] `json:"onboardedFor"`
Picture nullable.Nullable[string] `json:"picture"`
Provider nullable.Nullable[string] `json:"provider"`
ReferralCode nullable.Nullable[string] `json:"referralCode"`
ReservedRentalLimit *int `json:"reservedRentalLimit,omitempty"`
Role CurrentUserRole `json:"role"`
}
CurrentUser The authenticated user, with account state resolved.
type CurrentUserRole ¶
type CurrentUserRole string
CurrentUserRole defines model for CurrentUser.Role.
const ( CurrentUserRoleElite CurrentUserRole = "elite" CurrentUserRolePro CurrentUserRole = "pro" CurrentUserRoleUser CurrentUserRole = "user" )
Defines values for CurrentUserRole.
func (CurrentUserRole) Valid ¶
func (e CurrentUserRole) Valid() bool
Valid indicates whether the value is a known member of the CurrentUserRole enum.
type DeleteSSHKeyParams ¶
type DeleteSSHKeyParams struct {
ID int `json:"id"`
}
DeleteSSHKeyParams defines model for DeleteSSHKeyParams.
type DeletedSSHKey ¶
type DeletedSSHKey struct {
ID int `json:"id"`
}
DeletedSSHKey The id of the SSH public key that was deleted.
type DetachSSHKeyParams ¶
type DetachSSHKeyParams struct {
RentalID string `json:"rentalId"`
SSHPublicKeyID int `json:"sshPublicKeyId"`
}
DetachSSHKeyParams defines model for DetachSSHKeyParams.
type EthernetVariant ¶
type EthernetVariant string
EthernetVariant defines model for EthernetVariant.
const ( EthernetVariantNormal EthernetVariant = "normal" EthernetVariantRocev2 EthernetVariant = "rocev2" )
Defines values for EthernetVariant.
func (EthernetVariant) Valid ¶
func (e EthernetVariant) Valid() bool
Valid indicates whether the value is a known member of the EthernetVariant enum.
type ExistingStorageVolume ¶
type ExistingStorageVolume struct {
ID string `json:"id"`
IsNew ExistingStorageVolumeIsNew `json:"isNew"`
}
ExistingStorageVolume defines model for ExistingStorageVolume.
type ExistingStorageVolumeIsNew ¶
type ExistingStorageVolumeIsNew bool
ExistingStorageVolumeIsNew defines model for ExistingStorageVolume.IsNew.
const (
ExistingStorageVolumeIsNewFalse ExistingStorageVolumeIsNew = false
)
Defines values for ExistingStorageVolumeIsNew.
func (ExistingStorageVolumeIsNew) Valid ¶
func (e ExistingStorageVolumeIsNew) Valid() bool
Valid indicates whether the value is a known member of the ExistingStorageVolumeIsNew enum.
type ExtendReservedRentalParams ¶
type ExtendReservedRentalParams struct {
ExpectedReservedUntil time.Time `json:"expectedReservedUntil"`
ExpectedTotalPriceCents int `json:"expectedTotalPriceCents"`
RentalID string `json:"rentalId"`
TermPeriodDays int `json:"termPeriodDays"`
}
ExtendReservedRentalParams defines model for ExtendReservedRentalParams.
type GPUFormFactor ¶
type GPUFormFactor string
GPUFormFactor defines model for GPUFormFactor.
const ( GPUFormFactorPCIE GPUFormFactor = "pcie" GPUFormFactorSxm5 GPUFormFactor = "sxm5" GPUFormFactorSxm6 GPUFormFactor = "sxm6" )
Defines values for GPUFormFactor.
func (GPUFormFactor) Valid ¶
func (e GPUFormFactor) Valid() bool
Valid indicates whether the value is a known member of the GPUFormFactor enum.
type GPUType ¶
type GPUType string
GPUType defines model for GPUType.
type GetRentalParams ¶
type GetRentalParams struct {
// RentalID The rental's `rentalId`.
RentalID string `form:"rentalId" json:"rentalId"`
}
GetRentalParams defines parameters for GetRental.
type GetReservationExtensionQuoteParams ¶
type GetReservationExtensionQuoteParams struct {
RentalID string `form:"rentalId" json:"rentalId"`
TermPeriodDays *int `form:"termPeriodDays,omitempty" json:"termPeriodDays,omitempty"`
}
GetReservationExtensionQuoteParams defines parameters for GetReservationExtensionQuote.
type GetReservedConversionQuoteParams ¶
type GetReservedConversionQuoteParams struct {
RentalID string `form:"rentalId" json:"rentalId"`
}
GetReservedConversionQuoteParams defines parameters for GetReservedConversionQuote.
type HasRentalHistoryParams ¶
type HasRentalHistoryParams struct {
IncludePrivateCloud *bool `form:"includePrivateCloud,omitempty" json:"includePrivateCloud,omitempty"`
}
HasRentalHistoryParams defines parameters for HasRentalHistory.
type HistoricalRental ¶
type HistoricalRental struct {
AttachedStorage []AttachedStorage `json:"attachedStorage"`
ConnectionType ConnectionType `json:"connectionType"`
ConvertToOnDemandOnExpiry nullable.Nullable[bool] `json:"convertToOnDemandOnExpiry"`
CreatedAt time.Time `json:"createdAt"`
// CreatedBy The user who created a rental.
CreatedBy RentalCreator `json:"createdBy"`
CurrentTerm RentalTerm `json:"currentTerm"`
EthernetVariant nullable.Nullable[EthernetVariant] `json:"ethernetVariant"`
ExposedPorts []int `json:"exposedPorts"`
GPUCount int `json:"gpuCount"`
GPUFormFactor GPUFormFactor `json:"gpuFormFactor"`
GPUType GPUType `json:"gpuType"`
Label nullable.Nullable[string] `json:"label"`
ManagedCluster nullable.Nullable[ManagedClusterRef] `json:"managedCluster"`
MonitoringEnabled bool `json:"monitoringEnabled"`
Name nullable.Nullable[string] `json:"name"`
NetworkInterfaces []NetworkInterface `json:"networkInterfaces"`
Nodes []RentalNode `json:"nodes"`
OrgID nullable.Nullable[string] `json:"orgId"`
PortMappings []PortMapping `json:"portMappings"`
PrivateCluster nullable.Nullable[PrivateCluster] `json:"privateCluster"`
Region string `json:"region"`
RentalID string `json:"rentalId"`
RentalType RentalType `json:"rentalType"`
SSHEndpoints []SSHEndpoint `json:"sshEndpoints"`
StartedAt nullable.Nullable[time.Time] `json:"startedAt"`
Status RentalStatus `json:"status"`
SupportsAttachedStorage bool `json:"supportsAttachedStorage"`
SupportsCustomPorts bool `json:"supportsCustomPorts"`
SupportsMultipleSSHKeys bool `json:"supportsMultipleSshKeys"`
SupportsPortForwarding bool `json:"supportsPortForwarding"`
SupportsSSHKeyUpdates bool `json:"supportsSshKeyUpdates"`
TerminatedAt time.Time `json:"terminatedAt"`
TerminationReason nullable.Nullable[string] `json:"terminationReason"`
TotalCost float64 `json:"totalCost"`
UpdatedAt nullable.Nullable[time.Time] `json:"updatedAt"`
UserID string `json:"userId"`
}
HistoricalRental A GPU rental that has ended, with its total cost.
type ListActiveRentalsParams ¶
type ListActiveRentalsParams struct {
Page *int `form:"page,omitempty" json:"page,omitempty"`
PageSize *int `form:"pageSize,omitempty" json:"pageSize,omitempty"`
GPUType *GPUType `form:"gpuType,omitempty" json:"gpuType,omitempty"`
Region *string `form:"region,omitempty" json:"region,omitempty"`
TermType *TermType `form:"termType,omitempty" json:"termType,omitempty"`
IncludePrivateCloud *bool `form:"includePrivateCloud,omitempty" json:"includePrivateCloud,omitempty"`
RentalType *RentalType `form:"rentalType,omitempty" json:"rentalType,omitempty"`
IncludeClusterPools *bool `form:"includeClusterPools,omitempty" json:"includeClusterPools,omitempty"`
}
ListActiveRentalsParams defines parameters for ListActiveRentals.
type ListRentalHistoryParams ¶
type ListRentalHistoryParams struct {
Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"`
Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
GPUType *GPUType `form:"gpuType,omitempty" json:"gpuType,omitempty"`
Region *string `form:"region,omitempty" json:"region,omitempty"`
TermType *TermType `form:"termType,omitempty" json:"termType,omitempty"`
IncludePrivateCloud *bool `form:"includePrivateCloud,omitempty" json:"includePrivateCloud,omitempty"`
RentalType *RentalType `form:"rentalType,omitempty" json:"rentalType,omitempty"`
}
ListRentalHistoryParams defines parameters for ListRentalHistory.
type ListRentalSSHKeysParams ¶
type ListRentalSSHKeysParams struct {
RentalID string `form:"rentalId" json:"rentalId"`
}
ListRentalSSHKeysParams defines parameters for ListRentalSSHKeys.
type ListReserveOptionsParams ¶
type ListReserveOptionsParams struct {
TermPeriodDays *int `form:"termPeriodDays,omitempty" json:"termPeriodDays,omitempty"`
}
ListReserveOptionsParams defines parameters for ListReserveOptions.
type ManagedClusterRef ¶
type ManagedClusterRef struct {
Label nullable.Nullable[string] `json:"label"`
Name string `json:"name"`
}
ManagedClusterRef The managed Kubernetes cluster a rental is a node pool of.
type NetworkInterface ¶
type NetworkInterface struct {
PrivateIP string `json:"privateIp"`
PublicIP string `json:"publicIp"`
}
NetworkInterface The public and private addresses of one node of a rental.
type NewStorageVolume ¶
type NewStorageVolume struct {
IsNew NewStorageVolumeIsNew `json:"isNew"`
Label string `json:"label"`
SizeInGb int `json:"sizeInGb"`
}
NewStorageVolume defines model for NewStorageVolume.
type NewStorageVolumeIsNew ¶
type NewStorageVolumeIsNew bool
NewStorageVolumeIsNew defines model for NewStorageVolume.IsNew.
const (
NewStorageVolumeIsNewTrue NewStorageVolumeIsNew = true
)
Defines values for NewStorageVolumeIsNew.
func (NewStorageVolumeIsNew) Valid ¶
func (e NewStorageVolumeIsNew) Valid() bool
Valid indicates whether the value is a known member of the NewStorageVolumeIsNew enum.
type OnDemandTerm ¶
type OnDemandTerm struct {
CostPerHour float64 `json:"costPerHour"`
DiscountPercentage nullable.Nullable[any] `json:"discountPercentage"`
EffectiveAt time.Time `json:"effectiveAt"`
OriginalCostPerHour nullable.Nullable[any] `json:"originalCostPerHour"`
ReservationEndsAt nullable.Nullable[any] `json:"reservationEndsAt"`
ReservedUntil nullable.Nullable[any] `json:"reservedUntil"`
TermPeriodDays nullable.Nullable[any] `json:"termPeriodDays"`
TermType OnDemandTermTermType `json:"termType"`
}
OnDemandTerm defines model for OnDemandTerm.
type OnDemandTermTermType ¶
type OnDemandTermTermType string
OnDemandTermTermType defines model for OnDemandTerm.TermType.
const (
OnDemandTermTermTypeOnDemand OnDemandTermTermType = "on-demand"
)
Defines values for OnDemandTermTermType.
func (OnDemandTermTermType) Valid ¶
func (e OnDemandTermTermType) Valid() bool
Valid indicates whether the value is a known member of the OnDemandTermTermType enum.
type Option ¶
type Option func(*transport) error
Option configures a Client.
func WithBaseURL ¶
WithBaseURL points the client at a different API endpoint, for example a staging environment or a test server. Plain http is accepted only for loopback hosts, so an API key is never sent unencrypted over a network.
func WithHTTPClient ¶
WithHTTPClient replaces the underlying HTTP client (for custom transports, proxies or timeouts). The default has a 30 second timeout.
func WithRetryPolicy ¶
func WithRetryPolicy(p RetryPolicy) Option
WithRetryPolicy overrides the default RetryPolicy.
func WithUserAgent ¶
WithUserAgent prepends a product token to the User-Agent header, for example "hyperbolic-operator/0.1.0". The SDK's own token is always kept.
type OrganizationMember ¶
type OrganizationMember struct {
Email string `json:"email"`
FullName *string `json:"fullName,omitempty"`
ImageURL *string `json:"imageUrl,omitempty"`
Role OrganizationMemberRole `json:"role"`
}
OrganizationMember The organization member an API key belongs to.
type OrganizationMemberRole ¶
type OrganizationMemberRole string
OrganizationMemberRole defines model for OrganizationMember.Role.
const ( OrganizationMemberRoleOrgAdmin OrganizationMemberRole = "org:admin" OrganizationMemberRoleOrgMember OrganizationMemberRole = "org:member" )
Defines values for OrganizationMemberRole.
func (OrganizationMemberRole) Valid ¶
func (e OrganizationMemberRole) Valid() bool
Valid indicates whether the value is a known member of the OrganizationMemberRole enum.
type OutcomeUnknownError ¶
OutcomeUnknownError wraps the underlying failure of a non-idempotent call whose effect is unknown. It matches ErrOutcomeUnknown with errors.Is.
func (*OutcomeUnknownError) Error ¶
func (e *OutcomeUnknownError) Error() string
func (*OutcomeUnknownError) Is ¶
func (e *OutcomeUnknownError) Is(target error) bool
Is reports whether target is ErrOutcomeUnknown.
func (*OutcomeUnknownError) Unwrap ¶
func (e *OutcomeUnknownError) Unwrap() error
type PortMapping ¶
type PortMapping struct {
ExternalPort int `json:"externalPort"`
InternalPort int `json:"internalPort"`
}
PortMapping A port reachable from outside, and the port it reaches inside the machine.
type PrivateCloudTerm ¶
type PrivateCloudTerm struct {
CostPerHour float64 `json:"costPerHour"`
DiscountPercentage nullable.Nullable[any] `json:"discountPercentage"`
EffectiveAt time.Time `json:"effectiveAt"`
OriginalCostPerHour nullable.Nullable[any] `json:"originalCostPerHour"`
ReservationEndsAt nullable.Nullable[any] `json:"reservationEndsAt"`
ReservedUntil nullable.Nullable[any] `json:"reservedUntil"`
TermPeriodDays nullable.Nullable[any] `json:"termPeriodDays"`
TermType PrivateCloudTermTermType `json:"termType"`
}
PrivateCloudTerm defines model for PrivateCloudTerm.
type PrivateCloudTermTermType ¶
type PrivateCloudTermTermType string
PrivateCloudTermTermType defines model for PrivateCloudTerm.TermType.
const (
PrivateCloudTermTermTypePrivateCloud PrivateCloudTermTermType = "private-cloud"
)
Defines values for PrivateCloudTermTermType.
func (PrivateCloudTermTermType) Valid ¶
func (e PrivateCloudTermTermType) Valid() bool
Valid indicates whether the value is a known member of the PrivateCloudTermTermType enum.
type PrivateCluster ¶
type PrivateCluster struct {
GPUModel nullable.Nullable[string] `json:"gpuModel"`
Handover map[string]interface{} `json:"handover"`
Location nullable.Nullable[string] `json:"location"`
Nodes []PrivateClusterNode `json:"nodes"`
SSHPort nullable.Nullable[float64] `json:"sshPort"`
SSHUser string `json:"sshUser"`
}
PrivateCluster The topology of a dedicated private cluster.
type PrivateClusterNode ¶
type PrivateClusterNode struct {
Hostname nullable.Nullable[string] `json:"hostname"`
PrivateIP string `json:"privateIp"`
PublicIP nullable.Nullable[string] `json:"publicIp"`
Role PrivateClusterNodeRole `json:"role"`
}
PrivateClusterNode One machine of a dedicated private cluster.
type PrivateClusterNodeRole ¶
type PrivateClusterNodeRole string
PrivateClusterNodeRole defines model for PrivateClusterNode.Role.
const ( PrivateClusterNodeRoleCompute PrivateClusterNodeRole = "compute" PrivateClusterNodeRoleHead PrivateClusterNodeRole = "head" PrivateClusterNodeRoleLogin PrivateClusterNodeRole = "login" )
Defines values for PrivateClusterNodeRole.
func (PrivateClusterNodeRole) Valid ¶
func (e PrivateClusterNodeRole) Valid() bool
Valid indicates whether the value is a known member of the PrivateClusterNodeRole enum.
type RebootRentalInstanceParams ¶
type RebootRentalInstanceParams struct {
InstanceRef string `json:"instanceRef"`
RentalID string `json:"rentalId"`
}
RebootRentalInstanceParams defines model for RebootRentalInstanceParams.
type Rental ¶
type Rental struct {
AttachedStorage []AttachedStorage `json:"attachedStorage"`
ConnectionType ConnectionType `json:"connectionType"`
ConvertToOnDemandOnExpiry nullable.Nullable[bool] `json:"convertToOnDemandOnExpiry"`
CreatedAt time.Time `json:"createdAt"`
// CreatedBy The user who created a rental.
CreatedBy RentalCreator `json:"createdBy"`
CurrentTerm RentalTerm `json:"currentTerm"`
EthernetVariant nullable.Nullable[EthernetVariant] `json:"ethernetVariant"`
ExposedPorts []int `json:"exposedPorts"`
GPUCount int `json:"gpuCount"`
GPUFormFactor GPUFormFactor `json:"gpuFormFactor"`
GPUType GPUType `json:"gpuType"`
Label nullable.Nullable[string] `json:"label"`
ManagedCluster nullable.Nullable[ManagedClusterRef] `json:"managedCluster"`
MonitoringEnabled bool `json:"monitoringEnabled"`
Name nullable.Nullable[string] `json:"name"`
NetworkInterfaces []NetworkInterface `json:"networkInterfaces"`
Nodes []RentalNode `json:"nodes"`
OrgID nullable.Nullable[string] `json:"orgId"`
PortMappings []PortMapping `json:"portMappings"`
PrivateCluster nullable.Nullable[PrivateCluster] `json:"privateCluster"`
Region string `json:"region"`
RentalID string `json:"rentalId"`
RentalType RentalType `json:"rentalType"`
SSHEndpoints []SSHEndpoint `json:"sshEndpoints"`
StartedAt nullable.Nullable[time.Time] `json:"startedAt"`
SupportsAttachedStorage bool `json:"supportsAttachedStorage"`
SupportsCustomPorts bool `json:"supportsCustomPorts"`
SupportsMultipleSSHKeys bool `json:"supportsMultipleSshKeys"`
SupportsPortForwarding bool `json:"supportsPortForwarding"`
SupportsSSHKeyUpdates bool `json:"supportsSshKeyUpdates"`
TerminatedAt nullable.Nullable[time.Time] `json:"terminatedAt"`
TerminationReason nullable.Nullable[string] `json:"terminationReason"`
UpdatedAt nullable.Nullable[time.Time] `json:"updatedAt"`
UserID string `json:"userId"`
}
Rental A GPU rental.
type RentalCreator ¶
type RentalCreator struct {
Email string `json:"email"`
ID string `json:"id"`
Name nullable.Nullable[string] `json:"name"`
Picture nullable.Nullable[string] `json:"picture"`
}
RentalCreator The user who created a rental.
type RentalHistoryPage ¶
type RentalHistoryPage struct {
Items []HistoricalRental `json:"items"`
NextCursor nullable.Nullable[string] `json:"nextCursor"`
TotalCount nullable.Nullable[int] `json:"totalCount"`
}
RentalHistoryPage One page of past rentals, most recently terminated first. Pass `nextCursor` back as `cursor` for the next page; it is `null` on the last page. `totalCount` is set on the first page only.
type RentalInstance ¶
type RentalInstance struct {
// ActualResources The hardware one node actually booted with, as its host reported it.
ActualResources *RentalInstanceResources `json:"actualResources,omitempty"`
InstanceRef string `json:"instanceRef"`
InternalIP nullable.Nullable[string] `json:"internalIp"`
Phase string `json:"phase"`
SSH nullable.Nullable[string] `json:"ssh"`
SupportsReboot bool `json:"supportsReboot"`
}
RentalInstance The live state of one node of a running rental.
type RentalInstanceReboot ¶
type RentalInstanceReboot struct {
InstanceRef string `json:"instanceRef"`
Message string `json:"message"`
RentalID string `json:"rentalId"`
}
RentalInstanceReboot Confirmation that a node of a rental is rebooting.
type RentalInstanceResources ¶
type RentalInstanceResources struct {
GPUCount int `json:"gpuCount"`
GPUMemoryGb *int `json:"gpuMemoryGb,omitempty"`
GPUModel *string `json:"gpuModel,omitempty"`
NumaNodes *float64 `json:"numaNodes,omitempty"`
RAMGb int `json:"ramGb"`
ScratchDiskCount *int `json:"scratchDiskCount,omitempty"`
ScratchDiskGb *int `json:"scratchDiskGb,omitempty"`
VcpuCount int `json:"vcpuCount"`
}
RentalInstanceResources The hardware one node actually booted with, as its host reported it.
type RentalLookup ¶
type RentalLookup struct {
// contains filtered or unexported fields
}
RentalLookup defines model for RentalLookup.
func (RentalLookup) AsActiveRentalLookup ¶
func (t RentalLookup) AsActiveRentalLookup() (ActiveRentalLookup, error)
AsActiveRentalLookup returns the union data inside the RentalLookup as a ActiveRentalLookup
func (RentalLookup) AsTerminatedRentalLookup ¶
func (t RentalLookup) AsTerminatedRentalLookup() (TerminatedRentalLookup, error)
AsTerminatedRentalLookup returns the union data inside the RentalLookup as a TerminatedRentalLookup
func (RentalLookup) Discriminator ¶
func (t RentalLookup) Discriminator() (string, error)
func (*RentalLookup) FromActiveRentalLookup ¶
func (t *RentalLookup) FromActiveRentalLookup(v ActiveRentalLookup) error
FromActiveRentalLookup overwrites any union data inside the RentalLookup as the provided ActiveRentalLookup
func (*RentalLookup) FromTerminatedRentalLookup ¶
func (t *RentalLookup) FromTerminatedRentalLookup(v TerminatedRentalLookup) error
FromTerminatedRentalLookup overwrites any union data inside the RentalLookup as the provided TerminatedRentalLookup
func (RentalLookup) MarshalJSON ¶
func (t RentalLookup) MarshalJSON() ([]byte, error)
func (*RentalLookup) MergeActiveRentalLookup ¶
func (t *RentalLookup) MergeActiveRentalLookup(v ActiveRentalLookup) error
MergeActiveRentalLookup performs a merge with any union data inside the RentalLookup, using the provided ActiveRentalLookup
func (*RentalLookup) MergeTerminatedRentalLookup ¶
func (t *RentalLookup) MergeTerminatedRentalLookup(v TerminatedRentalLookup) error
MergeTerminatedRentalLookup performs a merge with any union data inside the RentalLookup, using the provided TerminatedRentalLookup
func (*RentalLookup) UnmarshalJSON ¶
func (t *RentalLookup) UnmarshalJSON(b []byte) error
func (RentalLookup) ValueByDiscriminator ¶
func (t RentalLookup) ValueByDiscriminator() (interface{}, error)
type RentalNode ¶
type RentalNode struct {
CPUCount nullable.Nullable[float64] `json:"cpuCount"`
CPUModel string `json:"cpuModel"`
GPUCount int `json:"gpuCount"`
RAMGb int `json:"ramGb"`
StorageGb int `json:"storageGb"`
VcpuCount nullable.Nullable[float64] `json:"vcpuCount"`
}
RentalNode Hardware of one node of a rental, normalised across machine types.
type RentalOption ¶
type RentalOption struct {
// contains filtered or unexported fields
}
RentalOption defines model for RentalOption.
func (RentalOption) AsBareMetalOption ¶
func (t RentalOption) AsBareMetalOption() (BareMetalOption, error)
AsBareMetalOption returns the union data inside the RentalOption as a BareMetalOption
func (RentalOption) AsVirtualMachineOption ¶
func (t RentalOption) AsVirtualMachineOption() (VirtualMachineOption, error)
AsVirtualMachineOption returns the union data inside the RentalOption as a VirtualMachineOption
func (RentalOption) Discriminator ¶
func (t RentalOption) Discriminator() (string, error)
func (*RentalOption) FromBareMetalOption ¶
func (t *RentalOption) FromBareMetalOption(v BareMetalOption) error
FromBareMetalOption overwrites any union data inside the RentalOption as the provided BareMetalOption
func (*RentalOption) FromVirtualMachineOption ¶
func (t *RentalOption) FromVirtualMachineOption(v VirtualMachineOption) error
FromVirtualMachineOption overwrites any union data inside the RentalOption as the provided VirtualMachineOption
func (RentalOption) MarshalJSON ¶
func (t RentalOption) MarshalJSON() ([]byte, error)
func (*RentalOption) MergeBareMetalOption ¶
func (t *RentalOption) MergeBareMetalOption(v BareMetalOption) error
MergeBareMetalOption performs a merge with any union data inside the RentalOption, using the provided BareMetalOption
func (*RentalOption) MergeVirtualMachineOption ¶
func (t *RentalOption) MergeVirtualMachineOption(v VirtualMachineOption) error
MergeVirtualMachineOption performs a merge with any union data inside the RentalOption, using the provided VirtualMachineOption
func (*RentalOption) UnmarshalJSON ¶
func (t *RentalOption) UnmarshalJSON(b []byte) error
func (RentalOption) ValueByDiscriminator ¶
func (t RentalOption) ValueByDiscriminator() (interface{}, error)
type RentalStatus ¶
type RentalStatus string
RentalStatus defines model for RentalStatus.
const ( RentalStatusFailed RentalStatus = "Failed" RentalStatusPending RentalStatus = "Pending" RentalStatusRebooting RentalStatus = "Rebooting" RentalStatusRunning RentalStatus = "Running" RentalStatusTerminated RentalStatus = "Terminated" RentalStatusTerminating RentalStatus = "Terminating" RentalStatusUnknown RentalStatus = "Unknown" )
Defines values for RentalStatus.
func (RentalStatus) Valid ¶
func (e RentalStatus) Valid() bool
Valid indicates whether the value is a known member of the RentalStatus enum.
type RentalTerm ¶
type RentalTerm struct {
// contains filtered or unexported fields
}
RentalTerm defines model for RentalTerm.
func (RentalTerm) AsOnDemandTerm ¶
func (t RentalTerm) AsOnDemandTerm() (OnDemandTerm, error)
AsOnDemandTerm returns the union data inside the RentalTerm as a OnDemandTerm
func (RentalTerm) AsPrivateCloudTerm ¶
func (t RentalTerm) AsPrivateCloudTerm() (PrivateCloudTerm, error)
AsPrivateCloudTerm returns the union data inside the RentalTerm as a PrivateCloudTerm
func (RentalTerm) AsReservedTerm ¶
func (t RentalTerm) AsReservedTerm() (ReservedTerm, error)
AsReservedTerm returns the union data inside the RentalTerm as a ReservedTerm
func (RentalTerm) Discriminator ¶
func (t RentalTerm) Discriminator() (string, error)
func (*RentalTerm) FromOnDemandTerm ¶
func (t *RentalTerm) FromOnDemandTerm(v OnDemandTerm) error
FromOnDemandTerm overwrites any union data inside the RentalTerm as the provided OnDemandTerm
func (*RentalTerm) FromPrivateCloudTerm ¶
func (t *RentalTerm) FromPrivateCloudTerm(v PrivateCloudTerm) error
FromPrivateCloudTerm overwrites any union data inside the RentalTerm as the provided PrivateCloudTerm
func (*RentalTerm) FromReservedTerm ¶
func (t *RentalTerm) FromReservedTerm(v ReservedTerm) error
FromReservedTerm overwrites any union data inside the RentalTerm as the provided ReservedTerm
func (RentalTerm) MarshalJSON ¶
func (t RentalTerm) MarshalJSON() ([]byte, error)
func (*RentalTerm) MergeOnDemandTerm ¶
func (t *RentalTerm) MergeOnDemandTerm(v OnDemandTerm) error
MergeOnDemandTerm performs a merge with any union data inside the RentalTerm, using the provided OnDemandTerm
func (*RentalTerm) MergePrivateCloudTerm ¶
func (t *RentalTerm) MergePrivateCloudTerm(v PrivateCloudTerm) error
MergePrivateCloudTerm performs a merge with any union data inside the RentalTerm, using the provided PrivateCloudTerm
func (*RentalTerm) MergeReservedTerm ¶
func (t *RentalTerm) MergeReservedTerm(v ReservedTerm) error
MergeReservedTerm performs a merge with any union data inside the RentalTerm, using the provided ReservedTerm
func (*RentalTerm) UnmarshalJSON ¶
func (t *RentalTerm) UnmarshalJSON(b []byte) error
func (RentalTerm) ValueByDiscriminator ¶
func (t RentalTerm) ValueByDiscriminator() (interface{}, error)
type RentalTermTypeSummary ¶
type RentalTermTypeSummary struct {
CostPerHourCents int `json:"costPerHourCents"`
Count int `json:"count"`
}
RentalTermTypeSummary How many active rentals are on one term type, and their summed hourly cost in cents.
type RentalTermination ¶
RentalTermination Confirmation that a rental is terminating.
type RentalType ¶
type RentalType string
RentalType defines model for RentalType.
const ( RentalTypeBareMetal RentalType = "bare-metal" RentalTypeVirtualMachine RentalType = "virtual-machine" )
Defines values for RentalType.
func (RentalType) Valid ¶
func (e RentalType) Valid() bool
Valid indicates whether the value is a known member of the RentalType enum.
type RentalWithStatus ¶
type RentalWithStatus struct {
AttachedStorage []AttachedStorage `json:"attachedStorage"`
ConnectionType ConnectionType `json:"connectionType"`
ConvertToOnDemandOnExpiry nullable.Nullable[bool] `json:"convertToOnDemandOnExpiry"`
CreatedAt time.Time `json:"createdAt"`
// CreatedBy The user who created a rental.
CreatedBy RentalCreator `json:"createdBy"`
CurrentTerm RentalTerm `json:"currentTerm"`
EthernetVariant nullable.Nullable[EthernetVariant] `json:"ethernetVariant"`
ExposedPorts []int `json:"exposedPorts"`
GPUCount int `json:"gpuCount"`
GPUFormFactor GPUFormFactor `json:"gpuFormFactor"`
GPUType GPUType `json:"gpuType"`
Instances *[]RentalInstance `json:"instances,omitempty"`
Label nullable.Nullable[string] `json:"label"`
ManagedCluster nullable.Nullable[ManagedClusterRef] `json:"managedCluster"`
MonitoringEnabled bool `json:"monitoringEnabled"`
Name nullable.Nullable[string] `json:"name"`
NetworkInterfaces []NetworkInterface `json:"networkInterfaces"`
Nodes []RentalNode `json:"nodes"`
OrgID nullable.Nullable[string] `json:"orgId"`
PortMappings []PortMapping `json:"portMappings"`
PrivateCluster nullable.Nullable[PrivateCluster] `json:"privateCluster"`
Region string `json:"region"`
RentalID string `json:"rentalId"`
RentalType RentalType `json:"rentalType"`
SSHEndpoints []SSHEndpoint `json:"sshEndpoints"`
StartedAt nullable.Nullable[time.Time] `json:"startedAt"`
Status RentalStatus `json:"status"`
SupportsAttachedStorage bool `json:"supportsAttachedStorage"`
SupportsCustomPorts bool `json:"supportsCustomPorts"`
SupportsMultipleSSHKeys bool `json:"supportsMultipleSshKeys"`
SupportsPortForwarding bool `json:"supportsPortForwarding"`
SupportsSSHKeyUpdates bool `json:"supportsSshKeyUpdates"`
TerminatedAt nullable.Nullable[time.Time] `json:"terminatedAt"`
TerminationReason nullable.Nullable[string] `json:"terminationReason"`
UpdatedAt nullable.Nullable[time.Time] `json:"updatedAt"`
UserID string `json:"userId"`
}
RentalWithStatus A GPU rental with its live status.
type RentalsService ¶
type RentalsService struct {
// contains filtered or unexported fields
}
RentalsService manages on-demand and reserved GPU rentals.
func (*RentalsService) ActiveSummary ¶
func (s *RentalsService) ActiveSummary(ctx context.Context) (*ActiveRentalSummary, error)
ActiveSummary calls GET /v2/on-demand/active-rental-summary: get a summary of active rentals.
Count the caller's active rentals and sum their hourly cost in cents, in total and per term type.
func (*RentalsService) AttachSSHKey ¶
func (s *RentalsService) AttachSSHKey(ctx context.Context, params AttachSSHKeyParams) (*SuccessResponse, error)
AttachSSHKey calls POST /v2/on-demand/rentals/ssh-keys/attach: attach an SSH key to a rental.
Attach a saved SSH public key to a running or pending virtual machine rental, without a restart.
func (*RentalsService) ConversionQuote ¶
func (s *RentalsService) ConversionQuote(ctx context.Context, params GetReservedConversionQuoteParams) (*ReservedConversionQuote, error)
ConversionQuote calls GET /v2/on-demand/get-reserved-conversion-quote: get a reserved conversion quote.
func (*RentalsService) ConvertToReserved ¶
func (s *RentalsService) ConvertToReserved(ctx context.Context, params ConvertRentalToReservedParams) (*ReservedRentalConversion, error)
ConvertToReserved calls POST /v2/on-demand/convert-to-reserved: convert a rental to a reserved term.
It is not retried after a failure that may have reached the server. Such a failure matches ErrOutcomeUnknown: check whether the call took effect before making it again.
func (*RentalsService) Create ¶
func (s *RentalsService) Create(ctx context.Context, params CreateRentalParams) (*Rental, error)
Create calls POST /v2/on-demand/rentals: create a rental.
Rent a virtual machine or a bare metal server. `rentalType` decides which machine-type-specific fields apply; sending a field for the other type is a BAD_REQUEST (INVALID_INPUT_FOR_RENTAL_TYPE).
It is not retried after a failure that may have reached the server. Such a failure matches ErrOutcomeUnknown: check whether the call took effect before making it again.
Example ¶
Rent the cheapest in-stock 8x H100 virtual machine, handling the one failure that can bill twice if ignored: a create whose outcome is unknown.
package main
import (
"context"
"errors"
"fmt"
"log"
"os"
hyperbolic "github.com/HyperbolicLabs/hyperbolic-go"
)
func main() {
ctx := context.Background()
client, err := hyperbolic.NewClient(os.Getenv("HYPERBOLIC_API_KEY"))
if err != nil {
log.Fatal(err)
}
options, err := client.Rentals.Options(ctx)
if err != nil {
log.Fatal(err)
}
var cheapest *hyperbolic.VirtualMachineOption
for _, o := range options {
vm, err := o.AsVirtualMachineOption()
if err != nil || vm.MachineType != hyperbolic.VirtualMachineOptionMachineTypeVirtualMachine {
continue
}
inStock := vm.Enabled && (vm.TotalAvailable == nil || *vm.TotalAvailable > 0)
if vm.GPUType == hyperbolic.GPUTypeH100 && vm.GPUCount == 8 && inStock &&
(cheapest == nil || vm.CostPerHourCents < cheapest.CostPerHourCents) {
cheapest = &vm
}
}
if cheapest == nil {
log.Fatal("no 8x H100 in stock")
}
const label = "train-run-42"
created, err := client.Rentals.Create(ctx, hyperbolic.CreateRentalParams{
RentalType: hyperbolic.RentalTypeVirtualMachine,
GPUType: hyperbolic.Ptr(hyperbolic.GPUTypeH100),
GPUCount: 8,
Region: hyperbolic.Ptr(cheapest.Region),
Label: hyperbolic.Ptr(label),
})
if errors.Is(err, hyperbolic.ErrOutcomeUnknown) {
// The rental may exist. Look it up by label instead of creating
// another one.
for r, err := range client.Rentals.ListActiveAll(ctx, hyperbolic.ListActiveRentalsParams{}) {
if err != nil {
log.Fatal(err)
}
if l, _ := r.Label.Get(); l == label {
fmt.Println("rental exists:", r.RentalID)
return
}
}
log.Fatal("the create did not take effect, so it is safe to try again")
}
if err != nil {
log.Fatal(err)
}
fmt.Println("created rental", created.RentalID)
}
Output:
func (*RentalsService) DetachSSHKey ¶
func (s *RentalsService) DetachSSHKey(ctx context.Context, params DetachSSHKeyParams) (*SuccessResponse, error)
DetachSSHKey calls POST /v2/on-demand/rentals/ssh-keys/detach: detach an SSH key from a rental.
Detach a saved SSH public key from a running or pending virtual machine rental, without a restart.
func (*RentalsService) ExtendReserved ¶
func (s *RentalsService) ExtendReserved(ctx context.Context, params ExtendReservedRentalParams) (*ReservedRentalExtension, error)
ExtendReserved calls POST /v2/on-demand/extend-reserved: extend a reserved rental.
It is not retried after a failure that may have reached the server. Such a failure matches ErrOutcomeUnknown: check whether the call took effect before making it again.
func (*RentalsService) ExtensionQuote ¶
func (s *RentalsService) ExtensionQuote(ctx context.Context, params GetReservationExtensionQuoteParams) (*ReservationExtensionQuote, error)
ExtensionQuote calls GET /v2/on-demand/get-reservation-extension-quote: get a reservation extension quote.
Get a reservation extension quote. Pass `termPeriodDays` to also get the price for that length as `requestedOption`.
func (*RentalsService) Get ¶
func (s *RentalsService) Get(ctx context.Context, params GetRentalParams) (*RentalLookup, error)
Get calls GET /v2/on-demand/rental: get a rental.
Look up one rental by its ID, whether it is still running or has ended. Returns null when no rental with that ID belongs to the caller.
When nothing matches, the error matches ErrNotFound.
func (*RentalsService) HasHistory ¶
func (s *RentalsService) HasHistory(ctx context.Context, params HasRentalHistoryParams) (bool, error)
HasHistory calls GET /v2/on-demand/has-rental-history: check whether any past rentals exist.
Whether the caller has at least one rental that has ended.
func (*RentalsService) ListActive ¶
func (s *RentalsService) ListActive(ctx context.Context, params ListActiveRentalsParams) (*ActiveRentalsPage, error)
ListActive calls GET /v2/on-demand/rentals/active: list active rentals.
Active rentals with their live status, most recently started first, as numbered pages. Pass `rentalType` to list one machine type; omit it to list all of them.
func (*RentalsService) ListActiveAll ¶
func (s *RentalsService) ListActiveAll(ctx context.Context, params ListActiveRentalsParams) iter.Seq2[RentalWithStatus, error]
ListActiveAll iterates over the items of every page ListActive returns, from params.Page (the first page when unset). It stops at the first error, yielding it.
Example ¶
List every active rental, a page at a time behind the iterator.
package main
import (
"context"
"fmt"
"log"
"os"
hyperbolic "github.com/HyperbolicLabs/hyperbolic-go"
)
func main() {
ctx := context.Background()
client, err := hyperbolic.NewClient(os.Getenv("HYPERBOLIC_API_KEY"))
if err != nil {
log.Fatal(err)
}
for r, err := range client.Rentals.ListActiveAll(ctx, hyperbolic.ListActiveRentalsParams{}) {
if err != nil {
log.Fatal(err)
}
fmt.Println(r.RentalID, r.Status, r.GPUCount, r.GPUType)
}
}
Output:
func (*RentalsService) ListHistory ¶
func (s *RentalsService) ListHistory(ctx context.Context, params ListRentalHistoryParams) (*RentalHistoryPage, error)
ListHistory calls GET /v2/on-demand/rentals/history: list past rentals.
Past rentals, most recently terminated first, one page at a time. Pass the response's `nextCursor` as `cursor` to read the next page.
func (*RentalsService) ListHistoryAll ¶
func (s *RentalsService) ListHistoryAll(ctx context.Context, params ListRentalHistoryParams) iter.Seq2[HistoricalRental, error]
ListHistoryAll iterates over the items of every page ListHistory returns, from params.Cursor (the first page when unset). It stops at the first error, yielding it.
func (*RentalsService) Options ¶
func (s *RentalsService) Options(ctx context.Context) ([]RentalOption, error)
Options calls GET /v2/on-demand/rental-options: get a list of rental options.
func (*RentalsService) RebootInstance ¶
func (s *RentalsService) RebootInstance(ctx context.Context, params RebootRentalInstanceParams) (*RentalInstanceReboot, error)
RebootInstance calls POST /v2/on-demand/rentals/reboot-instance: reboot a single instance within a rental.
Reboots one instance in place; tenant data is preserved. Call it only for an instance whose `instances[].supportedFeatures` includes `guest-reboot`. Reports INVALID_INSTANCE_REF for an `instanceRef` outside this rental, REBOOT_NOT_SUPPORTED for a rental whose provider cannot reboot, and REBOOT_ALREADY_IN_PROGRESS while one is in flight.
It is not retried after a failure that may have reached the server. Such a failure matches ErrOutcomeUnknown: check whether the call took effect before making it again.
func (*RentalsService) RequestReservation ¶
func (s *RentalsService) RequestReservation(ctx context.Context, params RequestReservationParams) (*ReservationRequest, error)
RequestReservation calls POST /v2/on-demand/request-reservation: request a reservation.
Request a reservation for a large instance ¶
It is not retried after a failure that may have reached the server. Such a failure matches ErrOutcomeUnknown: check whether the call took effect before making it again.
func (*RentalsService) ReserveOptions ¶
func (s *RentalsService) ReserveOptions(ctx context.Context, params ListReserveOptionsParams) (*ReserveOptions, error)
ReserveOptions calls GET /v2/on-demand/reserve-options: get a list of reserve options.
Get a list of reserve options. Pass `termPeriodDays` to also get the discount for that length as `requestedOption`.
func (*RentalsService) Terminate ¶
func (s *RentalsService) Terminate(ctx context.Context, params TerminateRentalParams) (*RentalTermination, error)
Terminate calls POST /v2/on-demand/rentals/terminate: terminate a rental.
Terminate a virtual machine or bare metal rental.
func (*RentalsService) Update ¶
func (s *RentalsService) Update(ctx context.Context, params UpdateRentalParams) (*Rental, error)
Update calls POST /v2/on-demand/rentals/update: update a rental.
Update a rental's label and/or its reserved-term end-of-term action. Pass an empty label to clear it.
type RequestReservationParams ¶
type RequestReservationParams struct {
GPUCount int `json:"gpuCount"`
}
RequestReservationParams defines model for RequestReservationParams.
type ReservationExtensionOption ¶
type ReservationExtensionOption struct {
DiscountPercentage float64 `json:"discountPercentage"`
NewReservedUntil time.Time `json:"newReservedUntil"`
TermPeriodDays int `json:"termPeriodDays"`
TotalPriceCents float64 `json:"totalPriceCents"`
}
ReservationExtensionOption One term a reserved rental can be extended by.
type ReservationExtensionQuote ¶
type ReservationExtensionQuote struct {
CostPerHourCents float64 `json:"costPerHourCents"`
Options []ReservationExtensionOption `json:"options"`
// RequestedOption One term a reserved rental can be extended by.
RequestedOption *ReservationExtensionOption `json:"requestedOption,omitempty"`
ReservedUntil time.Time `json:"reservedUntil"`
}
ReservationExtensionQuote What extending a reserved rental would cost, per term.
type ReservationRequest ¶
type ReservationRequest struct {
Message string `json:"message"`
}
ReservationRequest defines model for ReservationRequest.
type ReserveOptions ¶
type ReserveOptions struct {
Options []struct {
DiscountPercentage float64 `json:"discountPercentage"`
TermPeriodDays int `json:"termPeriodDays"`
} `json:"options"`
// RequestedOption The requested `termPeriodDays` with its discount. Only present when a length is passed.
RequestedOption *struct {
DiscountPercentage float64 `json:"discountPercentage"`
TermPeriodDays int `json:"termPeriodDays"`
} `json:"requestedOption,omitempty"`
}
ReserveOptions defines model for ReserveOptions.
type ReservedConversionOption ¶
type ReservedConversionOption struct {
DiscountPercentage float64 `json:"discountPercentage"`
TermPeriodDays int `json:"termPeriodDays"`
TotalPriceCents float64 `json:"totalPriceCents"`
}
ReservedConversionOption One term an on-demand rental can be converted to.
type ReservedConversionQuote ¶
type ReservedConversionQuote struct {
CostPerHourCents float64 `json:"costPerHourCents"`
EstimatedUsageTailCents float64 `json:"estimatedUsageTailCents"`
Options []ReservedConversionOption `json:"options"`
}
ReservedConversionQuote What converting an on-demand rental to reserved would cost, per term.
type ReservedRentalConversion ¶
type ReservedRentalConversion struct {
AmountChargedCents float64 `json:"amountChargedCents"`
RentalID string `json:"rentalId"`
ReservedUntil time.Time `json:"reservedUntil"`
UsageTailCents float64 `json:"usageTailCents"`
}
ReservedRentalConversion An on-demand rental converted to reserved, and what it cost.
type ReservedRentalExtension ¶
type ReservedRentalExtension struct {
AmountChargedCents float64 `json:"amountChargedCents"`
RentalID string `json:"rentalId"`
ReservedUntil time.Time `json:"reservedUntil"`
}
ReservedRentalExtension A reserved rental's new end, and what extending it cost.
type ReservedTerm ¶
type ReservedTerm struct {
CostPerHour float64 `json:"costPerHour"`
DiscountPercentage float64 `json:"discountPercentage"`
EffectiveAt time.Time `json:"effectiveAt"`
OriginalCostPerHour float64 `json:"originalCostPerHour"`
ReservationEndsAt nullable.Nullable[time.Time] `json:"reservationEndsAt"`
ReservedUntil nullable.Nullable[time.Time] `json:"reservedUntil"`
TermPeriodDays int `json:"termPeriodDays"`
TermType ReservedTermTermType `json:"termType"`
}
ReservedTerm defines model for ReservedTerm.
type ReservedTermTermType ¶
type ReservedTermTermType string
ReservedTermTermType defines model for ReservedTerm.TermType.
const (
ReservedTermTermTypeReserved ReservedTermTermType = "reserved"
)
Defines values for ReservedTermTermType.
func (ReservedTermTermType) Valid ¶
func (e ReservedTermTermType) Valid() bool
Valid indicates whether the value is a known member of the ReservedTermTermType enum.
type RetryPolicy ¶
type RetryPolicy struct {
// MaxAttempts is the total number of attempts, including the first.
// Values below 1 mean a single attempt.
MaxAttempts int
// BaseDelay is the delay before the first retry. It doubles each attempt.
BaseDelay time.Duration
// MaxDelay caps the delay between attempts. If the server asks for a
// longer Retry-After than this, the client stops and returns the error so
// the caller can reschedule instead of blocking.
MaxDelay time.Duration
}
RetryPolicy controls how the client retries failed requests.
Reads and other idempotent calls are retried on 429, 502, 503, 504 and transport errors. Non-idempotent calls (create, reboot) are retried only on 429 or when the connection was never established, because anything else might have taken effect.
func DefaultRetryPolicy ¶
func DefaultRetryPolicy() RetryPolicy
DefaultRetryPolicy is 3 attempts with exponential backoff from 500ms, capped at 10s.
func NoRetries ¶
func NoRetries() RetryPolicy
NoRetries disables retries. Controllers that requeue on error often prefer this, so a reconcile never blocks on backoff.
type SSHEndpoint ¶
type SSHEndpoint struct {
Host string `json:"host"`
Port int `json:"port"`
User string `json:"user"`
}
SSHEndpoint Where to connect to a rental over SSH.
type SSHKey ¶
type SSHKey struct {
CreatedAt time.Time `json:"createdAt"`
// CreatedBy The user who added an SSH public key.
CreatedBy SSHKeyCreator `json:"createdBy"`
ID int `json:"id"`
Name nullable.Nullable[string] `json:"name"`
OrgID nullable.Nullable[string] `json:"orgId"`
PublicKey string `json:"publicKey"`
UserID string `json:"userId"`
}
SSHKey An SSH public key saved to a user's account or an organization. userId is the member who added it; orgId is set when the key belongs to an organization.
type SSHKeyCreator ¶
type SSHKeyCreator struct {
Email string `json:"email"`
Name nullable.Nullable[string] `json:"name"`
}
SSHKeyCreator The user who added an SSH public key.
type SSHKeyWithLiveRentalCount ¶
type SSHKeyWithLiveRentalCount struct {
CreatedAt time.Time `json:"createdAt"`
// CreatedBy The user who added an SSH public key.
CreatedBy SSHKeyCreator `json:"createdBy"`
ID int `json:"id"`
LiveRentalCount int `json:"liveRentalCount"`
Name nullable.Nullable[string] `json:"name"`
OrgID nullable.Nullable[string] `json:"orgId"`
PublicKey string `json:"publicKey"`
UserID string `json:"userId"`
}
SSHKeyWithLiveRentalCount An SSH public key, with the number of live rentals it is attached to.
type SSHKeysService ¶
type SSHKeysService struct {
// contains filtered or unexported fields
}
SSHKeysService manages the SSH public keys saved on the account.
func (*SSHKeysService) Create ¶
func (s *SSHKeysService) Create(ctx context.Context, params CreateSSHKeyParams) (*SSHKey, error)
Create calls POST /v2/ssh-keys: create an SSH public key for the current user or organization.
Create an SSH public key for the current user or organization. Reports SSH_PUBLIC_KEY_ALREADY_EXISTS when a key with identical type and body already exists under the current user or organization.
It is not retried after a failure that may have reached the server. Such a failure matches ErrOutcomeUnknown: check whether the call took effect before making it again.
func (*SSHKeysService) Delete ¶
func (s *SSHKeysService) Delete(ctx context.Context, params DeleteSSHKeyParams) (*DeletedSSHKey, error)
Delete calls POST /v2/ssh-keys/delete: delete an SSH public key.
Deletes an SSH public key. Reports SSH_PUBLIC_KEY_IN_USE while the key is attached to a live rental, SSH_PUBLIC_KEY_NOT_FOUND for a key that doesn't exist or the user doesn't control, and NOT_AUTHORIZED_TO_ACCESS_OWNED_RESOURCE for an organization key added by another member unless the caller is an organization admin.
func (*SSHKeysService) List ¶
func (s *SSHKeysService) List(ctx context.Context) ([]SSHKeyWithLiveRentalCount, error)
List calls GET /v2/ssh-keys: list SSH public keys for the current user or organization.
func (*SSHKeysService) ListForRental ¶
func (s *SSHKeysService) ListForRental(ctx context.Context, params ListRentalSSHKeysParams) ([]SSHKey, error)
ListForRental calls GET /v2/ssh-keys/rental: list the SSH public keys attached to a rental.
List the SSH public keys attached to a rental. Reports RENTAL_NOT_FOUND for rentals that don't exist or the user doesn't control.
func (*SSHKeysService) Update ¶
func (s *SSHKeysService) Update(ctx context.Context, params UpdateSSHKeyParams) (*SSHKey, error)
Update calls POST /v2/ssh-keys/update: rename an SSH public key.
Renames an SSH public key. Reports SSH_PUBLIC_KEY_NOT_FOUND for keys that don't exist or the user doesn't control, and NOT_AUTHORIZED_TO_ACCESS_OWNED_RESOURCE for an organization key added by another member unless the caller is an organization admin.
type StorageVolume ¶
type StorageVolume struct {
AttachedRentalIds []string `json:"attachedRentalIds"`
CostPerHourCents float64 `json:"costPerHourCents"`
CreatedAt time.Time `json:"createdAt"`
Label string `json:"label"`
OrgID nullable.Nullable[string] `json:"orgId"`
Region string `json:"region"`
SizeInGb int `json:"sizeInGb"`
StartedAt nullable.Nullable[time.Time] `json:"startedAt"`
Status StorageVolumeStatus `json:"status"`
StorageVolumeID string `json:"storageVolumeId"`
TerminatedAt nullable.Nullable[time.Time] `json:"terminatedAt"`
TerminationReason nullable.Nullable[string] `json:"terminationReason"`
UpdatedAt nullable.Nullable[time.Time] `json:"updatedAt"`
UserID string `json:"userId"`
VirtualIP string `json:"virtualIp"`
}
StorageVolume A network storage volume.
type StorageVolumeChoice ¶
type StorageVolumeChoice struct {
// contains filtered or unexported fields
}
StorageVolumeChoice Bare metal only.
func (StorageVolumeChoice) AsExistingStorageVolume ¶
func (t StorageVolumeChoice) AsExistingStorageVolume() (ExistingStorageVolume, error)
AsExistingStorageVolume returns the union data inside the StorageVolumeChoice as a ExistingStorageVolume
func (StorageVolumeChoice) AsNewStorageVolume ¶
func (t StorageVolumeChoice) AsNewStorageVolume() (NewStorageVolume, error)
AsNewStorageVolume returns the union data inside the StorageVolumeChoice as a NewStorageVolume
func (*StorageVolumeChoice) FromExistingStorageVolume ¶
func (t *StorageVolumeChoice) FromExistingStorageVolume(v ExistingStorageVolume) error
FromExistingStorageVolume overwrites any union data inside the StorageVolumeChoice as the provided ExistingStorageVolume
func (*StorageVolumeChoice) FromNewStorageVolume ¶
func (t *StorageVolumeChoice) FromNewStorageVolume(v NewStorageVolume) error
FromNewStorageVolume overwrites any union data inside the StorageVolumeChoice as the provided NewStorageVolume
func (StorageVolumeChoice) MarshalJSON ¶
func (t StorageVolumeChoice) MarshalJSON() ([]byte, error)
func (*StorageVolumeChoice) MergeExistingStorageVolume ¶
func (t *StorageVolumeChoice) MergeExistingStorageVolume(v ExistingStorageVolume) error
MergeExistingStorageVolume performs a merge with any union data inside the StorageVolumeChoice, using the provided ExistingStorageVolume
func (*StorageVolumeChoice) MergeNewStorageVolume ¶
func (t *StorageVolumeChoice) MergeNewStorageVolume(v NewStorageVolume) error
MergeNewStorageVolume performs a merge with any union data inside the StorageVolumeChoice, using the provided NewStorageVolume
func (*StorageVolumeChoice) UnmarshalJSON ¶
func (t *StorageVolumeChoice) UnmarshalJSON(b []byte) error
type StorageVolumeOption ¶
type StorageVolumeOption struct {
CostPerGbHourCents float64 `json:"costPerGbHourCents"`
MaxSizeInGb int `json:"maxSizeInGb"`
Region string `json:"region"`
}
StorageVolumeOption defines model for StorageVolumeOption.
type StorageVolumeStatus ¶
type StorageVolumeStatus string
StorageVolumeStatus defines model for StorageVolumeStatus.
const ( StorageVolumeStatusActive StorageVolumeStatus = "active" StorageVolumeStatusInactive StorageVolumeStatus = "inactive" StorageVolumeStatusUnknown StorageVolumeStatus = "unknown" )
Defines values for StorageVolumeStatus.
func (StorageVolumeStatus) Valid ¶
func (e StorageVolumeStatus) Valid() bool
Valid indicates whether the value is a known member of the StorageVolumeStatus enum.
type StorageVolumesService ¶
type StorageVolumesService struct {
// contains filtered or unexported fields
}
StorageVolumesService manages network storage volumes and their attachments.
func (*StorageVolumesService) Attach ¶
func (s *StorageVolumesService) Attach(ctx context.Context, params AttachStorageVolumeParams) (*AttachStorageVolumeResponse, error)
Attach calls POST /v2/on-demand/storage-volumes/attach: attach a storage volume to bare metal instance(s).
func (*StorageVolumesService) Create ¶
func (s *StorageVolumesService) Create(ctx context.Context, params CreateStorageVolumeParams) (*CreatedStorageVolume, error)
Create calls POST /v2/on-demand/storage-volumes: create a storage volume.
It is not retried after a failure that may have reached the server. Such a failure matches ErrOutcomeUnknown: check whether the call took effect before making it again.
func (*StorageVolumesService) List ¶
func (s *StorageVolumesService) List(ctx context.Context) ([]StorageVolume, error)
List calls GET /v2/on-demand/storage-volumes: get a list of storage volumes.
func (*StorageVolumesService) Options ¶
func (s *StorageVolumesService) Options(ctx context.Context) ([]StorageVolumeOption, error)
Options calls GET /v2/on-demand/storage-volume-options: get a list of storage volume options.
func (*StorageVolumesService) Terminate ¶
func (s *StorageVolumesService) Terminate(ctx context.Context, params TerminateStorageVolumeParams) (*TerminateStorageVolumeResponse, error)
Terminate calls POST /v2/on-demand/storage-volumes/terminate: terminate a storage volume.
func (*StorageVolumesService) Update ¶
func (s *StorageVolumesService) Update(ctx context.Context, params UpdateStorageVolumeParams) (*UpdateStorageVolumeResponse, error)
Update calls POST /v2/on-demand/storage-volumes/update: update a storage volume.
Update a storage volume's attached instances and/or size
type SuccessResponse ¶
type SuccessResponse struct {
Success bool `json:"success"`
}
SuccessResponse Result of an operation that returns no payload.
type TermType ¶
type TermType string
TermType defines model for TermType.
type TerminateRentalParams ¶
type TerminateRentalParams struct {
Reason *string `json:"reason,omitempty"`
RentalID string `json:"rentalId"`
}
TerminateRentalParams defines model for TerminateRentalParams.
type TerminateStorageVolumeParams ¶
type TerminateStorageVolumeParams struct {
Reason *string `json:"reason,omitempty"`
StorageVolumeID string `json:"storageVolumeId"`
}
TerminateStorageVolumeParams defines model for TerminateStorageVolumeParams.
type TerminateStorageVolumeResponse ¶
type TerminateStorageVolumeResponse struct {
Message string `json:"message"`
StorageVolumeID string `json:"storageVolumeId"`
}
TerminateStorageVolumeResponse Confirmation that a storage volume is terminating.
type TerminatedRentalLookup ¶
type TerminatedRentalLookup struct {
// Rental A GPU rental that has ended, with its total cost.
Rental HistoricalRental `json:"rental"`
State TerminatedRentalLookupState `json:"state"`
}
TerminatedRentalLookup A rental lookup that found a rental that has ended.
type TerminatedRentalLookupState ¶
type TerminatedRentalLookupState string
TerminatedRentalLookupState defines model for TerminatedRentalLookup.State.
const (
TerminatedRentalLookupStateTerminated TerminatedRentalLookupState = "terminated"
)
Defines values for TerminatedRentalLookupState.
func (TerminatedRentalLookupState) Valid ¶
func (e TerminatedRentalLookupState) Valid() bool
Valid indicates whether the value is a known member of the TerminatedRentalLookupState enum.
type UpdateCurrentUserParams ¶
type UpdateCurrentUserParams struct {
Name nullable.Nullable[string] `json:"name,omitempty"`
OnboardedFor nullable.Nullable[string] `json:"onboardedFor,omitempty"`
}
UpdateCurrentUserParams defines model for UpdateCurrentUserParams.
type UpdateRentalParams ¶
type UpdateRentalParams struct {
ConvertToOnDemandOnExpiry *bool `json:"convertToOnDemandOnExpiry,omitempty"`
Label *string `json:"label,omitempty"`
RentalID string `json:"rentalId"`
}
UpdateRentalParams defines model for UpdateRentalParams.
type UpdateSSHKeyParams ¶
UpdateSSHKeyParams defines model for UpdateSSHKeyParams.
type UpdateStorageVolumeParams ¶
type UpdateStorageVolumeParams struct {
Label *string `json:"label,omitempty"`
RentalIds *[]string `json:"rentalIds,omitempty"`
SizeInGb *int `json:"sizeInGb,omitempty"`
StorageVolumeID string `json:"storageVolumeId"`
}
UpdateStorageVolumeParams defines model for UpdateStorageVolumeParams.
type UpdateStorageVolumeResponse ¶
type UpdateStorageVolumeResponse struct {
AttachedRentalIds []string `json:"attachedRentalIds"`
Message string `json:"message"`
SizeInGb int `json:"sizeInGb"`
StorageVolumeID string `json:"storageVolumeId"`
}
UpdateStorageVolumeResponse Confirmation that a storage volume is being updated.
type User ¶
type User struct {
CreatedAt time.Time `json:"createdAt"`
Email string `json:"email"`
EmailVerified nullable.Nullable[bool] `json:"emailVerified"`
ID string `json:"id"`
IsActive nullable.Nullable[bool] `json:"isActive"`
Name nullable.Nullable[string] `json:"name"`
OnboardedAt nullable.Nullable[time.Time] `json:"onboardedAt"`
OnboardedFor nullable.Nullable[string] `json:"onboardedFor"`
Picture nullable.Nullable[string] `json:"picture"`
Provider nullable.Nullable[string] `json:"provider"`
ReferralCode nullable.Nullable[string] `json:"referralCode"`
}
User A Hyperbolic user account.
type UserMutationResponse ¶
type UserMutationResponse struct {
Success bool `json:"success"`
// User A Hyperbolic user account.
User User `json:"user"`
}
UserMutationResponse The user account as it stands after an update.
type UsersService ¶
type UsersService struct {
// contains filtered or unexported fields
}
UsersService reads and updates the signed-in user.
func (*UsersService) DeleteMe ¶
func (s *UsersService) DeleteMe(ctx context.Context) (*SuccessResponse, error)
DeleteMe calls DELETE /v2/users/me: delete the current user.
func (*UsersService) Me ¶
func (s *UsersService) Me(ctx context.Context) (*CurrentUser, error)
Me calls GET /v2/users/me: get the current user.
func (*UsersService) UpdateMe ¶
func (s *UsersService) UpdateMe(ctx context.Context, params UpdateCurrentUserParams) (*UserMutationResponse, error)
UpdateMe calls PUT /v2/users/me: update the current user.
func (*UsersService) VerifyPhoneNumber ¶
func (s *UsersService) VerifyPhoneNumber(ctx context.Context, params VerifyPhoneNumberParams) (*SuccessResponse, error)
VerifyPhoneNumber calls PUT /v2/users/me/verify-phone-number: verify a phone number.
It is not retried after a failure that may have reached the server. Such a failure matches ErrOutcomeUnknown: check whether the call took effect before making it again.
type VerifyPhoneNumberParams ¶
type VerifyPhoneNumberParams struct {
PhoneNumber string `json:"phoneNumber"`
}
VerifyPhoneNumberParams defines model for VerifyPhoneNumberParams.
type VirtualMachineOption ¶
type VirtualMachineOption struct {
ConnectionType ConnectionType `json:"connectionType"`
CostPerHourCents float64 `json:"costPerHourCents"`
Enabled bool `json:"enabled"`
EthernetVariant *EthernetVariant `json:"ethernetVariant,omitempty"`
GPUCount int `json:"gpuCount"`
GPUFormFactor GPUFormFactor `json:"gpuFormFactor"`
GPUType GPUType `json:"gpuType"`
MachineType VirtualMachineOptionMachineType `json:"machineType"`
Nodes []struct {
CPUModel string `json:"cpuModel"`
GPUCount int `json:"gpuCount"`
RAMGb int `json:"ramGb"`
StorageGb int `json:"storageGb"`
VcpuCount int `json:"vcpuCount"`
} `json:"nodes"`
Region string `json:"region"`
SupportsCustomPorts bool `json:"supportsCustomPorts"`
SupportsMultipleSSHKeys bool `json:"supportsMultipleSshKeys"`
SupportsSSHKeyUpdates bool `json:"supportsSshKeyUpdates"`
TotalAvailable *int `json:"totalAvailable,omitempty"`
}
VirtualMachineOption defines model for VirtualMachineOption.
type VirtualMachineOptionMachineType ¶
type VirtualMachineOptionMachineType string
VirtualMachineOptionMachineType defines model for VirtualMachineOption.MachineType.
const (
VirtualMachineOptionMachineTypeVirtualMachine VirtualMachineOptionMachineType = "virtual-machine"
)
Defines values for VirtualMachineOptionMachineType.
func (VirtualMachineOptionMachineType) Valid ¶
func (e VirtualMachineOptionMachineType) Valid() bool
Valid indicates whether the value is a known member of the VirtualMachineOptionMachineType enum.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package hyperbolictest provides an in-memory fake of the Hyperbolic API for tests, with fault injection for the failures that matter most to callers: rate limiting, 5xx responses, timeouts, and failures that happen after the server has already applied a request.
|
Package hyperbolictest provides an in-memory fake of the Hyperbolic API for tests, with fault injection for the failures that matter most to callers: rate limiting, 5xx responses, timeouts, and failures that happen after the server has already applied a request. |