getMetrics method
Request the job status.
To request the status of a job, we recommend using
projects.locations.jobs.getMetrics
with a
regional endpoint.
Using projects.jobs.getMetrics
is not recommended, as you can only
request the status of jobs that are running in us-central1
.
Request parameters:
projectId
- A project id.
jobId
- The job to get metrics for.
location
- The
regional endpoint
that contains the job specified by job_id.
startTime
- Return only metric data that has changed since this time.
Default is to return all information about all metrics for the job.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a JobMetrics.
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<JobMetrics> getMetrics(
core.String projectId,
core.String jobId, {
core.String? location,
core.String? startTime,
core.String? $fields,
}) async {
final _queryParams = <core.String, core.List<core.String>>{
if (location != null) 'location': [location],
if (startTime != null) 'startTime': [startTime],
if ($fields != null) 'fields': [$fields],
};
final _url = 'v1b3/projects/' +
commons.escapeVariable('$projectId') +
'/jobs/' +
commons.escapeVariable('$jobId') +
'/metrics';
final _response = await _requester.request(
_url,
'GET',
queryParams: _queryParams,
);
return JobMetrics.fromJson(
_response as core.Map<core.String, core.dynamic>);
}