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. # IAM Permissions Requires the bigquery.jobs.update permission on the job resource. If the user matches the creator of the job, the bigquery.jobs.create permission on the project is required instead.

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>>{
    'location': ?location == null ? null : [location],
    'fields': ?$fields == null ? null : [$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>,
  );
}