Samuel A. Falvo II | 17ae565 | 2014-02-12 20:47:43 -0800 | [diff] [blame] | 1 | package images |
| 2 | |
| 3 | import ( |
| 4 | "github.com/rackspace/gophercloud/openstack/identity" |
| 5 | ) |
| 6 | |
| 7 | type Client struct { |
Samuel A. Falvo II | e246ac0 | 2014-02-13 23:20:09 -0800 | [diff] [blame^] | 8 | endpoint string |
Samuel A. Falvo II | 17ae565 | 2014-02-12 20:47:43 -0800 | [diff] [blame] | 9 | authority identity.AuthResults |
Samuel A. Falvo II | e246ac0 | 2014-02-13 23:20:09 -0800 | [diff] [blame^] | 10 | options identity.AuthOptions |
Samuel A. Falvo II | 17ae565 | 2014-02-12 20:47:43 -0800 | [diff] [blame] | 11 | } |
| 12 | |
| 13 | func NewClient(e string, a identity.AuthResults, ao identity.AuthOptions) *Client { |
| 14 | return &Client{ |
Samuel A. Falvo II | e246ac0 | 2014-02-13 23:20:09 -0800 | [diff] [blame^] | 15 | endpoint: e, |
Samuel A. Falvo II | 17ae565 | 2014-02-12 20:47:43 -0800 | [diff] [blame] | 16 | authority: a, |
Samuel A. Falvo II | e246ac0 | 2014-02-13 23:20:09 -0800 | [diff] [blame^] | 17 | options: ao, |
Samuel A. Falvo II | 17ae565 | 2014-02-12 20:47:43 -0800 | [diff] [blame] | 18 | } |
| 19 | } |
| 20 | |
| 21 | func (c *Client) getListUrl() string { |
| 22 | return c.endpoint + "/images/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 | } |