Part of libcloud.common View Source
Abiquo Utilities Module for the Abiquo Driver. Common utilities needed by the L{AbiquoNodeDriver}.
Function | get_href | Search a RESTLink element in the L{AbiquoResponse}. |
Class | AbiquoResponse | Abiquo XML Response. |
Class | AbiquoConnection | A Connection to Abiquo API. |
Class | ForbiddenError | Exception used when credentials are ok but user has not permissions. |
Search a RESTLink element in the L{AbiquoResponse}. Abiquo, as a REST API, it offers self-discovering functionality. That means that you could walk through the whole API only navigating from the links offered by the entities. This is a basic method to find the 'relations' of an entity searching into its links. For instance, a Rack entity serialized as XML as the following:: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <rack> <link href="http://host/api/admin/datacenters/1" type="application/vnd.abiquo.datacenter+xml" rel="datacenter"/> <link href="http://host/api/admin/datacenters/1/racks/1" type="application/vnd.abiquo.rack+xml" rel="edit"/> <link href="http://host/api/admin/datacenters/1/racks/1/machines" type="application/vnd.abiquo.machines+xml" rel="machines"/> <haEnabled>false</haEnabled> <id>1</id> <longDescription></longDescription> <name>racacaca</name> <nrsq>10</nrsq> <shortDescription></shortDescription> <vlanIdMax>4094</vlanIdMax> <vlanIdMin>2</vlanIdMin> <vlanPerVdcReserved>1</vlanPerVdcReserved> <vlansIdAvoided></vlansIdAvoided> </rack> offers link to datacenters (rel='datacenter'), to itself (rel='edit') and to the machines defined in it (rel='machines') A call to this method with the 'rack' element using 'datacenter' as 'rel' will return: 'http://10.60.12.7:80/api/admin/datacenters/1' @type element: C{xml.etree.ElementTree} @param element: Xml Entity returned by Abiquo API (required) @type rel: C{string} @param rel: relation link name @rtype: C{string} @return: the 'href' value according to the 'rel' input parameter