delete method

Future<Role> delete(
  1. String name, {
  2. String? etag,
  3. String? $fields,
})

Deletes a custom Role.

When you delete a custom role, the following changes occur immediately: * You cannot bind a principal to the custom role in an IAM Policy. * Existing bindings to the custom role are not changed, but they have no effect. * By default, the response from ListRoles does not include the custom role. You have 7 days to undelete the custom role. After 7 days, the following changes occur: * The custom role is permanently deleted and cannot be recovered. * If an IAM policy contains a binding to the custom role, the binding is permanently removed.

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.delete()](https://cloud.google.com/iam/reference/rest/v1/projects.roles/delete): projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}. This method deletes 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.delete()](https://cloud.google.com/iam/reference/rest/v1/organizations.roles/delete): organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}. This method deletes 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 ^projects/\[^/\]+/roles/\[^/\]+$.

etag - Used to perform a consistent read-modify-write.

$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> delete(
  core.String name, {
  core.String? etag,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (etag != null) 'etag': [etag],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/' + core.Uri.encodeFull('$name');

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