Add support for Listing Servers.
Up to now, all you could do is authenticate with Gophercloud. Now, you
can list your servers too!
This is a pretty straight-ahead port of logic from Gorax to Gophercloud.
After you gain access to the ComputeApi, you simply invoke
ListServers(). This returns a slice of Server structures, one each for
the servers your account has access to. See the 02-list-servers.go
acceptance test.
Note that no unit-level tests exist for this functionality. Writing a
unit test for this code would only serve to test the compiler's ability
to emit bug-free machine code. (Observe ListServers() has no control
flow points, and all its dependencies already have their own unit
tests.)
Being that this is a straight-ahead port from Gorax, some things remain
to be done:
1) Provide an API for accessing Rackspace-specific fields. (#34)
2) Assuming (1) is successful, remove Rack-specific fields from Server
and other structures of interest. (#34)
3) Rename ComputeApi to something more descriptive -- like ServerApi().
(#33)
4) Implement token re-authentication logic. (#12)
diff --git a/images.go b/images.go
new file mode 100644
index 0000000..95dad59
--- /dev/null
+++ b/images.go
@@ -0,0 +1,9 @@
+package gophercloud
+
+// ImageLink provides a reference to a image by either ID or by direct URL.
+// Some services use just the ID, others use just the URL.
+// This structure provides a common means of expressing both in a single field.
+type ImageLink struct {
+ Id string `json:"id"`
+ Links []Link `json:"links"`
+}