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(context.Background(), 1231) fmt.Println("## Instance request with Invalid ID") fmt.Println("### Linode:", linode) fmt.Println("### Error:", err) if spendMoney { linode, err = linodeClient.CreateInstance(context.Background(), linodego.InstanceCreateOptions{Region: "us-central", Type: "g5-nanode-1"}) if err != nil { log.Fatalln("* While creating instance: ", err) } linode, err = linodeClient.UpdateInstance(context.Background(), 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(context.Background(), 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(context.Background(), event); err != nil { log.Fatalln("* Failed to mark Linode create event seen", err) } diskSwap, err := linodeClient.CreateInstanceDisk(context.Background(), 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(context.Background(), 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(context.Background(), eventSwap); err != nil { log.Fatalln("* Failed to mark swap disk create event seen", err) } diskRaw, err := linodeClient.CreateInstanceDisk(context.Background(), 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(context.Background(), 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(context.Background(), eventRaw); err != nil { log.Fatalln("* Failed to mark raw disk create event seen", err) } diskDebian, err := linodeClient.CreateInstanceDisk( context.Background(), 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(context.Background(), 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(context.Background(), 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(context.Background(), 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(context.Background(), linode.ID, config.ID, updateOpts) if err != nil { log.Fatalln("* Failed to update Config", err) } fmt.Println("### Updated Config:") booted, err := linodeClient.BootInstance(context.Background(), linode.ID, config.ID) if err != nil || !booted { log.Fatalln("* Failed to boot Instance", err) } fmt.Println("### Booted Instance") eventBooted, err := linodeClient.WaitForEventFinished(context.Background(), 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(context.Background(), eventBooted); err != nil { log.Fatalln("* Failed to mark boot event seen", err) } err = linodeClient.DeleteInstanceConfig(context.Background(), linode.ID, config.ID) if err != nil { log.Fatalln("* Failed to delete Config", err) } fmt.Println("### Deleted Config") err = linodeClient.DeleteInstanceDisk(context.Background(), linode.ID, diskSwap.ID) if err != nil { log.Fatalln("* Failed to delete Disk", err) } fmt.Println("### Deleted Disk") err = linodeClient.DeleteInstance(context.Background(), linode.ID) if err != nil { log.Fatalln("* Failed to delete Instance", err) } fmt.Println("### Deleted Instance") } linodes, err := linodeClient.ListInstances(context.Background(), 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(context.Background(), linodes[0].ID) if err != nil { log.Fatal(err) } fmt.Println("## First Linode") configs, err := linodeClient.ListInstanceConfigs(context.Background(), linode.ID, nil) if err != nil { log.Fatal(err) } else if len(configs) > 0 { config, err := linodeClient.GetInstanceConfig(context.Background(), 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(context.Background(), linode.ID, nil) if err != nil { log.Fatal(err) } else if len(disks) > 0 { disk, err := linodeClient.GetInstanceDisk(context.Background(), 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(context.Background(), 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(context.Background(), 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(context.Background(), linode.ID, nil) if err != nil { log.Fatal(err) } else if len(volumes) > 0 { volume, err := linodeClient.GetVolume(context.Background(), 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(context.Background(), &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 ¶
- Constants
- Variables
- type APIError
- type APIErrorReason
- type Account
- type Client
- func (c *Client) AddInstanceIPAddress(ctx context.Context, linodeID int, public bool) (*InstanceIP, error)
- func (c *Client) AttachVolume(ctx context.Context, id int, options *VolumeAttachOptions) (*Volume, error)
- func (c *Client) BootInstance(ctx context.Context, id int, configID int) (bool, error)
- func (c *Client) CancelInstanceBackups(ctx context.Context, linodeID int) (bool, error)
- func (c *Client) CloneInstance(ctx context.Context, id int, options InstanceCloneOptions) (*Instance, error)
- func (c *Client) CloneVolume(ctx context.Context, id int, label string) (*Volume, error)
- func (c *Client) CreateDomain(ctx context.Context, domain DomainCreateOptions) (*Domain, error)
- func (c *Client) CreateDomainRecord(ctx context.Context, domainID int, domainrecord DomainRecordCreateOptions) (*DomainRecord, error)
- func (c *Client) CreateImage(ctx context.Context, createOpts ImageCreateOptions) (*Image, error)
- func (c *Client) CreateInstance(ctx context.Context, instance InstanceCreateOptions) (*Instance, error)
- func (c *Client) CreateInstanceConfig(ctx context.Context, linodeID int, createOpts InstanceConfigCreateOptions) (*InstanceConfig, error)
- func (c *Client) CreateInstanceDisk(ctx context.Context, linodeID int, createOpts InstanceDiskCreateOptions) (*InstanceDisk, error)
- func (c *Client) CreateInstanceSnapshot(ctx context.Context, linodeID int, label string) (*InstanceSnapshot, error)
- func (c *Client) CreateNodeBalancer(ctx context.Context, nodebalancer NodeBalancerCreateOptions) (*NodeBalancer, error)
- func (c *Client) CreateNodeBalancerConfig(ctx context.Context, nodebalancerID int, ...) (*NodeBalancerConfig, error)
- func (c *Client) CreateNodeBalancerNode(ctx context.Context, nodebalancerID int, configID int, ...) (*NodeBalancerNode, error)
- func (c *Client) CreateStackscript(ctx context.Context, createOpts StackscriptCreateOptions) (*Stackscript, error)
- func (c *Client) CreateVolume(ctx context.Context, createOpts VolumeCreateOptions) (*Volume, error)
- func (c *Client) DeleteDomain(ctx context.Context, id int) error
- func (c *Client) DeleteDomainRecord(ctx context.Context, domainID int, id int) error
- func (c *Client) DeleteImage(ctx context.Context, id string) error
- func (c *Client) DeleteInstance(ctx context.Context, id int) error
- func (c *Client) DeleteInstanceConfig(ctx context.Context, linodeID int, configID int) error
- func (c *Client) DeleteInstanceDisk(ctx context.Context, linodeID int, diskID int) error
- func (c *Client) DeleteNodeBalancer(ctx context.Context, id int) error
- func (c *Client) DeleteNodeBalancerConfig(ctx context.Context, nodebalancerID int, configID int) error
- func (c *Client) DeleteNodeBalancerNode(ctx context.Context, nodebalancerID int, configID int, nodeID int) error
- func (c *Client) DeleteStackscript(ctx context.Context, id int) error
- func (c *Client) DeleteVolume(ctx context.Context, id int) error
- func (c *Client) DetachVolume(ctx context.Context, id int) (bool, error)
- func (c *Client) EnableInstanceBackups(ctx context.Context, linodeID int) (bool, error)
- func (c *Client) GetAccount(ctx context.Context) (*Account, error)
- func (c *Client) GetDomain(ctx context.Context, id int) (*Domain, error)
- func (c *Client) GetDomainRecord(ctx context.Context, domainID int, id int) (*DomainRecord, error)
- func (c *Client) GetEvent(ctx context.Context, id int) (*Event, error)
- func (c *Client) GetIPAddress(ctx context.Context, id string) (*InstanceIP, error)
- func (c *Client) GetIPv6Pool(ctx context.Context, id string) (*IPv6Range, error)
- func (c *Client) GetIPv6Range(ctx context.Context, id string) (*IPv6Range, error)
- func (c *Client) GetImage(ctx context.Context, id string) (*Image, error)
- func (c *Client) GetInstance(ctx context.Context, linodeID int) (*Instance, error)
- func (c *Client) GetInstanceBackups(ctx context.Context, linodeID int) (*InstanceBackupsResponse, error)
- func (c *Client) GetInstanceConfig(ctx context.Context, linodeID int, configID int) (*InstanceConfig, error)
- func (c *Client) GetInstanceDisk(ctx context.Context, linodeID int, configID int) (*InstanceDisk, error)
- func (c *Client) GetInstanceIPAddress(ctx context.Context, linodeID int, ipaddress string) (*InstanceIP, error)
- func (c *Client) GetInstanceIPAddresses(ctx context.Context, linodeID int) (*InstanceIPAddressResponse, error)
- func (c *Client) GetInstanceSnapshot(ctx context.Context, linodeID int, snapshotID int) (*InstanceSnapshot, error)
- func (c *Client) GetInvoice(ctx context.Context, id int) (*Invoice, error)
- func (c *Client) GetKernel(ctx context.Context, kernelID string) (*LinodeKernel, error)
- func (c *Client) GetLongviewClient(ctx context.Context, id string) (*LongviewClient, error)
- func (c *Client) GetLongviewSubscription(ctx context.Context, id string) (*LongviewSubscription, error)
- func (c *Client) GetNodeBalancer(ctx context.Context, id int) (*NodeBalancer, error)
- func (c *Client) GetNodeBalancerConfig(ctx context.Context, nodebalancerID int, configID int) (*NodeBalancerConfig, error)
- func (c *Client) GetNodeBalancerNode(ctx context.Context, nodebalancerID int, configID int, nodeID int) (*NodeBalancerNode, error)
- func (c *Client) GetRegion(ctx context.Context, id string) (*Region, error)
- func (c *Client) GetStackscript(ctx context.Context, id int) (*Stackscript, error)
- func (c *Client) GetTicket(ctx context.Context, id int) (*Ticket, error)
- func (c *Client) GetType(ctx context.Context, typeID string) (*LinodeType, error)
- func (c *Client) GetVolume(ctx context.Context, id int) (*Volume, error)
- func (c *Client) ListDomainRecords(ctx context.Context, domainID int, opts *ListOptions) ([]*DomainRecord, error)
- func (c *Client) ListDomains(ctx context.Context, opts *ListOptions) ([]*Domain, error)
- func (c *Client) ListEvents(ctx context.Context, opts *ListOptions) ([]*Event, error)
- func (c *Client) ListIPAddresses(ctx context.Context, opts *ListOptions) ([]*InstanceIP, error)
- func (c *Client) ListIPv6Pools(ctx context.Context, opts *ListOptions) ([]*IPv6Range, error)
- func (c *Client) ListIPv6Ranges(ctx context.Context, opts *ListOptions) ([]*IPv6Range, error)
- func (c *Client) ListImages(ctx context.Context, opts *ListOptions) ([]*Image, error)
- func (c *Client) ListInstanceConfigs(ctx context.Context, linodeID int, opts *ListOptions) ([]*InstanceConfig, error)
- func (c *Client) ListInstanceDisks(ctx context.Context, linodeID int, opts *ListOptions) ([]*InstanceDisk, error)
- func (c *Client) ListInstanceVolumes(ctx context.Context, linodeID int, opts *ListOptions) ([]*Volume, error)
- func (c *Client) ListInstances(ctx context.Context, opts *ListOptions) ([]*Instance, error)
- func (c *Client) ListInvoiceItems(ctx context.Context, id int, opts *ListOptions) ([]*InvoiceItem, error)
- func (c *Client) ListInvoices(ctx context.Context, opts *ListOptions) ([]*Invoice, error)
- func (c *Client) ListKernels(ctx context.Context, opts *ListOptions) ([]*LinodeKernel, error)
- func (c *Client) ListLongviewClients(ctx context.Context, opts *ListOptions) ([]*LongviewClient, error)
- func (c *Client) ListLongviewSubscriptions(ctx context.Context, opts *ListOptions) ([]*LongviewSubscription, error)
- func (c *Client) ListNodeBalancerConfigs(ctx context.Context, nodebalancerID int, opts *ListOptions) ([]*NodeBalancerConfig, error)
- func (c *Client) ListNodeBalancerNodes(ctx context.Context, nodebalancerID int, configID int, opts *ListOptions) ([]*NodeBalancerNode, error)
- func (c *Client) ListNodeBalancers(ctx context.Context, opts *ListOptions) ([]*NodeBalancer, error)
- func (c *Client) ListNotifications(ctx context.Context, opts *ListOptions) ([]*Notification, error)
- func (c *Client) ListRegions(ctx context.Context, opts *ListOptions) ([]*Region, error)
- func (c *Client) ListStackscripts(ctx context.Context, opts *ListOptions) ([]*Stackscript, error)
- func (c *Client) ListTickets(ctx context.Context, opts *ListOptions) ([]*Ticket, error)
- func (c *Client) ListTypes(ctx context.Context, opts *ListOptions) ([]*LinodeType, error)
- func (c *Client) ListVolumes(ctx context.Context, opts *ListOptions) ([]*Volume, error)
- func (c *Client) MarkEventRead(ctx context.Context, event *Event) error
- func (c *Client) MarkEventsSeen(ctx context.Context, event *Event) error
- func (c *Client) MutateInstance(ctx context.Context, id int) (bool, error)
- func (c *Client) R(ctx context.Context) *resty.Request
- func (c *Client) RebootInstance(ctx context.Context, id int, configID int) (bool, error)
- func (c *Client) RebuildInstance(ctx context.Context, id int, opts RebuildInstanceOptions) (*Instance, error)
- func (c *Client) RenameInstance(ctx context.Context, linodeID int, label string) (*Instance, error)
- func (c *Client) RenameInstanceConfig(ctx context.Context, linodeID int, configID int, label string) (*InstanceConfig, error)
- func (c *Client) RenameInstanceDisk(ctx context.Context, linodeID int, diskID int, label string) (*InstanceDisk, error)
- func (c *Client) RenameVolume(ctx context.Context, id int, label string) (*Volume, error)
- func (c *Client) RescueInstance(ctx context.Context, id int, opts RescueInstanceOptions) (bool, error)
- func (c *Client) ResizeInstance(ctx context.Context, id int, linodeType string) (bool, error)
- func (c *Client) ResizeInstanceDisk(ctx context.Context, linodeID int, diskID int, size int) (*InstanceDisk, error)
- func (c *Client) ResizeVolume(ctx context.Context, id int, size int) (bool, error)
- func (c Client) Resource(resourceName string) *Resource
- func (c *Client) RestoreInstanceBackup(ctx context.Context, linodeID int, backupID int, opts RestoreInstanceOptions) (bool, error)
- func (c *Client) SetBaseURL(url string) *Client
- func (c *Client) SetDebug(debug bool) *Client
- func (c *Client) SetUserAgent(ua string) *Client
- func (c *Client) ShutdownInstance(ctx context.Context, id int) (bool, error)
- func (c *Client) UpdateDomain(ctx context.Context, id int, domain DomainUpdateOptions) (*Domain, error)
- func (c *Client) UpdateDomainRecord(ctx context.Context, domainID int, id int, ...) (*DomainRecord, error)
- func (c *Client) UpdateImage(ctx context.Context, id string, updateOpts ImageUpdateOptions) (*Image, error)
- func (c *Client) UpdateInstance(ctx context.Context, id int, instance InstanceUpdateOptions) (*Instance, error)
- func (c *Client) UpdateInstanceConfig(ctx context.Context, linodeID int, configID int, ...) (*InstanceConfig, error)
- func (c *Client) UpdateInstanceDisk(ctx context.Context, linodeID int, diskID int, ...) (*InstanceDisk, error)
- func (c *Client) UpdateNodeBalancer(ctx context.Context, id int, updateOpts NodeBalancerUpdateOptions) (*NodeBalancer, error)
- func (c *Client) UpdateNodeBalancerConfig(ctx context.Context, nodebalancerID int, configID int, ...) (*NodeBalancerConfig, error)
- func (c *Client) UpdateNodeBalancerNode(ctx context.Context, nodebalancerID int, configID int, nodeID int, ...) (*NodeBalancerNode, error)
- func (c *Client) UpdateStackscript(ctx context.Context, id int, updateOpts StackscriptUpdateOptions) (*Stackscript, error)
- func (client Client) WaitForEventFinished(ctx context.Context, id interface{}, entityType EntityType, action EventAction, ...) (*Event, error)
- func (client Client) WaitForInstanceStatus(ctx context.Context, instanceID int, status InstanceStatus, timeoutSeconds int) (*Instance, error)
- func (client Client) WaitForSnapshotStatus(ctx context.Context, instanceID int, snapshotID int, ...) (*InstanceSnapshot, error)
- func (client Client) WaitForVolumeLinodeID(ctx context.Context, volumeID int, linodeID *int, timeoutSeconds int) error
- func (client Client) WaitForVolumeStatus(ctx context.Context, volumeID int, status VolumeStatus, timeoutSeconds int) (*Volume, error)
- type ConfigAlgorithm
- type ConfigCheck
- type ConfigCipher
- type ConfigProtocol
- type ConfigStickiness
- type CreditCard
- type DiskFilesystem
- type Domain
- type DomainCreateOptions
- type DomainRecord
- type DomainRecordCreateOptions
- type DomainRecordType
- type DomainRecordUpdateOptions
- type DomainRecordsPagedResponse
- type DomainStatus
- type DomainType
- type DomainUpdateOptions
- type DomainsPagedResponse
- type EntityType
- type Error
- type Event
- type EventAction
- type EventEntity
- type EventStatus
- type EventsPagedResponse
- type IPAddressesPagedResponse
- type IPv6PoolsPagedResponse
- type IPv6Range
- type IPv6RangesPagedResponse
- type Image
- type ImageCreateOptions
- type ImageUpdateOptions
- type ImagesPagedResponse
- type Instance
- type InstanceAlert
- type InstanceBackup
- type InstanceBackupSnapshotResponse
- type InstanceBackupsResponse
- type InstanceCloneOptions
- type InstanceConfig
- type InstanceConfigCreateOptions
- type InstanceConfigDevice
- type InstanceConfigDeviceMap
- type InstanceConfigHelpers
- type InstanceConfigUpdateOptions
- type InstanceConfigsPagedResponse
- type InstanceCreateOptions
- type InstanceDisk
- type InstanceDiskCreateOptions
- type InstanceDiskUpdateOptions
- type InstanceDisksPagedResponse
- type InstanceIP
- type InstanceIPAddressResponse
- type InstanceIPv4Response
- type InstanceIPv6Response
- type InstanceSnapshot
- type InstanceSnapshotDisk
- type InstanceSnapshotStatus
- type InstanceSpec
- type InstanceStatus
- type InstanceUpdateOptions
- type InstanceVolumesPagedResponse
- type InstancesPagedResponse
- type Invoice
- type InvoiceItem
- type InvoiceItemsPagedResponse
- type InvoicesPagedResponse
- type LinodeAddons
- type LinodeBackupsAddon
- type LinodeKernel
- type LinodeKernelsPagedResponse
- type LinodePrice
- type LinodeType
- type LinodeTypesPagedResponse
- type ListOptions
- type LongviewClient
- type LongviewClientsPagedResponse
- type LongviewSubscription
- type LongviewSubscriptionsPagedResponse
- type NodeBalancer
- type NodeBalancerConfig
- type NodeBalancerConfigCreateOptions
- type NodeBalancerConfigUpdateOptions
- type NodeBalancerConfigsPagedResponse
- type NodeBalancerCreateOptions
- type NodeBalancerNode
- type NodeBalancerNodeCreateOptions
- type NodeBalancerNodeStatus
- type NodeBalancerNodeUpdateOptions
- type NodeBalancerNodesPagedResponse
- type NodeBalancerTransfer
- type NodeBalancerUpdateOptions
- type NodeBalancersPagedResponse
- type NodeMode
- type Notification
- type NotificationEntity
- type NotificationsPagedResponse
- type PageOptions
- type RebuildInstanceOptions
- type Region
- type RegionsPagedResponse
- type RescueInstanceOptions
- type Resource
- type RestoreInstanceOptions
- type Stackscript
- type StackscriptCreateOptions
- type StackscriptUpdateOptions
- type StackscriptsPagedResponse
- type Ticket
- type TicketEntity
- type TicketsPagedResponse
- type Volume
- type VolumeAttachOptions
- type VolumeCreateOptions
- type VolumeStatus
- type VolumesPagedResponse
Examples ¶
- Package
- Client.CreateNodeBalancer
- Client.CreateNodeBalancerConfig
- Client.CreateNodeBalancerNode
- Client.CreateStackscript
- Client.GetAccount
- Client.GetImage (Missing)
- Client.GetKernel (Specific)
- Client.GetType (Missing)
- Client.ListImages (All)
- Client.ListImages (Badfilter)
- Client.ListImages (Notfound)
- Client.ListKernels (All)
- Client.ListKernels (AllWithOpts)
- Client.ListKernels (Filtered)
- Client.ListKernels (Page1)
- Client.ListLongviewSubscriptions (Page1)
- Client.ListStackscripts (Page1)
- Client.ListTypes (All)
Constants ¶
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.2.0" // APIEnvVar environment var to check for API token APIEnvVar = "LINODE_TOKEN" // APISecondsPerPoll how frequently to poll for new Events APISecondsPerPoll = 10 )
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 )
const ( TicketClosed = "closed" TicketOpen = "open" TicketNew = "new" )
Ticket Statuses
Variables ¶
Functions ¶
This section is empty.
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
type APIErrorReason ¶
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 ¶
NewClient factory to create new Client struct
func (*Client) AddInstanceIPAddress ¶
func (c *Client) AddInstanceIPAddress(ctx context.Context, linodeID int, public bool) (*InstanceIP, error)
AddInstanceIPAddress adds a public or private IP to a Linode instance
func (*Client) AttachVolume ¶
func (c *Client) AttachVolume(ctx context.Context, id int, options *VolumeAttachOptions) (*Volume, error)
AttachVolume attaches a volume to a Linode instance
func (*Client) BootInstance ¶
BootInstance will boot a Linode instance A configID of 0 will cause Linode to choose the last/best config
func (*Client) CancelInstanceBackups ¶ added in v0.2.0
CancelInstanceBackups Cancels backups for the specified Linode.
func (*Client) CloneInstance ¶
func (c *Client) CloneInstance(ctx context.Context, id int, options InstanceCloneOptions) (*Instance, error)
CloneInstance clone an existing Instances Disks and Configuration profiles to another Linode Instance
func (*Client) CloneVolume ¶
CloneVolume clones a Linode volume
func (*Client) CreateDomain ¶
CreateDomain creates a Domain
func (*Client) CreateDomainRecord ¶ added in v0.2.0
func (c *Client) CreateDomainRecord(ctx context.Context, domainID int, domainrecord DomainRecordCreateOptions) (*DomainRecord, error)
CreateDomainRecord creates a DomainRecord
func (*Client) CreateImage ¶ added in v0.2.0
CreateImage creates a Image
func (*Client) CreateInstance ¶
func (c *Client) CreateInstance(ctx context.Context, instance InstanceCreateOptions) (*Instance, error)
CreateInstance creates a Linode instance
func (*Client) CreateInstanceConfig ¶
func (c *Client) CreateInstanceConfig(ctx context.Context, linodeID int, createOpts InstanceConfigCreateOptions) (*InstanceConfig, error)
CreateInstanceConfig creates a new InstanceConfig for the given Instance
func (*Client) CreateInstanceDisk ¶
func (c *Client) CreateInstanceDisk(ctx context.Context, linodeID int, createOpts InstanceDiskCreateOptions) (*InstanceDisk, error)
CreateInstanceDisk creates a new InstanceDisk for the given Instance
func (*Client) CreateInstanceSnapshot ¶ added in v0.2.0
func (c *Client) CreateInstanceSnapshot(ctx context.Context, linodeID int, label string) (*InstanceSnapshot, error)
CreateInstanceSnapshot Creates or Replaces the snapshot Backup of a Linode. If a previous snapshot exists for this Linode, it will be deleted.
func (*Client) CreateNodeBalancer ¶
func (c *Client) CreateNodeBalancer(ctx context.Context, nodebalancer NodeBalancerCreateOptions) (*NodeBalancer, error)
CreateNodeBalancer creates a NodeBalancer
Example ¶
// Example readers, Ignore this bit of setup code needed to record test fixtures linodeClient, teardown := createTestClient(nil, "fixtures/ExampleCreateNodeBalancer") defer teardown() fmt.Println("## NodeBalancer create") var nbID int var nb = &linodego.NodeBalancer{ ClientConnThrottle: 20, Region: "us-east", } createOpts := nb.GetCreateOptions() nb, err := linodeClient.CreateNodeBalancer(context.Background(), createOpts) if err != nil { log.Fatal(err) } nbID = nb.ID fmt.Println("### Get") nb, err = linodeClient.GetNodeBalancer(context.Background(), nbID) if err != nil { log.Fatal(err) } updateOpts := nb.GetUpdateOptions() *updateOpts.Label += "_renamed" nb, err = linodeClient.UpdateNodeBalancer(context.Background(), nbID, updateOpts) if err != nil { log.Fatal(err) } fmt.Println("### Delete") if err := linodeClient.DeleteNodeBalancer(context.Background(), nbID); err != nil { log.Fatal(err) }
Output: ## NodeBalancer create ### Get ### Delete
func (*Client) CreateNodeBalancerConfig ¶
func (c *Client) CreateNodeBalancerConfig(ctx context.Context, nodebalancerID int, nodebalancerConfig NodeBalancerConfigCreateOptions) (*NodeBalancerConfig, error)
CreateNodeBalancerConfig creates a NodeBalancerConfig
Example ¶
// Example readers, Ignore this bit of setup code needed to record test fixtures linodeClient, teardown := createTestClient(nil, "fixtures/ExampleCreateNodeBalancerConfig") defer teardown() fmt.Println("## NodeBalancer create") clientConnThrottle := 20 nb, err := linodeClient.CreateNodeBalancer(context.Background(), linodego.NodeBalancerCreateOptions{ ClientConnThrottle: &clientConnThrottle, Region: "us-east", }) if err != nil { log.Fatal(err) } fmt.Println("## NodeBalancer Config create") createOpts := linodego.NodeBalancerConfigCreateOptions{ Port: 80, /* Protocol: linodego.ProtocolHTTP, Algorithm: linodego.AlgorithmLeastConn, Stickiness: linodego.StickinessHTTPCookie, Check: linodego.CheckHTTP, CheckInterval: 30, CheckAttempts: 5, CipherSuite: linodego.CipherRecommended, */ } nbc, err := linodeClient.CreateNodeBalancerConfig(context.Background(), nb.ID, createOpts) if err != nil { log.Fatal(err) } nbcID := nbc.ID fmt.Println("## NodeBalancer Config update") updateOpts := nbc.GetUpdateOptions() updateOpts.Port += 8000 nbc, err = linodeClient.UpdateNodeBalancerConfig(context.Background(), nb.ID, nbc.ID, updateOpts) if err != nil { log.Fatal(err) } fmt.Println("### List") configs, err := linodeClient.ListNodeBalancerConfigs(context.Background(), nb.ID, nil) if err != nil { log.Fatal(err) } fmt.Println("### Get") nbc, err = linodeClient.GetNodeBalancerConfig(context.Background(), nb.ID, configs[0].ID) if err != nil { log.Fatal(err) } fmt.Println("### Delete") if nbc.ID != nbcID { log.Fatalf("Unexpected Nodebalancer Config ID %d != %d", nbc.ID, nbcID) } if err := linodeClient.DeleteNodeBalancerConfig(context.Background(), nb.ID, nbc.ID); err != nil { log.Fatal(err) } if err := linodeClient.DeleteNodeBalancer(context.Background(), nb.ID); err != nil { log.Fatal(err) }
Output: ## NodeBalancer create ## NodeBalancer Config create ## NodeBalancer Config update ### List ### Get ### Delete
func (*Client) CreateNodeBalancerNode ¶
func (c *Client) CreateNodeBalancerNode(ctx context.Context, nodebalancerID int, configID int, createOpts NodeBalancerNodeCreateOptions) (*NodeBalancerNode, error)
CreateNodeBalancerNode creates a NodeBalancerNode
Example ¶
// Example readers, Ignore this bit of setup code needed to record test fixtures linodeClient, teardown := createTestClient(nil, "fixtures/ExampleCreateNodeBalancerNode") defer teardown() fmt.Println("## NodeBalancer create") clientConnThrottle := 20 nb, err := linodeClient.CreateNodeBalancer(context.Background(), linodego.NodeBalancerCreateOptions{ ClientConnThrottle: &clientConnThrottle, Region: "us-east", }) if err != nil { log.Fatal(err) } fmt.Println("## NodeBalancer Config create") nbc, err := linodeClient.CreateNodeBalancerConfig(context.Background(), nb.ID, linodego.NodeBalancerConfigCreateOptions{ Port: 80, }) if err != nil { log.Fatal(err) } fmt.Println("## NodeBalancer Node create") createOpts := linodego.NodeBalancerNodeCreateOptions{ Address: "192.168.129.255:80", Label: "192.168.129.255-80", } nbn, err := linodeClient.CreateNodeBalancerNode(context.Background(), nb.ID, nbc.ID, createOpts) if err != nil { log.Fatal(err) } nbnID := nbn.ID fmt.Println("## NodeBalancer Node update") updateOpts := nbn.GetUpdateOptions() updateOpts.Address = "192.168.129.0:8080" nbn, err = linodeClient.UpdateNodeBalancerNode(context.Background(), nb.ID, nbc.ID, nbn.ID, updateOpts) if err != nil { log.Fatal(err) } fmt.Println("### List") nodes, err := linodeClient.ListNodeBalancerNodes(context.Background(), nb.ID, nbc.ID, nil) if err != nil { log.Fatal(err) } fmt.Println("### Get") nbn, err = linodeClient.GetNodeBalancerNode(context.Background(), nb.ID, nbc.ID, nodes[0].ID) if err != nil { log.Fatal(err) } fmt.Println("### Delete") if nbn.ID != nbnID { log.Fatalf("Unexpected Nodebalancer Node ID %d != %d", nbn.ID, nbnID) } if err := linodeClient.DeleteNodeBalancerNode(context.Background(), nb.ID, nbc.ID, nbn.ID); err != nil { log.Fatal(err) } if err := linodeClient.DeleteNodeBalancerConfig(context.Background(), nb.ID, nbc.ID); err != nil { log.Fatal(err) } if err := linodeClient.DeleteNodeBalancer(context.Background(), nb.ID); err != nil { log.Fatal(err) }
Output: ## NodeBalancer create ## NodeBalancer Config create ## NodeBalancer Node create ## NodeBalancer Node update ### List ### Get ### Delete
func (*Client) CreateStackscript ¶
func (c *Client) CreateStackscript(ctx context.Context, createOpts StackscriptCreateOptions) (*Stackscript, error)
CreateStackscript creates a StackScript
Example ¶
// Example readers, Ignore this bit of setup code needed to record test fixtures linodeClient, teardown := createTestClient(nil, "fixtures/ExampleCreateStackscript") defer teardown() fmt.Println("## Stackscript create") var ss *linodego.Stackscript var err error for rev := 1; rev < 4; rev++ { fmt.Println("### Revision", rev) if rev == 1 { stackscript := linodego.Stackscript{}.GetCreateOptions() stackscript.Description = "description for example stackscript " + time.Now().String() // stackscript.Images = make([]string, 2, 2) stackscript.Images = []string{"linode/debian9", "linode/ubuntu18.04"} stackscript.IsPublic = false stackscript.Label = "example stackscript " + time.Now().String() stackscript.RevNote = "revision " + strconv.Itoa(rev) stackscript.Script = "#!/bin/bash\n" ss, err = linodeClient.CreateStackscript(context.Background(), stackscript) if err != nil { log.Fatal(err) } } else { update := ss.GetUpdateOptions() update.RevNote = "revision " + strconv.Itoa(rev) update.Label = strconv.Itoa(rev) + " " + ss.Label update.Script += "echo " + strconv.Itoa(rev) + "\n" ss, err = linodeClient.UpdateStackscript(context.Background(), ss.ID, update) if err != nil { log.Fatal(err) } } } fmt.Println("### Get") ss, err = linodeClient.GetStackscript(context.Background(), ss.ID) if err != nil { log.Fatal(err) } fmt.Println("### Delete") err = linodeClient.DeleteStackscript(context.Background(), ss.ID) if err != nil { log.Fatal(err) }
Output: ## Stackscript create ### Revision 1 ### Revision 2 ### Revision 3 ### Get ### Delete
func (*Client) CreateVolume ¶
CreateVolume creates a Linode Volume
func (*Client) DeleteDomain ¶
DeleteDomain deletes the Domain with the specified id
func (*Client) DeleteDomainRecord ¶ added in v0.2.0
DeleteDomainRecord deletes the DomainRecord with the specified id
func (*Client) DeleteImage ¶ added in v0.2.0
DeleteImage deletes the Image with the specified id
func (*Client) DeleteInstance ¶
DeleteInstance deletes a Linode instance
func (*Client) DeleteInstanceConfig ¶
DeleteInstanceConfig deletes a Linode InstanceConfig
func (*Client) DeleteInstanceDisk ¶
DeleteInstanceDisk deletes a Linode Instance Disk
func (*Client) DeleteNodeBalancer ¶
DeleteNodeBalancer deletes the NodeBalancer with the specified id
func (*Client) DeleteNodeBalancerConfig ¶
func (c *Client) DeleteNodeBalancerConfig(ctx context.Context, nodebalancerID int, configID int) error
DeleteNodeBalancerConfig deletes the NodeBalancerConfig with the specified id
func (*Client) DeleteNodeBalancerNode ¶
func (c *Client) DeleteNodeBalancerNode(ctx context.Context, nodebalancerID int, configID int, nodeID int) error
DeleteNodeBalancerNode deletes the NodeBalancerNode with the specified id
func (*Client) DeleteStackscript ¶
DeleteStackscript deletes the StackScript with the specified id
func (*Client) DeleteVolume ¶
DeleteVolume deletes the Volume with the specified id
func (*Client) DetachVolume ¶
DetachVolume detaches a Linode volume
func (*Client) EnableInstanceBackups ¶ added in v0.2.0
EnableInstanceBackups Enables backups for the specified Linode.
func (*Client) GetAccount ¶
GetAccount gets the contact and billing information related to the Account
Example ¶
// Example readers, Ignore this bit of setup code needed to record test fixtures linodeClient, teardown := createTestClient(nil, "fixtures/ExampleGetAccount") defer teardown() account, err := linodeClient.GetAccount(context.Background()) if err != nil { log.Fatalln("* While getting account: ", err) } fmt.Println("Account email has @:", strings.Contains(account.Email, "@"))
Output: Account email has @: true
func (*Client) GetDomain ¶
GetDomain gets the domain with the provided ID
func (*Client) GetDomainRecord ¶
GetDomainRecord gets the domainrecord with the provided ID
func (*Client) GetEvent ¶
GetEvent gets the Event with the Event ID
func (*Client) GetIPAddress ¶
GetIPAddress gets the template with the provided ID
func (*Client) GetIPv6Pool ¶
GetIPv6Pool gets the template with the provided ID
func (*Client) GetIPv6Range ¶
GetIPv6Range gets the template with the provided ID
func (*Client) GetImage ¶
GetImage gets the Image with the provided ID
Example (Missing) ¶
// Example readers, Ignore this bit of setup code needed to record test fixtures linodeClient, teardown := createTestClient(nil, "fixtures/ExampleGetImage_missing") defer teardown() _, err := linodeClient.GetImage(context.Background(), "not-found") if err != nil { if v, ok := err.(*linodego.Error); ok { fmt.Println("Request was:", v.Response.Request.URL) fmt.Println("Response was:", v.Response.Status) fmt.Println("Error was:", v) } }
Output: Request was: https://api.linode.com/v4/images/not-found Response was: 404 NOT FOUND Error was: [404] Not found
func (*Client) GetInstance ¶
GetInstance gets the instance with the provided ID
func (*Client) GetInstanceBackups ¶
func (c *Client) GetInstanceBackups(ctx context.Context, linodeID int) (*InstanceBackupsResponse, error)
GetInstanceBackups gets the Instance's available Backups. This is not called ListInstanceBackups because a single object is returned, matching the API response.
func (*Client) GetInstanceConfig ¶
func (c *Client) GetInstanceConfig(ctx context.Context, linodeID int, configID int) (*InstanceConfig, error)
GetInstanceConfig gets the template with the provided ID
func (*Client) GetInstanceDisk ¶
func (c *Client) GetInstanceDisk(ctx context.Context, linodeID int, configID int) (*InstanceDisk, error)
GetInstanceDisk gets the template with the provided ID
func (*Client) GetInstanceIPAddress ¶
func (c *Client) GetInstanceIPAddress(ctx context.Context, 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(ctx context.Context, linodeID int) (*InstanceIPAddressResponse, error)
GetInstanceIPAddresses gets the IPAddresses for a Linode instance
func (*Client) GetInstanceSnapshot ¶
func (c *Client) GetInstanceSnapshot(ctx context.Context, linodeID int, snapshotID int) (*InstanceSnapshot, error)
GetInstanceSnapshot gets the snapshot with the provided ID
func (*Client) GetInvoice ¶
GetInvoice gets the a single Invoice matching the provided ID
func (*Client) GetKernel ¶
GetKernel gets the kernel with the provided ID
Example (Specific) ¶
// Example readers, Ignore this bit of setup code needed to record test fixtures linodeClient, teardown := createTestClient(nil, "fixtures/ExampleGetKernel_specific") defer teardown() l32, err := linodeClient.GetKernel(context.Background(), "linode/latest-32bit") if err == nil { fmt.Println("Label starts:", l32.Label[0:9]) } else { log.Fatalln(err) } l64, err := linodeClient.GetKernel(context.Background(), "linode/latest-64bit") if err == nil { fmt.Println("Label starts:", l64.Label[0:9]) } else { log.Fatalln(err) } // Interference check fmt.Println("First Label still starts:", l32.Label[0:9])
Output: Label starts: Latest 32 Label starts: Latest 64 First Label still starts: Latest 32
func (*Client) GetLongviewClient ¶
GetLongviewClient gets the template with the provided ID
func (*Client) GetLongviewSubscription ¶
func (c *Client) GetLongviewSubscription(ctx context.Context, id string) (*LongviewSubscription, error)
GetLongviewSubscription gets the template with the provided ID
func (*Client) GetNodeBalancer ¶
GetNodeBalancer gets the NodeBalancer with the provided ID
func (*Client) GetNodeBalancerConfig ¶
func (c *Client) GetNodeBalancerConfig(ctx context.Context, nodebalancerID int, configID int) (*NodeBalancerConfig, error)
GetNodeBalancerConfig gets the template with the provided ID
func (*Client) GetNodeBalancerNode ¶
func (c *Client) GetNodeBalancerNode(ctx context.Context, nodebalancerID int, configID int, nodeID int) (*NodeBalancerNode, error)
GetNodeBalancerNode gets the template with the provided ID
func (*Client) GetRegion ¶
GetRegion gets the template with the provided ID
func (*Client) GetStackscript ¶
GetStackscript gets the Stackscript with the provided ID
func (*Client) GetTicket ¶
GetTicket gets a Support Ticket on the Account with the specified ID
func (*Client) GetType ¶
GetType gets the type with the provided ID
Example (Missing) ¶
ExampleGetType_missing demonstrates the Error type, which allows inspecting the request and response. Error codes will be the HTTP status code, or sub-100 for errors before the request was issued.
// Example readers, Ignore this bit of setup code needed to record test fixtures linodeClient, teardown := createTestClient(nil, "fixtures/ExampleGetType_missing") defer teardown() _, err := linodeClient.GetType(context.Background(), "missing-type") if err != nil { if v, ok := err.(*linodego.Error); ok { fmt.Println("Request was:", v.Response.Request.URL) fmt.Println("Response was:", v.Response.Status) fmt.Println("Error was:", v) } }
Output: Request was: https://api.linode.com/v4/linode/types/missing-type Response was: 404 NOT FOUND Error was: [404] Not found
func (*Client) GetVolume ¶
GetVolume gets the template with the provided ID
func (*Client) ListDomainRecords ¶
func (c *Client) ListDomainRecords(ctx context.Context, domainID int, opts *ListOptions) ([]*DomainRecord, error)
ListDomainRecords lists DomainRecords
func (*Client) ListDomains ¶
ListDomains lists Domains
func (*Client) ListEvents ¶
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(ctx context.Context, opts *ListOptions) ([]*InstanceIP, error)
ListIPAddresses lists IPAddresses
func (*Client) ListIPv6Pools ¶
ListIPv6Pools lists IPv6Pools
func (*Client) ListIPv6Ranges ¶
ListIPv6Ranges lists IPv6Ranges
func (*Client) ListImages ¶
ListImages lists Images
Example (All) ¶
// Example readers, Ignore this bit of setup code needed to record test fixtures linodeClient, teardown := createTestClient(nil, "fixtures/ExampleListImages_all") defer teardown() filterOpt := linodego.NewListOptions(0, "") images, err := linodeClient.ListImages(context.Background(), filterOpt) if err != nil { log.Fatal(err) } fmt.Println("Fetched Results/100 pages:", filterOpt.Pages > filterOpt.Results/100) fmt.Println("Fetched all results:", filterOpt.Results == len(images))
Output: Fetched Results/100 pages: true Fetched all results: true
Example (Badfilter) ¶
ExampleListImages_notfound demonstrates that an error is returned by the API and linodego when an invalid filter is provided
// Example readers, Ignore this bit of setup code needed to record test fixtures linodeClient, teardown := createTestClient(nil, "fixtures/ExampleListImages_badfilter") defer teardown() filterOpt := linodego.ListOptions{Filter: "{\"foo\":\"bar\"}"} images, err := linodeClient.ListImages(context.Background(), &filterOpt) if err == nil { log.Fatal(err) } fmt.Println("Error given on bad filter:", err) fmt.Println("Images on bad filter:", images) // TODO: nil would be better here
Output: Error given on bad filter: [400] [X-Filter] Cannot filter on foo Images on bad filter: []
Example (Notfound) ¶
ExampleListImages_notfound demonstrates that an empty slice is returned, not an error, when a filter matches no results.
// Example readers, Ignore this bit of setup code needed to record test fixtures linodeClient, teardown := createTestClient(nil, "fixtures/ExampleListImages_notfound") defer teardown() filterOpt := linodego.ListOptions{Filter: "{\"label\":\"not-found\"}"} images, err := linodeClient.ListImages(context.Background(), &filterOpt) if err != nil { log.Fatal(err) } fmt.Println("Images with Label 'not-found':", len(images))
Output: Images with Label 'not-found': 0
func (*Client) ListInstanceConfigs ¶
func (c *Client) ListInstanceConfigs(ctx context.Context, linodeID int, opts *ListOptions) ([]*InstanceConfig, error)
ListInstanceConfigs lists InstanceConfigs
func (*Client) ListInstanceDisks ¶
func (c *Client) ListInstanceDisks(ctx context.Context, linodeID int, opts *ListOptions) ([]*InstanceDisk, error)
ListInstanceDisks lists InstanceDisks
func (*Client) ListInstanceVolumes ¶
func (c *Client) ListInstanceVolumes(ctx context.Context, linodeID int, opts *ListOptions) ([]*Volume, error)
ListInstanceVolumes lists InstanceVolumes
func (*Client) ListInstances ¶
ListInstances lists linode instances
func (*Client) ListInvoiceItems ¶
func (c *Client) ListInvoiceItems(ctx context.Context, id int, opts *ListOptions) ([]*InvoiceItem, error)
ListInvoiceItems gets the invoice items associated with a specific Invoice
func (*Client) ListInvoices ¶
ListInvoices gets a paginated list of Invoices against the Account
func (*Client) ListKernels ¶
func (c *Client) ListKernels(ctx context.Context, opts *ListOptions) ([]*LinodeKernel, error)
ListKernels lists linode kernels
Example (All) ¶
ExampleListKernels_all Demonstrates how to list all Linode Kernels. Paginated responses are automatically traversed and concatenated when the ListOptions are nil
// Example readers, Ignore this bit of setup code needed to record test fixtures linodeClient, teardown := createTestClient(nil, "fixtures/ExampleListKernels_all") defer teardown() kernels, err := linodeClient.ListKernels(context.Background(), nil) if err != nil { log.Fatal(err) } // The Linode API default pagination size is 100. fmt.Println("Fetched > 100:", len(kernels) > 100)
Output: Fetched > 100: true
Example (AllWithOpts) ¶
// Example readers, Ignore this bit of setup code needed to record test fixtures linodeClient, teardown := createTestClient(nil, "fixtures/ExampleListKernels_allWithOpts") defer teardown() filterOpt := linodego.NewListOptions(0, "") kernels, err := linodeClient.ListKernels(context.Background(), filterOpt) if err != nil { log.Fatal(err) } // The Linode API default pagination size is 100. fmt.Println("Fetched > 100:", len(kernels) > 100) fmt.Println("Fetched Results/100 pages:", filterOpt.Pages > filterOpt.Results/100) fmt.Println("Fetched all results:", filterOpt.Results == len(kernels))
Output: Fetched > 100: true Fetched Results/100 pages: true Fetched all results: true
Example (Filtered) ¶
// Example readers, Ignore this bit of setup code needed to record test fixtures linodeClient, teardown := createTestClient(nil, "fixtures/ExampleListKernels_filtered") defer teardown() filterOpt := linodego.ListOptions{Filter: "{\"label\":\"Recovery - Finnix (kernel)\"}"} kernels, err := linodeClient.ListKernels(context.Background(), &filterOpt) if err != nil { log.Fatal(err) } for _, kern := range kernels { fmt.Println(kern.ID, kern.Label) }
Output: linode/finnix Recovery - Finnix (kernel) linode/finnix-legacy Recovery - Finnix (kernel)
Example (Page1) ¶
// Example readers, Ignore this bit of setup code needed to record test fixtures linodeClient, teardown := createTestClient(nil, "fixtures/ExampleListKernels_page1") defer teardown() filterOpt := linodego.NewListOptions(1, "") kernels, err := linodeClient.ListKernels(context.Background(), filterOpt) if err != nil { log.Fatal(err) } // The Linode API default pagination size is 100. fmt.Println("Fetched == 100:", len(kernels) == 100) fmt.Println("Results > 100:", filterOpt.Results > 100) fmt.Println("Pages > 1:", filterOpt.Pages > 1) k := kernels[len(kernels)-1] fmt.Println("Kernel Version in ID:", strings.Index(k.ID, k.Label) > -1)
Output: Fetched == 100: true Results > 100: true Pages > 1: true Kernel Version in ID: true
func (*Client) ListLongviewClients ¶
func (c *Client) ListLongviewClients(ctx context.Context, opts *ListOptions) ([]*LongviewClient, error)
ListLongviewClients lists LongviewClients
func (*Client) ListLongviewSubscriptions ¶
func (c *Client) ListLongviewSubscriptions(ctx context.Context, opts *ListOptions) ([]*LongviewSubscription, error)
ListLongviewSubscriptions lists LongviewSubscriptions
Example (Page1) ¶
// Example readers, Ignore this bit of setup code needed to record test fixtures linodeClient, teardown := createTestClient(nil, "fixtures/ExampleListLongviewSubscriptions_page1") defer teardown() pageOpt := linodego.ListOptions{PageOptions: &linodego.PageOptions{Page: 1}} subscriptions, err := linodeClient.ListLongviewSubscriptions(context.Background(), &pageOpt) if err != nil { log.Fatal(err) } fmt.Println("Longview Subscription Types:", len(subscriptions))
Output: Longview Subscription Types: 4
func (*Client) ListNodeBalancerConfigs ¶
func (c *Client) ListNodeBalancerConfigs(ctx context.Context, nodebalancerID int, opts *ListOptions) ([]*NodeBalancerConfig, error)
ListNodeBalancerConfigs lists NodeBalancerConfigs
func (*Client) ListNodeBalancerNodes ¶
func (c *Client) ListNodeBalancerNodes(ctx context.Context, nodebalancerID int, configID int, opts *ListOptions) ([]*NodeBalancerNode, error)
ListNodeBalancerNodes lists NodeBalancerNodes
func (*Client) ListNodeBalancers ¶
func (c *Client) ListNodeBalancers(ctx context.Context, opts *ListOptions) ([]*NodeBalancer, error)
ListNodeBalancers lists NodeBalancers
func (*Client) ListNotifications ¶
func (c *Client) ListNotifications(ctx context.Context, 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 ¶
ListRegions lists Regions
func (*Client) ListStackscripts ¶
func (c *Client) ListStackscripts(ctx context.Context, opts *ListOptions) ([]*Stackscript, error)
ListStackscripts lists Stackscripts
Example (Page1) ¶
// Example readers, Ignore this bit of setup code needed to record test fixtures linodeClient, teardown := createTestClient(nil, "fixtures/ExampleListStackscripts_page1") defer teardown() filterOpt := linodego.NewListOptions(1, "") scripts, err := linodeClient.ListStackscripts(context.Background(), filterOpt) if err != nil { log.Fatal(err) } // The Linode API default pagination size is 100. fmt.Println("Fetched == 100:", len(scripts) == 100) fmt.Println("Results > 100:", filterOpt.Results > 100) fmt.Println("Pages > 1:", filterOpt.Pages > 1) s := scripts[len(scripts)-1] fmt.Println("StackScript Script has shebang:", strings.Index(s.Script, "#!/") > -1)
Output: Fetched == 100: true Results > 100: true Pages > 1: true StackScript Script has shebang: true
func (*Client) ListTickets ¶
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(ctx context.Context, opts *ListOptions) ([]*LinodeType, error)
ListTypes lists linode types
Example (All) ¶
// Example readers, Ignore this bit of setup code needed to record test fixtures linodeClient, teardown := createTestClient(nil, "fixtures/ExampleListTypes_all") defer teardown() types, err := linodeClient.ListTypes(context.Background(), nil) if err != nil { log.Fatal(err) } fmt.Println("ID contains class:", strings.Index(types[0].ID, types[0].Class) > -1) fmt.Println("Plan has Ram:", types[0].Memory > 0)
Output: ID contains class: true Plan has Ram: true
func (*Client) ListVolumes ¶
ListVolumes lists Volumes
func (*Client) MarkEventRead ¶
MarkEventRead marks a single Event as read.
func (*Client) MarkEventsSeen ¶
MarkEventsSeen marks all Events up to and including this Event by ID as seen.
func (*Client) MutateInstance ¶
MutateInstance Upgrades a Linode to its next generation.
func (*Client) RebootInstance ¶
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(ctx context.Context, 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 ¶
RenameInstance renames an Instance
func (*Client) RenameInstanceConfig ¶
func (c *Client) RenameInstanceConfig(ctx context.Context, linodeID int, configID int, label string) (*InstanceConfig, error)
RenameInstanceConfig renames an InstanceConfig
func (*Client) RenameInstanceDisk ¶
func (c *Client) RenameInstanceDisk(ctx context.Context, linodeID int, diskID int, label string) (*InstanceDisk, error)
RenameInstanceDisk renames an InstanceDisk
func (*Client) RenameVolume ¶
RenameVolume renames the label of a Linode volume There is no UpdateVolume because the label is the only alterable field.
func (*Client) RescueInstance ¶ added in v0.2.0
func (c *Client) RescueInstance(ctx context.Context, id int, opts RescueInstanceOptions) (bool, error)
RescueInstance reboots an instance into a safe environment for performing many system recovery and disk management tasks. Rescue Mode is based on the Finnix recovery distribution, a self-contained and bootable Linux distribution. You can also use Rescue Mode for tasks other than disaster recovery, such as formatting disks to use different filesystems, copying data between disks, and downloading files from a disk via SSH and SFTP.
func (*Client) ResizeInstance ¶
ResizeInstance resizes an instance to new Linode type
func (*Client) ResizeInstanceDisk ¶
func (c *Client) ResizeInstanceDisk(ctx context.Context, linodeID int, diskID int, size int) (*InstanceDisk, error)
ResizeInstanceDisk resizes the size of the Instance disk
func (*Client) ResizeVolume ¶
ResizeVolume resizes an instance to new Linode type
func (Client) Resource ¶
Resource looks up a resource by name
func (*Client) RestoreInstanceBackup ¶ added in v0.2.0
func (c *Client) RestoreInstanceBackup(ctx context.Context, linodeID int, backupID int, opts RestoreInstanceOptions) (bool, error)
RestoreInstanceBackup Restores a Linode's Backup to the specified Linode.
func (*Client) SetDebug ¶
SetDebug sets the debug on resty's client
func (*Client) SetUserAgent ¶
SetUserAgent sets a custom user-agent for HTTP requests
func (*Client) ShutdownInstance ¶
ShutdownInstance - Shutdown an instance
func (*Client) UpdateDomain ¶
func (c *Client) UpdateDomain(ctx context.Context, id int, domain DomainUpdateOptions) (*Domain, error)
UpdateDomain updates the Domain with the specified id
func (*Client) UpdateDomainRecord ¶ added in v0.2.0
func (c *Client) UpdateDomainRecord(ctx context.Context, domainID int, id int, domainrecord DomainRecordUpdateOptions) (*DomainRecord, error)
UpdateDomainRecord updates the DomainRecord with the specified id
func (*Client) UpdateImage ¶ added in v0.2.0
func (c *Client) UpdateImage(ctx context.Context, id string, updateOpts ImageUpdateOptions) (*Image, error)
UpdateImage updates the Image with the specified id
func (*Client) UpdateInstance ¶
func (c *Client) UpdateInstance(ctx context.Context, id int, instance InstanceUpdateOptions) (*Instance, error)
UpdateInstance creates a Linode instance
func (*Client) UpdateInstanceConfig ¶
func (c *Client) UpdateInstanceConfig(ctx context.Context, linodeID int, configID int, updateOpts InstanceConfigUpdateOptions) (*InstanceConfig, error)
UpdateInstanceConfig update an InstanceConfig for the given Instance
func (*Client) UpdateInstanceDisk ¶
func (c *Client) UpdateInstanceDisk(ctx context.Context, linodeID int, diskID int, updateOpts InstanceDiskUpdateOptions) (*InstanceDisk, error)
UpdateInstanceDisk creates a new InstanceDisk for the given Instance
func (*Client) UpdateNodeBalancer ¶
func (c *Client) UpdateNodeBalancer(ctx context.Context, id int, updateOpts NodeBalancerUpdateOptions) (*NodeBalancer, error)
UpdateNodeBalancer updates the NodeBalancer with the specified id
func (*Client) UpdateNodeBalancerConfig ¶
func (c *Client) UpdateNodeBalancerConfig(ctx context.Context, nodebalancerID int, configID int, updateOpts NodeBalancerConfigUpdateOptions) (*NodeBalancerConfig, error)
UpdateNodeBalancerConfig updates the NodeBalancerConfig with the specified id
func (*Client) UpdateNodeBalancerNode ¶
func (c *Client) UpdateNodeBalancerNode(ctx context.Context, 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(ctx context.Context, id int, updateOpts StackscriptUpdateOptions) (*Stackscript, error)
UpdateStackscript updates the StackScript with the specified id
func (Client) WaitForEventFinished ¶
func (client Client) WaitForEventFinished(ctx context.Context, 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.
func (Client) WaitForInstanceStatus ¶ added in v0.2.0
func (client Client) WaitForInstanceStatus(ctx context.Context, instanceID int, status InstanceStatus, timeoutSeconds int) (*Instance, error)
WaitForInstanceStatus waits for the Linode instance to reach the desired state before returning. It will timeout with an error after timeoutSeconds.
func (Client) WaitForSnapshotStatus ¶ added in v0.2.0
func (client Client) WaitForSnapshotStatus(ctx context.Context, instanceID int, snapshotID int, status InstanceSnapshotStatus, timeoutSeconds int) (*InstanceSnapshot, error)
WaitForSnapshotStatus waits for the Snapshot to reach the desired state before returning. It will timeout with an error after timeoutSeconds.
func (Client) WaitForVolumeLinodeID ¶ added in v0.2.0
func (client Client) WaitForVolumeLinodeID(ctx context.Context, 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 (Client) WaitForVolumeStatus ¶ added in v0.2.0
func (client Client) WaitForVolumeStatus(ctx context.Context, volumeID int, status VolumeStatus, timeoutSeconds int) (*Volume, error)
WaitForVolumeStatus waits for the Volume to reach the desired state before returning. It will timeout with an error after timeoutSeconds.
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 ¶
CreditCard information associated with the Account.
type DiskFilesystem ¶ added in v0.2.0
type DiskFilesystem string
var ( FilesystemRaw DiskFilesystem = "raw" FilesystemSwap DiskFilesystem = "swap" FilesystemExt3 DiskFilesystem = "ext3" FilesystemExt4 DiskFilesystem = "ext4" FilesystemInitrd DiskFilesystem = "initrd" )
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 DomainType // 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 DomainStatus // 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 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"` // 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 DomainType `json:"type"` // 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 DomainStatus `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 DomainRecord ¶
type DomainRecord struct { ID int Type DomainRecordType 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
func (DomainRecord) GetUpdateOptions ¶ added in v0.2.0
func (d DomainRecord) GetUpdateOptions() (du DomainRecordUpdateOptions)
type DomainRecordCreateOptions ¶ added in v0.2.0
type DomainRecordCreateOptions struct { Type DomainRecordType `json:"type"` Name string `json:"name"` Target string `json:"target"` Priority *int `json:"priority,omitempty"` Weight *int `json:"weight,omitempty"` Port *int `json:"port,omitempty"` Service *string `json:"service,omitempty"` Protocol *string `json:"protocol,omitempty"` TTLSec int `json:"ttl_sec,omitempty"` // 0 is not accepted by Linode, so can be omitted Tag *string `json:"tag,omitempty"` }
type DomainRecordType ¶ added in v0.2.0
type DomainRecordType string
const ( RecordTypeA DomainRecordType = "A" RecordTypeAAAA DomainRecordType = "AAAA" RecordTypeNS DomainRecordType = "NS" RecordTypeMX DomainRecordType = "MX" RecordTypeCNAME DomainRecordType = "CNAME" RecordTypeTXT DomainRecordType = "TXT" RecordTypeSRV DomainRecordType = "SRV" RecordTypePTR DomainRecordType = "PTR" RecordTypeCAA DomainRecordType = "CAA" )
type DomainRecordUpdateOptions ¶ added in v0.2.0
type DomainRecordUpdateOptions struct { Type DomainRecordType `json:"type,omitempty"` Name string `json:"name,omitempty"` Target string `json:"target,omitempty"` Priority *int `json:"priority,omitempty"` // 0 is valid, so omit only nil values Weight *int `json:"weight,omitempty"` // 0 is valid, so omit only nil values Port *int `json:"port,omitempty"` // 0 is valid to spec, so omit only nil values Service *string `json:"service,omitempty"` Protocol *string `json:"protocol,omitempty"` TTLSec int `json:"ttl_sec,omitempty"` // 0 is not accepted by Linode, so can be omitted Tag *string `json:"tag,omitempty"` }
type DomainRecordsPagedResponse ¶
type DomainRecordsPagedResponse struct { *PageOptions Data []*DomainRecord }
DomainRecordsPagedResponse represents a paginated DomainRecord API response
type DomainStatus ¶ added in v0.2.0
type DomainStatus string
const ( DomainStatusDisabled DomainStatus = "disabled" DomainStatusActive DomainStatus = "active" DomainStatusEditMode DomainStatus = "edit_mode" DomainStatusHasErrors DomainStatus = "has_errors" )
type DomainType ¶ added in v0.2.0
type DomainType string
const ( DomainTypeMaster DomainType = "master" DomainTypeSlave DomainType = "slave" )
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 DomainType `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 DomainStatus `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 ¶
Error wraps the LinodeGo error with the relevant http.Response
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 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 `json:"is_public"` 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
func (Image) GetUpdateOptions ¶ added in v0.2.0
func (i Image) GetUpdateOptions() (iu ImageUpdateOptions)
type ImageCreateOptions ¶ added in v0.2.0
type ImageUpdateOptions ¶ added in v0.2.0
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,omitempty"` Type string `json:"type,omitempty"` // LinodeID is an optional existing instance to use as the target of the clone LinodeID int `json:"linode_id,omitempty"` Label string `json:"label,omitempty"` Group string `json:"group,omitempty"` BackupsEnabled bool `json:"backups_enabled"` Disks []int `json:"disks,omitempty"` Configs []int `json:"configs,omitempty"` }
InstanceCloneOptions is an options struct sent when Cloning an Instance
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"` Helpers *InstanceConfigHelpers `json:"helpers,omitempty"` MemoryLimit int `json:"memory_limit,omitempty"` Kernel string `json:"kernel,omitempty"` InitRD int `json:"init_rd,omitempty"` 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 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 InstanceConfigUpdateOptions ¶
type InstanceConfigUpdateOptions struct { Label string `json:"label,omitempty"` Comments string `json:"comments"` Devices InstanceConfigDeviceMap `json:"devices"` Helpers *InstanceConfigHelpers `json:"helpers,omitempty"` // MemoryLimit 0 means unlimitted, this is not omitted MemoryLimit int `json:"memory_limit"` Kernel string `json:"kernel,omitempty"` // InitRD is nullable, permit the sending of null InitRD *int `json:"init_rd"` RootDevice string `json:"root_device,omitempty"` RunLevel string `json:"run_level,omitempty"` VirtMode string `json:"virt_mode,omitempty"` }
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 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 InstanceIPAddressResponse ¶
type InstanceIPAddressResponse struct { IPv4 *InstanceIPv4Response IPv6 *InstanceIPv6Response }
type InstanceIPv4Response ¶
type InstanceIPv4Response struct { Public []*InstanceIP Private []*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 InstanceSnapshotStatus 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 InstanceSnapshotStatus ¶ added in v0.2.0
type InstanceSnapshotStatus string
var ( SnapshotPaused InstanceSnapshotStatus = "paused" SnapshotPending InstanceSnapshotStatus = "pending" SnapshotRunning InstanceSnapshotStatus = "running" SnapshotNeedsPostProcessing InstanceSnapshotStatus = "needsPostProcessing" SnapshotSuccessful InstanceSnapshotStatus = "successful" SnapshotFailed InstanceSnapshotStatus = "failed" SnapshotUserAborted InstanceSnapshotStatus = "userAborted" )
type InstanceSpec ¶
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"` WatchdogEnabled *bool `json:"watchdog_enabled,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 ¶
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 (i NodeBalancerConfig) GetCreateOptions() NodeBalancerConfigCreateOptions
func (NodeBalancerConfig) GetUpdateOptions ¶
func (i NodeBalancerConfig) GetUpdateOptions() NodeBalancerConfigUpdateOptions
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 NodeMode 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 NodeBalancerNodeUpdateOptions ¶
type NodeBalancerNodesPagedResponse ¶
type NodeBalancerNodesPagedResponse struct { *PageOptions Data []*NodeBalancerNode }
NodeBalancerNodesPagedResponse represents a paginated NodeBalancerNode API response
type NodeBalancerTransfer ¶
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 NodeMode ¶ added in v0.2.0
type NodeMode string
NodeMode is the mode a NodeBalancer should use when sending traffic to a NodeBalancer Node
var ( // ModeAccept is the NodeMode indicating a NodeBalancer Node is accepting traffic ModeAccept NodeMode = "accept" // ModeReject is the NodeMode indicating a NodeBalancer Node is not receiving traffic ModeReject NodeMode = "reject" // ModeDrain is the NodeMode indicating a NodeBalancer Node is not receiving new traffic, but may continue receiving traffic from pinned connections ModeDrain NodeMode = "drain" )
type Notification ¶
type NotificationEntity ¶
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 ¶
LinodeRegion represents a linode region object
type RegionsPagedResponse ¶
type RegionsPagedResponse struct { *PageOptions Data []*Region }
LinodeRegionsPagedResponse represents a linode API response for listing
type RescueInstanceOptions ¶ added in v0.2.0
type RescueInstanceOptions struct {
Devices InstanceConfigDeviceMap `json:"devices"`
}
type Resource ¶
type Resource struct { R func(ctx context.Context) *resty.Request PR func(ctx context.Context) *resty.Request // contains filtered or unexported fields }
Resource represents a linode API resource
type RestoreInstanceOptions ¶ added in v0.2.0
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 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 ¶
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 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
Source Files
¶
- account.go
- account_events.go
- account_invoices.go
- account_notifications.go
- client.go
- domain_records.go
- domains.go
- errors.go
- images.go
- instance_configs.go
- instance_disks.go
- instance_ips.go
- instance_snapshots.go
- instance_volumes.go
- instances.go
- kernels.go
- longview.go
- longview_subscriptions.go
- managed.go
- network_ips.go
- network_pools.go
- network_ranges.go
- nodebalancer.go
- nodebalancer_config_nodes.go
- nodebalancer_configs.go
- pagination.go
- profile.go
- regions.go
- resources.go
- stackscripts.go
- support.go
- types.go
- util.go
- volumes.go
- waitfor.go