Samuel A. Falvo II | 10decf9 | 2014-02-13 17:05:35 -0800 | [diff] [blame^] | 1 | package flavors |
| 2 | |
| 3 | import ( |
| 4 | "github.com/rackspace/gophercloud/openstack/identity" |
| 5 | ) |
| 6 | |
| 7 | type Client struct { |
| 8 | endpoint string |
| 9 | authority identity.AuthResults |
| 10 | options identity.AuthOptions |
| 11 | } |
| 12 | |
| 13 | func NewClient(e string, a identity.AuthResults, ao identity.AuthOptions) *Client { |
| 14 | return &Client{ |
| 15 | endpoint: e, |
| 16 | authority: a, |
| 17 | options: ao, |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | func (c *Client) getListUrl() string { |
| 22 | return c.endpoint + "/flavors/detail" |
| 23 | } |
| 24 | |
| 25 | func (c *Client) getListHeaders() (map[string]string, error) { |
| 26 | t, err := identity.GetToken(c.authority) |
| 27 | if err != nil { |
| 28 | return map[string]string{}, err |
| 29 | } |
| 30 | |
| 31 | return map[string]string{ |
| 32 | "X-Auth-Token": t.Id, |
| 33 | }, nil |
| 34 | } |
| 35 | |