Merge "Update gophercloud vendor"

This commit is contained in:
Jenkins 2017-06-24 09:55:09 +00:00 committed by Gerrit Code Review
commit a68cb327eb
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")
}