Introducing new FooResult idiom :shipit:
diff --git a/openstack/networking/v2/extensions/results.go b/openstack/networking/v2/extensions/results.go
index 42e7fc3..2b8408d 100644
--- a/openstack/networking/v2/extensions/results.go
+++ b/openstack/networking/v2/extensions/results.go
@@ -1,10 +1,34 @@
package extensions
import (
+ "fmt"
+
"github.com/mitchellh/mapstructure"
+ "github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/pagination"
)
+type GetResult struct {
+ gophercloud.CommonResult
+}
+
+func (r GetResult) Extract() (*Extension, error) {
+ if r.Err != nil {
+ return nil, r.Err
+ }
+
+ var res struct {
+ Extension *Extension `json:"extension"`
+ }
+
+ err := mapstructure.Decode(r.Resp, &res)
+ if err != nil {
+ return nil, fmt.Errorf("Error decoding Neutron extension: %v", err)
+ }
+
+ return res.Extension, nil
+}
+
// Extension is a struct that represents a Neutron extension.
type Extension struct {
Updated string `json:"updated"`