Implement images.Get(). Image tests now pass.
diff --git a/openstack/compute/v2/images/requests.go b/openstack/compute/v2/images/requests.go
index 832979c..8736382 100644
--- a/openstack/compute/v2/images/requests.go
+++ b/openstack/compute/v2/images/requests.go
@@ -1,6 +1,7 @@
package images
import (
+ "github.com/racker/perigee"
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/pagination"
)
@@ -32,6 +33,10 @@
return images[len(images)-1].ID, nil
}
+// GetResult opaquely stores the result of a Get call.
+// Use ExtractImage() to translate it into this provider's version of an Image structure.
+type GetResult map[string]interface{}
+
// List enumerates the available images.
func List(client *gophercloud.ServiceClient) pagination.Pager {
createPage := func(r pagination.LastHTTPResponse) pagination.Page {
@@ -42,3 +47,15 @@
return pagination.NewPager(client, getListURL(client), createPage)
}
+
+// Get acquires additional detail about a specific image by ID.
+// Use ExtractImage() to intepret the result as an openstack Image.
+func Get(client *gophercloud.ServiceClient, id string) (GetResult, error) {
+ var result GetResult
+ _, err := perigee.Request("GET", getImageURL(client, id), perigee.Options{
+ MoreHeaders: client.Provider.AuthenticatedHeaders(),
+ Results: &result,
+ OkCodes: []int{200},
+ })
+ return result, err
+}