linode

package module
v0.0.0-...-d454a41 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2015 License: MIT Imports: 11 Imported by: 0

README

linode Circle CI GoDoc

linode is a (mostly) complete set of Go bindings to the Linode API. It is not particularly idiomatic; the goal was to match the API as written rather than Go-ifying it.

Installation

Assuming you've got a working Go environment:

$ go get github.com/alexsacr/linode
Usage

About what you'd expect:

package main

import (
    "fmt"

    "github.com/alexsacr/linode"
)

func main() {
    c := linode.NewClient("yourAPIKey")

    ok := c.TestEcho()
    fmt.Println(ok)
}

The Linode API is fond of optional parameters, and Go hates them.

A simple solution to this conundrum would be to check if a particular parameter was zeroed or not, but that breaks down quick. false, 0, and "" may be meaningful in a particular context.

Stealing some inspiration from the Github and DigitalOcean Go bindings, all optional parameters for API calls are pointers. A nil parameter will not be sent to the API:

package main

import (
    "fmt"
    "os"

    "github.com/alexsacr/linode"
)

func main() {
    c := linode.NewClient("yourAPIKey")

    invoice, err := c.AccountEstimateInvoice("linode_new", linode.Int(1), linode.Int(2), nil)
    if err != nil {
        fmt.Printf("Oops: %s\n", err)
        os.Exit(1)
    }
    fmt.Printf("%+v\n", invoice)
}

Convenience functions are provided for creating pointers from literals (linode.Int(), linode.String(), and linode.Bool()).

API calls with a large number of optional parameters have separate option structs defined for them.

For more details, see the godoc.

Missing Methods

avail.nodebalancers was not added since, currently, it's a bit useless.

linode.ip.addpublic, with the IPv4 belt-tightening, cannot be tested and so was not added.

Deviations

At the time of writing, the published API has a number of errors and omissions.

linode.disk.create and linode.disk.update have multiple undocumented (but required) arguments that this package includes.

linode.config.create and linode.config.update have no documented arguments. This package includes all (?) of the missing arguments.

The following methods have arguments that claim they accept bool values, but actually must be integers (1 or 0):

  • pendingOnly for linode.job.list
  • isPublic for stackscript.create
  • isPublic for stackscript.update
  • checkPassive for nodebalancer.config.create

account.estimateinvoice returns a field named amount, not price.

There is an undocumented return field called billingmethod in account.info.

domain.update ignores the description argument

domain.list returns an empty string if no master IPs are set, but returns "none" if no AXFR IPs are set. This package returns empty strings in both cases for consistency.

Contributing

Pull requests are always welcome.

To get a couple tools needed for testing:

$ make setup

And then to run the unit tests:

$ make

Integration tests will cost you real money. A few cents probably, but it's hard to say for sure. With that warning in mind, read on.

Export an environment variable called LINODE_API_KEY set to, well, your API key. The key should be for an account with nothing currently in it. Then run:

$ make test-all

Documentation

Overview

Package linode provides complete bindings to the Linode API.

Index

Constants

View Source
const (
	// Linode API URL.
	BaseURL = "https://api.linode.com/"
)

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) *bool

Bool is a convenience function for creating a bool pointer.

func Int

func Int(i int) *int

Int is a convenience function for creating an integer pointer.

func String

func String(s string) *string

String is a convenience function for creating a string pointer.

Types

type AccInfo

type AccInfo struct {
	ActiveSince      string  `json:"ACTIVE_SINCE"`
	TransferPool     int     `json:"TRANSFER_POOL"`
	TransferUsed     int     `json:"TRANSFER_USED"`
	TransferBillable int     `json:"TRANSFER_BILLABLE"`
	Managed          bool    `json:"MANAGED"`
	Balance          float64 `json:"BALANCE"`
	BillingMethod    string  `json:"BILLING_METHOD"`
}

AccInfo is the API response to the 'account.info' call.

type Client

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

Client is the API client. It should be created by a call to NewClient().

func NewClient

func NewClient(apiKey string) *Client

NewClient returns a new client configured with the passed API key.

func (*Client) AccountEstimateInvoice

func (c *Client) AccountEstimateInvoice(mode string, term *int, planID *int,
	linodeID *int) (EstimatedInvoice, error)

AccountEstimateInvoice maps to the 'account.estimateinvoice' call.

https://www.linode.com/api/account/account.estimateinvoice

func (*Client) AccountInfo

func (c *Client) AccountInfo() (AccInfo, error)

AccountInfo maps to the 'account.info' call.

https://www.linode.com/api/account/account.info

func (*Client) AvailDatacenters

func (c *Client) AvailDatacenters() ([]Datacenter, error)

AvailDatacenters maps to the 'avail.datacenters' call.

https://www.linode.com/api/utility/avail.datacenters

func (*Client) AvailDistributions

func (c *Client) AvailDistributions(distributionID *int) ([]Distribution, error)

AvailDistributions maps to the 'avail.distributions' call.

https://www.linode.com/api/utility/avail.distributions

func (*Client) AvailKernels

func (c *Client) AvailKernels(kernelID *int, isXen *bool) ([]Kernel, error)

AvailKernels maps to the 'avail.kernels' call.

https://www.linode.com/api/utility/avail.kernels

func (*Client) AvailLinodePlans

func (c *Client) AvailLinodePlans(planID *int) ([]LinodePlan, error)

AvailLinodePlans maps to the 'avail.linodeplans' call.

https://www.linode.com/api/utility/avail.linodeplans

func (*Client) AvailStackScripts

func (c *Client) AvailStackScripts(distID *int, distVendor *string,
	keywords *string) ([]StackScript, error)

AvailStackScripts maps to the 'avail.stackscripts' call.

https://www.linode.com/api/utility/avail.stackscripts

func (*Client) DomainCreate

func (c *Client) DomainCreate(domain string, Type string,
	conf DomainCreateOpts) (domainID int, err error)

DomainCreate maps to the 'domain.create' call.

https://www.linode.com/api/dns/domain.create

func (*Client) DomainDelete

func (c *Client) DomainDelete(domainID int) error

DomainDelete maps to the 'domain.delete' call.

https://www.linode.com/api/dns/domain.delete

func (*Client) DomainList

func (c *Client) DomainList(domainID *int) ([]Domain, error)

DomainList maps to the 'domain.list' call.

https://www.linode.com/api/dns/domain.list

func (*Client) DomainResourceCreate

func (c *Client) DomainResourceCreate(domainID int, rType string,
	conf DomainResourceCreateOpts) (resourceID int, err error)

DomainResourceCreate maps to the 'domain.resource.create' call.

NOTE: The TTL passed is not respected by the API. It must be set to one of: 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, 1209600, or 2419200.

https://www.linode.com/api/dns/domain.resource.create

func (*Client) DomainResourceDelete

func (c *Client) DomainResourceDelete(domainID int, resourceID int) error

DomainResourceDelete maps to the "domain.resource.delete" call.

https://www.linode.com/api/dns/domain.resource.delete

func (*Client) DomainResourceList

func (c *Client) DomainResourceList(domainID int, resourceID *int) ([]DomainResource, error)

DomainResourceList maps to the 'domain.resource.list' call.

https://www.linode.com/api/dns/domain.resource.list

func (*Client) DomainResourceUpdate

func (c *Client) DomainResourceUpdate(resourceID int, conf DomainResourceUpdateOpts) error

DomainResourceUpdate maps to the 'domain.resource.update' call.

https://www.linode.com/api/dns/domain.resource.update

func (*Client) DomainUpdate

func (c *Client) DomainUpdate(domainID int, conf DomainUpdateOpts) error

DomainUpdate maps to the 'domain.update' call.

https://www.linode.com/api/dns/domain.update

func (*Client) ImageDelete

func (c *Client) ImageDelete(imgID int) error

ImageDelete maps to the 'image.delete' call.

https://www.linode.com/api/image/image.delete

func (*Client) ImageList

func (c *Client) ImageList(imgID *int, pendingOnly *bool) ([]Image, error)

ImageList maps to the 'image.list' call.

https://www.linode.com/api/image/image.list

func (*Client) ImageUpdate

func (c *Client) ImageUpdate(imgID int, label *string, description *string) error

ImageUpdate maps to the 'image.update' call.

https://www.linode.com/api/image/image.update

func (*Client) LinodeBoot

func (c *Client) LinodeBoot(linodeID int, configID *int) (jobID int, err error)

LinodeBoot maps to the 'linode.boot' call.

https://www.linode.com/api/linode/linode.boot

func (*Client) LinodeClone

func (c *Client) LinodeClone(linodeID int, datacenterID int, planID int, term *int,
	hypervisor *string) (cloneLinodeID int, err error)

LinodeClone maps to the 'linode.clone' call.

https://www.linode.com/api/linode/linode.clone

func (*Client) LinodeConfigCreate

func (c *Client) LinodeConfigCreate(linodeID int, kernelID int, label string,
	diskList string, conf LinodeConfigCreateOpts) (configID int, err error)

LinodeConfigCreate maps to the 'linode.config.create' call.

https://www.linode.com/api/linode/linode.config.create

func (*Client) LinodeConfigDelete

func (c *Client) LinodeConfigDelete(linodeID int, configID int) error

LinodeConfigDelete maps to the 'linode.config.delete' call.

https://www.linode.com/api/linode/linode.config.delete

func (*Client) LinodeConfigList

func (c *Client) LinodeConfigList(linodeID int, configID *int) ([]LinodeConfig, error)

LinodeConfigList maps to the 'linode.config.list' call.

https://www.linode.com/api/linode/linode.config.list

func (*Client) LinodeConfigUpdate

func (c *Client) LinodeConfigUpdate(configID int, conf LinodeConfigUpdateOpts) error

LinodeConfigUpdate maps to the 'linode.config.update' call.

https://www.linode.com/api/linode/linode.config.update

func (*Client) LinodeCreate

func (c *Client) LinodeCreate(datacenterID int, planID int,
	term *int) (linodeID int, err error)

LinodeCreate maps to the 'linode.create' call.

https://www.linode.com/api/linode/linode.create

func (*Client) LinodeDelete

func (c *Client) LinodeDelete(linodeID int, skipChecks *bool) error

LinodeDelete maps to the 'linode.delete' call.

https://www.linode.com/api/linode/linode.delete

func (*Client) LinodeDiskCreate

func (c *Client) LinodeDiskCreate(linodeID int, label string, dType string,
	size int) (jobID int, diskID int, err error)

LinodeDiskCreate maps to the 'linode.disk.create' call.

https://www.linode.com/api/linode/linode.disk.create

func (*Client) LinodeDiskCreateFromDistribution

func (c *Client) LinodeDiskCreateFromDistribution(linodeID int, distID int, label string,
	size int, rootPass string, rootSSHKey *string) (jobID int, diskID int, err error)

LinodeDiskCreateFromDistribution maps to the 'linode.disk.createfromdistribution' call.

https://www.linode.com/api/linode/linode.disk.createfromdistribution

func (*Client) LinodeDiskCreateFromImage

func (c *Client) LinodeDiskCreateFromImage(imageID int, linodeID int, label string, size *int,
	rootPass *string, rootSSHKey *string) (jobID int, diskID int, err error)

LinodeDiskCreateFromImage maps to the 'linode.disk.createfromimage' call.

https://www.linode.com/api/linode/linode.disk.createfromimage

func (*Client) LinodeDiskCreateFromStackScript

func (c *Client) LinodeDiskCreateFromStackScript(linodeID int, ssID int, ssUDFResp string,
	distID int, label string, size int, rootPass string,
	rootSSHKey *string) (jobID int, diskID int, err error)

LinodeDiskCreateFromStackScript maps to the 'linode.disk.createfromstackscript' call.

https://www.linode.com/api/linode/linode.disk.createfromstackscript

func (*Client) LinodeDiskDelete

func (c *Client) LinodeDiskDelete(linodeID int, diskID int) (jobID int, err error)

LinodeDiskDelete maps to the 'linode.disk.delete' call.

https://www.linode.com/api/linode/linode.disk.delete

func (*Client) LinodeDiskDuplicate

func (c *Client) LinodeDiskDuplicate(linodeID int, diskID int) (jobID int, nDiskID int,
	err error)

LinodeDiskDuplicate maps to the 'linode.disk.duplicate' call.

https://www.linode.com/api/linode/linode.disk.duplicate

func (*Client) LinodeDiskImagize

func (c *Client) LinodeDiskImagize(linodeID int, diskID int, description *string,
	label *string) (jobID int, imageID int, err error)

LinodeDiskImagize maps to the 'linode.disk.imagize' call.

https://www.linode.com/api/linode/linode.disk.imagize

func (*Client) LinodeDiskList

func (c *Client) LinodeDiskList(linodeID int, diskID *int) ([]LinodeDisk, error)

LinodeDiskList maps to the 'linode.disk.list' call.

https://www.linode.com/api/linode/linode.disk.list

func (*Client) LinodeDiskResize

func (c *Client) LinodeDiskResize(linodeID int, diskID int, size int) (jobID int, err error)

LinodeDiskResize maps to the 'linode.disk.resize' call.

https://www.linode.com/api/linode/linode.disk.resize

func (*Client) LinodeDiskUpdate

func (c *Client) LinodeDiskUpdate(linodeID int, diskID int, label *string, readOnly *bool) error

LinodeDiskUpdate maps to the 'linode.disk.update' call.

https://www.linode.com/api/linode/linode.disk.update

func (*Client) LinodeIPAddPrivate

func (c *Client) LinodeIPAddPrivate(linodeID int) (ipID int, ipAddr string, err error)

LinodeIPAddPrivate maps to the 'linode.ip.addprivate' call.

https://www.linode.com/api/linode/linode.ip.addprivate

func (*Client) LinodeIPList

func (c *Client) LinodeIPList(linodeID *int, ipID *int) ([]LinodeIP, error)

LinodeIPList maps to the 'linode.ip.list' call.

https://www.linode.com/api/linode/linode.ip.list

func (*Client) LinodeIPSwap

func (c *Client) LinodeIPSwap(ipID int, withIPID *int, toLinodeID *int) error

LinodeIPSwap maps to the 'linode.ip.swap' call.

https://www.linode.com/api/linode/linode.ip.swap

func (*Client) LinodeJobList

func (c *Client) LinodeJobList(linodeID int, jobID *int, pendingOnly *bool) ([]LinodeJob, error)

LinodeJobList maps to the 'linode.job.list' call.

https://www.linode.com/api/linode/linode.job.list

func (*Client) LinodeList

func (c *Client) LinodeList(linodeID *int) ([]Linode, error)

LinodeList maps to the 'linode.list' call.

https://www.linode.com/api/linode/linode.list

func (*Client) LinodeReboot

func (c *Client) LinodeReboot(linodeID int, configID *int) (jobID int, err error)

LinodeReboot maps to the 'linode.reboot' call.

https://www.linode.com/api/linode/linode.reboot

func (*Client) LinodeResize

func (c *Client) LinodeResize(linodeID int, planID int) error

LinodeResize maps to the 'linode.resize' call.

https://www.linode.com/api/linode/linode.resize

func (*Client) LinodeShutdown

func (c *Client) LinodeShutdown(linodeID int) (jobID int, err error)

LinodeShutdown maps to the 'linode.shutdown' call.

https://www.linode.com/api/linode/linode.shutdown

func (*Client) LinodeUpdate

func (c *Client) LinodeUpdate(linodeID int, conf LinodeOpts) error

LinodeUpdate maps to the 'linode.update' call.

https://www.linode.com/api/linode/linode.update

func (*Client) NodeBalancerConfigCreate

func (c *Client) NodeBalancerConfigCreate(nbID int,
	conf NodeBalancerConfigCreateOpts) (confID int, err error)

NodeBalancerConfigCreate maps to the 'nodebalancer.config.create' call.

https://www.linode.com/api/nodebalancer/nodebalancer.config.create

func (*Client) NodeBalancerConfigDelete

func (c *Client) NodeBalancerConfigDelete(nbID int, confID int) error

NodeBalancerConfigDelete maps to the 'nodebalancer.config.delete' call.

https://www.linode.com/api/nodebalancer/nodebalancer.config.delete

func (*Client) NodeBalancerConfigList

func (c *Client) NodeBalancerConfigList(nbID int, confID *int) ([]NodeBalancerConfig, error)

NodeBalancerConfigList maps to the 'nodebalancer.config.list' call.

https://www.linode.com/api/nodebalancer/nodebalancer.config.list

func (*Client) NodeBalancerConfigUpdate

func (c *Client) NodeBalancerConfigUpdate(confID int, conf NodeBalancerConfigUpdateOpts) error

NodeBalancerConfigUpdate maps to the 'nodebalancer.config.update' call.

https://www.linode.com/api/nodebalancer/nodebalancer.config.update

func (*Client) NodeBalancerCreate

func (c *Client) NodeBalancerCreate(datacenterID int, label *string,
	throttle *int) (nbID int, err error)

NodeBalancerCreate maps to the 'nodebalancer.create' call.

https://www.linode.com/api/nodebalancer/nodebalancer.create

func (*Client) NodeBalancerDelete

func (c *Client) NodeBalancerDelete(nbID int) error

NodeBalancerDelete maps to the 'nodebalancer.delete' call.

https://www.linode.com/api/nodebalancer/nodebalancer.delete

func (*Client) NodeBalancerList

func (c *Client) NodeBalancerList(nbID *int) ([]NodeBalancer, error)

NodeBalancerList maps to the 'nodebalancer.list' call.

https://www.linode.com/api/nodebalancer/nodebalancer.list

func (*Client) NodeBalancerNodeCreate

func (c *Client) NodeBalancerNodeCreate(confID int, label string, address string, weight *int,
	mode *string) (nodeID int, err error)

NodeBalancerNodeCreate maps to the 'nodebalancer.node.create' call.

https://www.linode.com/api/nodebalancer/nodebalancer.node.create

func (*Client) NodeBalancerNodeDelete

func (c *Client) NodeBalancerNodeDelete(nodeID int) error

NodeBalancerNodeDelete maps to the 'nodebalancer.node.delete' call.

https://www.linode.com/api/nodebalancer/nodebalancer.node.delete

func (*Client) NodeBalancerNodeList

func (c *Client) NodeBalancerNodeList(confID int, nodeID *int) ([]NodeBalancerNode, error)

NodeBalancerNodeList maps to the 'nodebalancer.node.list' call.

https://www.linode.com/api/nodebalancer/nodebalancer.node.list

func (*Client) NodeBalancerNodeUpdate

func (c *Client) NodeBalancerNodeUpdate(nodeID int, label *string, address *string, weight *int,
	mode *string) error

NodeBalancerNodeUpdate maps to the 'nodebalancer.node.update' call.

https://www.linode.com/api/nodebalancer/nodebalancer.node.update

func (*Client) NodeBalancerUpdate

func (c *Client) NodeBalancerUpdate(nbID int, label *string, throttle *int) error

NodeBalancerUpdate maps to the 'nodebalancer.update' call.

https://www.linode.com/api/nodebalancer/nodebalancer.update

func (*Client) StackScriptCreate

func (c *Client) StackScriptCreate(label string, distIDList string, script string,
	description *string, isPublic *bool, revNote *string) (ssID int, err error)

StackScriptCreate maps to the 'stackscript.create' call.

https://www.linode.com/api/stackscript/stackscript.create

func (*Client) StackScriptDelete

func (c *Client) StackScriptDelete(ssID int) error

StackScriptDelete maps to the 'stackscript.delete' call.

https://www.linode.com/api/stackscript/stackscript.delete

func (*Client) StackScriptList

func (c *Client) StackScriptList(ssID *int) ([]StackScript, error)

StackScriptList maps to the 'stackscript.list' call.

https://www.linode.com/api/stackscript/stackscript.list

func (*Client) StackScriptUpdate

func (c *Client) StackScriptUpdate(ssID int, label *string, description *string,
	distIDList *string, isPublic *bool, revNote *string, script *string) error

StackScriptUpdate maps to the 'stackscript.update' call.

https://www.linode.com/api/stackscript/stackscript.update

func (*Client) TestEcho

func (c *Client) TestEcho() error

TestEcho maps to the 'test.echo' call. It has hardcoded arguments (foo:bar). It can be used to test your API key.

https://www.linode.com/api/utility/test.echo

func (*Client) UserGetAPIKey

func (c *Client) UserGetAPIKey(username string, password string, token *string, expires *int,
	label *string) (apiKey string, err error)

UserGetAPIKey maps to the 'user.getapikey' call. It is used to generate an API key from your Linode Manager credentials.

Token is required if you have enabled 2-factor auth.

Expires is the number of hours an API key will be valid for, from 0-8760 hours. The default (if you pass in nil) is 168 hours. If you pass 0, the key will never expire.

https://www.linode.com/api/account/user.getapikey

func (*Client) WaitForAllJobs

func (c *Client) WaitForAllJobs(linodeID int, checkInterval time.Duration,
	timeout time.Duration) error

WaitForAllJobs waits for all jobs on the passed Linode to be completed.

Error will be non-nil if there is an API error, or the timeout is reached.

func (*Client) WaitForJob

func (c *Client) WaitForJob(linodeID int, jobID int, checkInterval time.Duration,
	timeout time.Duration) (ok bool, err error)

WaitForJob will wait for the specified jobID to complete, checking every checkInterval up to the timeout.

Ok indicates whether the job was successful or not.

Error will only be non-nil if the timeout is reached, there is an API error, or the passed job doesn't exist.

type Datacenter

type Datacenter struct {
	ID       int    `json:"DATACENTERID"`
	Location string `json:"LOCATION"`
	Abbr     string `json:"ABBR"`
}

Datacenter is the API response to the 'avail.datacenters' call.

type Distribution

type Distribution struct {
	Is64Bit       bool   `mapstructure:"IS64BIT"`
	Label         string `mapstructure:"LABEL"`
	MinImageSize  int    `mapstructure:"MINIMAGESIZE"`
	ID            int    `mapstructure:"DISTRIBUTIONID"`
	CreateDT      string `mapstructure:"CREATE_DT"`
	RequiresPVOps bool   `mapstructure:"REQUIRESPVOPSKERNEL"`
}

Distribution is the API repsonse to the 'avail.distributions' call.

type Domain

type Domain struct {
	ID           int    `mapstructure:"DOMAINID"`
	Description  string `mapstructure:"DESCRIPTION"`
	Type         string `mapstructure:"TYPE"`
	Status       int    `mapstructure:"STATUS"`
	SOAEmail     string `mapstructure:"SOA_EMAIL"`
	Domain       string `mapstructure:"DOMAIN"`
	RetrySec     int    `mapstructure:"RETRY_SEC"`
	MasterIPs    string `mapstructure:"MASTER_IPS"`
	AXFRIPs      string `mapstructure:"AXFR_IPS"`
	ExpireSec    int    `mapstructure:"EXPIRE_SEC"`
	RefreshSec   int    `mapstructure:"REFRESH_SEC"`
	TTLSec       int    `mapstructure:"TTL_SEC"`
	DisplayGroup string `mapstructure:"LPM_DISPLAYGROUP"`
}

Domain is the API response to the 'domain.list' call.

type DomainCreateOpts

type DomainCreateOpts struct {
	Description  *string `args:"Description"`
	SOAEmail     *string `args:"SOA_Email"`
	RefreshSec   *int    `args:"Refresh_sec"`
	RetrySec     *int    `args:"Retry_sec"`
	ExpireSec    *int    `args:"Expire_sec"`
	TTLSec       *int    `args:"TTL_sec"`
	DisplayGroup *string `args:"lpm_displayGroup"`
	Status       *int    `args:"status"`
	MasterIPs    *string `args:"master_ips"`
	AXFRIPs      *string `args:"axfr_ips"`
}

DomainCreateOpts contains the optional arguments to DomainCreate().

type DomainResource

type DomainResource struct {
	Protocol string `mapstructure:"PROTOCOL"`
	TTLSec   int    `mapstructure:"TTL_SEC"`
	Priority int    `mapstructure:"PRIORITY"`
	Type     string `mapstructure:"TYPE"`
	Target   string `mapstructure:"TARGET"`
	Weight   int    `mapstructure:"WEIGHT"`
	ID       int    `mapstructure:"RESOURCEID"`
	Port     int    `mapstructure:"PORT"`
	DomainID int    `mapstructure:"DOMAINID"`
	Name     string `mapstructure:"NAME"`
}

DomainResource is the API response to the 'domain.resource.list' call.

type DomainResourceCreateOpts

type DomainResourceCreateOpts struct {
	Name     *string `args:"Name"`
	Target   *string `args:"Target"`
	Priority *int    `args:"Priority"`
	Weight   *int    `args:"Weight"`
	Protocol *string `args:"Protocol"`
	TTLSec   *int    `args:"TTL_sec"`
	Port     *int    `args:"Port"`
}

DomainResourceCreateOpts contains the optional arguments to DomainResourceCreate().

type DomainResourceUpdateOpts

type DomainResourceUpdateOpts struct {
	DomainID *int    `args:"DomainID"`
	Name     *string `args:"Name"`
	Target   *string `args:"Target"`
	Priority *int    `args:"Priority"`
	Weight   *int    `args:"Weight"`
	Port     *int    `args:"Port"`
	Protocol *string `args:"Protocol"`
	TTLSec   *int    `args:"TTL_sec"`
}

DomainResourceUpdateOpts contains the optional arguments to DomainResourceUpdate().

type DomainUpdateOpts

type DomainUpdateOpts struct {
	Domain       *string `args:"Domain"`
	Type         *string `args:"Type"`
	SOAEmail     *string `args:"SOA_Email"`
	RefreshSec   *int    `args:"Refresh_sec"`
	RetrySec     *int    `args:"Retry_sec"`
	ExpireSec    *int    `args:"Expire_sec"`
	TTLSec       *int    `args:"TTL_sec"`
	DisplayGroup *string `args:"lpm_displayGroup"`
	Status       *int    `args:"status"`
	MasterIPs    *string `args:"master_ips"`
	AXFRIPs      *string `args:"axfr_ips"`
}

DomainUpdateOpts contains the optional arguments to DomainUpdate().

type EstimatedInvoice

type EstimatedInvoice struct {
	InvoiceTo string  `json:"INVOICE_TO"`
	Price     float64 `json:"AMOUNT"`
}

EstimatedInvoice is the API response to the 'account.estimateinvoice' call.

type Image

type Image struct {
	CreateDT    string `mapstructure:"CREATE_DT"`
	Creator     string `mapstructure:"CREATOR"`
	Description string `mapstructure:"DESCRIPTION"`
	FSType      string `mapstructure:"FS_TYPE"`
	ID          int    `mapstructure:"IMAGEID"`
	IsPublic    bool   `mapstructure:"ISPUBLIC"`
	Label       string `mapstructure:"LABEL"`
	LastUsedDT  string `mapstructure:"LAST_USED_DT"`
	MinSize     int    `mapstructure:"MINSIZE"`
	Status      string `mapstructure:"STATUS"`
	Type        string `mapstructure:"TYPE"`
}

Image is the API response to the 'image.list' call.

type Kernel

type Kernel struct {
	Label   string `mapstructure:"LABEL"`
	IsXen   bool   `mapstructure:"ISXEN"`
	IsPVOps bool   `mapstructure:"ISPVOPS"`
	ID      int    `mapstructure:"KERNELID"`
}

Kernel is the API response to the 'avail.kernels' call.

type Linode

type Linode struct {
	TotalXfer             int    `mapstructure:"TOTALXFER"`
	BackupsEnabled        bool   `mapstructure:"BACKUPSENABLED"`
	Watchdog              bool   `mapstructure:"WATCHDOG"`
	DisplayGroup          string `mapstructure:"LPM_DISPLAYGROUP"`
	Status                int    `mapstructure:"STATUS"`
	TotalRAM              int    `mapstructure:"TOTALRAM"`
	BackupWindow          int    `mapstructure:"BACKUPWINDOW"`
	Label                 string `mapstructure:"LABEL"`
	BackupWeeklyDay       int    `mapstructure:"BACKUPWEEKLYDAY"`
	DatacenterID          int    `mapstructure:"DATACENTERID"`
	TotalHD               int    `mapstructure:"TOTALHD"`
	ID                    int    `mapstructure:"LINODEID"`
	CreateDT              string `mapstructure:"CREATE_DT"`
	PlanID                int    `mapstructure:"PLANID"`
	DistVendor            string `mapstructure:"DISTRIBUTIONVENDOR"`
	AlertBWQuotaEnabled   bool   `mapstructure:"ALERT_BWQUOTA_ENABLED"`
	AlertBWQuotaThreshold int    `mapstructure:"ALERT_BWQUOTA_THRESHOLD"`
	AlertDiskIOEnabled    bool   `mapstructure:"ALERT_DISKIO_ENABLED"`
	AlertDiskIOThreshold  int    `mapstructure:"ALERT_DISKIO_THRESHOLD"`
	AlertCPUEnabled       bool   `mapstructure:"ALERT_CPU_ENABLED"`
	AlertCPUThreshold     int    `mapstructure:"ALERT_CPU_THRESHOLD"`
	AlertBWInEnabled      bool   `mapstructure:"ALERT_BWIN_ENABLED"`
	AlertBWInThreshold    int    `mapstructure:"ALERT_BWIN_THRESHOLD"`
	AlertBWOutEnabled     bool   `mapstructure:"ALERT_BWOUT_ENABLED"`
	AlertBWOutThreshold   int    `mapstructure:"ALERT_BWOUT_THRESHOLD"`
}

Linode is the API response to the 'linode.list' call.

type LinodeConfig

type LinodeConfig struct {
	RootDeviceCustom      string `mapstructure:"RootDeviceCustom"`
	Comments              string `mapstructure:"Comments"`
	IsRescue              bool   `mapstructure:"isRescue"`
	DevTmpFSAutomount     bool   `mapstructure:"devtmpfs_automount"`
	HelperDistro          bool   `mapstructure:"helper_distro"`
	HelperDisableUpdateDB bool   `mapstructure:"helper_disableUpdateDB"`
	Label                 string `mapstructure:"label"`
	HelperNetwork         bool   `mapstructure:"helper_network"`
	ID                    int    `mapstructure:"ConfigID"`
	DiskList              string `mapstructure:"DiskList"`
	RootDeviceRO          bool   `mapstructure:"RootDeviceRO"`
	RunLevel              string `mapstructure:"RunLevel"`
	RootDeviceNum         int    `mapstructure:"RootDeviceNum"`
	HelperXen             bool   `mapstructure:"helper_xen"`
	RAMLimit              int    `mapstructure:"RAMLimit"`
	VirtMode              string `mapstructure:"virt_mode"`
	LinodeID              int    `mapstructure:"LinodeID"`
	HelperDepmod          bool   `mapstructure:"helper_depmod"`
	KernelID              int    `mapstructure:"KernelID"`
}

LinodeConfig is the API response to the 'linode.config.list' call.

type LinodeConfigCreateOpts

type LinodeConfigCreateOpts struct {
	Comments              *string `args:"Comments"`
	RAMLimit              *int    `args:"RAMLimit"`
	VirtMode              *string `args:"virt_mode"`
	RunLevel              *string `args:"RunLevel"`
	RootDeviceNum         *int    `args:"RootDeviceNum"`
	RootDeviceCustom      *string `args:"RootDeviceCustom"`
	RootDeviceRO          *bool   `args:"RootDeviceRO"`
	HelperDisableUpdateDB *bool   `args:"helper_disableUpdateDB"`
	HelperDistro          *bool   `args:"helper_distro"`
	HelperXen             *bool   `args:"helper_xen"`
	HelperDepmod          *bool   `args:"helper_depmod"`
	HelperNetwork         *bool   `args:"helper_network"`
	DevTmpFSAutomount     *bool   `args:"devtmpfs_automount"`
}

LinodeConfigCreateOpts contains the optional arguments to LinodeConfigCreate().

type LinodeConfigUpdateOpts

type LinodeConfigUpdateOpts struct {
	LinodeID              *int    `args:"LinodeID"`
	KernelID              *int    `args:"KernelID"`
	Comments              *string `args:"Comments"`
	RAMLimit              *int    `args:"RAMLimit"`
	VirtMode              *string `args:"virt_mode"`
	RunLevel              *string `args:"RunLevel"`
	RootDeviceNum         *int    `args:"RootDeviceNum"`
	RootDeviceCustom      *string `args:"RootDeviceCustom"`
	RootDeviceRO          *bool   `args:"RootDeviceRO"`
	HelperDisableUpdateDB *bool   `args:"helper_disableUpdateDB"`
	HelperDistro          *bool   `args:"helper_distro"`
	HelperXen             *bool   `args:"helper_xen"`
	HelperDepmod          *bool   `args:"helper_depmod"`
	HelperNetwork         *bool   `args:"helper_network"`
	DevTmpFSAutomount     *bool   `args:"devtmpfs_automount"`
}

LinodeConfigUpdateOpts contains the optional arguments to LinodeConfigUpdate().

type LinodeDisk

type LinodeDisk struct {
	UpdateDT   string `mapstructure:"UPDATE_DT"`
	ID         int    `mapstructure:"DISKID"`
	Label      string `mapstructure:"LABEL"`
	Type       string `mapstructure:"TYPE"`
	LinodeID   int    `mapstructure:"LINODEID"`
	IsReadOnly bool   `mapstructure:"ISREADONLY"`
	Status     int    `mapstructure:"STATUS"`
	CreateDT   string `mapstructure:"CREATE_DT"`
	Size       int    `mapstructure:"SIZE"`
}

LinodeDisk is the API response to the 'linode.disk.list' call.

type LinodeIP

type LinodeIP struct {
	LinodeID int    `mapstructure:"LINODEID"`
	IsPublic bool   `mapstructure:"ISPUBLIC"`
	Address  string `mapstructure:"IPADDRESS"`
	RDNSName string `mapstructure:"RDNS_NAME"`
	ID       int    `mapstructure:"IPADDRESSID"`
}

LinodeIP is the API response to the 'linode.ip.list' call.

type LinodeJob

type LinodeJob struct {
	EnteredDT    string `mapstructure:"ENTERED_DT"`
	Action       string `mapstructure:"ACTION"`
	Label        string `mapstructure:"LABEL"`
	HostStartDT  string `mapstructure:"HOST_START_DT"`
	LinodeID     int    `mapstructure:"LINODEID"`
	HostFinishDT string `mapstructure:"HOST_FINISH_DT"`
	Duration     int    `mapstructure:"DURATION"`
	HostMessage  string `mapstructure:"HOST_MESSAGE"`
	ID           int    `mapstructure:"JOBID"`
	HostSuccess  bool   `mapstructure:"HOST_SUCCESS"`
}

LinodeJob is the API response to the 'linode.job.list' call.

func (LinodeJob) Done

func (j LinodeJob) Done() bool

Done returns true if the job has finished.

func (LinodeJob) Success

func (j LinodeJob) Success() bool

Success returns true if the job completely successfully. If the job is not done, or was unsuccessful, Success returns false.

type LinodeOpts

type LinodeOpts struct {
	Label                 *string `args:"label"`
	DisplayGroup          *string `args:"lpm_displayGroup"`
	AlertCPUEnabled       *bool   `args:"Alert_cpu_enabled"`
	AlertCPUThreshold     *int    `args:"Alert_cpu_threshold"`
	AlertDiskIOEnabled    *bool   `args:"Alert_diskio_enabled"`
	AlertDiskIOThreshold  *int    `args:"Alert_diskio_threshold"`
	AlertBWInEnabled      *bool   `args:"Alert_bwin_enabled"`
	AlertBWInThreshold    *int    `args:"Alert_bwin_threshold"`
	AlertBWOutEnabled     *bool   `args:"Alert_bwout_enabled"`
	AlertBWOutThreshold   *int    `args:"Alert_bwout_threshold"`
	AlertBWQuotaEnabled   *bool   `args:"Alert_bwquota_enabled"`
	AlertBWQuotaThreshold *int    `args:"Alert_bwquota_threshold"`
	BackupWindow          *int    `args:"backupWindow"`
	BackupWeeklyDay       *int    `args:"backupWeeklyDay"`
	Watchdog              *bool   `args:"watchdog"`
}

LinodeOpts contains the optional arguments to LinodeUpdate().

type LinodePlan

type LinodePlan struct {
	Cores  int     `json:"CORES"`
	Price  float64 `json:"PRICE"`
	RAM    int     `json:"RAM"`
	Xfer   int     `json:"XFER"`
	ID     int     `json:"PLANID"`
	Label  string  `json:"LABEL"`
	Disk   int     `json:"DISK"`
	Hourly float64 `json:"HOURLY"`
}

LinodePlan is the API response to the 'avail.linodeplans' call.

type NodeBalancer

type NodeBalancer struct {
	ID           int    `json:"NODEBALANCERID"`
	Label        string `json:"LABEL"`
	DatacenterID int    `json:"DATACENTERID"`
	Hostname     string `json:"HOSTNAME"`
	IPv4Addr     string `json:"ADDRESS4"`
	IPv6Addr     string `json:"ADDRESS6"`
	Throttle     int    `json:"CLIENTCONNTHROTTLE"`
}

NodeBalancer is the API response to the 'nodebalancer.list' call.

type NodeBalancerConfig

type NodeBalancerConfig struct {
	Stickiness     string `mapstructure:"STICKINESS"`
	CheckPath      string `mapstructure:"CHECK_PATH"`
	Port           int    `mapstructure:"PORT"`
	CheckBody      string `mapstructure:"CHECK_BODY"`
	Check          string `mapstructure:"CHECK"`
	CheckInterval  int    `mapstructure:"CHECK_INTERVAL"`
	Protocol       string `mapstructure:"PROTOCOL"`
	ID             int    `mapstructure:"CONFIGID"`
	Algorithm      string `mapstructure:"ALGORITHM"`
	CheckTimeout   int    `mapstructure:"CHECK_TIMEOUT"`
	NodeBalancerID int    `mapstructure:"NODEBALANCERID"`
	CheckAttempts  int    `mapstructure:"CHECK_ATTEMPTS"`
	CheckPassive   bool   `mapstructure:"CHECK_PASSIVE"`
	SSLFingerprint string `mapstructure:"SSL_FINGERPRINT"`
	SSLCommonName  string `mapstructure:"SSL_COMMONNAME"`
}

NodeBalancerConfig is the API response to the 'nodebalancer.config.list' call.

type NodeBalancerConfigCreateOpts

type NodeBalancerConfigCreateOpts struct {
	Port          *int    `args:"Port"`
	Protocol      *string `args:"Protocol"`
	Algorithm     *string `args:"Algorithm"`
	Stickiness    *string `args:"Stickiness"`
	Check         *string `args:"check"`
	CheckInterval *int    `args:"check_interval"`
	CheckTimeout  *int    `args:"check_timeout"`
	CheckAttempts *int    `args:"check_attempts"`
	CheckPath     *string `args:"check_path"`
	CheckBody     *string `args:"check_body"`
	CheckPassive  *bool   `args:"check_passive,int"`
	SSLCert       *string `args:"ssl_cert"`
	SSLKey        *string `args:"ssl_key"`
}

NodeBalancerConfigCreateOpts contains the optional arguments to NodeBalancerConfigCreate().

type NodeBalancerConfigUpdateOpts

type NodeBalancerConfigUpdateOpts struct {
	Port          *int    `args:"Port"`
	Protocol      *string `args:"Protocol"`
	Algorithm     *string `args:"Algorithm"`
	Stickiness    *string `args:"Stickiness"`
	Check         *string `args:"check"`
	CheckInterval *int    `args:"check_interval"`
	CheckTimeout  *int    `args:"check_timeout"`
	CheckAttempts *int    `args:"check_attempts"`
	CheckPath     *string `args:"check_path"`
	CheckBody     *string `args:"check_body"`
	CheckPassive  *bool   `args:"check_passive,int"`
	SSLCert       *string `args:"ssl_cert"`
	SSLKey        *string `args:"ssl_key"`
}

NodeBalancerConfigUpdateOpts contains the optional arguments to NodeBalancerConfigUpdate().

type NodeBalancerNode

type NodeBalancerNode struct {
	Weight         int    `mapstructure:"WEIGHT"`
	Address        string `mapstructure:"ADDRESS"`
	Label          string `mapstructure:"LABEL"`
	ID             int    `mapstructure:"NODEID"`
	Mode           string `mapstructure:"MODE"`
	Status         string `mapstructure:"STATUS"`
	NodeBalancerID int    `mapstructure:"NODEBALANCERID"`
	ConfigID       int    `mapstructure:"CONFIGID"`
}

NodeBalancerNode is the API response to the 'nodebalancer.node.list' call.

type StackScript

type StackScript struct {
	Script        string `mapstructure:"SCRIPT"`
	Description   string `mapstructure:"DESCRIPTION"`
	DistIDList    string `mapstructure:"DISTRIBUTIONIDLIST"`
	Label         string `mapstructure:"LABEL"`
	TotalDeploys  int    `mapstructure:"DEPLOYMENTSTOTAL"`
	LatestRev     int    `mapstructure:"LATESTREV"`
	CreateDT      string `mapstructure:"CREATE_DT"`
	ActiveDeploys int    `mapstructure:"DEPLOYMENTSACTIVE"`
	ID            int    `mapstructure:"STACKSCRIPTID"`
	RevNote       string `mapstructure:"REV_NOTE"`
	RevDT         string `mapstructure:"REV_DT"`
	IsPublic      bool   `mapstructure:"ISPUBLIC"`
	UserID        int    `mapstructure:"USERID"`
}

StackScript is the API response to the 'stackscript.list' and 'avail.stackscripts' calls.

Directories

Path Synopsis
_third_party
mapstructure
The mapstructure package exposes functionality to convert an abitrary map[string]interface{} into a native Go structure.
The mapstructure package exposes functionality to convert an abitrary map[string]interface{} into a native Go structure.
testify
Package testify is a set of packages that provide many tools for testifying that your code will behave as you intend.
Package testify is a set of packages that provide many tools for testifying that your code will behave as you intend.
testify/assert
Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.
Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.
testify/http
A set of tools to make testing http activity using the Go testing system easier.
A set of tools to make testing http activity using the Go testing system easier.
testify/mock
Provides a system by which it is possible to mock your objects and verify calls are happening as expected.
Provides a system by which it is possible to mock your objects and verify calls are happening as expected.
testify/require
Alternative testing tools which stop test execution if test failed.
Alternative testing tools which stop test execution if test failed.
testify/suite
The suite package contains logic for creating testing suite structs and running the methods on those structs as tests.
The suite package contains logic for creating testing suite structs and running the methods on those structs as tests.

Jump to

Keyboard shortcuts

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