undelete method

Future<Alert> undelete(
  1. UndeleteAlertRequest request,
  2. String alertId, {
  3. String? $fields,
})

Restores, or "undeletes", an alert that was marked for deletion within the past 30 days.

Attempting to undelete an alert which was marked for deletion over 30 days ago (which has been removed from the Alert Center database) or a nonexistent alert returns a NOT_FOUND error. Attempting to undelete an alert which has not been marked for deletion has no effect.

request - The metadata request object.

Request parameters:

alertId - Required. The identifier of the alert to undelete.

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

Completes with a Alert.

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<Alert> undelete(
  UndeleteAlertRequest request,
  core.String alertId, {
  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_ =
      'v1beta1/alerts/' + commons.escapeVariable('$alertId') + ':undelete';

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