Update gophercloud vendor

Update including
* Fix tenants users v2.0 URL in Ocata version of openstack
* Support password option of create user in identity v2
* Add ListUsers by tenantID method in identity v2

Change-Id: Ie2e34d9196907fab5048e468d9ddfbf7e4c6d78e
Signed-off-by: mozhuli <21621232@zju.edu.cn>
This commit is contained in:
mozhulee 2017-06-24 16:19:20 +08:00
parent 4ff66bd27b
commit cd6644e04d
3 changed files with 19 additions and 6 deletions

View File

@ -3,21 +3,21 @@ package tenants
import "github.com/gophercloud/gophercloud"
func listURL(client *gophercloud.ServiceClient) string {
return client.ServiceURL("tenants")
return client.ServiceURL("v2.0/tenants")
}
func getURL(client *gophercloud.ServiceClient, tenantID string) string {
return client.ServiceURL("tenants", tenantID)
return client.ServiceURL("v2.0/tenants", tenantID)
}
func createURL(client *gophercloud.ServiceClient) string {
return client.ServiceURL("tenants")
return client.ServiceURL("v2.0/tenants")
}
func deleteURL(client *gophercloud.ServiceClient, tenantID string) string {
return client.ServiceURL("tenants", tenantID)
return client.ServiceURL("v2.0/tenants", tenantID)
}
func updateURL(client *gophercloud.ServiceClient, tenantID string) string {
return client.ServiceURL("tenants", tenantID)
return client.ServiceURL("v2.0/tenants", tenantID)
}

View File

@ -26,6 +26,8 @@ type CommonOpts struct {
Enabled *bool `json:"enabled,omitempty"`
// The email address of this user.
Email string `json:"email,omitempty"`
// Password is the password of the new user.
Password string `json:"password,omitempty"`
}
// CreateOpts represents the options needed when creating new users.
@ -104,3 +106,10 @@ func ListRoles(client *gophercloud.ServiceClient, tenantID, userID string) pagin
return RolePage{pagination.SinglePageBase(r)}
})
}
// ListUsers requests details on a single tenant's users by tenantID.
func ListUsers(client *gophercloud.ServiceClient, tenantID string) pagination.Pager {
return pagination.NewPager(client, listUsersURL(client, tenantID), func(r pagination.PageResult) pagination.Page {
return UserPage{pagination.SinglePageBase(r)}
})
}

View File

@ -4,7 +4,7 @@ import "github.com/gophercloud/gophercloud"
const (
tenantPath = "tenants"
userPath = "users"
userPath = "v2.0/users"
rolePath = "roles"
)
@ -19,3 +19,7 @@ func rootURL(c *gophercloud.ServiceClient) string {
func listRolesURL(c *gophercloud.ServiceClient, tenantID, userID string) string {
return c.ServiceURL(tenantPath, tenantID, userPath, userID, rolePath)
}
func listUsersURL(c *gophercloud.ServiceClient, tenantID string) string {
return c.ServiceURL(tenantPath, tenantID, "users")
}