blob: cfa1b38e997ade4de25a0bccff53e25f7b554de2 [file] [log] [blame]
Daniel Speichert44e3b542015-08-26 20:55:58 -04001package roles
2
3import (
4 "github.com/rackspace/gophercloud"
5 "github.com/rackspace/gophercloud/pagination"
6)
7
8// RoleAssignmentsOpts allows you to query the RoleAssignments method.
9type RoleAssignmentsOpts struct {
10 GroupId string `q:"group.id"`
11 RoleId string `q:"role.id"`
12 ScopeDomainId string `q:"scope.domain.id"`
13 ScopeProjectId string `q:"scope.project.id"`
14 UserId string `q:"user.id"`
15 Effective bool `q:"effective"`
16}
17
18// RoleAssignments enumerates the roles assigned to a specified resource.
19func RoleAssignments(client *gophercloud.ServiceClient, opts RoleAssignmentsOpts) pagination.Pager {
20 u := roleAssignmentsURL(client)
21 q, err := gophercloud.BuildQueryString(opts)
22 if err != nil {
23 return pagination.Pager{Err: err}
24 }
25 u += q.String()
26 createPage := func(r pagination.PageResult) pagination.Page {
27 return RoleAssignmentsPage{pagination.LinkedPageBase{PageResult: r}}
28 }
29
30 return pagination.NewPager(client, u, createPage)
31}