cancel method
Starts asynchronous cancellation on a long-running operation.
The server makes a best effort to cancel the operation, but success is not
guaranteed. If the server doesn't support this method, it returns
google.rpc.Code.UNIMPLEMENTED
. Clients can use Operations.GetOperation
or other methods to check whether the cancellation succeeded or whether
the operation completed despite cancellation. On successful cancellation,
the operation is not deleted; instead, it becomes an operation with an
Operation.error value with a google.rpc.Status.code of 1
, corresponding
to Code.CANCELLED
.
Request parameters:
name
- The name of the operation resource to be cancelled.
$fields
- Selector specifying which fields to include in a partial
response.
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<void> cancel(
core.String name, {
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final url_ = 'operations/' + commons.escapeVariable('$name') + ':cancel';
await _requester.request(
url_,
'POST',
queryParams: queryParams_,
downloadOptions: null,
);
}