Don't use type-aliases for CreateOpts and UpdateOpts.
They make the godoc output much less readable. The duplication is minimal, and I think having the documentation be better is a worthwhile tradeoff.
diff --git a/openstack/identity/v2/users/requests.go b/openstack/identity/v2/users/requests.go
index e6bb591..d3ab134 100644
--- a/openstack/identity/v2/users/requests.go
+++ b/openstack/identity/v2/users/requests.go
@@ -28,7 +28,7 @@
Disabled EnabledState = &iFalse
)
-type commonOpts struct {
+type CreateOpts struct {
// Either a name or username is required. When provided, the value must be
// unique or a 409 conflict error will be returned. If you provide a name but
// omit a username, the latter will be set to the former; and vice versa.
@@ -44,9 +44,6 @@
Email string
}
-// CreateOpts represents the options needed when creating new users.
-type CreateOpts commonOpts
-
// CreateOptsBuilder describes struct types that can be accepted by the Create call.
type CreateOptsBuilder interface {
ToUserCreateMap() (map[string]interface{}, error)
@@ -117,8 +114,23 @@
ToUserUpdateMap() map[string]interface{}
}
-// UpdateOpts specifies the base attributes that may be updated on an existing server.
-type UpdateOpts commonOpts
+// UpdateOpts specifies the base attributes that may be updated on an existing
+// server.
+type UpdateOpts struct {
+ // Either a name or username is required. When provided, the value must be
+ // unique or a 409 conflict error will be returned. If you provide a name but
+ // omit a username, the latter will be set to the former; and vice versa.
+ Name, Username string
+
+ // The ID of the tenant to which you want to assign this user.
+ TenantID string
+
+ // Indicates whether this user is enabled or not.
+ Enabled EnabledState
+
+ // The email address of this user.
+ Email string
+}
// ToUserUpdateMap formats an UpdateOpts structure into a request body.
func (opts UpdateOpts) ToUserUpdateMap() map[string]interface{} {