From cd6644e04d92e3ef5eb6b251b49cf772220fc63c Mon Sep 17 00:00:00 2001 From: mozhulee <21621232@zju.edu.cn> Date: Sat, 24 Jun 2017 16:19:20 +0800 Subject: [PATCH] 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> --- .../gophercloud/openstack/identity/v2/tenants/urls.go | 10 +++++----- .../openstack/identity/v2/users/requests.go | 9 +++++++++ .../gophercloud/openstack/identity/v2/users/urls.go | 6 +++++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/urls.go b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/urls.go index 0f02669..4f39d92 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/urls.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/urls.go @@ -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) } diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/users/requests.go b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/users/requests.go index 37fcd38..1819f02 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/users/requests.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/users/requests.go @@ -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)} + }) +} diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/users/urls.go b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/users/urls.go index 89f66f2..e26613f 100644 --- a/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/users/urls.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/users/urls.go @@ -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") +}