cancel method
Requests that a job be cancelled.
This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully. Cancelled jobs may still incur costs.
Request parameters:
projectId
- Required. Project ID of the job to cancel
Value must have pattern ^\[^/\]+$
.
jobId
- Required. Job ID of the job to cancel
Value must have pattern ^\[^/\]+$
.
location
- The geographic location of the job. You must
specify the location
to run the job for the following scenarios: * If the location to run a job
is not in the us
or the eu
multi-regional location * If the job's
location is in a single region (for example, us-central1
)
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a JobCancelResponse.
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<JobCancelResponse> cancel(
core.String projectId,
core.String jobId, {
core.String? location,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if (location != null) 'location': [location],
if ($fields != null) 'fields': [$fields],
};
final url_ = 'projects/' +
core.Uri.encodeFull('$projectId') +
'/jobs/' +
core.Uri.encodeFull('$jobId') +
'/cancel';
final response_ = await _requester.request(
url_,
'POST',
queryParams: queryParams_,
);
return JobCancelResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}