Jamie Hannaford | 0ca076c | 2014-10-30 13:12:35 +0100 | [diff] [blame] | 1 | package roles |
| 2 | |
| 3 | import ( |
| 4 | "github.com/rackspace/gophercloud" |
| 5 | "github.com/rackspace/gophercloud/pagination" |
| 6 | ) |
| 7 | |
| 8 | func List(client *gophercloud.ServiceClient) pagination.Pager { |
| 9 | createPage := func(r pagination.PageResult) pagination.Page { |
| 10 | return RolePage{pagination.SinglePageBase(r)} |
| 11 | } |
| 12 | return pagination.NewPager(client, rootURL(client), createPage) |
| 13 | } |
Jamie Hannaford | 9b642e0 | 2014-10-30 13:20:06 +0100 | [diff] [blame^] | 14 | |
| 15 | func AddRoleToUser(client *gophercloud.ServiceClient, tenantID, userID, roleID string) AddRoleResult { |
| 16 | var result AddRoleResult |
| 17 | |
| 18 | _, result.Err = perigee.Request("PUT", userRoleURL(client, tenantID, userID, roleID), perigee.Options{ |
| 19 | MoreHeaders: client.AuthenticatedHeaders(), |
| 20 | OkCodes: []int{201}, |
| 21 | }) |
| 22 | |
| 23 | return result |
| 24 | } |