in pkg/client/sonar/permission_template.go [148:168]
func (sc *Client) GetPermissionTemplateGroups(ctx context.Context, templateID string) (map[string][]string, error) {
var response getPermissionGroupsResponse
rsp, err := sc.startRequest(ctx).
SetResult(&response).
SetQueryParams(map[string]string{
"templateId": templateID,
"ps": "100",
}).
Get("/permissions/template_groups")
if err = sc.checkError(rsp, err); err != nil {
return nil, fmt.Errorf("failed to get permission template groups: %w", err)
}
result := make(map[string][]string, len(response.Groups))
for _, g := range response.Groups {
result[g.GroupName] = g.Permissions
}
return result, nil
}