API support for looking up compute resource networks, clusters, volumes etc

As a follow on from my post in the Foreman users group:

https://groups.google.com/forum/#!topic/foreman-users/wzRlD4ZB83k

I want to ability from the Foreman API to access compute resource
information such as cluster, network interface & volume information.

Since some of these concepts are handled differently across the various
resource types, what's the best way of implementing this?

Similar to the available_images call, I was thinking along the lines of
adding something like:

GET /api/compute_resources/:id/networks
GET /api/compute_resources/:id/clusters
GET /api/compute_resources/:id/volumes

Adding top level methods to the compute_resource model class and then
having each individual compute resource class override it (Ovirt in my
case).

Thoughts?

That makes sense - you'll probably find some of it is already access
from Fog and is used in our UI forms (e.g.
app/views/compute_resources_vms/form.

You can also use RABL in the API to customise the response for different
compute resources types, see app/views/api/v2/compute_resources/ for
examples.

··· On 27/01/14 16:06, James Netherton wrote: > As a follow on from my post in the Foreman users group: > > https://groups.google.com/forum/#!topic/foreman-users/wzRlD4ZB83k > > I want to ability from the Foreman API to access compute resource > information such as cluster, network interface & volume information. > > Since some of these concepts are handled differently across the various > resource types, what's the best way of implementing this? > > Similar to the available_images call, I was thinking along the lines of > adding something like: > > GET /api/compute_resources/:id/networks > GET /api/compute_resources/:id/clusters > GET /api/compute_resources/:id/volumes > > Adding top level methods to the compute_resource model class and then > having each individual compute resource class override it (Ovirt in my > case).


Dominic Cleal
Red Hat Engineering