Documentation ¶
Index ¶
- type Account
- type AccountHistory
- type AccountService
- type AccountUsage
- type Client
- type CreateOptionsService
- type CreateServerOptions
- type CreateTransactionOptions
- type HostDisks
- type HostImage
- type HostImageVersion
- type HostOptions
- type HostPlanType
- type HostRegion
- type HostSize
- type HostSubRegion
- type Ports
- type RebuildOptions
- type SSHKey
- type SSHKeyService
- type Server
- type ServerCreateOptions
- type ServerService
- func (ss *ServerService) Create(opts *CreateServerOptions) (*Server, error)
- func (ss *ServerService) Destroy(id string) error
- func (ss *ServerService) List() ([]Server, error)
- func (ss *ServerService) Protection(id string, enabled bool) (*Server, error)
- func (ss *ServerService) Rebuild(id string, opts *RebuildOptions) error
- func (ss *ServerService) Resize(id string, size string) error
- func (ss *ServerService) Restart(id string) error
- func (ss *ServerService) SetPorts(id string, ports *[]Ports) (*Server, error)
- func (ss *ServerService) Show(id string) (*Server, error)
- type Transaction
- type TransactionService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { ID string `json:"id"` Email string `json:"email"` EmailConfirmed bool `json:"emailConfirmed"` Created time.Time `json:"created"` Used int `json:"used"` Limit int `json:"limit"` Twofa bool `json:"twofa"` Balance int `json:"balance"` CostPerHr int `json:"costPerHr"` LowBalanceAlertDays int `json:"billingAlert"` NegativeAllowance int `json:"negativeAllowance"` }
Account represents a BitLaunch account
type AccountHistory ¶ added in v1.1.0
type AccountHistory struct { History []struct { ID string `json:"id"` Time time.Time `json:"time"` Description string `json:"description"` } `json:"history"` Total int `json:"total"` }
AccountHistory represents the usage data of a BitLaunch account
type AccountService ¶
type AccountService struct {
// contains filtered or unexported fields
}
AccountService manages account API actions
func (*AccountService) History ¶ added in v1.1.0
func (as *AccountService) History(page, perPage int) (*AccountHistory, error)
History shows the account history/activity
func (*AccountService) Usage ¶ added in v1.1.0
func (as *AccountService) Usage(filter ...string) (*AccountUsage, error)
Usage shows the account usage
type AccountUsage ¶ added in v1.1.0
type AccountUsage struct { Server []usageData `json:"serverUsage"` Backup []usageData `json:"backupUsage"` Bandwidth []usageData `json:"bandwidthUsage"` Protection []usageData `json:"protectionUsage"` TotalUSD int `json:"totalUsd"` PrevMonth string `json:"prevMonth"` ThisMonth string `json:"thisMonth"` NextMonth string `json:"nextMonth"` }
AccountUsage represents the usage data of a BitLaunch account
type Client ¶
type Client struct { Account *AccountService Server *ServerService Transaction *TransactionService CreateOptions *CreateOptionsService SSHKey *SSHKeyService // contains filtered or unexported fields }
Client manages interaction with the API
type CreateOptionsService ¶
type CreateOptionsService struct {
// contains filtered or unexported fields
}
CreateOptionsService manages create options API actions
func (*CreateOptionsService) Show ¶
func (co *CreateOptionsService) Show(hostID int) (*ServerCreateOptions, error)
Show the server create options
type CreateServerOptions ¶
type CreateServerOptions struct { Name string `json:"name"` HostID int `json:"hostID"` HostImageID string `json:"HostImageID"` SizeID string `json:"sizeID"` RegionID string `json:"regionID"` SSHKeys []string `json:"sshKeys"` Password string `json:"password"` InitScript string `json:"initscript"` }
CreateServerOptions defines options for creating a new server
type CreateTransactionOptions ¶
type CreateTransactionOptions struct { AmountUSD int `json:"amountUsd"` CryptoSymbol string `json:"cryptoSymbol"` LightningNetwork bool `json:"lightningNetwork"` }
CreateTransactionOptions represents options for create a new transaction
type HostDisks ¶
type HostDisks struct { Type string `json:"type"` Count int `json:"count"` Size string `json:"size"` Unit string `json:"unit"` }
HostDisks represents a disk
type HostImage ¶
type HostImage struct { ID int `json:"id"` Name string `json:"name"` Type string `json:"type"` MinDiskSize int `json:"minDiskSize"` DefaultVersion HostImageVersion `json:"version"` Versions []HostImageVersion `json:"versions"` ExtraCostPerMonth int `json:"extraCostPerMonth"` Windows bool `json:"windows"` }
HostImage represents an image
type HostImageVersion ¶
type HostImageVersion struct { ID string `json:"id"` Description string `json:"description"` PasswordUnsupported bool `json:"passwordUnsupported"` }
HostImageVersion represents an image version
type HostOptions ¶
type HostOptions struct { Rebuild bool `json:"rebuild"` Resize bool `json:"resize"` Backups bool `json:"backups"` Userscript bool `json:"userScript"` }
HostOptions represents what options a certain host provides
type HostPlanType ¶
type HostPlanType struct { Type string `json:"type"` Description string `json:"description"` Name string `json:"name"` }
HostPlanType represents the type of plan
type HostRegion ¶
type HostRegion struct { ID int `json:"id"` Name string `json:"name"` ISO string `json:"iso"` DefaultSubregion HostSubRegion `json:"subregion"` Subregions []HostSubRegion `json:"subregions"` }
HostRegion represents a region
type HostSize ¶
type HostSize struct { ID string `json:"id"` Slug string `json:"slug"` BandwidthGB int `json:"bandwidthGB"` CPUCount int `json:"cpuCount"` DiskGB int `json:"diskGB"` Disks []HostDisks `json:"disks"` MemoryMB int `json:"memoryMB"` CostPerHour int `json:"costPerHr"` CostPerMonth float64 `json:"costPerMonth"` // PlanType indicates the hardware plan of the server (Standard, CPU focused) PlanType string `json:"planType"` }
HostSize represents a server size
type HostSubRegion ¶
type HostSubRegion struct { ID string `json:"id"` Description string `json:"description"` Slug string `json:"slug"` }
HostSubRegion represents a sub region
type RebuildOptions ¶ added in v1.1.0
type RebuildOptions struct { ID string `json:"hostImageID"` Description string `json:"imageDescription"` }
RebuildOptions defines options for rebuilding a server
type SSHKey ¶
type SSHKey struct { ID string `json:"id"` Name string `json:"name"` Fingerprint string `json:"fingerprint"` Content string `json:"content"` Created time.Time `json:"created"` }
SSHKey represents an ssh key
type SSHKeyService ¶
type SSHKeyService struct {
// contains filtered or unexported fields
}
SSHKeyService manages ssh key API actions
type Server ¶
type Server struct { ID string `json:"id"` Name string `json:"name"` HostID int `json:"host"` Ipv4 string `json:"ipv4"` Region string `json:"region"` Size string `json:"size"` SizeDesc string `json:"sizeDescription"` Image string `json:"image"` ImageDesc string `json:"imageDescription"` Created time.Time `json:"created"` Rate int `json:"rate"` BandwidthUsed int `json:"bandwidthUsed"` BandwidthAllowance int `json:"bandwidthAllowance"` Status string `json:"status"` ErrorText string `json:"errorText"` BackupsEnabled bool `json:"backupsEnabled"` Version string `json:"version"` Abuse bool `json:"abuse"` DiskGB int `json:"diskGB"` Protection struct { Enabled bool `json:"enabled"` Proxy struct { IP string `json:"ip"` Region string `json:"region"` Ports []Ports `json:"ports"` Target string `json:"target"` } `json:"proxy"` } `json:"protection"` }
Server represents a server
type ServerCreateOptions ¶
type ServerCreateOptions struct { HostID int `json:"hostID"` Images []HostImage `json:"image"` Regions []HostRegion `json:"region"` Sizes []HostSize `json:"size"` Available bool `json:"available"` BandwidthCost int `json:"bandwidthCost"` PlanTypes []HostPlanType `json:"planTypes"` }
ServerCreateOptions represents server creation options
type ServerService ¶
type ServerService struct {
// contains filtered or unexported fields
}
ServerService manages server API actions
func (*ServerService) Create ¶
func (ss *ServerService) Create(opts *CreateServerOptions) (*Server, error)
Create server
func (*ServerService) Protection ¶ added in v1.1.0
func (ss *ServerService) Protection(id string, enabled bool) (*Server, error)
Protection is to enable/disable DDoS protection on a server
func (*ServerService) Rebuild ¶ added in v1.1.0
func (ss *ServerService) Rebuild(id string, opts *RebuildOptions) error
Rebuild server
func (*ServerService) Resize ¶ added in v1.1.0
func (ss *ServerService) Resize(id string, size string) error
Resize server
func (*ServerService) Restart ¶ added in v1.1.0
func (ss *ServerService) Restart(id string) error
Restart server
type Transaction ¶
type Transaction struct { ID string `json:"id"` TID string `json:"transactionId"` Date time.Time `json:"date"` Address string `json:"address"` Symbol string `json:"cryptoSymbol"` AmountUSD float64 `json:"amountUsd"` AmountCrypto string `json:"amountCrypto"` Status string `json:"status"` StatusURL string `json:"statusUrl"` QrCodeURL string `json:"qrCodeUrl"` }
Transaction represents a transaction
type TransactionService ¶
type TransactionService struct {
// contains filtered or unexported fields
}
TransactionService manages account API actions
func (*TransactionService) Create ¶
func (ss *TransactionService) Create(opts *CreateTransactionOptions) (*Transaction, error)
Create transaction
func (*TransactionService) List ¶
func (ss *TransactionService) List(page, perPage int) ([]Transaction, error)
List transactions
func (*TransactionService) Show ¶
func (ss *TransactionService) Show(id string) (*Transaction, error)
Show transaction