list method

Future<ListRolesResponse> list({
  1. int? pageSize,
  2. String? pageToken,
  3. String? parent,
  4. bool? showDeleted,
  5. String? view,
  6. String? $fields,
})

Lists every predefined Role that IAM supports, or every custom role that is defined for an organization or project.

Request parameters:

pageSize - Optional limit on the number of roles to include in the response. The default is 300, and the maximum is 1,000.

pageToken - Optional pagination token returned in an earlier ListRolesResponse.

parent - The parent parameter's value depends on the target resource for the request, namely [roles](https://cloud.google.com/iam/reference/rest/v1/roles), [projects](https://cloud.google.com/iam/reference/rest/v1/projects.roles), or [organizations](https://cloud.google.com/iam/reference/rest/v1/organizations.roles). Each resource type's parent value format is described below: * [roles.list()](https://cloud.google.com/iam/reference/rest/v1/roles/list): An empty string. This method doesn't require a resource; it simply returns all predefined roles in Cloud IAM. Example request URL: https://iam.googleapis.com/v1/roles * [projects.roles.list()](https://cloud.google.com/iam/reference/rest/v1/projects.roles/list): projects/{PROJECT_ID}. This method lists all project-level custom roles. Example request URL: https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles * [organizations.roles.list()](https://cloud.google.com/iam/reference/rest/v1/organizations.roles/list): organizations/{ORGANIZATION_ID}. This method lists all organization-level custom roles. Example request URL: https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.

showDeleted - Include Roles that have been deleted.

view - Optional view for the returned Role objects. When FULL is specified, the includedPermissions field is returned, which includes a list of all permissions in the role. The default value is BASIC, which does not return the includedPermissions field. Possible string values are:

  • "BASIC" : Omits the included_permissions field. This is the default value.
  • "FULL" : Returns all fields.

$fields - Selector specifying which fields to include in a partial response.

Completes with a ListRolesResponse.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<ListRolesResponse> list({
  core.int? pageSize,
  core.String? pageToken,
  core.String? parent,
  core.bool? showDeleted,
  core.String? view,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (pageSize != null) 'pageSize': ['${pageSize}'],
    if (pageToken != null) 'pageToken': [pageToken],
    if (parent != null) 'parent': [parent],
    if (showDeleted != null) 'showDeleted': ['${showDeleted}'],
    if (view != null) 'view': [view],
    if ($fields != null) 'fields': [$fields],
  };

  const url_ = 'v1/roles';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return ListRolesResponse.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}