undelete method
Undeletes a custom Role.
request
- The metadata request object.
Request parameters:
name
- The name
parameter's value depends on the target resource for
the request, namely
[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 name
value format is described below: *
[projects.roles.undelete()
](https://cloud.google.com/iam/reference/rest/v1/projects.roles/undelete):
projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}
. This method undeletes 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.undelete()
](https://cloud.google.com/iam/reference/rest/v1/organizations.roles/undelete):
organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}
. This method
undeletes 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 ^organizations/\[^/\]+/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> undelete(
UndeleteRoleRequest request,
core.String name, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1/' + core.Uri.encodeFull('$name') + ':undelete';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Role.fromJson(response_ as core.Map<core.String, core.dynamic>);
}