api.Api = class Api
    Linode API (version 2) client class.
 
Instantiate with: Api(), or Api(optional parameters)
 
Optional parameters:
      key - Your API key, from "My Profile" in the LPM (default: None)
      batching - Enable batching support (default: False)
 
This interfaces with the Linode API (version 2) and receives a response
via JSON, which is then parsed and returned as a dictionary (or list
of dictionaries).
 
In the event of API problems, raises ApiError:
      api.ApiError: [{u'ERRORCODE': 99,
                      u'ERRORMESSAGE': u'Error Message'}]
 
If you do not specify a key, the only method you may use is
user_getapikey(username, password).  This will retrieve and store
the API key for a given user.
 
Full documentation on the API can be found from Linode at:
      http://www.linode.com/api/
 
  Methods defined here:
__getattr__(self, name)
Return a callable for any undefined attribute and assume it's an API call
__init__(self, key=None, batching=False)
avail_datacenters(self, **kw)
Returns a list of Linode data center facilities.
 
Returns list of dictionaries:
    [{
      DATACENTERID: Datacenter ID
      LOCATION    : City, ST, USA
     }, ...]
avail_distributions(self, **kw)
Returns a list of available Linux Distributions.
 
Returns list of dictionaries:
    [{
      IS64BIT       : 0 or 1
      CREATE_DT     : YYYY-MM-DD hh:mm:ss.0
      DISTRIBUTIONID: Distribution ID
      MINIMAGESIZE  : MB required to deploy image
      LABEL         : Description of image
     }, ...]
avail_kernels(self, **kw)
List available kernels.
 
Keyword arguments (* = required):
      isXen
 
Returns list of dictionaries:
    [{
      KERNELID: Kernel ID
      ISXEN   : 0 or 1
      LABEL   : kernel version string
     }, ...]
avail_linodeplans(self, **kw)
Returns a structure of Linode PlanIDs containing PlanIDs, and
their availability in each datacenter.
 
Returns list of dictionaries:
    [{
      DISK  : Maximum disk allocation (GB)
      PRICE : Price (US dollars)
      RAM   : Maximum memory (MB)
      PLANID: Plan ID
      LABEL : Name of plan
      AVAIL : {u'Datacenter ID': 'Quantity'}
      XFER  : Allowed transfer (GB/mo)
     }, ...]
avail_stackscripts(self, **kw)
Returns a list of publicly available StackScript.
 
Keyword arguments (* = required):
      StackScriptID
      DistributionID
      DistributionVendor
      keywords
 
Returns list of dictionaries:
    [{
      DEPLOYMENTSACTIVE : The number of Scripts that Depend on this Script
      REV_NOTE          : Comment regarding this revision
      LABEL             : test
      LATESTREV         : The number of the latest revision
      DEPLOYMENTSTOTAL  : Number of times this script has been deployed
      CREATE_DT         : 'yyyy-mm-dd hh:mm:ss.0'
      REV_DT            : 'yyyy-mm-dd hh:mm:ss.0'
      DESCRIPTION       : User defined description of the script
      SCRIPT            : The actual source of the script
      ISPUBLIC          : 0 or 1
      DISTRIBUTIONIDLIST: Comma separated list of distributions this script is available
      STACKSCRIPTID     : StackScript ID
     }, ...]
batchFlush(self)
Initiates a batch flush.  Raises Exception if not in batching mode.
domain_create(self, **kw)
Create a new domain.
 
For type='master', SOA_Email is required.
For type='slave', Master_IPs is required.
 
Master_IPs is a comma or semicolon-delimited list of master IPs.
Status is 1 (Active), 2 (EditMode), or 3 (Off).
 
TTL values are rounded up to the nearest valid value:
300, 3600, 7200, 14400, 28800, 57600, 86400, 172800,
345600, 604800, 1209600, or 2419200 seconds.
 
Keyword arguments (* = required):
     *Domain
     *Type
      SOA_Email
      Refresh_sec
      Retry_sec
      Expire_sec
      TTL_sec
      status
      master_ips
 
Returns dictionary:
     {
      DomainID: Domain ID number
     }
domain_delete(self, **kw)
Deletes a given domain, by domainid.
 
Keyword arguments (* = required):
     *DomainID
 
Returns dictionary:
     {
      DomainID: Domain ID number
     }
domain_list(self, **kw)
Returns a list of domains associated with this account.
 
Keyword arguments (* = required):
      DomainID
 
Returns list of dictionaries:
    [{
      STATUS     : Status flag
      RETRY_SEC  : SOA Retry field
      DOMAIN     : Domain name
      DOMAINID   : Domain ID number
      SOA_EMAIL  : SOA e-mail address (user@domain)
      REFRESH_SEC: SOA Refresh field
      EXPIRE_SEC : SOA Expire field
      TTL_SEC    : Default TTL
      DESCRIPTION: Description
      MASTER_IPS : Master nameservers (for slave zones)
      TYPE       : Type of zone (master or slave)
     }, ...]
domain_resource_create(self, **kw)
Creates a resource within a given DomainID.
 
TTL values are rounded up to the nearest valid value:
300, 3600, 7200, 14400, 28800, 57600, 86400, 172800,
345600, 604800, 1209600, or 2419200 seconds.
 
For A and AAAA records, specify Target as "[remote_addr]" to
use the source IP address of the request as the target, e.g.
for updating pointers to dynamic IP addresses.
 
Keyword arguments (* = required):
     *DomainID
     *Type
      Name
      Target
      Priority
      Weight
      Port
      Protocol
      TTL_Sec
 
Returns dictionary:
     {
      ResourceID: Resource ID number
     }
domain_resource_delete(self, **kw)
Deletes a Resource from a Domain.
 
Keyword arguments (* = required):
     *DomainID
     *ResourceID
 
Returns dictionary:
     {
      ResourceID: Resource ID number
     }
domain_resource_list(self, **kw)
List the resources associated with a given DomainID.
 
Keyword arguments (* = required):
     *DomainID
      ResourceID
 
Returns list of dictionaries:
    [{
      PRIORITY  : Priority (for MX, SRV)
      DOMAINID  : Domain ID number
      PROTOCOL  : Protocol (for SRV)
      TTL_SEC   : TTL for record (0=default)
      WEIGHT    : Weight (for SRV)
      TARGET    : The "right hand side" of the record
      RESOURCEID: Resource ID number
      TYPE      : Resource Type (A, MX, etc)
      PORT      : Port (for SRV)
      NAME      : The hostname or FQDN
     }, ...]
domain_resource_update(self, **kw)
Updates a domain resource.
 
TTL values are rounded up to the nearest valid value:
300, 3600, 7200, 14400, 28800, 57600, 86400, 172800,
345600, 604800, 1209600, or 2419200 seconds.
 
For A and AAAA records, specify Target as "[remote_addr]" to
use the source IP address of the request as the target, e.g.
for updating pointers to dynamic IP addresses.
 
Keyword arguments (* = required):
     *DomainID
     *ResourceID
      Name
      Target
      Priority
      Weight
      Port
      Protocol
      TTL_Sec
 
Returns dictionary:
     {
      ResourceID: Resource ID number
     }
domain_update(self, **kw)
Updates the parameters of a given domain.
 
TTL values are rounded up to the nearest valid value:
300, 3600, 7200, 14400, 28800, 57600, 86400, 172800,
345600, 604800, 1209600, or 2419200 seconds.
 
Keyword arguments (* = required):
     *DomainID
      Domain
      Type
      SOA_Email
      Refresh_sec
      Retry_sec
      Expire_sec
      TTL_sec
      status
      master_ips
 
Returns dictionary:
     {
      DomainID: Domain ID number
     }
linode_boot(self, **kw)
Submit a boot job for a Linode.
 
On job submission, returns the job ID.  Does not wait for job
completion (see linode_job_list).
 
Keyword arguments (* = required):
     *LinodeID
      ConfigID
 
Returns dictionary:
     {
      JobID: Job ID
     }
linode_config_create(self, **kw)
Creates a configuration profile.
 
Keyword arguments (* = required):
     *LinodeID
     *KernelID
     *Label
     *Disklist
      Comments
      RAMLimit
      RunLevel
      RootDeviceNum
      RootDeviceCustom
      RootDeviceRO
      helper_disableUpdateDB
      helper_xen
      helper_depmod
 
Returns dictionary:
     {
      ConfigID: Config ID
     }
linode_config_delete(self, **kw)
Deletes a configuration profile.  This does not delete the
Linode itself, nor its disk images (see linode_disk_delete,
linode_delete).
 
Keyword arguments (* = required):
     *LinodeID
     *ConfigID
 
Returns dictionary:
     {
      ConfigID: Config ID
     }
linode_config_list(self, **kw)
Lists all configuration profiles for a given Linode.
 
Keyword arguments (* = required):
     *LinodeID
 
Returns list of dictionaries:
    [{
      RAMLimit              : Max memory (MB), 0 is unlimited
      LinodeID              : Linode ID
      RootDeviceRO          : 0 or 1
      helper_disableUpdateDB: 0 or 1
      Label                 : Profile name
      RootDeviceNum         : root partition (1=first, 0=RootDeviceCustom)
      Comments              : comments field
      ConfigID              : Config ID
      RootDeviceCustom      : 
      helper_libtls         : 0 or 1
      DiskList              : ',,,,,,,,' disk array
      RunLevel              : in ['default', 'single', 'binbash'
      KernelID              : Kernel ID
      helper_xen            : 0 or 1
      helper_depmod         : 0 or 1
     }, ...]
linode_config_update(self, **kw)
Updates a configuration profile.
 
Keyword arguments (* = required):
     *LinodeID
     *ConfigID
      KernelID
      Label
      Comments
      RAMLimit
      DiskList
      RunLevel
      RootDeviceNum
      RootDeviceCustom
      RootDeviceRO
      helper_disableUpdateDB
      helper_xen
      helper_depmod
 
Returns dictionary:
     {
      ConfigID: Config ID
     }
linode_create(self, **kw)
Create a new Linode.
 
This will create a billing event.
 
Keyword arguments (* = required):
     *DatacenterID
     *PlanID
     *PaymentTerm
 
Returns dictionary:
     {
      LinodeID: New Linode ID
     }
linode_delete(self, **kw)
Completely, immediately, and totally deletes a Linode.
Requires all disk images be deleted first, or that the optional
skipChecks parameter be set.
 
This will create a billing event.
 
WARNING: Deleting your last Linode may disable services that
require a paid account (e.g. DNS hosting).
 
Keyword arguments (* = required):
     *LinodeID
      skipChecks
 
Returns dictionary:
     {
      LinodeID: Destroyed Linode ID
     }
linode_disk_create(self, **kw)
Submits a job to create a new disk image.
 
On job submission, returns the disk ID and job ID.  Does not
wait for job completion (see linode_job_list).
 
Keyword arguments (* = required):
     *LinodeID
     *Type
     *Size
     *Label
      isReadOnly
 
Returns dictionary:
     {
      DiskID: Disk ID
      JobID : Job ID
     }
linode_disk_createfromdistribution(self, **kw)
Submits a job to create a disk image from a Linode template.
 
On job submission, returns the disk ID and job ID.  Does not
wait for job completion (see linode_job_list).
 
Keyword arguments (* = required):
     *LinodeID
     *DistributionID
     *rootPass
     *Label
     *Size
      rootSSHKey
 
Returns dictionary:
     {
      DiskID: New Disk ID
      JobID : Job ID
     }
linode_disk_delete(self, **kw)
Submits a job to delete a disk image.
 
WARNING: All data on the disk image will be lost forever.
 
On job submission, returns the disk ID and job ID.  Does not
wait for job completion (see linode_job_list).
 
Keyword arguments (* = required):
     *LinodeID
     *DiskID
 
Returns dictionary:
     {
      DiskID: Deleted Disk ID
      JobID : Job ID
     }
linode_disk_duplicate(self, **kw)
Submits a job to preform a bit-for-bit copy of a disk image.
 
On job submission, returns the disk ID and job ID.  Does not
wait for job completion (see linode_job_list).
 
Keyword arguments (* = required):
     *LinodeID
     *DiskID
 
Returns dictionary:
     {
      DiskID: New Disk ID
      JobID : Job ID
     }
linode_disk_list(self, **kw)
Lists all disk images associated with a Linode.
 
Keyword arguments (* = required):
     *LinodeID
 
Returns list of dictionaries:
    [{
      STATUS    : Status flag
      CREATE_DT : YYYY-MM-DD hh:mm:ss.0
      LINODEID  : Linode ID
      UPDATE_DT : YYYY-MM-DD hh:mm:ss.0
      ISREADONLY: 0 or 1
      SIZE      : Size of disk (MB)
      TYPE      : in ['ext3', 'swap', 'raw']
      DISKID    : Disk ID
      LABEL     : Disk label
     }, ...]
linode_disk_resize(self, **kw)
Submits a job to resize a partition.
 
On job submission, returns the disk ID and job ID.  Does not
wait for job completion (see linode_job_list).
 
Keyword arguments (* = required):
     *LinodeID
     *DiskID
     *Size
 
Returns dictionary:
     {
      DiskID: Disk ID
      JobID : Job ID
     }
linode_disk_update(self, **kw)
Updates the information about a disk image.
 
Keyword arguments (* = required):
     *LinodeID
     *DiskID
      Label
      isReadOnly
 
Returns dictionary:
     {
      DiskID: Disk ID
     }
linode_ip_list(self, **kw)
Lists a Linode's IP addresses.
 
Keyword arguments (* = required):
     *LinodeID
      IPAddressID
 
Returns list of dictionaries:
    [{
      RDNS_NAME  : reverse.dns.name.here
      ISPUBLIC   : 0 or 1
      IPADDRESS  : 192.168.100.1
      IPADDRESSID: IP address ID
      LINODEID   : Linode ID
     }, ...]
linode_job_list(self, **kw)
Returns the contents of the job queue.
 
Keyword arguments (* = required):
     *LinodeID
      pendingOnly
      JobID
 
Returns list of dictionaries:
    [{
      DURATION      : Duration spent processing or ''
      HOST_SUCCESS  : 1 or ''
      LINODEID      : Linode ID
      HOST_FINISH_DT: 'yyyy-mm-dd hh:mm:ss.0' or ''
      ACTION        : API action (e.g. u'linode.create')
      ENTERED_DT    : yyyy-mm-dd hh:mm:ss.0
      JOBID         : Job ID
      LABEL         : Description of job
      HOST_MESSAGE  : response from host
      HOST_START_DT : 'yyyy-mm-dd hh:mm:ss.0' or ''
     }, ...]
linode_list(self, **kw)
List information about your Linodes.
 
Status flag values:
  -2: Boot Failed (not in use)
  -1: Being Created
   0: Brand New
   1: Running
   2: Powered Off
   3: Shutting Down (not in use)
   4: Saved to Disk (not in use)
 
Keyword arguments (* = required):
      LinodeID
 
Returns list of dictionaries:
    [{
      ALERT_DISKIO_ENABLED   : 0 or 1
      BACKUPWEEKLYDAY        : 0..6 (day of week, 0 = Sunday)
      LABEL                  : linode label
      DATACENTERID           : Datacenter ID
      ALERT_BWOUT_ENABLED    : 0 or 1
      ALERT_CPU_THRESHOLD    : 0..400 (% CPU)
      TOTALHD                : available disk (GB)
      ALERT_BWQUOTA_THRESHOLD: 0..100
      ALERT_BWQUOTA_ENABLED  : 0 or 1
      TOTALXFER              : available bandwidth (GB/month)
      STATUS                 : Status flag
      ALERT_BWIN_ENABLED     : 0 or 1
      ALERT_BWIN_THRESHOLD   : integer (Mb/sec?)
      ALERT_DISKIO_THRESHOLD : integer (IO ops/sec?)
      WATCHDOG               : 0 or 1
      LINODEID               : Linode ID
      ALERT_CPU_ENABLED      : 0 or 1
      TOTALRAM               : available RAM (MB)
      LPM_DISPLAYGROUP       : group label
      ALERT_BWOUT_THRESHOLD  : integer (Mb/sec?)
      BACKUPSENABLED         : 0 or 1
      BACKUPWINDOW           : some integer
     }, ...]
linode_reboot(self, **kw)
Submit a reboot job for a Linode.
 
On job submission, returns the job ID.  Does not wait for job
completion (see linode_job_list).
 
Keyword arguments (* = required):
     *LinodeID
      ConfigID
 
Returns dictionary:
     {
      JobID: Job ID
     }
linode_resize(self, **kw)
Resize a Linode from one plan to another.
 
Immediately shuts the Linode down, charges/credits the account, and
issues a migration to an appropriate host server.
 
Keyword arguments (* = required):
     *LinodeID
     *PlanID
linode_shutdown(self, **kw)
Submit a shutdown job for a Linode.
 
On job submission, returns the job ID.  Does not wait for job
completion (see linode_job_list).
 
Keyword arguments (* = required):
     *LinodeID
 
Returns dictionary:
     {
      JobID: Job ID
     }
linode_update(self, **kw)
Update information about, or settings for, a Linode.
 
See linode_list.__doc__ for information on parameters.
 
Keyword arguments (* = required):
     *LinodeID
      Label
      lpm_displayGroup
      Alert_cpu_enabled
      Alert_cpu_threshold
      Alert_diskio_enabled
      Alert_diskio_threshold
      Alert_bwin_enabled
      Alert_bwin_threshold
      Alert_bwout_enabled
      Alert_bwout_threshold
      Alert_bwquota_enabled
      Alert_bwquota_threshold
      backupWindow
      backupWeeklyDay
      watchdog
 
Returns dictionary:
     {
      LinodeID: LinodeID
     }
stackscript_create(self, **kw)
Create a StackScript
 
Keyword arguments (* = required):
     *Label
     *DistributionIDList
     *script
      Description
      isPublic
      rev_note
 
Returns dictionary:
     {
      STACKSCRIPTID: ID of the created StackScript
     }
stackscript_delete(self, **kw)
Delete an existing StackScript
 
Keyword arguments (* = required):
     *StackScriptID
stackscript_list(self, **kw)
List StackScripts you have created.
 
Keyword arguments (* = required):
      StackScriptID
 
Returns list of dictionaries:
    [{
      DEPLOYMENTSACTIVE : The number of Scripts that Depend on this Script
      REV_NOTE          : Comment regarding this revision
      LABEL             : test
      LATESTREV         : The number of the latest revision
      DEPLOYMENTSTOTAL  : Number of times this script has been deployed
      CREATE_DT         : 'yyyy-mm-dd hh:mm:ss.0'
      REV_DT            : 'yyyy-mm-dd hh:mm:ss.0'
      DESCRIPTION       : User defined description of the script
      SCRIPT            : The actual source of the script
      ISPUBLIC          : 0 or 1
      DISTRIBUTIONIDLIST: Comma separated list of distributions this script is available
      STACKSCRIPTID     : StackScript ID
     }, ...]
stackscript_update(self, **kw)
Update an existing StackScript
 
Keyword arguments (* = required):
     *StackScriptID
      Label
      Description
      DistributionIDList
      isPublic
      rev_note
      script
user_getapikey(self, **kw)
Given a username and password, returns the user's API key.  The
key is remembered by this instance for future use.
 
Please be advised that this will replace any previous key stored
by the instance.
 
Keyword arguments (* = required):
     *username
     *password
 
Returns dictionary:
     {
      USERNAME: Username
      API_KEY : API key
     }

Static methods defined here:
valid_commands()
Returns a list of API commands supported by this class.
valid_params()
Returns a list of all parameters used by methods of this class.