Adding get port operation
diff --git a/openstack/networking/v2/apiversions/results.go b/openstack/networking/v2/apiversions/results.go
index 9181e7e..0ab3b41 100644
--- a/openstack/networking/v2/apiversions/results.go
+++ b/openstack/networking/v2/apiversions/results.go
@@ -5,15 +5,20 @@
"github.com/rackspace/gophercloud/pagination"
)
+// APIVersion represents an API version for Neutron. It contains the status of
+// the API, and its unique ID.
type APIVersion struct {
Status string `mapstructure:"status" json:"status"`
ID string `mapstructure:"id" json:"id"`
}
+// APIVersionPage is the page returned by a pager when traversing over a
+// collection of API versions.
type APIVersionPage struct {
pagination.SinglePageBase
}
+// IsEmpty checks whether the page is empty.
func (r APIVersionPage) IsEmpty() (bool, error) {
is, err := ExtractAPIVersions(r)
if err != nil {
@@ -22,6 +27,8 @@
return len(is) == 0, nil
}
+// ExtractAPIVersion takes a collection page, extracts all of the elements,
+// and returns them a slice of APIVersion structs. It is effectively a cast.
func ExtractAPIVersions(page pagination.Page) ([]APIVersion, error) {
var resp struct {
Versions []APIVersion `mapstructure:"versions"`
@@ -35,6 +42,8 @@
return resp.Versions, nil
}
+// APIVersionResource represents a generic API resource. It contains the name
+// of the resource and its plural collection name.
type APIVersionResource struct {
Name string `mapstructure:"name" json:"name"`
Collection string `mapstructure:"collection" json:"collection"`