cancel method

Future<JobCancelResponse> cancel(
  1. String projectId,
  2. String jobId, {
  3. String? location,
  4. String? $fields,
})

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

jobId - [Required] Job ID of the job to cancel

location - The geographic location of the job. Required except for US and EU. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location.

$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/' +
      commons.escapeVariable('$projectId') +
      '/jobs/' +
      commons.escapeVariable('$jobId') +
      '/cancel';

  final response_ = await _requester.request(
    url_,
    'POST',
    queryParams: queryParams_,
  );
  return JobCancelResponse.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}