cancel method
- GoogleLongrunningCancelOperationRequest request,
- String name, {
- 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. 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
- The metadata request object.
Request parameters:
name
- The name of the operation resource to be cancelled.
Value must have pattern
^projects/\[^/\]+/apps/\[^/\]+/releases/\[^/\]+/operations/\[^/\]+$
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a GoogleProtobufEmpty.
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<GoogleProtobufEmpty> cancel(
GoogleLongrunningCancelOperationRequest request,
core.String name, {
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 = 'v1/' + core.Uri.encodeFull('$name') + ':cancel';
final _response = await _requester.request(
_url,
'POST',
body: _body,
queryParams: _queryParams,
);
return GoogleProtobufEmpty.fromJson(
_response as core.Map<core.String, core.dynamic>);
}