gobitlaunch: github.com/BitLaunchIO/gobitlaunch Index | Files

package gobitlaunch

import "github.com/BitLaunchIO/gobitlaunch"


Package Files

account.go create-options.go gobitlaunch.go server.go sshkeys.go transaction.go

type Account Uses

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 Uses

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 Uses

type AccountService struct {
    // contains filtered or unexported fields

AccountService manages account API actions

func (*AccountService) History Uses

func (as *AccountService) History(page, perPage int) (*AccountHistory, error)

History shows the account history/activity

func (*AccountService) Show Uses

func (as *AccountService) Show() (*Account, error)

Show the account

func (*AccountService) Usage Uses

func (as *AccountService) Usage(filter ...string) (*AccountUsage, error)

Usage shows the account usage

type AccountUsage Uses

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 Uses

type Client struct {
    Account       *AccountService
    Server        *ServerService
    Transaction   *TransactionService
    CreateOptions *CreateOptionsService
    SSHKey        *SSHKeyService
    // contains filtered or unexported fields

Client manages interaction with the API

func NewClient Uses

func NewClient(token string) *Client

NewClient takes an API token and returns a new BitLaunch API client

func (*Client) DoRequest Uses

func (c *Client) DoRequest(r *http.Request, data interface{}) error

DoRequest performs a http request

func (*Client) NewRequest Uses

func (c *Client) NewRequest(method, path string, body []byte) (*http.Request, error)

NewRequest creates an API Request

type CreateOptionsService Uses

type CreateOptionsService struct {
    // contains filtered or unexported fields

CreateOptionsService manages create options API actions

func (*CreateOptionsService) Show Uses

func (co *CreateOptionsService) Show(hostID int) (*ServerCreateOptions, error)

Show the server create options

type CreateServerOptions Uses

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 Uses

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 Uses

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 Uses

type HostImage struct {
    ID                 int                `json:"id"`
    Name               string             `json:"name"`
    Type               string             `json:"type"`
    MinDiskSize        int                `json:"minDiskSize"`
    UnavailableRegions []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 Uses

type HostImageVersion struct {
    ID                  string `json:"id"`
    Description         string `json:"description"`
    PasswordUnsupported bool   `json:"passwordUnsupported"`

HostImageVersion represents an image version

type HostOptions Uses

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 Uses

type HostPlanType struct {
    Type        string `json:"type"`
    Description string `json:"description"`
    Name        string `json:"name"`

HostPlanType represents the type of plan

type HostRegion Uses

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 Uses

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 Uses

type HostSubRegion struct {
    ID               string   `json:"id"`
    Description      string   `json:"description"`
    Slug             string   `json:"slug"`
    UnavailableSizes []string `json:"unavailableSizes"`

HostSubRegion represents a sub region

type Ports Uses

type Ports struct {
    PortNumber int    `json:"portNumber"`
    Protocol   string `json:"protocol"`

Ports represents a port slice object

type RebuildOptions Uses

type RebuildOptions struct {
    ID          string `json:"hostImageID"`
    Description string `json:"imageDescription"`

RebuildOptions defines options for rebuilding a server

type SSHKey Uses

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 Uses

type SSHKeyService struct {
    // contains filtered or unexported fields

SSHKeyService manages ssh key API actions

func (*SSHKeyService) Create Uses

func (ss *SSHKeyService) Create(k *SSHKey) (*SSHKey, error)

Create ssh key

func (*SSHKeyService) Delete Uses

func (ss *SSHKeyService) Delete(id string) error

Delete an SSH Key

func (*SSHKeyService) List Uses

func (ss *SSHKeyService) List() ([]SSHKey, error)

List ssh key

type Server Uses

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 Uses

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 Uses

type ServerService struct {
    // contains filtered or unexported fields

ServerService manages server API actions

func (*ServerService) Create Uses

func (ss *ServerService) Create(opts *CreateServerOptions) (*Server, error)

Create server

func (*ServerService) Destroy Uses

func (ss *ServerService) Destroy(id string) error

Destroy a server

func (*ServerService) List Uses

func (ss *ServerService) List() ([]Server, error)

List servers

func (*ServerService) Protection Uses

func (ss *ServerService) Protection(id string, enabled bool) (*Server, error)

Protection is to enable/disable DDoS protection on a server

func (*ServerService) Rebuild Uses

func (ss *ServerService) Rebuild(id string, opts *RebuildOptions) error

Rebuild server

func (*ServerService) Resize Uses

func (ss *ServerService) Resize(id string, size string) error

Resize server

func (*ServerService) Restart Uses

func (ss *ServerService) Restart(id string) error

Restart server

func (*ServerService) SetPorts Uses

func (ss *ServerService) SetPorts(id string, ports *[]Ports) (*Server, error)

SetPorts sets the enabled ports on a server for DDoS protection (Needs Protection enabled)

func (*ServerService) Show Uses

func (ss *ServerService) Show(id string) (*Server, error)

Show server

type Transaction Uses

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 Uses

type TransactionService struct {
    // contains filtered or unexported fields

TransactionService manages account API actions

func (*TransactionService) Create Uses

func (ss *TransactionService) Create(opts *CreateTransactionOptions) (*Transaction, error)

Create transaction

func (*TransactionService) List Uses

func (ss *TransactionService) List(page, perPage int) ([]Transaction, error)

List transactions

func (*TransactionService) Show Uses

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.