blob: 0c49159f926a6561d83dd5ce5cd0ee9908501cf0 [file] [log] [blame]
Samuel A. Falvo IIc007c272014-02-10 20:49:26 -08001package servers
2
3import (
4 "github.com/racker/perigee"
5)
6
7// ListResult abstracts the raw results of making a List() request against the
8// API. As OpenStack extensions may freely alter the response bodies of
9// structures returned to the client, you may only safely access the data
10// provided through separate, type-safe accessors or methods.
11type ListResult map[string]interface{}
12
13// List makes a request against the API to list servers accessible to you.
14func List(c *Client) (ListResult, error) {
15 var lr ListResult
16
17 h, err := c.getListHeaders()
18 if err != nil {
19 return nil, err
20 }
21
22 err = perigee.Get(c.getListUrl(), perigee.Options{
23 Results: &lr,
24 MoreHeaders: h,
25 })
26 return lr, err
27}
28