Adding create users operation :man_with_gua_pi_mao:
diff --git a/openstack/identity/v2/users/results.go b/openstack/identity/v2/users/results.go
index db27d3c..fe62ada 100644
--- a/openstack/identity/v2/users/results.go
+++ b/openstack/identity/v2/users/results.go
@@ -2,6 +2,8 @@
import (
"github.com/mitchellh/mapstructure"
+
+ "github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/pagination"
)
@@ -50,3 +52,26 @@
err := mapstructure.Decode(casted, &response)
return response.Users, err
}
+
+type commonResult struct {
+ gophercloud.Result
+}
+
+// Extract interprets any commonResult as a User, if possible.
+func (r commonResult) Extract() (*User, error) {
+ if r.Err != nil {
+ return nil, r.Err
+ }
+
+ var response struct {
+ User User `mapstructure:"user"`
+ }
+
+ err := mapstructure.Decode(r.Body, &response)
+
+ return &response.User, err
+}
+
+type CreateResult struct {
+ commonResult
+}