identity v2 error types
diff --git a/openstack/identity/v2/users/requests.go b/openstack/identity/v2/users/requests.go
index 22d3ca9..7fa5fc3 100644
--- a/openstack/identity/v2/users/requests.go
+++ b/openstack/identity/v2/users/requests.go
@@ -1,12 +1,11 @@
package users
import (
- "errors"
-
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/pagination"
)
+// List lists the existing users.
func List(client *gophercloud.ServiceClient) pagination.Pager {
createPage := func(r pagination.PageResult) pagination.Page {
return UserPage{pagination.SinglePageBase(r)}
@@ -58,7 +57,11 @@
m := make(map[string]interface{})
if opts.Name == "" && opts.Username == "" {
- return m, errors.New("Either a Name or Username must be provided")
+ err := gophercloud.ErrMissingInput{}
+ err.Function = "users.ToUserCreateMap"
+ err.Argument = "users.CreateOpts.Name/users.CreateOpts.Username"
+ err.Info = "Either a Name or Username must be provided"
+ return m, err
}
if opts.Name != "" {
@@ -152,6 +155,7 @@
return result
}
+// ListRoles lists the existing roles that can be assigned to users.
func ListRoles(client *gophercloud.ServiceClient, tenantID, userID string) pagination.Pager {
createPage := func(r pagination.PageResult) pagination.Page {
return RolePage{pagination.SinglePageBase(r)}