listPermissions method

Future<ListPermissionsResponse> listPermissions({
  1. required String workspaceId,
  2. String? groupId,
  3. int? maxResults,
  4. String? nextToken,
  5. String? userId,
  6. UserType? userType,
})

Lists the users and groups who have the Grafana Admin and Editor roles in this workspace. If you use this operation without specifying userId or groupId, the operation returns the roles of all users and groups. If you specify a userId or a groupId, only the roles for that user or group are returned. If you do this, you can specify only one userId or one groupId.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter workspaceId : The ID of the workspace to list permissions for. This parameter is required.

Parameter groupId : (Optional) Limits the results to only the group that matches this ID.

Parameter maxResults : The maximum number of results to include in the response.

Parameter nextToken : The token to use when requesting the next set of results. You received this token from a previous ListPermissions operation.

Parameter userId : (Optional) Limits the results to only the user that matches this ID.

Parameter userType : (Optional) If you specify SSO_USER, then only the permissions of IAM Identity Center users are returned. If you specify SSO_GROUP, only the permissions of IAM Identity Center groups are returned.

Implementation

Future<ListPermissionsResponse> listPermissions({
  required String workspaceId,
  String? groupId,
  int? maxResults,
  String? nextToken,
  String? userId,
  UserType? userType,
}) async {
  final $query = <String, List<String>>{
    if (groupId != null) 'groupId': [groupId],
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
    if (userId != null) 'userId': [userId],
    if (userType != null) 'userType': [userType.value],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/workspaces/${Uri.encodeComponent(workspaceId)}/permissions',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListPermissionsResponse.fromJson(response);
}