cancel method

Future<Empty> cancel(
  1. CancelOperationRequest request,
  2. String name, {
  3. String? $fields,
})

Starts asynchronous cancellation on a long-running operation.

The server makes a best effort to cancel the operation, but success is not guaranteed. Clients may use Operations.GetOperation or Operations.ListOperations to check whether the cancellation succeeded or the operation completed despite cancellation. Authorization requires the following Google IAM permission: * lifesciences.operations.cancel

request - The metadata request object.

Request parameters:

name - The name of the operation resource to be cancelled. Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/operations/\[^/\]+$.

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

Completes with a Empty.

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<Empty> cancel(
  CancelOperationRequest request,
  core.String name, {
  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 = 'v2beta/' + core.Uri.encodeFull('$name') + ':cancel';

  final _response = await _requester.request(
    _url,
    'POST',
    body: _body,
    queryParams: _queryParams,
  );
  return Empty.fromJson(_response as core.Map<core.String, core.dynamic>);
}