linodego

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2018 License: MIT Imports: 12 Imported by: 490

README

linodego

Build Status GoDoc Go Report Card codecov

Go client for Linode REST v4 API

Installation

go get -u github.com/chiefy/linodego

API Support

** Note: Currently in work-in-progress. Things will change and break until we release a tagged version. **

Check API_SUPPORT.md for current support of the Linode v4 API endpoints.

Documentation

See godoc for a complete reference.

The API generally follows the naming patterns prescribed in the OpenAPIv3 document for Linode APIv4.

Deviations in naming have been made to avoid using "Linode" and "Instance" redundantly or inconsistently.

A brief summary of the features offered in this API client are shown here.

Examples

General Usage
package main

import (
  "fmt"
  "log"
  "os"

  "github.com/chiefy/linodego"
)

func main() {
  apiKey, ok := os.LookupEnv("LINODE_TOKEN")
  if !ok {
    log.Fatal("Could not find LINODE_TOKEN, please assert it is set.")
  }
  linodeClient, err := linodego.NewClient(apiKey)
  if err != nil {
    log.Fatal(err)
  }
  linodeClient.SetDebug(true)
  res, err := linodeClient.GetInstance(4090913)
  if err != nil {
    log.Fatal(err)
  }
  fmt.Printf("%v", res)

}
Pagination
Auto-Pagination Requests
kernels, err := linodego.ListKernels(nil)
// len(kernels) == 218
Single Page
opts := NewListOptions(2,"")
// or opts := ListOptions{PageOptions: &PageOptions: {Page: 2 }}
kernels, err := linodego.ListKernels(opts)
// len(kernels) == 100
// opts.Results == 218
Filtering
opts := ListOptions{Filter: "{\"mine\":true}"}
// or opts := NewListOptions(0, "{\"mine\":true}")
stackscripts, err := linodego.ListStackscripts(opts)
Error Handling
Getting Single Entities
linode, err := linodego.GetLinode(555) // any Linode ID that does not exist or is not yours
// linode == nil: true
// err.Error() == "[404] Not Found"
// err.Code == "404"
// err.Message == "Not Found"
Lists

For lists, the list is still returned as [], but err works the same way as on the Get request.

linodes, err := linodego.ListLinodes(NewListOptions(0, "{\"foo\":bar}"))
// linodes == []
// err.Error() == "[400] [X-Filter] Cannot filter on foo"

Otherwise sane requests beyond the last page do not trigger an error, just an empty result:

linodes, err := linodego.ListLinodes(NewListOptions(9999, ""))
// linodes == []
// err = nil
Writes

When performing a POST or PUT request, multiple field related errors will be returned as a single error, currently like:

// err.Error() == "[400] [field1] foo problem; [field2] bar problem; [field3] baz problem"

Tests

Run make test to run the unit tests. This is the same as running go test except that make test will execute the tests while playing back API response fixtures that were recorded during a previous development build.

go test can be used without the fixtures, so long as LINODE_TEST_INSTANCE and LINODE_TEST_VOLUME are set to an instance ID and volume ID that exists on your account. The Linode instance must have a backup and a snapshot to match the test expectations. Copy env.sample to .env and configure your persistent test settings, including an API token.

go test -short can be used to run live API tests that do not require an account token.

This will be simplified in future versions.

To update the test fixtures, run make fixtures. This will record the API responses into the fixtures/ directory. Be careful about committing any sensitive account details. An attempt has been made to sanitize IP addresses and dates, but no automated sanitization will be performed against fixtures/*Account*.yaml, for example.

To prevent disrupting unaffected fixtures, target fixture generation like so: make ARGS="-run TestListVolumes" fixtures.

Discussion / Help

Join us at #linodego on the gophers slack

License

MIT License

Documentation

Overview

Example
// Example readers, Ignore this bit of setup code needed to record test fixtures
linodeClient, teardown := createTestClient(nil, "fixtures/Example")
defer teardown()

var linode *linodego.Instance
linode, err := linodeClient.GetInstance(1231)
fmt.Println("## Instance request with Invalid ID")
fmt.Println("### Linode:", linode)
fmt.Println("### Error:", err)

if spendMoney {
	linode, err = linodeClient.CreateInstance(&linodego.InstanceCreateOptions{Region: "us-central", Type: "g5-nanode-1"})
	if err != nil {
		log.Fatalln("* While creating instance: ", err)
	}
	linode, err = linodeClient.UpdateInstance(linode.ID, &linodego.InstanceUpdateOptions{Label: linode.Label + "-renamed"})
	if err != nil {
		log.Fatalln("* While renaming instance: ", err)
	}
	fmt.Println("## Created Instance")
	event, err := linodeClient.WaitForEventFinished(linode.ID, linodego.EntityLinode, linodego.ActionLinodeCreate, *linode.Created, 240)
	if err != nil {
		log.Fatalf("* Failed to wait for Linode %d to finish creation: %s", linode.ID, err)
	}
	if err := linodeClient.MarkEventRead(event); err != nil {
		log.Fatalln("* Failed to mark Linode create event seen", err)
	}

	diskSwap, err := linodeClient.CreateInstanceDisk(linode.ID, linodego.InstanceDiskCreateOptions{Size: 50, Filesystem: "swap", Label: "linodego_swap"})
	if err != nil {
		log.Fatalln("* While creating swap disk:", err)
	}
	eventSwap, err := linodeClient.WaitForEventFinished(linode.ID, linodego.EntityLinode, linodego.ActionDiskCreate, diskSwap.Created, 240)
	// @TODO it is not sufficient that a disk was created. Which disk was it?
	// Sounds like we'll need a WaitForEntityStatus function.
	if err != nil {
		log.Fatalf("* Failed to wait for swap disk %d to finish creation: %s", diskSwap.ID, err)
	}
	if err := linodeClient.MarkEventRead(eventSwap); err != nil {
		log.Fatalln("* Failed to mark swap disk create event seen", err)
	}

	diskRaw, err := linodeClient.CreateInstanceDisk(linode.ID, linodego.InstanceDiskCreateOptions{Size: 50, Filesystem: "raw", Label: "linodego_raw"})
	if err != nil {
		log.Fatalln("* While creating raw disk:", err)
	}
	eventRaw, err := linodeClient.WaitForEventFinished(linode.ID, linodego.EntityLinode, linodego.ActionDiskCreate, diskRaw.Created, 240)
	// @TODO it is not sufficient that a disk was created. Which disk was it?
	// Sounds like we'll need a WaitForEntityStatus function.
	if err != nil {
		log.Fatalf("* Failed to wait for raw disk %d to finish creation: %s", diskRaw.ID, err)
	}
	if err := linodeClient.MarkEventRead(eventRaw); err != nil {
		log.Fatalln("* Failed to mark raw disk create event seen", err)
	}

	diskDebian, err := linodeClient.CreateInstanceDisk(
		linode.ID,
		linodego.InstanceDiskCreateOptions{
			Size:       1500,
			Filesystem: "ext4",
			Image:      "linode/debian9",
			Label:      "linodego_debian",
			RootPass:   randPassword(),
		},
	)
	if err != nil {
		log.Fatalln("* While creating Debian disk:", err)
	}
	eventDebian, err := linodeClient.WaitForEventFinished(linode.ID, linodego.EntityLinode, linodego.ActionDiskCreate, diskDebian.Created, 240)
	// @TODO it is not sufficient that a disk was created. Which disk was it?
	// Sounds like we'll need a WaitForEntityStatus function.
	if err != nil {
		log.Fatalf("* Failed to wait for Debian disk %d to finish creation: %s", diskDebian.ID, err)
	}
	if err := linodeClient.MarkEventRead(eventDebian); err != nil {
		log.Fatalln("* Failed to mark Debian disk create event seen", err)
	}
	fmt.Println("### Created Disks")

	createOpts := linodego.InstanceConfigCreateOptions{
		Devices: &linodego.InstanceConfigDeviceMap{
			SDA: &linodego.InstanceConfigDevice{DiskID: diskDebian.ID},
			SDB: &linodego.InstanceConfigDevice{DiskID: diskRaw.ID},
			SDC: &linodego.InstanceConfigDevice{DiskID: diskSwap.ID},
		},
		Kernel: "linode/direct-disk",
		Label:  "example config label",
		// RunLevel:   "default",
		// VirtMode:   "paravirt",
		Comments: "example config comment",
		// RootDevice: "/dev/sda",
		Helpers: &linodego.InstanceConfigHelpers{
			Network:    true,
			ModulesDep: false,
		},
	}
	config, err := linodeClient.CreateInstanceConfig(linode.ID, createOpts)
	if err != nil {
		log.Fatalln("* Failed to create Config", err)
	}
	fmt.Println("### Created Config:")
	updateOpts := linodego.InstanceConfigUpdateOptions{
		Comments: "updated example config comment",
	}
	config, err = linodeClient.UpdateInstanceConfig(linode.ID, config.ID, updateOpts)
	if err != nil {
		log.Fatalln("* Failed to update Config", err)
	}
	fmt.Println("### Updated Config:")

	booted, err := linodeClient.BootInstance(linode.ID, config.ID)
	if err != nil || !booted {
		log.Fatalln("* Failed to boot Instance", err)
	}
	fmt.Println("### Booted Instance")

	eventBooted, err := linodeClient.WaitForEventFinished(linode.ID, linodego.EntityLinode, linodego.ActionLinodeBoot, *config.Updated, 240)
	if err != nil {
		fmt.Println("### Boot Instance failed as expected:", err)
	} else {
		log.Fatalln("* Expected boot Instance to fail")
	}

	if err := linodeClient.MarkEventRead(eventBooted); err != nil {
		log.Fatalln("* Failed to mark boot event seen", err)
	}

	err = linodeClient.DeleteInstanceConfig(linode.ID, config.ID)
	if err != nil {
		log.Fatalln("* Failed to delete Config", err)
	}
	fmt.Println("### Deleted Config")

	err = linodeClient.DeleteInstanceDisk(linode.ID, diskSwap.ID)
	if err != nil {
		log.Fatalln("* Failed to delete Disk", err)
	}
	fmt.Println("### Deleted Disk")

	err = linodeClient.DeleteInstance(linode.ID)
	if err != nil {
		log.Fatalln("* Failed to delete Instance", err)
	}
	fmt.Println("### Deleted Instance")

}

linodes, err := linodeClient.ListInstances(nil)
fmt.Println("## List Instances")

if len(linodes) == 0 {
	log.Println("No Linodes to inspect.")
} else {
	// This is redundantly used for illustrative purposes
	linode, err = linodeClient.GetInstance(linodes[0].ID)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("## First Linode")

	configs, err := linodeClient.ListInstanceConfigs(linode.ID, nil)
	if err != nil {
		log.Fatal(err)
	} else if len(configs) > 0 {
		config, err := linodeClient.GetInstanceConfig(linode.ID, configs[0].ID)
		if err != nil {
			log.Fatal(err)
		}
		fmt.Println("### First Config:", config.ID > 0)
	} else {
		fmt.Println("### No Configs")
	}

	disks, err := linodeClient.ListInstanceDisks(linode.ID, nil)
	if err != nil {
		log.Fatal(err)
	} else if len(disks) > 0 {
		disk, err := linodeClient.GetInstanceDisk(linode.ID, disks[0].ID)
		if err != nil {
			log.Fatal(err)
		}
		fmt.Println("### First Disk:", disk.ID > 0)
	} else {
		fmt.Println("### No Disks")
	}

	backups, err := linodeClient.GetInstanceBackups(linode.ID)
	if err != nil {
		log.Fatal(err)
	}
	if len(backups.Automatic) > 0 {
		fmt.Println("### First Auto Backup")
	} else {
		fmt.Println("### No Auto Backups")
	}
	fmt.Println("### Snapshots")
	if backups.Snapshot.Current != nil {
		// snapshot fetched will be exactly the same as backups.Snapshot.Current
		// just being redundant for illustrative purposes
		if snapshot, err := linodeClient.GetInstanceSnapshot(linode.ID, backups.Snapshot.Current.ID); err == nil {
			fmt.Println("#### Current:", snapshot.ID > 0)
		} else {
			fmt.Println("#### No Current Snapshot:", err)
		}
	} else {
		fmt.Println("### No Current Snapshot")
	}

	volumes, err := linodeClient.ListInstanceVolumes(linode.ID, nil)
	if err != nil {
		log.Fatal(err)
	} else if len(volumes) > 0 {
		volume, err := linodeClient.GetVolume(volumes[0].ID)
		if err != nil {
			log.Fatal(err)
		}
		fmt.Println("### First Volume:", volume.ID > 0)
	} else {
		fmt.Println("### No Volumes")
	}

	stackscripts, err := linodeClient.ListStackscripts(&linodego.ListOptions{Filter: "{\"mine\":true}"})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("## Your Stackscripts:", len(stackscripts) > 0)
}
Output:

## Instance request with Invalid ID
### Linode: <nil>
### Error: [404] Not found
## List Instances
## First Linode
### First Config: true
### First Disk: true
### No Auto Backups
### Snapshots
#### Current: true
### First Volume: true
## Your Stackscripts: true

Index

Examples

Constants

View Source
const (
	// APIHost Linode API hostname
	APIHost = "api.linode.com"
	// APIVersion Linode API version
	APIVersion = "v4"
	// APIProto connect to API with http(s)
	APIProto = "https"
	// Version of linodego
	Version = "0.0.1"
	// APIEnvVar environment var to check for API token
	APIEnvVar = "LINODE_TOKEN"
	// APISecondsPerPoll how frequently to poll for new Events
	APISecondsPerPoll = 10
)
View Source
const (
	// ErrorFromString is the Code identifying Errors created by string types
	ErrorFromString = 1
	// ErrorFromError is the Code identifying Errors created by error types
	ErrorFromError = 2
	// ErrorFromStringer is the Code identifying Errors created by fmt.Stringer types
	ErrorFromStringer = 3
)
View Source
const (
	TicketClosed = "closed"
	TicketOpen   = "open"
	TicketNew    = "new"
)

Ticket Statuses

Variables

This section is empty.

Functions

func WaitForInstanceStatus

func WaitForInstanceStatus(client *Client, instanceID int, status InstanceStatus, timeoutSeconds int) error

waitForInstanceStatus waits for the Linode instance to reach the desired state before returning. It will timeout with an error after timeoutSeconds.

func WaitForVolumeLinodeID

func WaitForVolumeLinodeID(client *Client, volumeID int, linodeID *int, timeoutSeconds int) error

WaitForVolumeLinodeID waits for the Volume to match the desired LinodeID before returning. An active Instance will not immediately attach or detach a volume, so the the LinodeID must be polled to determine volume readiness from the API. WaitForVolumeLinodeID will timeout with an error after timeoutSeconds.

func WaitForVolumeStatus

func WaitForVolumeStatus(client *Client, volumeID int, status VolumeStatus, timeoutSeconds int) error

WaitForVolumeStatus waits for the Volume to reach the desired state before returning. It will timeout with an error after timeoutSeconds.

Types

type APIError

type APIError struct {
	Errors []APIErrorReason `json:"errors"`
}

APIError is the error-set returned by the Linode API when presented with an invalid request

func (APIError) Error

func (e APIError) Error() string

type APIErrorReason

type APIErrorReason struct {
	Reason string `json:"reason"`
	Field  string `json:"field"`
}

APIErrorReason is an individual invalid request message returned by the Linode API

func (APIErrorReason) Error

func (r APIErrorReason) Error() string

type Account

type Account struct {
	FirstName  string `json:"first_name"`
	LastName   string `json:"last_name"`
	Email      string
	Company    string
	Address1   string
	Address2   string
	Balance    float32
	City       string
	State      string
	Zip        string
	Country    string
	TaxID      string      `json:"tax_id"`
	CreditCard *CreditCard `json:"credit_card"`
}

Account associated with the token in use

type Client

type Client struct {
	Images                *Resource
	InstanceDisks         *Resource
	InstanceConfigs       *Resource
	InstanceSnapshots     *Resource
	InstanceIPs           *Resource
	InstanceVolumes       *Resource
	Instances             *Resource
	IPAddresses           *Resource
	IPv6Pools             *Resource
	IPv6Ranges            *Resource
	Regions               *Resource
	StackScripts          *Resource
	Volumes               *Resource
	Kernels               *Resource
	Types                 *Resource
	Domains               *Resource
	DomainRecords         *Resource
	Longview              *Resource
	LongviewClients       *Resource
	LongviewSubscriptions *Resource
	NodeBalancers         *Resource
	NodeBalancerConfigs   *Resource
	NodeBalancerNodes     *Resource
	Tickets               *Resource
	Account               *Resource
	Invoices              *Resource
	InvoiceItems          *Resource
	Events                *Resource
	Notifications         *Resource
	Profile               *Resource
	Managed               *Resource
	// contains filtered or unexported fields
}

Client is a wrapper around the Resty client

func NewClient

func NewClient(codeAPIToken *string, transport http.RoundTripper) (client Client)

NewClient factory to create new Client struct

func (*Client) AddInstanceIPAddress

func (c *Client) AddInstanceIPAddress(linodeID int, public bool) (*InstanceIP, error)

AddInstanceIPAddress adds a public or private IP to a Linode instance

func (*Client) AttachVolume

func (c *Client) AttachVolume(id int, options *VolumeAttachOptions) (bool, error)

AttachVolume attaches volume to linode instance

func (*Client) BootInstance

func (c *Client) BootInstance(id int, configID int) (bool, error)

BootInstance will boot a Linode instance A configID of 0 will cause Linode to choose the last/best config

func (*Client) CloneInstance

func (c *Client) CloneInstance(id int, options *InstanceCloneOptions) (*Instance, error)

CloneInstance clones a Linode instance

func (*Client) CloneVolume

func (c *Client) CloneVolume(id int, label string) (*Volume, error)

CloneVolume clones a Linode volume

func (*Client) CreateDomain

func (c *Client) CreateDomain(domain *DomainCreateOptions) (*Domain, error)

CreateDomain creates a Domain

func (*Client) CreateInstance

func (c *Client) CreateInstance(instance *InstanceCreateOptions) (*Instance, error)

CreateInstance creates a Linode instance

func (*Client) CreateInstanceConfig

func (c *Client) CreateInstanceConfig(linodeID int, createOpts InstanceConfigCreateOptions) (*InstanceConfig, error)

CreateInstanceConfig creates a new InstanceConfig for the given Instance

func (*Client) CreateInstanceDisk

func (c *Client) CreateInstanceDisk(linodeID int, createOpts InstanceDiskCreateOptions) (*InstanceDisk, error)

CreateInstanceDisk creates a new InstanceDisk for the given Instance

func (*Client) CreateNodeBalancer

func (c *Client) CreateNodeBalancer(nodebalancer *NodeBalancerCreateOptions) (*NodeBalancer, error)

CreateNodeBalancer creates a NodeBalancer

func (*Client) CreateNodeBalancerConfig

func (c *Client) CreateNodeBalancerConfig(nodebalancerID int, nodebalancerConfig *NodeBalancerConfigCreateOptions) (*NodeBalancerConfig, error)

CreateNodeBalancerConfig creates a NodeBalancerConfig

func (*Client) CreateNodeBalancerNode

func (c *Client) CreateNodeBalancerNode(nodebalancerID int, configID int, createOpts *NodeBalancerNodeCreateOptions) (*NodeBalancerNode, error)

CreateNodeBalancerNode creates a NodeBalancerNode

func (*Client) CreateStackscript

func (c *Client) CreateStackscript(createOpts *StackscriptCreateOptions) (*Stackscript, error)

CreateStackscript creates a StackScript

func (*Client) CreateVolume

func (c *Client) CreateVolume(createOpts VolumeCreateOptions) (*Volume, error)

CreateVolume creates a Linode Volume

func (*Client) DeleteDomain

func (c *Client) DeleteDomain(id int) error

DeleteDomain deletes the Domain with the specified id

func (*Client) DeleteInstance

func (c *Client) DeleteInstance(id int) error

DeleteInstance deletes a Linode instance

func (*Client) DeleteInstanceConfig

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

DeleteInstanceConfig deletes a Linode InstanceConfig

func (*Client) DeleteInstanceDisk

func (c *Client) DeleteInstanceDisk(linodeID int, diskID int) error

DeleteInstanceDisk deletes a Linode Instance Disk

func (*Client) DeleteNodeBalancer

func (c *Client) DeleteNodeBalancer(id int) error

DeleteNodeBalancer deletes the NodeBalancer with the specified id

func (*Client) DeleteNodeBalancerConfig

func (c *Client) DeleteNodeBalancerConfig(nodebalancerID int, configID int) error

DeleteNodeBalancerConfig deletes the NodeBalancerConfig with the specified id

func (*Client) DeleteNodeBalancerNode

func (c *Client) DeleteNodeBalancerNode(nodebalancerID int, configID int, nodeID int) error

DeleteNodeBalancerNode deletes the NodeBalancerNode with the specified id

func (*Client) DeleteStackscript

func (c *Client) DeleteStackscript(id int) error

DeleteStackscript deletes the StackScript with the specified id

func (*Client) DeleteVolume

func (c *Client) DeleteVolume(id int) error

DeleteVolume deletes the Volume with the specified id

func (*Client) DetachVolume

func (c *Client) DetachVolume(id int) (bool, error)

DetachVolume detaches a Linode volume

func (*Client) GetAccount

func (c *Client) GetAccount() (*Account, error)

GetAccount gets the contact and billing information related to the Account

func (*Client) GetDomain

func (c *Client) GetDomain(id string) (*Domain, error)

GetDomain gets the domain with the provided ID

func (*Client) GetDomainRecord

func (c *Client) GetDomainRecord(id string) (*DomainRecord, error)

GetDomainRecord gets the template with the provided ID

func (*Client) GetEvent

func (c *Client) GetEvent(id int) (*Event, error)

GetEvent gets the Event with the Event ID

func (*Client) GetIPAddress

func (c *Client) GetIPAddress(id string) (*InstanceIP, error)

GetIPAddress gets the template with the provided ID

func (*Client) GetIPv6Pool

func (c *Client) GetIPv6Pool(id string) (*IPv6Range, error)

GetIPv6Pool gets the template with the provided ID

func (*Client) GetIPv6Range

func (c *Client) GetIPv6Range(id string) (*IPv6Range, error)

GetIPv6Range gets the template with the provided ID

func (*Client) GetImage

func (c *Client) GetImage(id string) (*Image, error)

GetImage gets the Image with the provided ID

func (*Client) GetInstance

func (c *Client) GetInstance(linodeID int) (*Instance, error)

GetInstance gets the instance with the provided ID

func (*Client) GetInstanceBackups

func (c *Client) GetInstanceBackups(linodeID int) (*InstanceBackupsResponse, error)

GetInstanceBackups gets the Instance's available Backups

func (*Client) GetInstanceConfig

func (c *Client) GetInstanceConfig(linodeID int, configID int) (*InstanceConfig, error)

GetInstanceConfig gets the template with the provided ID

func (*Client) GetInstanceDisk

func (c *Client) GetInstanceDisk(linodeID int, configID int) (*InstanceDisk, error)

GetInstanceDisk gets the template with the provided ID

func (*Client) GetInstanceIPAddress

func (c *Client) GetInstanceIPAddress(linodeID int, ipaddress string) (*InstanceIP, error)

GetInstanceIPAddress gets the IPAddress for a Linode instance matching a supplied IP address

func (*Client) GetInstanceIPAddresses

func (c *Client) GetInstanceIPAddresses(linodeID int) (*InstanceIPAddressResponse, error)

GetInstanceIPAddresses gets the IPAddresses for a Linode instance

func (*Client) GetInstanceSnapshot

func (c *Client) GetInstanceSnapshot(linodeID int, snapshotID int) (*InstanceSnapshot, error)

GetInstanceSnapshot gets the snapshot with the provided ID

func (*Client) GetInvoice

func (c *Client) GetInvoice(id int) (*Invoice, error)

GetInvoice gets the a single Invoice matching the provided ID

func (*Client) GetKernel

func (c *Client) GetKernel(kernelID string) (*LinodeKernel, error)

GetKernel gets the kernel with the provided ID

func (*Client) GetLongviewClient

func (c *Client) GetLongviewClient(id string) (*LongviewClient, error)

GetLongviewClient gets the template with the provided ID

func (*Client) GetLongviewSubscription

func (c *Client) GetLongviewSubscription(id string) (*LongviewSubscription, error)

GetLongviewSubscription gets the template with the provided ID

func (*Client) GetNodeBalancer

func (c *Client) GetNodeBalancer(id int) (*NodeBalancer, error)

GetNodeBalancer gets the NodeBalancer with the provided ID

func (*Client) GetNodeBalancerConfig

func (c *Client) GetNodeBalancerConfig(nodebalancerID int, configID int) (*NodeBalancerConfig, error)

GetNodeBalancerConfig gets the template with the provided ID

func (*Client) GetNodeBalancerNode

func (c *Client) GetNodeBalancerNode(nodebalancerID int, configID int, nodeID int) (*NodeBalancerNode, error)

GetNodeBalancerNode gets the template with the provided ID

func (*Client) GetRegion

func (c *Client) GetRegion(id string) (*Region, error)

GetRegion gets the template with the provided ID

func (*Client) GetStackscript

func (c *Client) GetStackscript(id int) (*Stackscript, error)

GetStackscript gets the Stackscript with the provided ID

func (*Client) GetTicket

func (c *Client) GetTicket(id int) (*Ticket, error)

GetTicket gets a Support Ticket on the Account with the specified ID

func (*Client) GetType

func (c *Client) GetType(typeID string) (*LinodeType, error)

GetType gets the type with the provided ID

func (*Client) GetVolume

func (c *Client) GetVolume(id int) (*Volume, error)

GetVolume gets the template with the provided ID

func (*Client) ListDomainRecords

func (c *Client) ListDomainRecords(opts *ListOptions) ([]*DomainRecord, error)

ListDomainRecords lists DomainRecords

func (*Client) ListDomains

func (c *Client) ListDomains(opts *ListOptions) ([]*Domain, error)

ListDomains lists Domains

func (*Client) ListEvents

func (c *Client) ListEvents(opts *ListOptions) ([]*Event, error)

ListEvents gets a collection of Event objects representing actions taken on the Account. The Events returned depend on the token grants and the grants of the associated user.

func (*Client) ListIPAddresses

func (c *Client) ListIPAddresses(opts *ListOptions) ([]*InstanceIP, error)

ListIPAddresses lists IPAddresses

func (*Client) ListIPv6Pools

func (c *Client) ListIPv6Pools(opts *ListOptions) ([]*IPv6Range, error)

ListIPv6Pools lists IPv6Pools

func (*Client) ListIPv6Ranges

func (c *Client) ListIPv6Ranges(opts *ListOptions) ([]*IPv6Range, error)

ListIPv6Ranges lists IPv6Ranges

func (*Client) ListImages

func (c *Client) ListImages(opts *ListOptions) ([]*Image, error)

ListImages lists Images

func (*Client) ListInstanceConfigs

func (c *Client) ListInstanceConfigs(linodeID int, opts *ListOptions) ([]*InstanceConfig, error)

ListInstanceConfigs lists InstanceConfigs

func (*Client) ListInstanceDisks

func (c *Client) ListInstanceDisks(linodeID int, opts *ListOptions) ([]*InstanceDisk, error)

ListInstanceDisks lists InstanceDisks

func (*Client) ListInstanceSnapshots

func (c *Client) ListInstanceSnapshots(linodeID int, opts *ListOptions) ([]*InstanceSnapshot, error)

ListInstanceSnapshots lists InstanceSnapshots

func (*Client) ListInstanceVolumes

func (c *Client) ListInstanceVolumes(linodeID int, opts *ListOptions) ([]*Volume, error)

ListInstanceVolumes lists InstanceVolumes

func (*Client) ListInstances

func (c *Client) ListInstances(opts *ListOptions) ([]*Instance, error)

ListInstances lists linode instances

func (*Client) ListInvoiceItems

func (c *Client) ListInvoiceItems(id int, opts *ListOptions) ([]*InvoiceItem, error)

ListInvoiceItems gets the invoice items associated with a specific Invoice

func (*Client) ListInvoices

func (c *Client) ListInvoices(opts *ListOptions) ([]*Invoice, error)

ListInvoices gets a paginated list of Invoices against the Account

func (*Client) ListKernels

func (c *Client) ListKernels(opts *ListOptions) ([]*LinodeKernel, error)

ListKernels lists linode kernels

func (*Client) ListLongviewClients

func (c *Client) ListLongviewClients(opts *ListOptions) ([]*LongviewClient, error)

ListLongviewClients lists LongviewClients

func (*Client) ListLongviewSubscriptions

func (c *Client) ListLongviewSubscriptions(opts *ListOptions) ([]*LongviewSubscription, error)

ListLongviewSubscriptions lists LongviewSubscriptions

func (*Client) ListNodeBalancerConfigs

func (c *Client) ListNodeBalancerConfigs(nodebalancerID int, opts *ListOptions) ([]*NodeBalancerConfig, error)

ListNodeBalancerConfigs lists NodeBalancerConfigs

func (*Client) ListNodeBalancerNodes

func (c *Client) ListNodeBalancerNodes(nodebalancerID int, configID int, opts *ListOptions) ([]*NodeBalancerNode, error)

ListNodeBalancerNodes lists NodeBalancerNodes

func (*Client) ListNodeBalancers

func (c *Client) ListNodeBalancers(opts *ListOptions) ([]*NodeBalancer, error)

ListNodeBalancers lists NodeBalancers

func (*Client) ListNotifications

func (c *Client) ListNotifications(opts *ListOptions) ([]*Notification, error)

ListNotifications gets a collection of Notification objects representing important, often time-sensitive items related to the Account. An account cannot interact directly with Notifications, and a Notification will disappear when the circumstances causing it have been resolved. For example, if the account has an important Ticket open, a response to the Ticket will dismiss the Notification.

func (*Client) ListRegions

func (c *Client) ListRegions(opts *ListOptions) ([]*Region, error)

ListRegions lists Regions

func (*Client) ListStackscripts

func (c *Client) ListStackscripts(opts *ListOptions) ([]*Stackscript, error)

ListStackscripts lists Stackscripts

func (*Client) ListTickets

func (c *Client) ListTickets(opts *ListOptions) ([]*Ticket, error)

ListTickets returns a collection of Support Tickets on the Account. Support Tickets can be both tickets opened with Linode for support, as well as tickets generated by Linode regarding the Account. This collection includes all Support Tickets generated on the Account, with open tickets returned first.

func (*Client) ListTypes

func (c *Client) ListTypes(opts *ListOptions) ([]*LinodeType, error)

ListTypes lists linode types

func (*Client) ListVolumes

func (c *Client) ListVolumes(opts *ListOptions) ([]*Volume, error)

ListVolumes lists Volumes

func (*Client) MarkEventRead

func (c *Client) MarkEventRead(event *Event) error

MarkEventRead marks a single Event as read.

func (*Client) MarkEventsSeen

func (c *Client) MarkEventsSeen(event *Event) error

MarkEventsSeen marks all Events up to and including this Event by ID as seen.

func (*Client) MutateInstance

func (c *Client) MutateInstance(id int) (bool, error)

MutateInstance Upgrades a Linode to its next generation.

func (*Client) R

func (c *Client) R() *resty.Request

R wraps resty's R method

func (*Client) RebootInstance

func (c *Client) RebootInstance(id int, configID int) (bool, error)

RebootInstance reboots a Linode instance A configID of 0 will cause Linode to choose the last/best config

func (*Client) RebuildInstance

func (c *Client) RebuildInstance(id int, opts *RebuildInstanceOptions) (*Instance, error)

RebuildInstance Deletes all Disks and Configs on this Linode, then deploys a new Image to this Linode with the given attributes.

func (*Client) RenameInstance

func (c *Client) RenameInstance(linodeID int, label string) (*Instance, error)

RenameInstance renames an Instance

func (*Client) RenameInstanceConfig

func (c *Client) RenameInstanceConfig(linodeID int, configID int, label string) (*InstanceConfig, error)

RenameInstanceConfig renames an InstanceConfig

func (*Client) RenameInstanceDisk

func (c *Client) RenameInstanceDisk(linodeID int, diskID int, label string) (*InstanceDisk, error)

RenameInstanceDisk renames an InstanceDisk

func (*Client) RenameVolume

func (c *Client) RenameVolume(id int, label string) (*Volume, error)

RenameVolume renames the label of a Linode volume There is no UpdateVolume because the label is the only alterable field.

func (*Client) ResizeInstance

func (c *Client) ResizeInstance(id int, linodeType string) (bool, error)

ResizeInstance resizes an instance to new Linode type

func (*Client) ResizeInstanceDisk

func (c *Client) ResizeInstanceDisk(linodeID int, diskID int, size int) (*InstanceDisk, error)

ResizeInstanceDisk resizes the size of the Instance disk

func (*Client) ResizeVolume

func (c *Client) ResizeVolume(id int, size int) (bool, error)

ResizeVolume resizes an instance to new Linode type

func (Client) Resource

func (c Client) Resource(resourceName string) *Resource

Resource looks up a resource by name

func (*Client) SetDebug

func (c *Client) SetDebug(debug bool) *Client

SetDebug sets the debug on resty's client

func (*Client) SetUserAgent

func (c *Client) SetUserAgent(ua string) *Client

SetUserAgent sets a custom user-agent for HTTP requests

func (*Client) ShutdownInstance

func (c *Client) ShutdownInstance(id int) (bool, error)

ShutdownInstance - Shutdown an instance

func (*Client) UpdateDomain

func (c *Client) UpdateDomain(id int, domain DomainUpdateOptions) (*Domain, error)

UpdateDomain updates the Domain with the specified id

func (*Client) UpdateInstance

func (c *Client) UpdateInstance(id int, instance *InstanceUpdateOptions) (*Instance, error)

UpdateInstance creates a Linode instance

func (*Client) UpdateInstanceConfig

func (c *Client) UpdateInstanceConfig(linodeID int, configID int, updateOpts InstanceConfigUpdateOptions) (*InstanceConfig, error)

UpdateInstanceConfig update an InstanceConfig for the given Instance

func (*Client) UpdateInstanceDisk

func (c *Client) UpdateInstanceDisk(linodeID int, diskID int, updateOpts InstanceDiskUpdateOptions) (*InstanceDisk, error)

UpdateInstanceDisk creates a new InstanceDisk for the given Instance

func (*Client) UpdateNodeBalancer

func (c *Client) UpdateNodeBalancer(id int, updateOpts NodeBalancerUpdateOptions) (*NodeBalancer, error)

UpdateNodeBalancer updates the NodeBalancer with the specified id

func (*Client) UpdateNodeBalancerConfig

func (c *Client) UpdateNodeBalancerConfig(nodebalancerID int, configID int, updateOpts NodeBalancerConfigUpdateOptions) (*NodeBalancerConfig, error)

UpdateNodeBalancerConfig updates the NodeBalancerConfig with the specified id

func (*Client) UpdateNodeBalancerNode

func (c *Client) UpdateNodeBalancerNode(nodebalancerID int, configID int, nodeID int, updateOpts NodeBalancerNodeUpdateOptions) (*NodeBalancerNode, error)

UpdateNodeBalancerNode updates the NodeBalancerNode with the specified id

func (*Client) UpdateStackscript

func (c *Client) UpdateStackscript(id int, updateOpts StackscriptUpdateOptions) (*Stackscript, error)

UpdateStackscript updates the StackScript with the specified id

func (Client) WaitForEventFinished

func (c Client) WaitForEventFinished(id interface{}, entityType EntityType, action EventAction, minStart time.Time, timeoutSeconds int) (*Event, error)

WaitForEventFinished waits for an entity action to reach the 'finished' state before returning. It will timeout with an error after timeoutSeconds. If the event indicates a failure both the failed event and the error will be returned.

type ConfigAlgorithm

type ConfigAlgorithm string
var (
	AlgorithmRoundRobin ConfigAlgorithm = "roundrobin"
	AlgorithmLeastConn  ConfigAlgorithm = "leastconn"
	AlgorithmSource     ConfigAlgorithm = "source"
)

type ConfigCheck

type ConfigCheck string
var (
	CheckNone       ConfigCheck = "none"
	CheckConnection ConfigCheck = "connection"
	CheckHTTP       ConfigCheck = "http"
	CheckHTTPBody   ConfigCheck = "http_body"
)

type ConfigCipher

type ConfigCipher string
var (
	CipherRecommended ConfigCipher = "recommended"
	CipherLegacy      ConfigCipher = "legacy"
)

type ConfigProtocol

type ConfigProtocol string
var (
	ProtocolHTTP  ConfigProtocol = "http"
	ProtocolHTTPS ConfigProtocol = "https"
	ProtocolTCP   ConfigProtocol = "tcp"
)

type ConfigStickiness

type ConfigStickiness string
var (
	StickinessNone       ConfigStickiness = "none"
	StickinessTable      ConfigStickiness = "table"
	StickinessHTTPCookie ConfigStickiness = "http_cookie"
)

type CreditCard

type CreditCard struct {
	LastFour string `json:"last_four"`
	Expiry   string
}

CreditCard information associated with the Account.

type Domain

type Domain struct {
	//	This Domain's unique ID
	ID int

	// The domain this Domain represents. These must be unique in our system; you cannot have two Domains representing the same domain.
	Domain string

	// If this Domain represents the authoritative source of information for the domain it describes, or if it is a read-only copy of a master (also called a slave).
	Type string // Enum:"master" "slave"

	// Deprecated: The group this Domain belongs to. This is for display purposes only.
	Group string

	// Used to control whether this Domain is currently being rendered.
	Status string // Enum:"disabled" "active" "edit_mode" "has_errors"

	// A description for this Domain. This is for display purposes only.
	Description string

	// Start of Authority email address. This is required for master Domains.
	SOAEmail string `json:"soa_email"`

	// The interval, in seconds, at which a failed refresh should be retried.
	// Valid values are 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, 1209600, and 2419200 - any other value will be rounded to the nearest valid value.
	RetrySec int `json:"retry_sec"`

	// The IP addresses representing the master DNS for this Domain.
	MasterIPs []string `json:"master_ips"`

	// The list of IPs that may perform a zone transfer for this Domain. This is potentially dangerous, and should be set to an empty list unless you intend to use it.
	AXfrIPs []string `json:"axfr_ips"`

	// The amount of time in seconds that may pass before this Domain is no longer authoritative. Valid values are 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, 1209600, and 2419200 - any other value will be rounded to the nearest valid value.
	ExpireSec int `json:"expire_sec"`

	// The amount of time in seconds before this Domain should be refreshed. Valid values are 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, 1209600, and 2419200 - any other value will be rounded to the nearest valid value.
	RefreshSec int `json:"refresh_sec"`

	// "Time to Live" - the amount of time in seconds that this Domain's records may be cached by resolvers or other domain servers. Valid values are 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, 1209600, and 2419200 - any other value will be rounded to the nearest valid value.
	TTLSec int `json:"ttl_sec"`
}

Domain represents a Domain object

func (Domain) GetUpdateOptions

func (d Domain) GetUpdateOptions() (du DomainUpdateOptions)

type DomainCreateOptions

type DomainCreateOptions DomainUpdateOptions

type DomainRecord

type DomainRecord struct {
	ID       int
	Type     string
	Name     string
	Target   string
	Priority int
	Weight   int
	Port     int
	Service  string
	Protocol string
	TTLSec   int `json:"ttl_sec"`
	Tag      string
}

DomainRecord represents a DomainRecord object

type DomainRecordsPagedResponse

type DomainRecordsPagedResponse struct {
	*PageOptions
	Data []*DomainRecord
}

DomainRecordsPagedResponse represents a paginated DomainRecord API response

type DomainUpdateOptions

type DomainUpdateOptions struct {
	// The domain this Domain represents. These must be unique in our system; you cannot have two Domains representing the same domain.
	Domain string `json:"domain,omitempty"`

	// If this Domain represents the authoritative source of information for the domain it describes, or if it is a read-only copy of a master (also called a slave).
	// Enum:"master" "slave"
	Type string `json:"type,omitempty"`

	// Deprecated: The group this Domain belongs to. This is for display purposes only.
	Group string `json:"group,omitempty"`

	// Used to control whether this Domain is currently being rendered.
	// Enum:"disabled" "active" "edit_mode" "has_errors"
	Status string `json:"status,omitempty"`

	// A description for this Domain. This is for display purposes only.
	Description string `json:"description,omitempty"`

	// Start of Authority email address. This is required for master Domains.
	SOAEmail string `json:"soa_email,omitempty"`

	// The interval, in seconds, at which a failed refresh should be retried.
	// Valid values are 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, 1209600, and 2419200 - any other value will be rounded to the nearest valid value.
	RetrySec int `json:"retry_sec,omitempty"`

	// The IP addresses representing the master DNS for this Domain.
	MasterIPs []string `json:"master_ips,omitempty"`

	// The list of IPs that may perform a zone transfer for this Domain. This is potentially dangerous, and should be set to an empty list unless you intend to use it.
	AXfrIPs []string `json:"axfr_ips,omitempty"`

	// The amount of time in seconds that may pass before this Domain is no longer authoritative. Valid values are 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, 1209600, and 2419200 - any other value will be rounded to the nearest valid value.
	ExpireSec int `json:"expire_sec,omitempty"`

	// The amount of time in seconds before this Domain should be refreshed. Valid values are 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, 1209600, and 2419200 - any other value will be rounded to the nearest valid value.
	RefreshSec int `json:"refresh_sec,omitempty"`

	// "Time to Live" - the amount of time in seconds that this Domain's records may be cached by resolvers or other domain servers. Valid values are 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, 1209600, and 2419200 - any other value will be rounded to the nearest valid value.
	TTLSec int `json:"ttl_sec,omitempty"`
}

type DomainsPagedResponse

type DomainsPagedResponse struct {
	*PageOptions
	Data []*Domain
}

DomainsPagedResponse represents a paginated Domain API response

type EntityType

type EntityType string

EntityType constants start with Entity and include Linode API Event Entity Types

const (
	EntityLinode EntityType = "linode"
	EntityDisk   EntityType = "disk"
)

type Error

type Error struct {
	Response *http.Response
	Code     int
	Message  string
}

Error wraps the LinodeGo error with the relevant http.Response

func NewError

func NewError(err interface{}) *Error

NewError creates a linodego.Error with a Code identifying the source err type, - ErrorFromString (1) from a string - ErrorFromError (2) for an error - ErrorFromStringer (3) for a Stringer - HTTP Status Codes (100-600) for a resty.Response object

func (Error) Error

func (g Error) Error() string

type Event

type Event struct {
	CreatedStr string `json:"created"`

	// The unique ID of this Event.
	ID int

	// Current status of the Event, Enum: "failed" "finished" "notification" "scheduled" "started"
	Status EventStatus

	// The action that caused this Event. New actions may be added in the future.
	Action EventAction

	// A percentage estimating the amount of time remaining for an Event. Returns null for notification events.
	PercentComplete int `json:"percent_complete"`

	// The rate of completion of the Event. Only some Events will return rate; for example, migration and resize Events.
	Rate string

	// If this Event has been read.
	Read bool

	// If this Event has been seen.
	Seen bool

	// The estimated time remaining until the completion of this Event. This value is only returned for in-progress events.
	TimeRemaining int

	// The username of the User who caused the Event.
	Username string

	// Detailed information about the Event's entity, including ID, type, label, and URL used to access it.
	Entity *EventEntity

	// When this Event was created.
	Created *time.Time `json:"-"`
}

Event represents an action taken on the Account.

type EventAction

type EventAction string

EventAction constants start with Action and include all known Linode API Event Actions.

const (
	ActionBackupsEnable            EventAction = "backups_enable"
	ActionBackupsCancel            EventAction = "backups_cancel"
	ActionBackupsRestore           EventAction = "backups_restore"
	ActionCommunityQuestionReply   EventAction = "community_question_reply"
	ActionCreateCardUpdated        EventAction = "credit_card_updated"
	ActionDiskCreate               EventAction = "disk_create"
	ActionDiskDelete               EventAction = "disk_delete"
	ActionDiskDuplicate            EventAction = "disk_duplicate"
	ActionDiskImagize              EventAction = "disk_imagize"
	ActionDiskResize               EventAction = "disk_resize"
	ActionDNSRecordCreate          EventAction = "dns_record_create"
	ActionDNSRecordDelete          EventAction = "dns_record_delete"
	ActionDNSZoneCreate            EventAction = "dns_zone_create"
	ActionDNSZoneDelete            EventAction = "dns_zone_delete"
	ActionImageDelete              EventAction = "image_delete"
	ActionLinodeAddIP              EventAction = "linode_addip"
	ActionLinodeBoot               EventAction = "linode_boot"
	ActionLinodeClone              EventAction = "linode_clone"
	ActionLinodeCreate             EventAction = "linode_create"
	ActionLinodeDelete             EventAction = "linode_delete"
	ActionLinodeDeleteIP           EventAction = "linode_deleteip"
	ActionLinodeMigrate            EventAction = "linode_migrate"
	ActionLinodeMutate             EventAction = "linode_mutate"
	ActionLinodeReboot             EventAction = "linode_reboot"
	ActionLinodeRebuild            EventAction = "linode_rebuild"
	ActionLinodeResize             EventAction = "linode_resize"
	ActionLinodeShutdown           EventAction = "linode_shutdown"
	ActionLinodeSnapshot           EventAction = "linode_snapshot"
	ActionLongviewClientCreate     EventAction = "longviewclient_create"
	ActionLongviewClientDelete     EventAction = "longviewclient_delete"
	ActionManagedDisabled          EventAction = "managed_disabled"
	ActionManagedEnabled           EventAction = "managed_enabled"
	ActionManagedServiceCreate     EventAction = "managed_service_create"
	ActionManagedServiceDelete     EventAction = "managed_service_delete"
	ActionNodebalancerCreate       EventAction = "nodebalancer_create"
	ActionNodebalancerDelete       EventAction = "nodebalancer_delete"
	ActionNodebalancerConfigCreate EventAction = "nodebalancer_config_create"
	ActionNodebalancerConfigDelete EventAction = "nodebalancer_config_delete"
	ActionPasswordReset            EventAction = "password_reset"
	ActionPaymentSubmitted         EventAction = "payment_submitted"
	ActionStackScriptCreate        EventAction = "stackscript_create"
	ActionStackScriptDelete        EventAction = "stackscript_delete"
	ActionStackScriptPublicize     EventAction = "stackscript_publicize"
	ActionStackScriptRevise        EventAction = "stackscript_revise"
	ActionTFADisabled              EventAction = "tfa_disabled"
	ActionTFAEnabled               EventAction = "tfa_enabled"
	ActionTicketAttachmentUpload   EventAction = "ticket_attachment_upload"
	ActionTicketCreate             EventAction = "ticket_create"
	ActionTicketReply              EventAction = "ticket_reply"
	ActionVolumeAttach             EventAction = "volume_attach"
	ActionVolumeClone              EventAction = "volume_clone"
	ActionVolumeCreate             EventAction = "volume_create"
	ActionVolumeDelte              EventAction = "volume_delete"
	ActionVolumeDetach             EventAction = "volume_detach"
	ActionVolumeResize             EventAction = "volume_resize"
)

type EventEntity

type EventEntity struct {
	// ID may be a string or int, it depends on the EntityType
	ID    interface{}
	Label string
	Type  EntityType
	URL   string
}

EventEntity provides detailed information about the Event's associated entity, including ID, Type, Label, and a URL that can be used to access it.

type EventStatus

type EventStatus string

EventStatus constants start with Event and include Linode API Event Status values

const (
	EventFailed       EventStatus = "failed"
	EventFinished     EventStatus = "finished"
	EventNotification EventStatus = "notification"
	EventScheduled    EventStatus = "scheduled"
	EventStarted      EventStatus = "started"
)

type EventsPagedResponse

type EventsPagedResponse struct {
	*PageOptions
	Data []*Event
}

EventsPagedResponse represents a paginated Events API response

type IPAddressesPagedResponse

type IPAddressesPagedResponse struct {
	*PageOptions
	Data []*InstanceIP
}

IPAddressesPagedResponse represents a paginated IPAddress API response

type IPv6PoolsPagedResponse

type IPv6PoolsPagedResponse struct {
	*PageOptions
	Data []*IPv6Range
}

IPv6PoolsPagedResponse represents a paginated IPv6Pool API response

type IPv6Range

type IPv6Range struct {
	Range  string
	Region string
}

type IPv6RangesPagedResponse

type IPv6RangesPagedResponse struct {
	*PageOptions
	Data []*IPv6Range
}

IPv6RangesPagedResponse represents a paginated IPv6Range API response

type Image

type Image struct {
	CreatedStr  string `json:"created"`
	UpdatedStr  string `json:"updated"`
	ID          string
	Label       string
	Description string
	Type        string
	IsPublic    bool
	Size        int
	Vendor      string
	Deprecated  bool

	CreatedBy string     `json:"created_by"`
	Created   *time.Time `json:"-"`
	Updated   *time.Time `json:"-"`
}

Image represents a deployable Image object for use with Linode Instances

type ImagesPagedResponse

type ImagesPagedResponse struct {
	*PageOptions
	Data []*Image
}

ImagesPagedResponse represents a linode API response for listing of images

type Instance

type Instance struct {
	CreatedStr string `json:"created"`
	UpdatedStr string `json:"updated"`

	ID         int
	Created    *time.Time `json:"-"`
	Updated    *time.Time `json:"-"`
	Region     string
	Alerts     *InstanceAlert
	Backups    *InstanceBackup
	Image      string
	Group      string
	IPv4       []*net.IP
	IPv6       string
	Label      string
	Type       string
	Status     InstanceStatus
	Hypervisor string
	Specs      *InstanceSpec
}

Instance represents a linode object

type InstanceAlert

type InstanceAlert struct {
	CPU           int `json:"cpu"`
	IO            int `json:"io"`
	NetworkIn     int `json:"network_in"`
	NetworkOut    int `json:"network_out"`
	TransferQuote int `json:"transfer_queue"`
}

InstanceAlert represents a metric alert

type InstanceBackup

type InstanceBackup struct {
	Enabled  bool `json:"enabled"`
	Schedule struct {
		Day    string `json:"day,omitempty"`
		Window string `json:"window,omitempty"`
	}
}

InstanceBackup represents backup settings for an instance

type InstanceBackupSnapshotResponse

type InstanceBackupSnapshotResponse struct {
	Current    *InstanceSnapshot
	InProgress *InstanceSnapshot `json:"in_progress"`
}

type InstanceBackupsResponse

type InstanceBackupsResponse struct {
	Automatic []*InstanceSnapshot
	Snapshot  *InstanceBackupSnapshotResponse
}

InstanceBackupsResponse response struct for backup snapshot

type InstanceCloneOptions

type InstanceCloneOptions struct {
	Region         string   `json:"region"`
	Type           string   `json:"type"`
	LinodeID       int      `json:"linode_id"`
	Label          string   `json:"label"`
	Group          string   `json:"group"`
	BackupsEnabled bool     `json:"backups_enabled"`
	Disks          []string `json:"disks"`
	Configs        []string `json:"configs"`
}

InstanceCloneOptions is an options struct when sending a clone request to the API

type InstanceConfig

type InstanceConfig struct {
	CreatedStr string `json:"created"`
	UpdatedStr string `json:"updated"`

	ID          int
	Label       string                   `json:"label"`
	Comments    string                   `json:"comments"`
	Devices     *InstanceConfigDeviceMap `json:"devices"`
	Helpers     *InstanceConfigHelpers   `json:"helpers"`
	MemoryLimit int                      `json:"memory_limit"`
	Kernel      string                   `json:"kernel"`
	InitRD      int                      `json:"init_rd"`
	RootDevice  string                   `json:"root_device"`
	RunLevel    string                   `json:"run_level"`
	VirtMode    string                   `json:"virt_mode"`
	Created     *time.Time               `json:"-"`
	Updated     *time.Time               `json:"-"`
}

func (InstanceConfig) GetCreateOptions

func (i InstanceConfig) GetCreateOptions() InstanceConfigCreateOptions

func (InstanceConfig) GetUpdateOptions

func (i InstanceConfig) GetUpdateOptions() InstanceConfigUpdateOptions

type InstanceConfigCreateOptions

type InstanceConfigCreateOptions struct {
	Label       string                   `json:"label,omitempty"`
	Comments    string                   `json:"comments,omitempty"`
	Devices     *InstanceConfigDeviceMap `json:"devices,omitempty"`
	Helpers     *InstanceConfigHelpers   `json:"helpers,omitempty"`
	MemoryLimit int                      `json:"memory_limit"`
	Kernel      string                   `json:"kernel,omitempty"`
	InitRD      int                      `json:"init_rd"`
	RootDevice  string                   `json:"root_device,omitempty"`
	RunLevel    string                   `json:"run_level,omitempty"`
	VirtMode    string                   `json:"virt_mode,omitempty"`
}

InstanceConfigCreateOptions are InstanceConfig settings that can be used at creation

type InstanceConfigDevice

type InstanceConfigDevice struct {
	DiskID   int `json:"disk_id,omitempty"`
	VolumeID int `json:"volume_id,omitempty"`
}

type InstanceConfigDeviceMap

type InstanceConfigDeviceMap struct {
	SDA *InstanceConfigDevice `json:"sda,omitempty"`
	SDB *InstanceConfigDevice `json:"sdb,omitempty"`
	SDC *InstanceConfigDevice `json:"sdc,omitempty"`
	SDD *InstanceConfigDevice `json:"sdd,omitempty"`
	SDE *InstanceConfigDevice `json:"sde,omitempty"`
	SDF *InstanceConfigDevice `json:"sdf,omitempty"`
	SDG *InstanceConfigDevice `json:"sdg,omitempty"`
	SDH *InstanceConfigDevice `json:"sdh,omitempty"`
}

type InstanceConfigHelpers

type InstanceConfigHelpers struct {
	UpdateDBDisabled  bool `json:"updatedb_disabled"`
	Distro            bool `json:"distro"`
	ModulesDep        bool `json:"modules_dep"`
	Network           bool `json:"network"`
	DevTmpFsAutomount bool `json:"devtmpfs_automount"`
}

type InstanceConfigUpdateOptions

type InstanceConfigUpdateOptions InstanceConfigCreateOptions

InstanceConfigUpdateOptions are InstanceConfig settings that can be used in updates

type InstanceConfigsPagedResponse

type InstanceConfigsPagedResponse struct {
	*PageOptions
	Data []*InstanceConfig
}

InstanceConfigsPagedResponse represents a paginated InstanceConfig API response

type InstanceCreateOptions

type InstanceCreateOptions struct {
	Region          string            `json:"region"`
	Type            string            `json:"type"`
	Label           string            `json:"label,omitempty"`
	Group           string            `json:"group,omitempty"`
	RootPass        string            `json:"root_pass,omitempty"`
	AuthorizedKeys  []string          `json:"authorized_keys,omitempty"`
	StackScriptID   int               `json:"stackscript_id,omitempty"`
	StackScriptData map[string]string `json:"stackscript_data,omitempty"`
	BackupID        int               `json:"backup_id,omitempty"`
	Image           string            `json:"image,omitempty"`
	BackupsEnabled  bool              `json:"backups_enabled,omitempty"`
	SwapSize        *int              `json:"swap_size,omitempty"`
	Booted          bool              `json:"booted,omitempty"`
}

InstanceCreateOptions require only Region and Type

type InstanceDisk

type InstanceDisk struct {
	CreatedStr string `json:"created"`
	UpdatedStr string `json:"updated"`

	ID         int
	Label      string
	Status     string
	Size       int
	Filesystem string
	Created    time.Time `json:"-"`
	Updated    time.Time `json:"-"`
}

type InstanceDiskCreateOptions

type InstanceDiskCreateOptions struct {
	Label string `json:"label"`
	Size  int    `json:"size"`

	// Image is optional, but requires RootPass if provided
	Image    string `json:"image,omitempty"`
	RootPass string `json:"root_pass,omitempty"`

	Filesystem      string            `json:"filesystem,omitempty"`
	AuthorizedKeys  []string          `json:"authorized_keys,omitempty"`
	ReadOnly        bool              `json:"read_only,omitempty"`
	StackscriptID   int               `json:"stackscript_id,omitempty"`
	StackscriptData map[string]string `json:"stackscript_data,omitempty"`
}

InstanceDiskCreateOptions are InstanceDisk settings that can be used at creation

type InstanceDiskUpdateOptions

type InstanceDiskUpdateOptions struct {
	Label    string `json:"label"`
	ReadOnly bool   `json:"read_only"`
}

InstanceDiskUpdateOptions are InstanceDisk settings that can be used in updates

type InstanceDisksPagedResponse

type InstanceDisksPagedResponse struct {
	*PageOptions
	Data []*InstanceDisk
}

InstanceDisksPagedResponse represents a paginated InstanceDisk API response

type InstanceIP

type InstanceIP struct {
	Address    string
	Gateway    string
	SubnetMask string
	Prefix     int
	Type       string
	Public     bool
	RDNS       string
	LinodeID   int `json:"linode_id"`
	Region     string
}

type InstanceIPAddressResponse

type InstanceIPAddressResponse struct {
	IPv4 *InstanceIPv4Response
	IPv6 *InstanceIPv6Response
}

type InstanceIPv4Response

type InstanceIPv4Response struct {
	Public  []*InstanceIP
	Private []*InstanceIP
	Shared  []*InstanceIP
}

type InstanceIPv6Response

type InstanceIPv6Response struct {
	LinkLocal *InstanceIP `json:"link_local"`
	SLAAC     *InstanceIP
	Global    []*IPv6Range
}

type InstanceSnapshot

type InstanceSnapshot struct {
	CreatedStr  string `json:"created"`
	UpdatedStr  string `json:"updated"`
	FinishedStr string `json:"finished"`

	ID       int
	Label    string
	Status   string
	Type     string
	Created  *time.Time `json:"-"`
	Updated  *time.Time `json:"-"`
	Finished *time.Time `json:"-"`
	Configs  []string
	Disks    []*InstanceSnapshotDisk
}

InstanceSnapshot represents a linode backup snapshot

type InstanceSnapshotDisk

type InstanceSnapshotDisk struct {
	Label      string
	Size       int
	Filesystem string
}

type InstanceSnapshotsPagedResponse

type InstanceSnapshotsPagedResponse struct {
	*PageOptions
	Data []*InstanceSnapshot
}

InstanceSnapshotsPagedResponse represents a paginated InstanceSnapshot API response

type InstanceSpec

type InstanceSpec struct {
	Disk     int
	Memory   int
	VCPUs    int
	Transfer int
}

InstanceSpec represents a linode spec

type InstanceStatus

type InstanceStatus string
const (
	InstanceBooting      InstanceStatus = "booting"
	InstanceRunning      InstanceStatus = "running"
	InstanceOffline      InstanceStatus = "offline"
	InstanceShuttingDown InstanceStatus = "shutting_down"
	InstanceRebooting    InstanceStatus = "rebooting"
	InstanceProvisioning InstanceStatus = "provisioning"
	InstanceDeleting     InstanceStatus = "deleting"
	InstanceMigrating    InstanceStatus = "migrating"
	InstanceRebuilding   InstanceStatus = "rebuilding"
	InstanceCloning      InstanceStatus = "cloning"
	InstanceRestoring    InstanceStatus = "restoring"
)

InstanceStatus enum represents potential Instance.Status values

type InstanceUpdateOptions

type InstanceUpdateOptions struct {
	Label   string         `json:"label,omitempty"`
	Group   string         `json:"group,omitempty"`
	Backups InstanceBackup `json:"backups,omitempty"`
	Alerts  InstanceAlert  `json:"alerts,omitempty"`
}

InstanceUpdateOptions is an options struct used when Updating an Instance

type InstanceVolumesPagedResponse

type InstanceVolumesPagedResponse struct {
	*PageOptions
	Data []*Volume
}

InstanceVolumesPagedResponse represents a paginated InstanceVolume API response

type InstancesPagedResponse

type InstancesPagedResponse struct {
	*PageOptions
	Data []*Instance
}

InstancesPagedResponse represents a linode API response for listing

type Invoice

type Invoice struct {
	DateStr string `json:"date"`

	ID    int
	Label string
	Total float32
	Date  *time.Time `json:"-"`
}

Invoice structs reflect an invoice for billable activity on the account.

type InvoiceItem

type InvoiceItem struct {
	FromStr string `json:"from"`
	ToStr   string `json:"to"`

	Label     string
	Type      string
	UnitPrice int
	Quantity  int
	Amount    float32
	From      *time.Time `json:"-"`
	To        *time.Time `json:"-"`
}

InvoiceItem structs reflect an single billable activity associate with an Invoice

type InvoiceItemsPagedResponse

type InvoiceItemsPagedResponse struct {
	*PageOptions
	Data []*InvoiceItem
}

InvoiceItemsPagedResponse represents a paginated Invoice Item API response

type InvoicesPagedResponse

type InvoicesPagedResponse struct {
	*PageOptions
	Data []*Invoice
}

InvoicesPagedResponse represents a paginated Invoice API response

type LinodeAddons

type LinodeAddons struct {
	Backups *LinodeBackupsAddon
}

LinodeAddons represent the linode addons object

type LinodeBackupsAddon

type LinodeBackupsAddon struct {
	Price *LinodePrice
}

LinodeBackupsAddon represents a linode backups addon object

type LinodeKernel

type LinodeKernel struct {
	ID           string
	Label        string
	Version      string
	KVM          bool
	XEN          bool
	Architecture string
	PVOPS        bool
}

LinodeKernel represents a linode kernel object

type LinodeKernelsPagedResponse

type LinodeKernelsPagedResponse struct {
	*PageOptions
	Data []*LinodeKernel
}

LinodeKernelsPagedResponse represents a linode kernels API response for listing

type LinodePrice

type LinodePrice struct {
	Hourly  float32
	Monthly float32
}

LinodePrice represents a linode type price object

type LinodeType

type LinodeType struct {
	ID         string
	Disk       int
	Class      string // enum: nanode, standard, highmem
	Price      *LinodePrice
	Label      string
	Addons     *LinodeAddons
	NetworkOut int `json:"network_out"`
	Memory     int
	Transfer   int
	VCPUs      int
}

LinodeType represents a linode type object

type LinodeTypesPagedResponse

type LinodeTypesPagedResponse struct {
	*PageOptions
	Data []*LinodeType
}

LinodeTypesPagedResponse represents a linode types API response for listing

type ListOptions

type ListOptions struct {
	*PageOptions
	Filter string
}

ListOptions are the pagination and filtering (TODO) parameters for endpoints

func NewListOptions

func NewListOptions(Page int, Filter string) *ListOptions

NewListOptions simplified construction of ListOptions using only the two writable properties, Page and Filter

type LongviewClient

type LongviewClient struct {
	ID int
}

LongviewClient represents a LongviewClient object

type LongviewClientsPagedResponse

type LongviewClientsPagedResponse struct {
	*PageOptions
	Data []*LongviewClient
}

LongviewClientsPagedResponse represents a paginated LongviewClient API response

type LongviewSubscription

type LongviewSubscription struct {
	ID              string
	Label           string
	ClientsIncluded int `json:"clients_included"`
	Price           *LinodePrice
}

LongviewSubscription represents a LongviewSubscription object

type LongviewSubscriptionsPagedResponse

type LongviewSubscriptionsPagedResponse struct {
	*PageOptions
	Data []*LongviewSubscription
}

LongviewSubscriptionsPagedResponse represents a paginated LongviewSubscription API response

type NodeBalancer

type NodeBalancer struct {
	CreatedStr string `json:"created"`
	UpdatedStr string `json:"updated"`
	// This NodeBalancer's unique ID.
	ID int
	// This NodeBalancer's label. These must be unique on your Account.
	Label *string
	// The Region where this NodeBalancer is located. NodeBalancers only support backends in the same Region.
	Region string
	// This NodeBalancer's hostname, ending with .nodebalancer.linode.com
	Hostname *string
	// This NodeBalancer's public IPv4 address.
	IPv4 *string
	// This NodeBalancer's public IPv6 address.
	IPv6 *string
	// Throttle connections per second (0-20). Set to 0 (zero) to disable throttling.
	ClientConnThrottle int `json:"client_conn_throttle"`
	// Information about the amount of transfer this NodeBalancer has had so far this month.
	Transfer NodeBalancerTransfer

	Created *time.Time `json:"-"`
	Updated *time.Time `json:"-"`
}

NodeBalancer represents a NodeBalancer object

func (NodeBalancer) GetCreateOptions

func (i NodeBalancer) GetCreateOptions() NodeBalancerCreateOptions

func (NodeBalancer) GetUpdateOptions

func (i NodeBalancer) GetUpdateOptions() NodeBalancerUpdateOptions

type NodeBalancerConfig

type NodeBalancerConfig struct {
	ID             int
	Port           int
	Protocol       ConfigProtocol
	Algorithm      ConfigAlgorithm
	Stickiness     ConfigStickiness
	Check          ConfigCheck
	CheckInterval  int                     `json:"check_interval"`
	CheckAttempts  int                     `json:"check_attempts"`
	CheckPath      string                  `json:"check_path"`
	CheckBody      string                  `json:"check_body"`
	CheckPassive   bool                    `json:"check_passive"`
	CheckTimeout   int                     `json:"check_timeout"`
	CipherSuite    ConfigCipher            `json:"cipher_suite"`
	NodeBalancerID int                     `json:"nodebalancer_id"`
	SSLCommonName  string                  `json:"ssl_commonname"`
	SSLFingerprint string                  `json:"ssl_fingerprint"`
	SSLCert        string                  `json:"ssl_cert"`
	SSLKey         string                  `json:"ssl_key"`
	NodesStatus    *NodeBalancerNodeStatus `json:"nodes_status"`
}

func (NodeBalancerConfig) GetCreateOptions

func (NodeBalancerConfig) GetUpdateOptions

type NodeBalancerConfigCreateOptions

type NodeBalancerConfigCreateOptions struct {
	Port          int              `json:"port"`
	Protocol      ConfigProtocol   `json:"protocol,omitempty"`
	Algorithm     ConfigAlgorithm  `json:"algorithm,omitempty"`
	Stickiness    ConfigStickiness `json:"stickiness,omitempty"`
	Check         ConfigCheck      `json:"check,omitempty"`
	CheckInterval int              `json:"check_interval,omitempty"`
	CheckAttempts int              `json:"check_attempts,omitempty"`
	CheckPath     string           `json:"check_path,omitempty"`
	CheckBody     string           `json:"check_body,omitempty"`
	CheckPassive  *bool            `json:"check_passive,omitempty"`
	CheckTimeout  int              `json:"check_timeout,omitempty"`
	CipherSuite   ConfigCipher     `json:"cipher_suite,omitempty"`
	SSLCert       string           `json:"ssl_cert,omitempty"`
	SSLKey        string           `json:"ssl_key,omitempty"`
}

NodeBalancerConfigUpdateOptions are permitted by CreateNodeBalancerConfig

type NodeBalancerConfigUpdateOptions

type NodeBalancerConfigUpdateOptions NodeBalancerConfigCreateOptions

NodeBalancerConfigUpdateOptions are permitted by UpdateNodeBalancerConfig

type NodeBalancerConfigsPagedResponse

type NodeBalancerConfigsPagedResponse struct {
	*PageOptions
	Data []*NodeBalancerConfig
}

NodeBalancerConfigsPagedResponse represents a paginated NodeBalancerConfig API response

type NodeBalancerCreateOptions

type NodeBalancerCreateOptions struct {
	Label              *string `json:"label,omitempty"`
	Region             string  `json:"region,omitempty"`
	ClientConnThrottle *int    `json:"client_conn_throttle,omitempty"`
}

NodeBalancerCreateOptions are the options permitted for CreateNodeBalancer

type NodeBalancerNode

type NodeBalancerNode struct {
	ID             int
	Address        string
	Label          string
	Status         string
	Weight         int
	Mode           string
	ConfigID       int `json:"config_id"`
	NodeBalancerID int `json:"nodebalancer_id"`
}

func (NodeBalancerNode) GetCreateOptions

func (i NodeBalancerNode) GetCreateOptions() NodeBalancerNodeCreateOptions

func (NodeBalancerNode) GetUpdateOptions

func (i NodeBalancerNode) GetUpdateOptions() NodeBalancerNodeUpdateOptions

type NodeBalancerNodeCreateOptions

type NodeBalancerNodeCreateOptions struct {
	Address string `json:"address"`
	Label   string `json:"label"`
	Weight  int    `json:"weight,omitempty"`
	Mode    string `json:"mode,omitempty"`
}

type NodeBalancerNodeStatus

type NodeBalancerNodeStatus struct {
	Up   int
	Down int
}

type NodeBalancerNodeUpdateOptions

type NodeBalancerNodeUpdateOptions struct {
	Address string `json:"address,omitempty"`
	Label   string `json:"label,omitempty"`
	Weight  int    `json:"weight,omitempty"`
	Mode    string `json:"mode,omitempty"`
}

type NodeBalancerNodesPagedResponse

type NodeBalancerNodesPagedResponse struct {
	*PageOptions
	Data []*NodeBalancerNode
}

NodeBalancerNodesPagedResponse represents a paginated NodeBalancerNode API response

type NodeBalancerTransfer

type NodeBalancerTransfer struct {
	// The total transfer, in MB, used by this NodeBalancer this month.
	Total *int
	// The total inbound transfer, in MB, used for this NodeBalancer this month.
	Out *int
	// The total outbound transfer, in MB, used for this NodeBalancer this month.
	In *int
}

type NodeBalancerUpdateOptions

type NodeBalancerUpdateOptions struct {
	Label              *string `json:"label,omitempty"`
	ClientConnThrottle *int    `json:"client_conn_throttle,omitempty"`
}

NodeBalancerUpdateOptions are the options permitted for UpdateNodeBalancer

type NodeBalancersPagedResponse

type NodeBalancersPagedResponse struct {
	*PageOptions
	Data []*NodeBalancer
}

NodeBalancersPagedResponse represents a paginated NodeBalancer API response

type Notification

type Notification struct {
	UntilStr string `json:"until"`
	WhenStr  string `json:"when"`

	Label    string
	Message  string
	Type     string
	Severity string
	Entity   *NotificationEntity
	Until    *time.Time `json:"-"`
	When     *time.Time `json:"-"`
}

type NotificationEntity

type NotificationEntity struct {
	ID    int
	Label string
	Type  string
	URL   string
}

NotificationEntity adds detailed information about the Notification. This could refer to the ticket that triggered the notification, for example.

type NotificationsPagedResponse

type NotificationsPagedResponse struct {
	*PageOptions
	Data []*Notification
}

NotificationsPagedResponse represents a paginated Notifications API response

type PageOptions

type PageOptions struct {
	Page    int `url:"page,omitempty"`
	Pages   int `url:"pages,omitempty"`
	Results int `url:"results,omitempty"`
}

PageOptions are the pagination parameters for List endpoints

type RebuildInstanceOptions

type RebuildInstanceOptions struct {
	Image           string            `json:"image"`
	RootPass        string            `json:"root_pass"`
	AuthorizedKeys  []string          `json:"authorized_keys"`
	StackscriptID   int               `json:"stackscript_id"`
	StackscriptData map[string]string `json:"stackscript_data"`
	Booted          bool              `json:"booted"`
}

RebuildInstanceOptions is a struct representing the options to send to the rebuild linode endpoint

type Region

type Region struct {
	ID      string
	Country string
}

LinodeRegion represents a linode region object

type RegionsPagedResponse

type RegionsPagedResponse struct {
	*PageOptions
	Data []*Region
}

LinodeRegionsPagedResponse represents a linode API response for listing

type Resource

type Resource struct {
	R  func() *resty.Request
	PR func() *resty.Request
	// contains filtered or unexported fields
}

Resource represents a linode API resource

func NewResource

func NewResource(client *Client, name string, endpoint string, useTemplate bool, singleType interface{}, pagedType interface{}) *Resource

NewResource is the factory to create a new Resource struct. If it has a template string the useTemplate bool must be set.

func (Resource) Endpoint

func (r Resource) Endpoint() (string, error)

Endpoint will return the non-templated endpoint string for resource

type Stackscript

type Stackscript struct {
	CreatedStr string `json:"created"`
	UpdatedStr string `json:"updated"`

	ID                int
	Username          string
	Label             string
	Description       string
	Images            []string
	DeploymentsTotal  int
	DeploymentsActive int
	IsPublic          bool
	Created           *time.Time `json:"-"`
	Updated           *time.Time `json:"-"`
	RevNote           string
	Script            string
	UserDefinedFields *map[string]string
	UserGravatarID    string
}

Stackscript represents a Linode StackScript

func (Stackscript) GetCreateOptions

func (i Stackscript) GetCreateOptions() StackscriptCreateOptions

func (Stackscript) GetUpdateOptions

func (i Stackscript) GetUpdateOptions() StackscriptUpdateOptions

type StackscriptCreateOptions

type StackscriptCreateOptions struct {
	Label       string   `json:"label"`
	Description string   `json:"description"`
	Images      []string `json:"images"`
	IsPublic    bool     `json:"is_public"`
	RevNote     string   `json:"rev_note"`
	Script      string   `json:"script"`
}

type StackscriptUpdateOptions

type StackscriptUpdateOptions StackscriptCreateOptions

type StackscriptsPagedResponse

type StackscriptsPagedResponse struct {
	*PageOptions
	Data []*Stackscript
}

StackscriptsPagedResponse represents a paginated Stackscript API response

type Ticket

type Ticket struct {
	ID          int
	Attachments []string
	Closed      *time.Time `json:"-"`
	Description string
	Entity      *TicketEntity
	GravatarID  string
	Opened      *time.Time `json:"-"`
	OpenedBy    string
	Status      string
	Summary     string
	Updated     *time.Time `json:"-"`
	UpdatedBy   string
}

Ticket represents a support ticket object

type TicketEntity

type TicketEntity struct {
	ID    int
	Label string
	Type  string
	URL   string
}

TicketEntity refers a ticket to a specific entity

type TicketsPagedResponse

type TicketsPagedResponse struct {
	*PageOptions
	Data []*Ticket
}

TicketsPagedResponse represents a paginated ticket API response

type Volume

type Volume struct {
	CreatedStr string `json:"created"`
	UpdatedStr string `json:"updated"`

	ID             int
	Label          string
	Status         VolumeStatus
	Region         string
	Size           int
	LinodeID       *int      `json:"linode_id"`
	FilesystemPath string    `json:"filesystem_path"`
	Created        time.Time `json:"-"`
	Updated        time.Time `json:"-"`
}

Volume represents a linode volume object

type VolumeAttachOptions

type VolumeAttachOptions struct {
	LinodeID int `json:"linode_id"`
	ConfigID int `json:"config_id,omitempty"`
}

type VolumeCreateOptions

type VolumeCreateOptions struct {
	Label    string `json:"label,omitempty"`
	Region   string `json:"region,omitempty"`
	LinodeID int    `json:"linode_id,omitempty"`
	ConfigID int    `json:"config_id,omitempty"`
	// The Volume's size, in GiB. Minimum size is 10GiB, maximum size is 10240GiB. A "0" value will result in the default size.
	Size int `json:"size,omitempty"`
}

type VolumeStatus

type VolumeStatus string

VolumeStatus indicates the status of the Volume

const (
	// VolumeCreating indicates the Volume is being created and is not yet available for use
	VolumeCreating VolumeStatus = "creating"

	// VolumeActive indicates the Volume is online and available for use
	VolumeActive VolumeStatus = "active"

	// VolumeResizing indicates the Volume is in the process of upgrading its current capacity
	VolumeResizing VolumeStatus = "resizing"

	// VolumeContactSupport indicates there is a problem with the Volume. A support ticket must be opened to resolve the issue
	VolumeContactSupport VolumeStatus = "contact_support"
)

type VolumesPagedResponse

type VolumesPagedResponse struct {
	*PageOptions
	Data []*Volume
}

VolumesPagedResponse represents a linode API response for listing of volumes

Directories

Path Synopsis
k8s module
test module

Jump to

Keyboard shortcuts

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