WebService::Linode - Perl Interface to the Linode.com API.
my $api = WebService::Linode->new( apikey => 'your api key here'); print Dumper($api->linode_list); $api->linode_reboot(linodeid=>242);
This module implements the Linode.com api methods. Linode methods have had dots replaced with underscores to generate the perl method name. All keys and parameters have been lower cased but returned data remains otherwise the same. For additional information see http://www.linode.com/api/
For documentation of possible arguments to the constructor, see WebService::Linode::Base.
Each of the Linode API methods below may optionally be prefixed with QUEUE_ to add that request to a queue to be processed later in one or more batch requests which can be processed by calling send_queued_requests. For example:
my @linode_ids = () # Get your linode ids through normal methods my @responses = map { $api->linode_ip_list( linodeid=>$_ ) } @linode_ids;
Can be reduced to a single request:
my @linode_ids = () # Get your linode ids through normal methods $api->QUEUE_linode_ip_list( linodeid=>$_ ) for @linode_ids; my @responses = $api->send_queued_requests; # One api request
See WebService::Linode::Base for additional queue management methods.
Send queued batch requests, returns list of responses.
Estimates the invoice for adding a new Linode or NodeBalancer as well as resizing a Linode. This returns two fields: PRICE which is the estimated cost of the invoice, and INVOICE_TO which is the date invoice would be though with timezone set to America/New_York
Required Parameters:
mode
This is one of the following options: 'linode_new', 'linode_resize', or 'nodebalancer_new'.
Optional Parameters:
planid
The desired PlanID available from avail.LinodePlans(). This is required for modes 'linode_new' and 'linode_resize'.
paymentterm
Subscription term in months. One of: 1, 12, or 24. This is required for modes 'linode_new' and 'nodebalancer_new'.
linodeid
This is the LinodeID you want to resize and is required for mode 'linode_resize'.
Shows information about your account such as the date your account was opened as well as your network utilization for the current month in gigabytes.
Pays current balance on file, returning it in the response.
ccnumber
ccexpyear
ccexpmonth
Returns a list of Linode data center facilities.
Returns a list of available Linux Distributions.
distributionid
Limits the results to the specified DistributionID
List available kernels.
isxen
Limits the results to show only Xen kernels
kernelid
Returns a structure of Linode PlanIDs containing the Plan label and the availability in each Datacenter.
Limits the list to the specified PlanID
Returns NodeBalancer pricing information.
Returns a list of available public StackScripts.
keywords
Search terms
Limit the results to StackScripts that can be applied to this DistributionID
distributionvendor
Debian, Ubuntu, Fedora, etc.
Create a domain record.
domain
The zone's name
type
master or slave
soa_email
Required when type=master
axfr_ips
IP addresses allowed to AXFR the entire zone, semicolon separated
retry_sec
description
Currently undisplayed.
status
0, 1, or 2 (disabled, active, edit mode)
ttl_sec
expire_sec
master_ips
When type=slave, the zone's master DNS servers list, semicolon separated
lpm_displaygroup
Display group in the Domain list inside the Linode DNS Manager
refresh_sec
domainid
Lists domains you have access to.
Limits the list to the specified DomainID
Update a domain record.
One of: NS, MX, A, AAAA, CNAME, TXT, or SRV
target
When Type=MX the hostname. When Type=CNAME the target of the alias. When Type=TXT the value of the record. When Type=A or AAAA the token of '[remote_addr]' will be substituted with the IP address of the request.
TTL. Leave as 0 to accept our default.
port
weight
priority
Priority for MX and SRV records, 0-255
protocol
The protocol to append to an SRV record. Ignored on other record types.
name
The hostname or FQDN. When Type=MX the subdomain to delegate to the Target MX server.
resourceid
Issues a boot job for the provided ConfigID. If no ConfigID is provided boots the last used configuration profile, or the first configuration profile if this Linode has never been booted.
configid
The ConfigID to boot, available from linode.config.list().
Creates a new Linode, assigns you full privileges, and then clones the specified LinodeID to the new Linode. There is a limit of 5 active clone operations per source Linode. It is recommended that the source Linode be powered down during the clone.
The desired PlanID available from avail.LinodePlans()
The LinodeID that you want cloned
datacenterid
The DatacenterID from avail.datacenters() where you wish to place this new Linode
Subscription term in months for prepaid customers. One of: 1, 12, or 24
Creates a Linode and assigns you full privileges. There is a 75-linodes-per-hour limiter.
Immediately removes a Linode from your account and issues a pro-rated credit back to your account, if applicable. To prevent accidental deletes, this requires the Linode has no Disk images. You must first delete its disk images."
The LinodeID to delete
skipchecks
Skips the safety checks and will always delete the Linode
Returns a list of all Linodes user has access or delete to, including some properties. Status values are -1: Being Created, 0: Brand New, 1: Running, and 2: Powered Off.
Limits the list to the specified LinodeID
Upgrades a Linode to its next generation.
Issues a shutdown, and then boot job for a given LinodeID.
Resizes a Linode from one plan to another. Immediately shuts the Linode down, charges/credits the account, and issue a migration to another host server.
Issues a shutdown job for a given LinodeID.
Updates a Linode's properties.
alert_bwquota_threshold
Percentage of monthly bw quota
alert_bwin_threshold
Mb/sec
alert_cpu_threshold
CPU Alert threshold, percentage 0-800
label
This Linode's label
ms_ssh_port
Display group in the Linode list inside the Linode Manager
alert_bwin_enabled
Enable the incoming bandwidth email alert
ms_ssh_disabled
backupwindow
alert_cpu_enabled
Enable the cpu usage email alert
backupweeklyday
alert_diskio_enabled
Enable the disk IO email alert
ms_ssh_ip
alert_bwquota_enabled
Enable the bw quote email alert
ms_ssh_user
watchdog
Enable the Lassie shutdown watchdog
alert_bwout_enabled
Enable the outgoing bandwidth email alert
alert_bwout_threshold
alert_diskio_threshold
IO ops/sec
Generates a console token starting a web console LISH session for the requesting IP
Creates a Linode Configuration Profile.
The Label for this profile
disklist
A comma delimited list of DiskIDs; position reflects device node. The 9th element for specifying the initrd.
The KernelID for this profile. Found in avail.kernels()
comments
Comments you wish to save along with this profile
helper_xen
Enable the Xen filesystem helper. Corrects fstab and inittab/upstart entries depending on the kernel you're booting. You want this.
devtmpfs_automount
Controls if pv_ops kernels should automount devtmpfs at boot.
rootdevicecustom
A custom root device setting.
rootdevicero
Enables the 'ro' kernel flag. Modern distros want this.
helper_depmod
Creates an empty modprobe file for the kernel you're booting.
helper_disableupdatedb
Enable the disableUpdateDB filesystem helper
helper_network
Automatically creates network configuration files for your distro and places them into your filesystem.
rootdevicenum
Which device number (1-8) that contains the root partition. 0 to utilize RootDeviceCustom.
runlevel
One of 'default', 'single', 'binbash'
ramlimit
RAMLimit in MB. 0 for max.
Deletes a Linode Configuration Profile.
Lists a Linode's Configuration Profiles.
Updates a Linode Configuration Profile.
The display label for this Disk
The formatted type of this disk. Valid types are: ext3, ext4, swap, raw
size
The size in MB of this Disk.
rootsshkey
fromdistributionid
rootpass
isreadonly
Enable forced read-only for this Disk
Size of this disk image in MB
The root user's password
The DistributionID to create this disk from. Found in avail.distributions()
The label of this new disk image
Optionally sets this string into /root/.ssh/authorized_keys upon distribution configuration.
Creates a new disk from a previously imagized disk.
imageid
The ID of the frozen image to deploy from
Specifies the Linode to deploy on to
Optionally sets this string into /root/.ssh/authorized_keys upon image deployment
Optionally sets the root password at deployment time. If a password is not provided the existing root password of the frozen image will not be modified
The size of the disk image to creates. Defaults to the minimum size required for the requested image
stackscriptudfresponses
JSON encoded name/value pairs, answering this StackScript's User Defined Fields
Which Distribution to apply this StackScript to. Must be one from the script's DistributionIDList
stackscriptid
The StackScript to create this image from
diskid
Performs a bit-for-bit copy of a disk image.
Creates a gold-master image for future deployments
Specifies the source Disk to create the image from
Specifies the source Linode to create the image from
An optional description of the created image
Sets the name of the image shown in the base image list, defaults to the source image label
Status values are 1: Ready and 2: Being Deleted.
The requested new size of this Disk in MB
Assigns a Private IP to a Linode. Returns the IPAddressID that was added.
Assigns a Public IP to a Linode. Returns the IPAddressID and IPAddress that was added.
The LinodeID of the Linode that will be assigned an additional public IP address
Returns the IP addresses of all Linodes you have access to.
If specified, limits the result to this LinodeID
ipaddressid
If specified, limits the result to this IPAddressID
Sets the rDNS name of a Public IP. Returns the IPAddressID and IPAddress that were updated.
hostname
The hostname to set the reverse DNS to
The IPAddressID of the address to update
Exchanges Public IP addresses between two Linodes within a Datacenter. The destination of the IP Address can be designated by either the toLinodeID or withIPAddressID parameter. Returns the resulting relationship of the Linode and IP Address parameters. When performing a one directional swap, the source is represented by the first of the two resultant array members.
The IPAddressID of an IP Address to transfer or swap
tolinodeid
The LinodeID of the Linode where IPAddressID will be transfered
withipaddressid
The IP Address ID to swap
pendingonly
jobid
Limits the list to the specified JobID
Create a StackScript.
script
The actual script
distributionidlist
Comma delimited list of DistributionIDs that this script works on
The Label for this StackScript
rev_note
ispublic
Whether this StackScript is published in the Library, for everyone to use
Lists StackScripts you have access to.
Limits the list to the specified StackScriptID
Update a StackScript.
nodebalancerid
The parent NodeBalancer's ID
check_path
When check=http, the path to request
ssl_cert
SSL certificate served by the NodeBalancer when the protocol is 'https'
check_body
When check=http_body, a regex against the expected result body
stickiness
Session persistence. One of 'none', 'table', 'http_cookie'
Port to bind to on the public interfaces. 1-65534
check_timeout
Seconds to wait before considering the probe a failure. 1-30. Must be less than check_interval.
check
Perform active health checks on the backend nodes. One of 'connection', 'http', 'http_body'
ssl_key
Unpassphrased private key for the SSL certificate when protocol is 'https'
check_attempts
Number of failed probes before taking a node out of rotation. 1-30
check_interval
Seconds between health check probes. 2-3600
Either 'tcp', 'http', or 'https'
algorithm
Balancing algorithm. One of 'roundrobin', 'leastconn', 'source'
Deletes a NodeBalancer's Config
The ConfigID to delete
Returns a list of NodeBalancers this user has access or delete to, including their properties
Limits the list to the specified ConfigID
Updates a Config's properties
address
The address:port combination used to communicate with this Node
This backend Node's label
The parent ConfigID to attach this Node to
The connections mode for this node. One of 'accept', 'reject', or 'drain'
Load balancing weight, 1-255. Higher means more connections.
Deletes a Node from a NodeBalancer Config
nodeid
The NodeID to delete
Returns a list of Nodes associated with a NodeBalancer Config
Limits the list to the specified NodeID
Updates a Node's properties
Authenticates a Linode Manager user against their username, password, and two-factor token (when enabled), and then returns a new API key, which can be used until it expires. The number of active keys is limited to 20.
password
username
An optional label for this key.
token
Required when two-factor authentication is enabled.
expires
Number of hours the key will remain valid, between 0 and 8760. 0 means no expiration. Defaults to 168.
Deletes a gold-master image
The ID of the gold-master image to delete
Lists available gold-master images
Request information for a specific gold-master image
pending
Show images currently being created.
Update an Image record.
The ID of the Image to modify.
The label of the Image.
An optional description of the Image.
Michael Greb, <michael@thegrebs.com>
<michael@thegrebs.com>
Stan "The Man" Schwertly <stan@schwertly.com>
<stan@schwertly.com>
Copyright 2008-2014 Michael Greb, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install WebService::Linode, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::Linode
CPAN shell
perl -MCPAN -e shell install WebService::Linode
For more information on module installation, please visit the detailed CPAN module installation guide.