Source code available in a git repo
git clone http://git.atxconsulting.com/linode/
and browesable at http://git.atxconsulting.com/cgi-bin/gitweb.cgi?p=linode;a=summary
I got inspired by Django and decided to implement a bit of their object model on top of the base Linode bindings. Thankfully the API is already pretty object oriented. A quick example of usage:
from oop import * for d in Domain.list(): print d.name for record in Resource.list(domain=d): print "\t%s\t%s\t%s" % (record.name, record.type, record.target)
results in
example.com A 127.0.0.1 www A 127.0.0.1 mail A 127.0.0.1 MX mail.example.com trac CNAME www.example.com svn CNAME trac.example.com
There is a class for each of the sections listed on the main API documentation page. A list (that may change in the future) of the classes currently available:
- Linode
- LinodeConfig
- LinodeDisk
- LinodeIP
- LinodeJob
- LinodePlan
- Datacenter
- Distribution
- Kernel
- Domain
- Resource
These classes (depending on their underlying abilities) have save/delete/list/get methods. To list all the configs for instance you may do: LinodeConfig.list(linode=l) where l is either a Linode object or an integer. The list() methods returns a generator object, and get() returns a specific object. There is also a builtin cache.
