linodego

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

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

Go to latest
Published: Jan 31, 2018 License: MIT Imports: 13 Imported by: 0

README

linodego

Overview

Package linodego is an unofficial Go client implementation for Linode API. Check the Linode API documentation for details: https://www.linode.com/api

Current API implementation supports using api_key request parameter. All requests are sent using GET methods. While it is also possible to use POST method by setting UsePost, Linode API seems to return response with keys captialized. Unmarshaling such response isn't fully tested.

TODO: Batch request is not implemented yet.

Example

Check examples/client.go for sample usage. Note that you must supple API Key in examples/client.go before running the program. Get API from https://manager.linode.com/profile/api

go run examples/client.go
Test

Update API Key in api_key_test.go, then run:

go test
Installation
go get "github.com/taoh/linodego"
Package
import "github.com/taoh/linodego"
Documentation

See GoDoc

License

The MIT License (MIT)

Copyright (c) 2015 TH

Documentation

Index

Constants

View Source
const (
	// API Client Version
	ClientVersion = "0.1"
)

Variables

View Source
var (
	// Unexpected Response Error
	ErrUnexpectedResponse = errors.New("Unexpected response")
	// General Response Error
	ErrResponse = errors.New("Error response")
	// Authentication Failure
	ErrAuthentication = errors.New("Authenticaion Failed. Be sure to use correct API Key")
)

Functions

func WaitForPendingJobs

func WaitForPendingJobs(client *Client, linodeid int)

expose a means to wait for a linode's pending jobs to complete

Types

type AccountInfo

type AccountInfo struct {
	AccountSince     CustomTime `json:"ACTIVE_SINCE"`
	TransferPool     int        `json:"TRANSFER_POOL"`
	TransferUsed     int        `json:"TRANSFER_USED"`
	TransferBillable int        `json:"TRANSFER_BILLABLE"`
	BillingMethod    string     `json:"BILLING_METHOD"`
	Managed          bool       `json:"MANAGED"`
	Balance          float32    `json:"BALANCE"`
}

type AccountInfoResponse

type AccountInfoResponse struct {
	Response
	AccountInfo AccountInfo
}

Response for account.info API

type AccountInterface

type AccountInterface interface {
	EstimateInvoice(string, int, int, int) (*EstimateInvoiceResponse, error)
	Info() (*AccountInfoResponse, error)
}

AccountService is an interface generated for "github.com/appscode/linodego".AccountService.

type AccountService

type AccountService struct {
	// contains filtered or unexported fields
}

Account Service

func (*AccountService) EstimateInvoice

func (t *AccountService) EstimateInvoice(mode string, planId int, paymentTerm int, linodeId int) (*EstimateInvoiceResponse, error)

Estimate Invoice

func (*AccountService) Info

Get Account Info

type ApiInterface

type ApiInterface interface {
	Spec(*ApiResponse) error
}

ApiService is an interface generated for "github.com/appscode/linodego".ApiService.

type ApiResponse

type ApiResponse struct {
	Response
	Data map[string]interface{}
}

Response for api.spec Service

type ApiService

type ApiService struct {
	// contains filtered or unexported fields
}

API Service

func (*ApiService) Spec

func (t *ApiService) Spec(v *ApiResponse) error

Get API Specs

type AvailDataCentersResponse

type AvailDataCentersResponse struct {
	Response
	DataCenters []DataCenter
}

Response for avail.datacenters API

type AvailDistributionsResponse

type AvailDistributionsResponse struct {
	Response
	Distributions []Distribution
}

Response for avail.distributions API

type AvailInterface

type AvailInterface interface {
	DataCenters() (*AvailDataCentersResponse, error)
	Distributions() (*AvailDistributionsResponse, error)
	FilterKernels(int, int) (*KernelsResponse, error)
	Kernels(map[string]string) (*KernelsResponse, error)
	LinodePlans() (*LinodePlansResponse, error)
	NodeBalancers() (*NodeBalancersResponse, error)
	StackScripts() (*StackScriptsResponse, error)
}

AvailService is an interface generated for "github.com/appscode/linodego".AvailService.

type AvailService

type AvailService struct {
	// contains filtered or unexported fields
}

Avail Service

func (*AvailService) DataCenters

func (t *AvailService) DataCenters() (*AvailDataCentersResponse, error)

Get DataCenters

func (*AvailService) Distributions

func (t *AvailService) Distributions() (*AvailDistributionsResponse, error)

Get Distributions

func (*AvailService) FilterKernels

func (t *AvailService) FilterKernels(isxen int, iskvm int) (*KernelsResponse, error)

Get filtered Kernels

func (*AvailService) Kernels

func (t *AvailService) Kernels(args map[string]string) (*KernelsResponse, error)

Get Kernels

func (*AvailService) LinodePlans

func (t *AvailService) LinodePlans() (*LinodePlansResponse, error)

Get Linode Plans

func (*AvailService) NodeBalancers

func (t *AvailService) NodeBalancers() (*NodeBalancersResponse, error)

Get Node Balancers

func (*AvailService) StackScripts

func (t *AvailService) StackScripts() (*StackScriptsResponse, error)

Get All Stackscripts

type Client

type Client struct {
	// Linode API Key
	ApiKey string
	// HTTP client to communicate with Linode API
	HTTPClient *http.Client
	// Base URL
	BaseURL *url.URL

	// Whether to use POST for API request, default is false
	UsePost bool

	// Services
	Test               TestInterface
	Api                ApiInterface
	Avail              AvailInterface
	Account            AccountInterface
	Image              ImageInterface
	Linode             LinodeInterface
	Job                LinodeJobInterface
	Config             LinodeConfigInterface
	Ip                 LinodeIPInterface
	Disk               LinodeDiskInterface
	StackScript        StackScriptInterface
	Volume             LinodeVolumeInterface
	NodeBalancer       NodeBalancerInterface
	NodeBalancerConfig NodeBalancerConfigInterface
	Node               NodeBalancerNodeInterface
}

Client of Linode v1 API

func NewClient

func NewClient(AccessKey string, httpClient *http.Client) *Client

Creates a new Linode client object.

type CustomBool

type CustomBool struct {
	Bool bool
}

CustomBool is a type to handle Linode's insistance of using ints as boolean values.

func (*CustomBool) MarshalJSON

func (cb *CustomBool) MarshalJSON() ([]byte, error)

func (*CustomBool) UnmarshalJSON

func (cb *CustomBool) UnmarshalJSON(b []byte) error

type CustomBoolImpl

type CustomBoolImpl interface {
	MarshalJSON() ([]byte, error)
	UnmarshalJSON([]byte) error
}

CustomBool is an interface generated for "github.com/appscode/linodego".CustomBool.

type CustomShortTime

type CustomShortTime struct {
	time.Time
}

func (*CustomShortTime) IsSet

func (ct *CustomShortTime) IsSet() bool

func (*CustomShortTime) MarshalJSON

func (ct *CustomShortTime) MarshalJSON() ([]byte, error)

func (*CustomShortTime) UnmarshalJSON

func (ct *CustomShortTime) UnmarshalJSON(b []byte) (err error)

type CustomString

type CustomString struct {
	// contains filtered or unexported fields
}

A special class to handle marshaling string response from Linode As sometimes Linode returns integer instead of string from API https://github.com/taoh/linodego/issues/1

func (*CustomString) MarshalJSON

func (cs *CustomString) MarshalJSON() ([]byte, error)

func (*CustomString) String

func (cs *CustomString) String() string

func (*CustomString) UnmarshalJSON

func (cs *CustomString) UnmarshalJSON(b []byte) (err error)

type CustomStringImpl

type CustomStringImpl interface {
	MarshalJSON() ([]byte, error)
	String() string
	UnmarshalJSON([]byte) error
}

CustomString is an interface generated for "github.com/appscode/linodego".CustomString.

type CustomTime

type CustomTime struct {
	time.Time
}

func (*CustomTime) IsSet

func (ct *CustomTime) IsSet() bool

func (*CustomTime) MarshalJSON

func (ct *CustomTime) MarshalJSON() ([]byte, error)

func (*CustomTime) UnmarshalJSON

func (ct *CustomTime) UnmarshalJSON(b []byte) (err error)

type DataCenter

type DataCenter struct {
	DataCenterId int    `json:"DATACENTERID"`
	Location     string `json:"LOCATION"`
	Abbr         string `json:"ABBR"`
}

type Disk

type Disk struct {
	UpdateDt   CustomTime   `json:"UPDATE_DT"`
	DiskId     int          `json:"DISKID"`
	Label      CustomString `json:"LABEL"`
	Type       string       `json:"TYPE"`
	LinodeId   int          `json:"LINODEID"`
	IsReadOnly int          `json:"ISREADONLY"`
	Status     int          `json:"STATUS"`
	CreateDt   CustomTime   `json:"CREATE_DT"`
	Size       int          `json:"SIZE"`
}

type DiskJob

type DiskJob struct {
	JobId  int `json:"JobID"`
	DiskId int `json:"DiskID"`
}

type Distribution

type Distribution struct {
	Is64Bit             int          `json:"IS64BIT"`
	Label               CustomString `json:"LABEL"`
	MinImageSize        int          `json:"MINIMAGESIZE"`
	DistributionId      int          `json:"DISTRIBUTIONID"`
	CreatedDt           CustomTime   `json:"CREATE_DT"`
	RequiresPVOPSKernel int          `json:"REQUIRESPVOPSKERNEL"`
}

type Error

type Error struct {
	ErrorCode    int    `json:"ERRORCODE"`
	ErrorMessage string `json:"ERRORMESSAGE"`
}

type EstimateInvoice

type EstimateInvoice struct {
	InvoiceTo CustomShortTime `json:"INVOICE_TO"`
	Amount    float32         `json:"AMOUNT"`
}

type EstimateInvoiceResponse

type EstimateInvoiceResponse struct {
	Response
	EstimateInvoice EstimateInvoice
}

Response for account.estimateinvoice API

type FullIPAddress

type FullIPAddress struct {
	LinodeId    int    `json:"LINODEID"`
	IsPublic    int    `json:"ISPUBLIC"`
	RDNSName    string `json:"RDNS_NAME"`
	IPAddress   string `json:"IPADDRESS"`
	IPAddressId int    `json:"IPADDRESSID"`
}

type IPAddress

type IPAddress struct {
	IPAddress   string `json:"IPAddress"`
	IPAddressId int    `json:"IPAddressID"`
}

type Image

type Image struct {
	CreateDt    CustomTime   `json:"CREATE_DT"`
	Creator     string       `json:"CREATOR"`
	Description string       `json:"DESCRIPTION"`
	FsType      string       `json:"FS_TYPE"`
	ImageId     int          `json:"IMAGEID"`
	IsPublic    int          `json:"ISPUBLIC"`
	Label       CustomString `json:"LABEL"`
	LastUsedDt  CustomTime   `json:"LAST_USED_DT"`
	MinSize     int          `json:"MINSIZE"`
	Status      string       `json:"STATUS"`
	Type        string       `json:"TYPE"`
}

type ImageInterface

type ImageInterface interface {
	Delete(int) (*ImageResponse, error)
	List() (*ImagesListResponse, error)
	Update(int, string, string) (*ImageResponse, error)
}

ImageService is an interface generated for "github.com/appscode/linodego".ImageService.

type ImageResponse

type ImageResponse struct {
	Response
	Image Image
}

Response for image.update or image.delete API

type ImageService

type ImageService struct {
	// contains filtered or unexported fields
}

Image Service

func (*ImageService) Delete

func (t *ImageService) Delete(imageId int) (*ImageResponse, error)

Delete given Image

func (*ImageService) List

func (t *ImageService) List() (*ImagesListResponse, error)

List all images

func (*ImageService) Update

func (t *ImageService) Update(imageId int, label string, description string) (*ImageResponse, error)

Update given Image

type ImagesListResponse

type ImagesListResponse struct {
	Response
	Images []Image
}

Response for image.list API

type Job

type Job struct {
	EnteredDt    CustomTime   `json:"ENTERED_DT"`
	Action       string       `json:"ACTION"`
	Label        string       `json:"LABEL"`
	HostStartDt  CustomTime   `json:"HOST_START_DT"`
	LinodeId     int          `json:"LINODEID"`
	HostFinishDt CustomTime   `json:"HOST_FINISH_DT"`
	HostMessage  string       `json:"HOST_MESSAGE"`
	JobId        int          `json:"JOBID"`
	HostSuccess  CustomString `json:"HOST_SUCCESS"` // Linode API returns empty string if HostSuccess is false. 1 otherwise.
}

type JobId

type JobId struct {
	JobId int `json:"JobID"`
}

type JobResponse

type JobResponse struct {
	Response
	JobId JobId
}

Job Response

type Kernel

type Kernel struct {
	Label    CustomString `json:"LABEL"`
	IsKvm    int          `json:"ISKVM"`
	IsXen    int          `json:"ISXEN"`
	IsPVOPS  int          `json:"ISPVOPS"`
	KernelId int          `json:"KERNELID"`
}

type KernelsResponse

type KernelsResponse struct {
	Response
	Kernels []Kernel
}

Response for avail.kernels API

type Linode

type Linode struct {
	TotalXFer             int          `json:"TOTALXFER"`
	BackupsEnabled        int          `json:"BACKUPSENABLED"`
	WatchDog              int          `json:"WATCHDOG"`
	LpmDisplayGroup       string       `json:"LPM_DISPLAYGROUP"`
	AlertBwQuotaEnabled   int          `json:"ALERT_BWQUOTA_ENABLED"`
	Status                int          `json:"STATUS"`
	TotalRAM              int          `json:"TOTALRAM"`
	AlertDiskIOThreshold  int          `json:"ALERT_DISKIO_THRESHOLD"`
	BackupWindow          int          `json:"BACKUPWINDOW"`
	AlertBwOutEnabled     int          `json:"ALERT_BWOUT_ENABLED"`
	AlertBwOutThreshold   int          `json:"ALERT_BWOUT_THRESHOLD"`
	Label                 CustomString `json:"LABEL"`
	AlertCPUEnabled       int          `json:"ALERT_CPU_ENABLED"`
	AlertBwQuotaThreshold int          `json:"ALERT_BWQUOTA_THRESHOLD"`
	AlertBwInThreshold    int          `json:"ALERT_BWIN_THRESHOLD"`
	BackupWeeklyDay       int          `json:"BACKUPWEEKLYDAY"`
	DataCenterId          int          `json:"DATACENTERID"`
	AlertCPUThreshold     int          `json:"ALERT_CPU_THRESHOLD"`
	TotalHD               int          `json:"TOTALHD"`
	AlertDiskIOEnabled    int          `json:"ALERT_DISKIO_ENABLED"`
	AlertBwInEnabled      int          `json:"ALERT_BWIN_ENABLED"`
	LinodeId              int          `json:"LINODEID"`
	CreateDt              CustomTime   `json:"CREATE_DT"`
	PlanId                int          `json:"PLANID"`
	DistributionVendor    string       `json:"DISTRIBUTIONVENDOR"`
}

type LinodeConfig

type LinodeConfig struct {
	HelperDisableUpdateDB int          `json:"helper_disableUpdateDB"`
	RootDeviceRO          bool         `json:"RootDeviceRO"`
	RootDeviceCustom      string       `json:"RootDeviceCustom"`
	Label                 CustomString `json:"Label"`
	DiskList              string       `json:"DiskList"`
	LinodeId              int          `json:"LinodeID"`
	Comments              string       `json:"Comments"`
	ConfigId              int          `json:"ConfigID"`
	HelperXen             int          `json:"helper_xen"` // Depreciated, use HelperDistro instead
	HelperDistro          CustomBool   `json:"helper_distro"`
	RunLevel              string       `json:"RunLevel"`
	HelperDepmod          CustomBool   `json:"helper_depmod"`
	KernelId              int          `json:"KernelID"`
	RootDeviceNum         int          `json:"RootDeviceNum"`
	HelperLibtls          CustomBool   `json:"helper_libtls"`
	HelperNetwork         CustomBool   `json:"helper_network"`
	RAMLimit              int          `json:"RAMLimit"`
}

type LinodeConfigId

type LinodeConfigId struct {
	LinodeConfigId int `json:"ConfigID"`
}

type LinodeConfigInterface

type LinodeConfigInterface interface {
	Create(int, int, string, map[string]string) (*LinodeConfigResponse, error)
	Delete(int, int) (*LinodeConfigResponse, error)
	List(int, int) (*LinodeConfigListResponse, error)
	Update(int, int, int, map[string]string) (*LinodeConfigResponse, error)
}

LinodeConfigService is an interface generated for "github.com/appscode/linodego".LinodeConfigService.

type LinodeConfigListResponse

type LinodeConfigListResponse struct {
	Response
	LinodeConfigs []LinodeConfig
}

Response for linode.config.list API

type LinodeConfigResponse

type LinodeConfigResponse struct {
	Response
	LinodeConfigId LinodeConfigId
}

Response for general config APIs

type LinodeConfigService

type LinodeConfigService struct {
	// contains filtered or unexported fields
}

Linode Config Service

func (*LinodeConfigService) Create

func (t *LinodeConfigService) Create(linodeId int, kernelId int, label string, args map[string]string) (*LinodeConfigResponse, error)

Create Config

func (*LinodeConfigService) Delete

func (t *LinodeConfigService) Delete(linodeId int, configId int) (*LinodeConfigResponse, error)

Delete Config

func (*LinodeConfigService) List

func (t *LinodeConfigService) List(linodeId int, configId int) (*LinodeConfigListResponse, error)

Get Config List. If configId is greater than 0, limit results to given config.

func (*LinodeConfigService) Update

func (t *LinodeConfigService) Update(configId int, linodeId int, kernelId int, args map[string]string) (*LinodeConfigResponse, error)

Update Config. See https://www.linode.com/api/linode/linode.config.update for allowed arguments.

type LinodeDiskInterface

type LinodeDiskInterface interface {
	Create(int, string, string, int, map[string]string) (*LinodeDiskJobResponse, error)
	CreateFromDistribution(int, int, string, int, map[string]string) (*LinodeDiskJobResponse, error)
	CreateFromImage(int, int, string, int, map[string]string) (*LinodeDiskJobResponse, error)
	CreateFromStackscript(int, int, string, string, int, int, string, map[string]string) (*LinodeDiskJobResponse, error)
	Delete(int, int) (*LinodeDiskJobResponse, error)
	Duplicate(int, int) (*LinodeDiskJobResponse, error)
	Imagize(int, int, string, string) (*LinodeDiskJobResponse, error)
	List(int, int) (*LinodeDiskListResponse, error)
	Resize(int, int, int) (*LinodeDiskJobResponse, error)
	Update(int, int, string, bool) (*LinodeDiskJobResponse, error)
}

LinodeDiskService is an interface generated for "github.com/appscode/linodego".LinodeDiskService.

type LinodeDiskJobResponse

type LinodeDiskJobResponse struct {
	Response
	DiskJob DiskJob
}

Response for general Disk jobs APIs

type LinodeDiskListResponse

type LinodeDiskListResponse struct {
	Response
	Disks []Disk
}

Response for linode.disk.list API

type LinodeDiskService

type LinodeDiskService struct {
	// contains filtered or unexported fields
}

Linode Disk Service

func (*LinodeDiskService) Create

func (t *LinodeDiskService) Create(linodeId int, diskType string, label string, size int, args map[string]string) (*LinodeDiskJobResponse, error)

Create disk

func (*LinodeDiskService) CreateFromDistribution

func (t *LinodeDiskService) CreateFromDistribution(distributionId int, linodeId int, label string, size int, args map[string]string) (*LinodeDiskJobResponse, error)

Create from Distribution

func (*LinodeDiskService) CreateFromImage

func (t *LinodeDiskService) CreateFromImage(imageId int, linodeId int, label string, size int, args map[string]string) (*LinodeDiskJobResponse, error)

Create from image

func (*LinodeDiskService) CreateFromStackscript

func (t *LinodeDiskService) CreateFromStackscript(
	stackScriptId int, linodeId int, label string,
	stackScriptUDFResponses string,
	distributionId int, size int, rootPass string,
	args map[string]string) (*LinodeDiskJobResponse, error)

Create from stackscript

func (*LinodeDiskService) Delete

func (t *LinodeDiskService) Delete(linodeId int, diskId int) (*LinodeDiskJobResponse, error)

Delete disk

func (*LinodeDiskService) Duplicate

func (t *LinodeDiskService) Duplicate(linodeId int, diskId int) (*LinodeDiskJobResponse, error)

Duplicate Disk

func (*LinodeDiskService) Imagize

func (t *LinodeDiskService) Imagize(linodeId int, diskId int, description string, label string) (*LinodeDiskJobResponse, error)

Imagize a disk

func (*LinodeDiskService) List

func (t *LinodeDiskService) List(linodeId int, diskId int) (*LinodeDiskListResponse, error)

List all disks. If diskId is greater than 0, limit the results to given disk.

func (*LinodeDiskService) Resize

func (t *LinodeDiskService) Resize(linodeId int, diskId int, size int) (*LinodeDiskJobResponse, error)

Resize a disk

func (*LinodeDiskService) Update

func (t *LinodeDiskService) Update(linodeId int, diskId int, label string, isReadOnly bool) (*LinodeDiskJobResponse, error)

Update a disk

type LinodeIPAddress

type LinodeIPAddress struct {
	LinodeId    int    `json:"LINODEID"`
	IPAddress   string `json:"IPADDRESS"`
	IPAddressId int    `json:"IPADDRESSID"`
}

type LinodeIPAddressResponse

type LinodeIPAddressResponse struct {
	Response
	IPAddress IPAddress
}

IP Address Response

type LinodeIPInterface

type LinodeIPInterface interface {
	AddPrivate(int) (*LinodeIPAddressResponse, error)
	AddPublic(int) (*LinodeIPAddressResponse, error)
	List(int, int) (*LinodeIPListResponse, error)
	SetRDNS(int, string) (*LinodeRDNSIPAddressResponse, error)
	Swap(int, int, int) (*LinodeLinodeIPAddressResponse, error)
}

LinodeIPService is an interface generated for "github.com/appscode/linodego".LinodeIPService.

type LinodeIPListResponse

type LinodeIPListResponse struct {
	Response
	FullIPAddresses []FullIPAddress
}

IP List Response

type LinodeIPService

type LinodeIPService struct {
	// contains filtered or unexported fields
}

Linode IP Service

func (*LinodeIPService) AddPrivate

func (t *LinodeIPService) AddPrivate(linodeId int) (*LinodeIPAddressResponse, error)

Add Private IP

func (*LinodeIPService) AddPublic

func (t *LinodeIPService) AddPublic(linodeId int) (*LinodeIPAddressResponse, error)

Add Public IP

func (*LinodeIPService) List

func (t *LinodeIPService) List(linodeId int, ipAddressId int) (*LinodeIPListResponse, error)

List All Ips. If linodeId or ipAddressId is less than 0, all IPs are returned. Otherwise, limits the reuslt to the given linodeId, ipAddressId or both.

func (*LinodeIPService) SetRDNS

func (t *LinodeIPService) SetRDNS(ipAddressId int, hostname string) (*LinodeRDNSIPAddressResponse, error)

Set RDNS

func (*LinodeIPService) Swap

func (t *LinodeIPService) Swap(ipAddressId int, withIPAddressId int, toLinodeId int) (*LinodeLinodeIPAddressResponse, error)

Swap Ips

type LinodeId

type LinodeId struct {
	LinodeId int `json:"LinodeID"`
}

type LinodeInterface

type LinodeInterface interface {
	Boot(int, int) (*JobResponse, error)
	Clone(int, int, int, int) (*LinodeResponse, error)
	Create(int, int, int) (*LinodeResponse, error)
	Delete(int, bool) (*LinodeResponse, error)
	List(int) (*LinodesListResponse, error)
	Reboot(int, int) (*JobResponse, error)
	Resize(int, int) (*LinodeResponse, error)
	Shutdown(int) (*JobResponse, error)
	Update(int, map[string]interface{}) (*LinodeResponse, error)
}

LinodeService is an interface generated for "github.com/appscode/linodego".LinodeService.

type LinodeJobInterface

type LinodeJobInterface interface {
	List(int, int, bool) (*LinodesJobListResponse, error)
}

LinodeJobService is an interface generated for "github.com/appscode/linodego".LinodeJobService.

type LinodeJobService

type LinodeJobService struct {
	// contains filtered or unexported fields
}

Job service

func (*LinodeJobService) List

func (t *LinodeJobService) List(linodeId int, jobId int, pendingOnly bool) (*LinodesJobListResponse, error)

List all jobs. If jobId is greater than 0, limit the list to given jobId.

type LinodeLinodeIPAddressResponse

type LinodeLinodeIPAddressResponse struct {
	Response
	LinodeIPAddresses []LinodeIPAddress
}

Full IP Address Response

type LinodeNodeBalancer

type LinodeNodeBalancer struct {
	NodeBalancerId     int          `json:"NODEBALANCERID"`
	Label              CustomString `json:"LABEL"`
	DataCenterId       int          `json:"DATACENTERID"`
	HostName           string       `json:"HOSTNAME"`
	Address4           string       `json:"ADDRESS4"`
	Address6           string       `json:"ADDRESS6"`
	ClientConnThrottle int          `json:"CLIENTCONNTHROTTLE"`
}

type LinodeNodeBalancerId

type LinodeNodeBalancerId struct {
	NodeBalancerId int `json:"NODEBALANCERID"`
}

type LinodePlan

type LinodePlan struct {
	Cores  int            `json:"CORES"`
	Price  float32        `json:"PRICE"`
	RAM    int            `json:"RAM"`
	Xfer   int            `json:"Xfer"`
	PlanId int            `json:"PLANID"`
	Label  CustomString   `json:"LABEL"`
	Avail  map[string]int `json:"AVAIL"`
	Disk   int            `json:"DISK"`
	Hourly float32        `json:"HOURLY"`
}

type LinodePlansResponse

type LinodePlansResponse struct {
	Response
	LinodePlans []LinodePlan
}

Response for avail.linodeplans API

type LinodeRDNSIPAddressResponse

type LinodeRDNSIPAddressResponse struct {
	Response
	RDNSIPAddress RDNSIPAddress
}

IP Address with RDNS Response

type LinodeResponse

type LinodeResponse struct {
	Response
	LinodeId LinodeId
}

General Linode API Response

type LinodeService

type LinodeService struct {
	// contains filtered or unexported fields
}

Linode Service

func (*LinodeService) Boot

func (t *LinodeService) Boot(linodeId int, configId int) (*JobResponse, error)

Boot Linode

func (*LinodeService) Clone

func (t *LinodeService) Clone(linodeId int, dataCenterId int, planId int, paymentTerm int) (*LinodeResponse, error)

Clone Linode

func (*LinodeService) Create

func (t *LinodeService) Create(dataCenterId int, planId int, paymentTerm int) (*LinodeResponse, error)

Create Linode

func (*LinodeService) Delete

func (t *LinodeService) Delete(linodeId int, skipChecks bool) (*LinodeResponse, error)

Delete Linode

func (*LinodeService) List

func (t *LinodeService) List(linodeId int) (*LinodesListResponse, error)

List all Linodes. If linodeId is less than 0, all linodes are returned. Otherwise, only returns the linode for given Id.

func (*LinodeService) Reboot

func (t *LinodeService) Reboot(linodeId int, configId int) (*JobResponse, error)

Reboot Linode

func (*LinodeService) Resize

func (t *LinodeService) Resize(linodeId int, planId int) (*LinodeResponse, error)

Resize Linode

func (*LinodeService) Shutdown

func (t *LinodeService) Shutdown(linodeId int) (*JobResponse, error)

Shutdown Linode

func (*LinodeService) Update

func (t *LinodeService) Update(linodeId int, args map[string]interface{}) (*LinodeResponse, error)

Update Linode

type LinodeVolumeInterface

type LinodeVolumeInterface interface {
	Clone(int, string) (*LinodeVolumeResponse, error)
	Create(int, string, map[string]string) (*LinodeVolumeResponse, error)
	Delete(int) (*LinodeVolumeResponse, error)
	List(int) (*LinodeVolumeListResponse, error)
	Update(int, map[string]string) (*LinodeVolumeResponse, error)
}

LinodeVolumeService is an interface generated for "github.com/appscode/linodego".LinodeVolumeService.

type LinodeVolumeListResponse

type LinodeVolumeListResponse struct {
	Response
	Volume []Volume
}

Response for volume.list API

type LinodeVolumeResponse

type LinodeVolumeResponse struct {
	Response
	VolumeId VolumeId
}

Response for general config APIs

type LinodeVolumeService

type LinodeVolumeService struct {
	// contains filtered or unexported fields
}

Linode Volume Service

func (*LinodeVolumeService) Clone

func (t *LinodeVolumeService) Clone(cloneFromId int, label string) (*LinodeVolumeResponse, error)

Clone Volume

func (*LinodeVolumeService) Create

func (t *LinodeVolumeService) Create(size int, label string, args map[string]string) (*LinodeVolumeResponse, error)

Create Volume

func (*LinodeVolumeService) Delete

func (t *LinodeVolumeService) Delete(volumeId int) (*LinodeVolumeResponse, error)

Delete Volume

func (*LinodeVolumeService) List

func (t *LinodeVolumeService) List(volumeId int) (*LinodeVolumeListResponse, error)

List all volumes. If volumeId is greater than 0, limit the results to given volume.

func (*LinodeVolumeService) Update

func (t *LinodeVolumeService) Update(volumeId int, args map[string]string) (*LinodeVolumeResponse, error)

Update Volume. See https://www.linode.com/api/volume/volume.update for allowed arguments.

type LinodesJobListResponse

type LinodesJobListResponse struct {
	Response
	Jobs []Job
}

Resonse for linode.job.list API

type LinodesListResponse

type LinodesListResponse struct {
	Response
	Linodes []Linode
}

Response for linode.list API

type NodeBalancer

type NodeBalancer struct {
	Hourly      float32 `json:"HOURLY"`
	Monthly     float32 `json:"MONTHLY"`
	Connections int     `json:"CONNECTIONS"`
}

type NodeBalancerConfig

type NodeBalancerConfig struct {
	Stickiness     CustomString `json:"STICKINESS"`
	CheckPath      CustomString `json:"CHECK_PATH"`
	Port           int          `json:"PORT"`
	CheckBody      CustomString `json:"CHECK_BODY"`
	Check          CustomString `json:"CHECK"`
	CheckInterval  int          `json:"CHECK_INTERVAL"`
	Protocol       CustomString `json:"PROTOCOL"`
	ConfigId       int          `json:"CONFIGID"`
	Algorithm      CustomString `json:"ALGORITHM"`
	CheckTimeout   int          `json:"CHECK_TIMEOUT"`
	NodeBalancerId int          `json:"NODEBALANCERID"`
	CheckAttempts  int          `json:"CHECK_ATTEMPTS"`
	CheckPassive   int          `json:"CHECK_PASSIVE"`
	SslFingerprint CustomString `json:"SSL_FINGERPRINT"`
	SslCommonName  CustomString `json:"SSL_COMMONNAME"`
}

type NodeBalancerConfigId

type NodeBalancerConfigId struct {
	NodeBalancerConfigId int `json:"ConfigID"`
}

type NodeBalancerConfigInterface

type NodeBalancerConfigInterface interface {
	Create(int, map[string]string) (*NodeBalancerConfigResponse, error)
	Delete(int, int) (*NodeBalancerConfigResponse, error)
	List(int, int) (*NodeBalancerConfigListResponse, error)
	Update(int, map[string]string) (*NodeBalancerConfigResponse, error)
}

NodeBalancerConfigService is an interface generated for "github.com/appscode/linodego".NodeBalancerConfigService.

type NodeBalancerConfigListResponse

type NodeBalancerConfigListResponse struct {
	Response
	NodeBalancerConfigs []NodeBalancerConfig
}

Response for nodebalancer.config.list API

type NodeBalancerConfigResponse

type NodeBalancerConfigResponse struct {
	Response
	NodeBalancerConfigId NodeBalancerConfigId
}

Response for general config APIs

type NodeBalancerConfigService

type NodeBalancerConfigService struct {
	// contains filtered or unexported fields
}

NodeBalancer Config Service

func (*NodeBalancerConfigService) Create

func (t *NodeBalancerConfigService) Create(nodeBalancerId int, args map[string]string) (*NodeBalancerConfigResponse, error)

Create Config

func (*NodeBalancerConfigService) Delete

func (t *NodeBalancerConfigService) Delete(nodeBalancerId int, configId int) (*NodeBalancerConfigResponse, error)

Delete Config

func (*NodeBalancerConfigService) List

func (t *NodeBalancerConfigService) List(nodeBalancerId int, configId int) (*NodeBalancerConfigListResponse, error)

Get Config List. If configId is greater than 0, limit results to given config.

func (*NodeBalancerConfigService) Update

func (t *NodeBalancerConfigService) Update(configId int, args map[string]string) (*NodeBalancerConfigResponse, error)

Update Config. See https://www.linode.com/api/nodebalancer/nodebalancer.config.update for allowed arguments.

type NodeBalancerInterface

type NodeBalancerInterface interface {
	Create(int, string, map[string]string) (*NodeBalancerResponse, error)
	Delete(int) (*NodeBalancerResponse, error)
	List(int) (*NodeBalancerListResponse, error)
	Update(int, map[string]string) (*NodeBalancerResponse, error)
}

NodeBalancerService is an interface generated for "github.com/appscode/linodego".NodeBalancerService.

type NodeBalancerListResponse

type NodeBalancerListResponse struct {
	Response
	NodeBalancer []LinodeNodeBalancer
}

Response for nodebalancer.list API

type NodeBalancerNode

type NodeBalancerNode struct {
	Weight         int          `json:"WEIGHT"`
	Address        CustomString `json:"ADDRESS"`
	Label          CustomString `json:"LABEL"`
	NodeId         int          `json:"NODEID"`
	Mode           CustomString `json:"MODE"`
	ConfigId       int          `json:"CONFIGID"`
	Status         CustomString `json:"STATUS"`
	NodeBalancerId int          `json:"NODEBALANCERID"`
}

type NodeBalancerNodeId

type NodeBalancerNodeId struct {
	NodeId int `json:"NODEID"`
}

type NodeBalancerNodeInterface

type NodeBalancerNodeInterface interface {
	Create(int, string, string, map[string]string) (*NodeBalancerNodeResponse, error)
	Delete(int) (*NodeBalancerNodeResponse, error)
	List(int, int) (*NodeBalancerNodeListResponse, error)
	Update(int, map[string]string) (*NodeBalancerNodeResponse, error)
}

NodeBalancerNodeService is an interface generated for "github.com/appscode/linodego".NodeBalancerNodeService.

type NodeBalancerNodeListResponse

type NodeBalancerNodeListResponse struct {
	Response
	NodeBalancerNodes []NodeBalancerNode
}

Response for nodebalancer.config.list API

type NodeBalancerNodeResponse

type NodeBalancerNodeResponse struct {
	Response
	NodeBalancerNodeId NodeBalancerNodeId
}

Response for general config APIs

type NodeBalancerNodeService

type NodeBalancerNodeService struct {
	// contains filtered or unexported fields
}

NodeBalancer Config Service

func (*NodeBalancerNodeService) Create

func (t *NodeBalancerNodeService) Create(configId int, label string, address string, args map[string]string) (*NodeBalancerNodeResponse, error)

Create Node

func (*NodeBalancerNodeService) Delete

Delete Node

func (*NodeBalancerNodeService) List

func (t *NodeBalancerNodeService) List(configId int, nodeId int) (*NodeBalancerNodeListResponse, error)

Get Node List. If configId is greater than 0, limit results to given node.

func (*NodeBalancerNodeService) Update

func (t *NodeBalancerNodeService) Update(NodeId int, args map[string]string) (*NodeBalancerNodeResponse, error)

Update Node. See https://www.linode.com/api/linode/linode.config.update for allowed arguments.

type NodeBalancerResponse

type NodeBalancerResponse struct {
	Response
	NodeBalancerId LinodeNodeBalancerId
}

Response for general config APIs

type NodeBalancerService

type NodeBalancerService struct {
	// contains filtered or unexported fields
}

Nodebalancer Service

func (*NodeBalancerService) Create

func (t *NodeBalancerService) Create(datacenterId int, label string, args map[string]string) (*NodeBalancerResponse, error)

Create NodeBalancer

func (*NodeBalancerService) Delete

func (t *NodeBalancerService) Delete(nodeBalancerId int) (*NodeBalancerResponse, error)

Delete Nodebalancer

func (*NodeBalancerService) List

func (t *NodeBalancerService) List(nodeBalancerId int) (*NodeBalancerListResponse, error)

List all nodebalancers. If nodeBalancerId is greater than 0, limit the results to given nodebalancer.

func (*NodeBalancerService) Update

func (t *NodeBalancerService) Update(nodeBalancerId int, args map[string]string) (*NodeBalancerResponse, error)

Update Nodebalancer. See https://www.linode.com/api/nodebalancer/nodebalancer.update for allowed arguments.

type NodeBalancersResponse

type NodeBalancersResponse struct {
	Response
	NodeBalancers []NodeBalancer
}

Response for avail.nodebalancers API

type RDNSIPAddress

type RDNSIPAddress struct {
	HostName    string `json:"HOSTNAME"`
	IPAddress   string `json:"IPADDRESS"`
	IPAddressId int    `json:"IPADDRESSID"`
}

type Response

type Response struct {
	Errors  []Error         `json:"ERRORARRAY"`
	RawData json.RawMessage `json:"DATA"`
	Action  string          `json:"ACTION"`
}

type StackScript

type StackScript struct {
	Script             string       `json:"SCRIPT"`
	Description        CustomString `json:"DESCRIPTION"`
	DistributionidList CustomString `json:"DISTRIBUTIONIDLIST"`
	Label              CustomString `json:"LABEL"`
	DeploymentsTotal   int          `json:"DEPLOYMENTSTOTAL"`
	LatestRev          int          `json:"LATESTREV"`
	CreatedDt          CustomTime   `json:"CREATE_DT"`
	DeploymentsActive  int          `json:"DEPLOYMENTSACTIVE"`
	StackScriptId      int          `json:"STACKSCRIPTID"`
	RevNote            CustomString `json:"REV_NOTE"`
	RevDt              CustomTime   `json:"REV_DT"`
	IsPublic           int          `json:"ISPUBLIC"`
	UserId             int          `json:"USERID"`
}

type StackScriptId

type StackScriptId struct {
	StackScriptId int `json:"StackScriptID"`
}

type StackScriptInterface

type StackScriptInterface interface {
	Create(string, string, string, map[string]string) (*StackScriptResponse, error)
	Delete(int) (*StackScriptResponse, error)
	List(int) (*StackScriptListResponse, error)
	Update(int, map[string]string) (*StackScriptResponse, error)
}

StackScriptService is an interface generated for "github.com/appscode/linodego".StackScriptService.

type StackScriptListResponse

type StackScriptListResponse struct {
	Response
	StackScripts []StackScript
}

Response for linode.config.list API

type StackScriptResponse

type StackScriptResponse struct {
	Response
	StackScriptId StackScriptId
}

Response for general config APIs

type StackScriptService

type StackScriptService struct {
	// contains filtered or unexported fields
}

Linode Config Service

func (*StackScriptService) Create

func (t *StackScriptService) Create(label, distributionIDList, script string, args map[string]string) (*StackScriptResponse, error)

Create Config

func (*StackScriptService) Delete

func (t *StackScriptService) Delete(scriptId int) (*StackScriptResponse, error)

Delete Config

func (*StackScriptService) List

func (t *StackScriptService) List(scriptId int) (*StackScriptListResponse, error)

Get Config List. If scriptId is greater than 0, limit results to given config.

func (*StackScriptService) Update

func (t *StackScriptService) Update(scriptId int, args map[string]string) (*StackScriptResponse, error)

Update Config. See https://www.linode.com/api/stackscript/stackscript.update for allowed arguments.

type StackScriptsResponse

type StackScriptsResponse struct {
	Response
	StackScripts []StackScript
}

Response for avail.stackscripts API

type TestInterface

type TestInterface interface {
	Echo(string, string, *TestResponse) error
}

TestService is an interface generated for "github.com/appscode/linodego".TestService.

type TestResponse

type TestResponse struct {
	Response
	Data map[string]string
}

Test Service Response

type TestService

type TestService struct {
	// contains filtered or unexported fields
}

Test Service

func (*TestService) Echo

func (t *TestService) Echo(key string, val string, v *TestResponse) error

Echo request with the given key and value

type Volume

type Volume struct {
	VolumeId int          `json:"VOLUMEID"`
	Label    CustomString `json:"LABEL"`
	Size     int          `json:"SIZE"`
	LinodeId int          `json:"LINODEID"`
	Status   string       `json:"STATUS"`
}

type VolumeId

type VolumeId struct {
	VolumeId int `json:"VOLUMEID"`
}

Directories

Path Synopsis
+build example
+build example

Jump to

Keyboard shortcuts

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