LEFT | RIGHT |
1 // The glance package provides a way to access the OpenStack Image Service APIs. | 1 // The glance package provides a way to access the OpenStack Image Service APIs. |
2 // See http://docs.openstack.org/api/openstack-image-service/2.0/content/. | 2 // See http://docs.openstack.org/api/openstack-image-service/2.0/content/. |
3 package glance | 3 package glance |
4 | 4 |
5 import ( | 5 import ( |
6 "fmt" | 6 "fmt" |
7 "launchpad.net/goose/client" | 7 "launchpad.net/goose/client" |
8 goosehttp "launchpad.net/goose/http" | 8 goosehttp "launchpad.net/goose/http" |
9 "net/http" | 9 "net/http" |
10 ) | 10 ) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 // GetImageDetail lists details of the specified image. | 89 // GetImageDetail lists details of the specified image. |
90 func (c *Client) GetImageDetail(imageId string) (*ImageDetail, error) { | 90 func (c *Client) GetImageDetail(imageId string) (*ImageDetail, error) { |
91 var resp struct { | 91 var resp struct { |
92 Image ImageDetail | 92 Image ImageDetail |
93 } | 93 } |
94 url := fmt.Sprintf("%s/%s", apiImages, imageId) | 94 url := fmt.Sprintf("%s/%s", apiImages, imageId) |
95 requestData := goosehttp.RequestData{RespValue: &resp} | 95 requestData := goosehttp.RequestData{RespValue: &resp} |
96 err := c.client.SendRequest(client.GET, "compute", url, &requestData, | 96 err := c.client.SendRequest(client.GET, "compute", url, &requestData, |
97 "failed to get details for imageId=%s", imageId) | 97 "failed to get details for imageId=%s", imageId) |
98 » return &resp.Image, err | 98 » if err != nil { |
| 99 » » return nil, err |
| 100 » } |
| 101 » return &resp.Image, nil |
99 } | 102 } |
LEFT | RIGHT |