list method
List the jobs of a project.
To list the jobs of a project in a region, we recommend using
projects.locations.jobs.list
with a
regional endpoint.
To list the all jobs across all regions, use projects.jobs.aggregated
.
Using projects.jobs.list
is not recommended, because you can only get
the list of jobs that are running in us-central1
.
projects.locations.jobs.list
and projects.jobs.list
support filtering
the list of jobs by name. Filtering by name isn't supported by
projects.jobs.aggregated
.
Request parameters:
projectId
- The project which owns the jobs.
location
- The
regional endpoint
that contains this job.
filter
- The kind of filter to use.
Possible string values are:
- "UNKNOWN" : The filter isn't specified, or is unknown. This returns all
jobs ordered on descending
JobUuid
. - "ALL" : Returns all running jobs first ordered on creation timestamp, then returns all terminated jobs ordered on the termination timestamp.
- "TERMINATED" : Filters the jobs that have a terminated state, ordered on
the termination timestamp. Example terminated states:
JOB_STATE_STOPPED
,JOB_STATE_UPDATED
,JOB_STATE_DRAINED
, etc. - "ACTIVE" : Filters the jobs that are running ordered on the creation timestamp.
name
- Optional. The job name.
pageSize
- If there are many jobs, limit response to at most this many.
The actual number of jobs returned will be the lesser of max_responses and
an unspecified server-defined limit.
pageToken
- Set this to the 'next_page_token' field of a previous
response to request additional results in a long list.
view
- Deprecated. ListJobs always returns summaries now. Use GetJob for
other JobViews.
Possible string values are:
- "JOB_VIEW_UNKNOWN" : The job view to return isn't specified, or is
unknown. Responses will contain at least the
JOB_VIEW_SUMMARY
information, and may contain additional information. - "JOB_VIEW_SUMMARY" : Request summary information only: Project ID, Job ID, job name, job type, job status, start/end time, and Cloud SDK version details.
- "JOB_VIEW_ALL" : Request all information available for this job. When
the job is in
JOB_STATE_PENDING
, the job has been created but is not yet running, and not all job information is available. For complete job information, wait until the job in isJOB_STATE_RUNNING
. For more information, see JobState. - "JOB_VIEW_DESCRIPTION" : Request summary info and limited job description data for steps, labels and environment.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a ListJobsResponse.
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<ListJobsResponse> list(
core.String projectId,
core.String location, {
core.String? filter,
core.String? name,
core.int? pageSize,
core.String? pageToken,
core.String? view,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if (filter != null) 'filter': [filter],
if (name != null) 'name': [name],
if (pageSize != null) 'pageSize': ['${pageSize}'],
if (pageToken != null) 'pageToken': [pageToken],
if (view != null) 'view': [view],
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1b3/projects/' +
commons.escapeVariable('$projectId') +
'/locations/' +
commons.escapeVariable('$location') +
'/jobs';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return ListJobsResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}