get method
Gets the definition of a Role.
Request parameters:
name
- The name
parameter's value depends on the target resource for
the request, namely
roles,
projects,
or
organizations.
Each resource type's name
value format is described below: *
roles.get:
roles/{ROLE_NAME}
. This method returns results from all
predefined roles
in IAM. Example request URL:
https://iam.googleapis.com/v1/roles/{ROLE_NAME}
*
projects.roles.get:
projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}
. This method returns only
custom roles
that have been created at the project level. Example request URL:
https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}
*
organizations.roles.get:
organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}
. This method
returns only
custom roles
that have been created at the organization level. Example request URL:
https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}
Note: Wildcard (*) values are invalid; you must specify a complete project
ID or organization ID.
Value must have pattern ^roles/\[^/\]+$
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a Role.
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<Role> get(
core.String name, {
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1/' + core.Uri.encodeFull('$name');
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return Role.fromJson(response_ as core.Map<core.String, core.dynamic>);
}