Samuel A. Falvo II | c007c27 | 2014-02-10 20:49:26 -0800 | [diff] [blame^] | 1 | package servers |
| 2 | |
| 3 | import ( |
| 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. |
| 11 | type ListResult map[string]interface{} |
| 12 | |
| 13 | // List makes a request against the API to list servers accessible to you. |
| 14 | func 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 | |