import "github.com/BitLaunchIO/gobitlaunch"
account.go create-options.go gobitlaunch.go server.go sshkeys.go transaction.go
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 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 struct {
// contains filtered or unexported fields
}
AccountService manages account API actions
func (as *AccountService) History(page, perPage int) (*AccountHistory, error)
History shows the account history/activity
func (as *AccountService) Show() (*Account, error)
Show the account
func (as *AccountService) Usage(filter ...string) (*AccountUsage, error)
Usage shows the account usage
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 struct { Account *AccountService Server *ServerService Transaction *TransactionService CreateOptions *CreateOptionsService SSHKey *SSHKeyService // contains filtered or unexported fields }
Client manages interaction with the API
NewClient takes an API token and returns a new BitLaunch API client
DoRequest performs a http request
NewRequest creates an API Request
type CreateOptionsService struct {
// contains filtered or unexported fields
}
CreateOptionsService manages create options API actions
func (co *CreateOptionsService) Show(hostID int) (*ServerCreateOptions, error)
Show the server create options
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 struct { AmountUSD int `json:"amountUsd"` CryptoSymbol string `json:"cryptoSymbol"` LightningNetwork bool `json:"lightningNetwork"` }
CreateTransactionOptions represents options for create a new transaction
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 struct { ID int `json:"id"` Name string `json:"name"` Type string `json:"type"` MinDiskSize int `json:"minDiskSize"` []string `json:"unavailableRegions"` DefaultVersion HostImageVersion `json:"version"` Versions []HostImageVersion `json:"versions"` ExtraCostPerMonth int `json:"extraCostPerMonth"` Windows bool `json:"windows"` }
HostImage represents an image
type HostImageVersion struct { ID string `json:"id"` Description string `json:"description"` PasswordUnsupported bool `json:"passwordUnsupported"` }
HostImageVersion represents an image version
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 struct { Type string `json:"type"` Description string `json:"description"` Name string `json:"name"` }
HostPlanType represents the type of plan
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 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 struct { ID string `json:"id"` Description string `json:"description"` Slug string `json:"slug"` []string `json:"unavailableSizes"` }
HostSubRegion represents a sub region
Ports represents a port slice object
type RebuildOptions struct { ID string `json:"hostImageID"` Description string `json:"imageDescription"` }
RebuildOptions defines options for rebuilding a server
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 struct {
// contains filtered or unexported fields
}
SSHKeyService manages ssh key API actions
func (ss *SSHKeyService) Create(k *SSHKey) (*SSHKey, error)
Create ssh key
func (ss *SSHKeyService) Delete(id string) error
Delete an SSH Key
func (ss *SSHKeyService) List() ([]SSHKey, error)
List ssh key
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 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 struct {
// contains filtered or unexported fields
}
ServerService manages server API actions
func (ss *ServerService) Create(opts *CreateServerOptions) (*Server, error)
Create server
func (ss *ServerService) Destroy(id string) error
Destroy a server
func (ss *ServerService) List() ([]Server, error)
List servers
Protection is to enable/disable DDoS protection on a server
func (ss *ServerService) Rebuild(id string, opts *RebuildOptions) error
Rebuild server
func (ss *ServerService) Resize(id string, size string) error
Resize server
func (ss *ServerService) Restart(id string) error
Restart server
SetPorts sets the enabled ports on a server for DDoS protection (Needs Protection enabled)
func (ss *ServerService) Show(id string) (*Server, error)
Show server
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 struct {
// contains filtered or unexported fields
}
TransactionService manages account API actions
func (ss *TransactionService) Create(opts *CreateTransactionOptions) (*Transaction, error)
Create transaction
func (ss *TransactionService) List(page, perPage int) ([]Transaction, error)
List transactions
func (ss *TransactionService) Show(id string) (*Transaction, error)
Show transaction
Package gobitlaunch imports 10 packages (graph). Updated 2020-10-16. Refresh now. Tools for package owners.