blob: 60c7cd1879d1538565cd4f044d6d8d8e40f2a5c5 [file] [log] [blame]
Samuel A. Falvo II10decf92014-02-13 17:05:35 -08001package flavors
2
3import (
4 "github.com/rackspace/gophercloud/openstack/identity"
5)
6
7type Client struct {
Samuel A. Falvo IIe246ac02014-02-13 23:20:09 -08008 endpoint string
Samuel A. Falvo II10decf92014-02-13 17:05:35 -08009 authority identity.AuthResults
Samuel A. Falvo IIe246ac02014-02-13 23:20:09 -080010 options identity.AuthOptions
Samuel A. Falvo II10decf92014-02-13 17:05:35 -080011}
12
13func NewClient(e string, a identity.AuthResults, ao identity.AuthOptions) *Client {
14 return &Client{
Samuel A. Falvo IIe246ac02014-02-13 23:20:09 -080015 endpoint: e,
Samuel A. Falvo II10decf92014-02-13 17:05:35 -080016 authority: a,
Samuel A. Falvo IIe246ac02014-02-13 23:20:09 -080017 options: ao,
Samuel A. Falvo II10decf92014-02-13 17:05:35 -080018 }
19}
20
21func (c *Client) getListUrl() string {
22 return c.endpoint + "/flavors/detail"
23}
24
25func (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}