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.toJson());
  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>);
}