forked from grafana/grafana-api-golang-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
service_account_permissions.go
39 lines (35 loc) · 1.21 KB
/
service_account_permissions.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package gapi
func (c *Client) ListServiceAccountResourcePermissions(id int64) ([]*ResourcePermission, error) {
return c.listResourcePermissions(ServiceAccountsResource, ResourceID(id))
}
func (c *Client) SetServiceAccountResourcePermissions(id int64, body SetResourcePermissionsBody) (*SetResourcePermissionsResponse, error) {
return c.setResourcePermissions(ServiceAccountsResource, ResourceID(id), body)
}
func (c *Client) SetUserServiceAccountResourcePermissions(id int64, userID int64, permission string) (*SetResourcePermissionsResponse, error) {
return c.setResourcePermissionByAssignment(
ServiceAccountsResource,
ResourceID(id),
UsersResource,
ResourceID(userID),
SetResourcePermissionBody{
Permission: SetResourcePermissionItem{
UserID: userID,
Permission: permission,
},
},
)
}
func (c *Client) SetTeamServiceAccountResourcePermissions(id int64, teamID int64, permission string) (*SetResourcePermissionsResponse, error) {
return c.setResourcePermissionByAssignment(
ServiceAccountsResource,
ResourceID(id),
TeamsResource,
ResourceID(teamID),
SetResourcePermissionBody{
Permission: SetResourcePermissionItem{
TeamID: teamID,
Permission: permission,
},
},
)
}