7
gooseerrors "launchpad.net/goose/errors"
8
goosehttp "launchpad.net/goose/http"
9
"launchpad.net/goose/identity"
16
// ErrorContextf prefixes any error stored in err with text formatted
17
// according to the format specifier. If err does not contain an error,
18
// ErrorContextf does nothing.
19
func ErrorContextf(err *error, format string, args ...interface{}) {
21
*err = errors.New(fmt.Sprintf(format, args...) + ": " + (*err).Error())
25
func getConfig(envVars ...string) (value string) {
27
for _, v := range envVars {
36
func GetEnvVars() (username, password, tenant, region, authUrl string) {
37
username = getConfig("OS_USERNAME", "NOVA_USERNAME")
38
password = getConfig("OS_PASSWORD", "NOVA_PASSWORD")
39
tenant = getConfig("OS_TENANT_NAME", "NOVA_PROJECT_ID")
40
region = getConfig("OS_REGION_NAME", "NOVA_REGION")
41
authUrl = getConfig("OS_AUTH_URL")
46
15
OS_API_TOKENS = "/tokens"
47
16
OS_API_FLAVORS = "/flavors"
63
type endpoint struct {
97
type metadata struct {
102
32
type OpenStackClient struct {
103
// URL to the OpenStack Identity service (Keystone)
104
IdentityEndpoint string
105
// Which region to use
110
Services map[string]service
116
func (c *OpenStackClient) Authenticate(username, password, tenant string) (err error) {
34
client *goosehttp.GooseHTTPClient
36
creds *identity.Credentials
37
auth identity.Authenticator
39
//TODO - store service urls by region.
40
ServiceURLs map[string]string
46
func NewOpenStackClient(creds *identity.Credentials, auth_method int) *OpenStackClient {
47
client := OpenStackClient{creds: creds}
48
client.creds.URL = client.creds.URL + OS_API_TOKENS
50
default: panic(fmt.Errorf("Invalid identity authorisation method: %d", auth_method))
51
case identity.AUTH_LEGACY:
52
client.auth = &identity.Legacy{}
53
case identity.AUTH_USERPASS:
54
client.auth = &identity.UserPass{}
59
func (c *OpenStackClient) Authenticate() (err error) {
118
if username == "" || password == "" || tenant == "" {
119
return fmt.Errorf("required argument(s) missing")
124
Username string `json:"username"`
125
Password string `json:"password"`
126
} `json:"passwordCredentials"`
127
Tenant string `json:"tenantName"`
130
req.Auth.Credentials.Username = username
131
req.Auth.Credentials.Password = password
132
req.Auth.Tenant = tenant
137
ServiceCatalog []service
143
err = c.request(POST, c.IdentityEndpoint+OS_API_TOKENS, nil, req, &resp, []int{http.StatusOK}, nil, nil, nil)
62
return fmt.Errorf("Authentication method has not been specified")
64
authDetails, err := c.auth.Auth(c.creds)
145
ErrorContextf(&err, "authentication failed")
66
gooseerrors.AddErrorContext(&err, "authentication failed")
149
c.Token = resp.Access.Token
150
c.User = resp.Access.User
151
c.Metadata = resp.Access.Metadata
152
if c.Services == nil {
153
c.Services = make(map[string]service)
155
for _, s := range resp.Access.ServiceCatalog {
156
// Filter endpoints outside our region
157
for i, e := range s.Endpoints {
158
if e.Region != c.Region {
159
s.Endpoints = append(s.Endpoints[:i], s.Endpoints[i+1:]...)
162
c.Services[s.Type] = s
70
c.TokenId = authDetails.TokenId
71
c.TenantId = authDetails.TenantId
72
c.UserId = authDetails.UserId
73
c.ServiceURLs = authDetails.ServiceURLs
167
77
func (c *OpenStackClient) IsAuthenticated() bool {
168
return c.Token.Id != ""
78
return c.TokenId != ""
171
81
type Link struct {
190
err = c.authRequest(GET, "compute", OS_API_FLAVORS, nil, nil, nil, &resp, []int{http.StatusOK}, nil, nil, nil)
100
requestData := goosehttp.RequestData{RespValue: &resp}
101
err = c.authRequest(GET, "compute", OS_API_FLAVORS, nil, &requestData)
192
ErrorContextf(&err, "failed to get list of flavors")
103
gooseerrors.AddErrorContext(&err, "failed to get list of flavors")
210
121
var resp struct {
211
122
Flavors []FlavorDetail
213
err = c.authRequest(GET, "compute", OS_API_FLAVORS_DETAIL, nil, nil, nil, &resp, []int{http.StatusOK}, nil, nil, nil)
124
requestData := goosehttp.RequestData{RespValue: &resp}
125
err = c.authRequest(GET, "compute", OS_API_FLAVORS_DETAIL, nil, &requestData)
215
ErrorContextf(&err, "failed to get list of flavors details")
127
gooseerrors.AddErrorContext(&err, "failed to get list of flavors details")
224
136
var resp struct {
227
err = c.authRequest(GET, "compute", OS_API_SERVERS, nil, nil, nil, &resp, []int{http.StatusOK}, nil, nil, nil)
139
requestData := goosehttp.RequestData{RespValue: &resp, ExpectedStatus: []int{http.StatusOK}}
140
err = c.authRequest(GET, "compute", OS_API_SERVERS, nil, &requestData)
229
ErrorContextf(&err, "failed to get list of servers")
142
gooseerrors.AddErrorContext(&err, "failed to get list of servers")
233
145
return resp.Servers, nil
255
167
var resp struct {
256
168
Servers []ServerDetail
258
err = c.authRequest(GET, "compute", OS_API_SERVERS_DETAIL, nil, nil, nil, &resp, []int{http.StatusOK}, nil, nil, nil)
170
requestData := goosehttp.RequestData{RespValue: &resp}
171
err = c.authRequest(GET, "compute", OS_API_SERVERS_DETAIL, nil, &requestData)
260
ErrorContextf(&err, "failed to get list of servers details")
173
gooseerrors.AddErrorContext(&err, "failed to get list of servers details")
270
183
Server ServerDetail
272
185
url := fmt.Sprintf("%s/%s", OS_API_SERVERS, serverId)
273
err := c.authRequest(GET, "compute", url, nil, nil, nil, &resp, []int{http.StatusOK}, nil, nil, nil)
186
requestData := goosehttp.RequestData{RespValue: &resp}
187
err := c.authRequest(GET, "compute", url, nil, &requestData)
275
ErrorContextf(&err, "failed to get details for serverId=%s", serverId)
189
gooseerrors.AddErrorContext(&err, "failed to get details for serverId=%s", serverId)
276
190
return ServerDetail{}, err
285
199
Server ServerDetail
287
201
url := fmt.Sprintf("%s/%s", OS_API_SERVERS, serverId)
288
err := c.authRequest(DELETE, "compute", url, nil, nil, nil, &resp, []int{http.StatusNoContent}, nil, nil, nil)
202
requestData := goosehttp.RequestData{RespValue: &resp, ExpectedStatus: []int{http.StatusNoContent}}
203
err := c.authRequest(DELETE, "compute", url, nil, &requestData)
290
ErrorContextf(&err, "failed to delete server with serverId=%s", serverId)
205
gooseerrors.AddErrorContext(&err, "failed to delete server with serverId=%s", serverId)
315
230
encoded := base64.StdEncoding.EncodeToString(data)
316
231
req.Server.UserData = &encoded
318
err = c.authRequest(POST, "compute", OS_API_SERVERS, nil, nil, &req, nil, []int{http.StatusAccepted}, nil, nil, nil)
233
requestData := goosehttp.RequestData{ReqValue: req, ExpectedStatus: []int{http.StatusAccepted}}
234
err = c.authRequest(POST, "compute", OS_API_SERVERS, nil, &requestData)
320
ErrorContextf(&err, "failed to run a server with %#v", opts)
236
gooseerrors.AddErrorContext(&err, "failed to run a server with %#v", opts)
346
262
var resp struct {
347
263
Groups []SecurityGroup `json:"security_groups"`
349
err = c.authRequest(GET, "compute", OS_API_SECURITY_GROUPS, nil, nil, nil, &resp, []int{http.StatusOK}, nil, nil, nil)
265
requestData := goosehttp.RequestData{RespValue: &resp}
266
err = c.authRequest(GET, "compute", OS_API_SECURITY_GROUPS, nil, &requestData)
351
ErrorContextf(&err, "failed to list security groups")
268
gooseerrors.AddErrorContext(&err, "failed to list security groups")
361
278
Groups []SecurityGroup `json:"security_groups"`
363
280
url := fmt.Sprintf("%s/%s/%s", OS_API_SERVERS, serverId, OS_API_SECURITY_GROUPS)
364
err = c.authRequest(GET, "compute", url, nil, nil, nil, &resp, []int{http.StatusOK}, nil, nil, nil)
281
requestData := goosehttp.RequestData{RespValue: &resp}
282
err = c.authRequest(GET, "compute", url, nil, &requestData)
366
ErrorContextf(&err, "failed to list server (%s) security groups", serverId)
284
gooseerrors.AddErrorContext(&err, "failed to list server (%s) security groups", serverId)
384
302
var resp struct {
385
303
SecurityGroup SecurityGroup `json:"security_group"`
387
err = c.authRequest(POST, "compute", OS_API_SECURITY_GROUPS, nil, nil, &req, &resp, []int{http.StatusOK}, nil, nil, nil)
305
requestData := goosehttp.RequestData{ReqValue: req, RespValue: &resp, ExpectedStatus: []int{http.StatusOK}}
306
err = c.authRequest(POST, "compute", OS_API_SECURITY_GROUPS, nil, &requestData)
389
ErrorContextf(&err, "failed to create a security group with name=%s", name)
308
gooseerrors.AddErrorContext(&err, "failed to create a security group with name=%s", name)
391
310
group = resp.SecurityGroup
396
315
func (c *OpenStackClient) DeleteSecurityGroup(groupId int) (err error) {
398
317
url := fmt.Sprintf("%s/%d", OS_API_SECURITY_GROUPS, groupId)
399
err = c.authRequest(DELETE, "compute", url, nil, nil, nil, nil, []int{http.StatusAccepted}, nil, nil, nil)
318
requestData := goosehttp.RequestData{ExpectedStatus: []int{http.StatusAccepted}}
319
err = c.authRequest(DELETE, "compute", url, nil, &requestData)
401
ErrorContextf(&err, "failed to delete a security group with id=%d", groupId)
321
gooseerrors.AddErrorContext(&err, "failed to delete a security group with id=%d", groupId)
424
344
SecurityGroupRule SecurityGroupRule `json:"security_group_rule"`
427
err = c.authRequest(POST, "compute", OS_API_SECURITY_GROUP_RULES, nil, nil, &req, &resp, []int{http.StatusOK}, nil, nil, nil)
347
requestData := goosehttp.RequestData{ReqValue: req, RespValue: &resp}
348
err = c.authRequest(POST, "compute", OS_API_SECURITY_GROUP_RULES, nil, &requestData)
429
ErrorContextf(&err, "failed to create a rule for the security group with id=%s", ruleInfo.GroupId)
350
gooseerrors.AddErrorContext(&err, "failed to create a rule for the security group with id=%s", ruleInfo.GroupId)
432
353
return resp.SecurityGroupRule, err
435
356
func (c *OpenStackClient) DeleteSecurityGroupRule(ruleId int) (err error) {
437
358
url := fmt.Sprintf("%s/%d", OS_API_SECURITY_GROUP_RULES, ruleId)
438
err = c.authRequest(DELETE, "compute", url, nil, nil, nil, nil, []int{http.StatusAccepted}, nil, nil, nil)
359
requestData := goosehttp.RequestData{ExpectedStatus: []int{http.StatusAccepted}}
360
err = c.authRequest(DELETE, "compute", url, nil, &requestData)
440
ErrorContextf(&err, "failed to delete a security group rule with id=%d", ruleId)
362
gooseerrors.AddErrorContext(&err, "failed to delete a security group rule with id=%d", ruleId)
453
375
req.AddSecurityGroup.Name = groupName
455
377
url := fmt.Sprintf("%s/%s/action", OS_API_SERVERS, serverId)
456
err = c.authRequest(POST, "compute", url, nil, nil, &req, nil, []int{http.StatusAccepted}, nil, nil, nil)
378
requestData := goosehttp.RequestData{ReqValue: req, ExpectedStatus: []int{http.StatusAccepted}}
379
err = c.authRequest(POST, "compute", url, nil, &requestData)
458
ErrorContextf(&err, "failed to add security group '%s' from server with id=%s", groupName, serverId)
381
gooseerrors.AddErrorContext(&err, "failed to add security group '%s' from server with id=%s", groupName, serverId)
470
393
req.RemoveSecurityGroup.Name = groupName
472
395
url := fmt.Sprintf("%s/%s/action", OS_API_SERVERS, serverId)
473
err = c.authRequest(POST, "compute", url, nil, nil, &req, nil, []int{http.StatusAccepted}, nil, nil, nil)
396
requestData := goosehttp.RequestData{ReqValue: req, ExpectedStatus: []int{http.StatusAccepted}}
397
err = c.authRequest(POST, "compute", url, nil, &requestData)
475
ErrorContextf(&err, "failed to remove security group '%s' from server with id=%s", groupName, serverId)
399
gooseerrors.AddErrorContext(&err, "failed to remove security group '%s' from server with id=%s", groupName, serverId)
491
415
FloatingIPs []FloatingIP `json:"floating_ips"`
494
err = c.authRequest(GET, "compute", OS_API_FLOATING_IPS, nil, nil, nil, &resp, []int{http.StatusOK}, nil, nil, nil)
418
requestData := goosehttp.RequestData{RespValue: &resp}
419
err = c.authRequest(GET, "compute", OS_API_FLOATING_IPS, nil, &requestData)
496
ErrorContextf(&err, "failed to list floating ips")
421
gooseerrors.AddErrorContext(&err, "failed to list floating ips")
499
424
return resp.FloatingIPs, err
508
433
url := fmt.Sprintf("%s/%d", OS_API_FLOATING_IPS, ipId)
509
err = c.authRequest(GET, "compute", url, nil, nil, nil, &resp, []int{http.StatusOK}, nil, nil, nil)
434
requestData := goosehttp.RequestData{RespValue: &resp}
435
err = c.authRequest(GET, "compute", url, nil, &requestData)
511
ErrorContextf(&err, "failed to get floating ip %d details", ipId)
437
gooseerrors.AddErrorContext(&err, "failed to get floating ip %d details", ipId)
514
440
return resp.FloatingIP, err
520
446
FloatingIP FloatingIP `json:"floating_ip"`
523
err = c.authRequest(POST, "compute", OS_API_FLOATING_IPS, nil, nil, nil, &resp, []int{http.StatusOK}, nil, nil, nil)
449
requestData := goosehttp.RequestData{RespValue: &resp}
450
err = c.authRequest(POST, "compute", OS_API_FLOATING_IPS, nil, &requestData)
525
ErrorContextf(&err, "failed to allocate a floating ip")
452
gooseerrors.AddErrorContext(&err, "failed to allocate a floating ip")
528
455
return resp.FloatingIP, err
531
458
func (c *OpenStackClient) DeleteFloatingIP(ipId int) (err error) {
533
460
url := fmt.Sprintf("%s/%d", OS_API_FLOATING_IPS, ipId)
534
err = c.authRequest(DELETE, "compute", url, nil, nil, nil, nil, []int{http.StatusAccepted}, nil, nil, nil)
461
requestData := goosehttp.RequestData{ExpectedStatus: []int{http.StatusAccepted}}
462
err = c.authRequest(DELETE, "compute", url, nil, &requestData)
536
ErrorContextf(&err, "failed to delete floating ip %d details", ipId)
464
gooseerrors.AddErrorContext(&err, "failed to delete floating ip %d details", ipId)
549
477
req.AddFloatingIP.Address = address
551
479
url := fmt.Sprintf("%s/%s/action", OS_API_SERVERS, serverId)
552
err = c.authRequest(POST, "compute", url, nil, nil, &req, nil, []int{http.StatusAccepted}, nil, nil, nil)
480
requestData := goosehttp.RequestData{ReqValue: req, ExpectedStatus: []int{http.StatusAccepted}}
481
err = c.authRequest(POST, "compute", url, nil, &requestData)
554
ErrorContextf(&err, "failed to add floating ip %s to server %s", address, serverId)
483
gooseerrors.AddErrorContext(&err, "failed to add floating ip %s to server %s", address, serverId)
567
496
req.RemoveFloatingIP.Address = address
569
498
url := fmt.Sprintf("%s/%s/action", OS_API_SERVERS, serverId)
570
err = c.authRequest(POST, "compute", url, nil, nil, &req, nil, []int{http.StatusAccepted}, nil, nil, nil)
499
requestData := goosehttp.RequestData{ReqValue: req, ExpectedStatus: []int{http.StatusAccepted}}
500
err = c.authRequest(POST, "compute", url, nil, &requestData)
572
ErrorContextf(&err, "failed to remove floating ip %s to server %s", address, serverId)
502
gooseerrors.AddErrorContext(&err, "failed to remove floating ip %s to server %s", address, serverId)
583
513
headers := make(http.Header)
584
514
headers.Add("X-Container-Read", ".r:*")
585
515
url := fmt.Sprintf("/%s", containerName)
586
err = c.authRequest(PUT, "object-store", url, nil, nil, nil, nil, []int{http.StatusAccepted, http.StatusCreated}, headers, nil, nil)
516
requestData := goosehttp.RequestData{ReqHeaders: headers, ExpectedStatus: []int{http.StatusAccepted, http.StatusCreated}}
517
err = c.authRequest(PUT, "object-store", url, nil, &requestData)
588
ErrorContextf(&err, "failed to create container %s.", containerName)
519
gooseerrors.AddErrorContext(&err, "failed to create container %s.", containerName)
594
525
func (c *OpenStackClient) DeleteContainer(containerName string) (err error) {
596
527
url := fmt.Sprintf("/%s", containerName)
597
err = c.authRequest(DELETE, "object-store", url, nil, nil, nil, nil, []int{http.StatusNoContent}, nil, nil, nil)
528
requestData := goosehttp.RequestData{ExpectedStatus: []int{http.StatusNoContent}}
529
err = c.authRequest(DELETE, "object-store", url, nil, &requestData)
599
ErrorContextf(&err, "failed to delete container %s.", containerName)
531
gooseerrors.AddErrorContext(&err, "failed to delete container %s.", containerName)
616
err = c.authRequest(HEAD, "object-store", url, nil, nil, nil, nil, []int{http.StatusOK}, nil, &headers, nil)
548
requestData := goosehttp.RequestData{ReqHeaders: headers, ExpectedStatus: []int{http.StatusOK}}
549
err = c.authRequest(HEAD, "object-store", url, nil, &requestData)
618
ErrorContextf(&err, "failed to HEAD object %s from container %s", objectName, containerName)
551
gooseerrors.AddErrorContext(&err, "failed to HEAD object %s from container %s", objectName, containerName)
621
554
return headers, nil
630
err = c.authRequest(GET, "object-store", url, nil, nil, nil, nil, []int{http.StatusOK}, nil, nil, &obj)
563
requestData := goosehttp.RequestData{RespData: &obj, ExpectedStatus: []int{http.StatusOK}}
564
err = c.authBinaryRequest(GET, "object-store", url, nil, &requestData)
632
ErrorContextf(&err, "failed to GET object %s content from container %s", objectName, containerName)
566
gooseerrors.AddErrorContext(&err, "failed to GET object %s content from container %s", objectName, containerName)
644
err = c.authRequest(DELETE, "object-store", url, nil, nil, nil, nil, []int{http.StatusAccepted}, nil, nil, nil)
578
requestData := goosehttp.RequestData{ExpectedStatus: []int{http.StatusAccepted}}
579
err = c.authRequest(DELETE, "object-store", url, nil, &requestData)
646
ErrorContextf(&err, "failed to DELETE object %s content from container %s", objectName, containerName)
581
gooseerrors.AddErrorContext(&err, "failed to DELETE object %s content from container %s", objectName, containerName)
657
err = c.authRequest(PUT, "object-store", url, nil, data, nil, nil, []int{http.StatusAccepted}, nil, nil, nil)
592
requestData := goosehttp.RequestData{ReqData: data, ExpectedStatus: []int{http.StatusAccepted}}
593
err = c.authBinaryRequest(PUT, "object-store", url, nil, &requestData)
659
ErrorContextf(&err, "failed to PUT object %s content from container %s", objectName, containerName)
595
gooseerrors.AddErrorContext(&err, "failed to PUT object %s content from container %s", objectName, containerName)
664
600
////////////////////////////////////////////////////////////////////////
665
601
// Private helpers
667
// request sends an HTTP request with the given method to the given URL,
668
// containing an optional body (serialized to JSON), and returning either
669
// an error or the (deserialized) response body
670
func (c *OpenStackClient) request(method, url string, rawReqBody []byte, body, resp interface{}, expectedStatus []int, reqHeaders http.Header, respHeaders *http.Header, rawRespBody *[]byte) (err error) {
673
c.client = &http.Client{CheckRedirect: nil}
680
if rawReqBody != nil {
681
rawReqReader := bytes.NewReader(rawReqBody)
682
req, err = http.NewRequest(method, url, rawReqReader)
683
} else if body != nil {
684
jsonBody, err = json.Marshal(body)
686
ErrorContextf(&err, "failed marshalling the request body")
690
reqBody := strings.NewReader(string(jsonBody))
691
req, err = http.NewRequest(method, url, reqBody)
693
req, err = http.NewRequest(method, url, nil)
696
ErrorContextf(&err, "failed creating the request")
699
req.Header.Add("Content-Type", "application/json")
700
req.Header.Add("Accept", "application/json")
701
if reqHeaders != nil {
702
for header, values := range reqHeaders {
703
for _, value := range values {
704
req.Header.Add(header, value)
708
if c.IsAuthenticated() {
709
req.Header.Add("X-Auth-Token", c.Token.Id)
712
rawResp, err := c.client.Do(req)
714
ErrorContextf(&err, "failed executing the request")
718
for _, status := range expectedStatus {
719
if rawResp.StatusCode == status {
724
if !foundStatus && len(expectedStatus) > 0 {
725
defer rawResp.Body.Close()
726
respBody, _ := ioutil.ReadAll(rawResp.Body)
729
"request (%s) returned unexpected status: %s; response body: %s; request body: %s",
737
respBody, err := ioutil.ReadAll(rawResp.Body)
738
defer rawResp.Body.Close()
740
ErrorContextf(&err, "failed reading the response body")
744
if len(respBody) > 0 {
745
if rawRespBody != nil {
746
*rawRespBody = respBody
747
} else if resp != nil {
748
// resp and rawRespBody are mutually exclusive
749
err = json.Unmarshal(respBody, &resp)
751
ErrorContextf(&err, "failed unmarshaling the response body: %s", respBody)
754
if respHeaders != nil {
755
*respHeaders = rawResp.Header
764
603
// makeUrl prepares a full URL to a service endpoint, with optional
765
604
// URL parts, appended to it and optional query string params. It
766
605
// uses the first endpoint it can find for the given service type
767
606
func (c *OpenStackClient) makeUrl(serviceType string, parts []string, params url.Values) (string, error) {
768
s, ok := c.Services[serviceType]
769
if !ok || len(s.Endpoints) == 0 {
607
url, ok := c.ServiceURLs[serviceType]
770
609
return "", errors.New("no endpoints known for service type: " + serviceType)
772
url := s.Endpoints[0].PublicURL
773
611
for _, part := range parts {
782
func (c *OpenStackClient) authRequest(method, svcType, apiCall string, params url.Values, rawBody []byte, body, resp interface{}, expectedStatus []int, reqHeaders http.Header, respHeaders *http.Header, respRawBody *[]byte) (err error) {
620
func (c *OpenStackClient) setupRequest(svcType, apiCall string, params url.Values, requestData *goosehttp.RequestData) (url string, err error) {
784
621
if !c.IsAuthenticated() {
785
return errors.New("not authenticated")
788
url, err := c.makeUrl(svcType, []string{apiCall}, params)
790
ErrorContextf(&err, "cannot find a '%s' node endpoint", svcType)
794
if body != nil && resp != nil {
795
err = c.request(method, url, rawBody, &body, &resp, expectedStatus, reqHeaders, respHeaders, respRawBody)
796
} else if resp != nil {
797
err = c.request(method, url, rawBody, nil, &resp, expectedStatus, reqHeaders, respHeaders, respRawBody)
798
} else if body != nil {
799
err = c.request(method, url, rawBody, &body, nil, expectedStatus, reqHeaders, respHeaders, respRawBody)
802
ErrorContextf(&err, "request failed")
622
return "", errors.New("not authenticated")
625
url, err = c.makeUrl(svcType, []string{apiCall}, params)
627
gooseerrors.AddErrorContext(&err, "cannot find a '%s' node endpoint", svcType)
632
c.client = &goosehttp.GooseHTTPClient{http.Client{CheckRedirect: nil}}
635
if requestData.ReqHeaders == nil {
636
requestData.ReqHeaders = make(http.Header)
638
requestData.ReqHeaders.Add("X-Auth-Token", c.TokenId)
642
func (c *OpenStackClient) authRequest(method, svcType, apiCall string, params url.Values, requestData *goosehttp.RequestData) (err error) {
643
url, err := c.setupRequest(svcType, apiCall, params, requestData)
647
err = c.client.JsonRequest(method, url, requestData)
651
func (c *OpenStackClient) authBinaryRequest(method, svcType, apiCall string, params url.Values, requestData *goosehttp.RequestData) (err error) {
652
url, err := c.setupRequest(svcType, apiCall, params, requestData)
656
err = c.client.BinaryRequest(method, url, requestData)