listJobs method
This operation lists jobs for a vault, including jobs that are in-progress
and jobs that have recently finished. The List Job operation returns a
list of these jobs sorted by job initiation time.
The List Jobs operation supports pagination. You should always check the
response Marker
field. If there are no more jobs to list, the
Marker
field is set to null
. If there are more
jobs to list, the Marker
field is set to a non-null value,
which you can use to continue the pagination of the list. To return a list
of jobs that begins at a specific job, set the marker request parameter to
the Marker
value for that job that you obtained from a
previous List Jobs request.
You can set a maximum limit for the number of jobs returned in the
response by specifying the limit
parameter in the request.
The default limit is 50. The number of jobs returned might be fewer than
the limit, but the number of returned jobs never exceeds the limit.
Additionally, you can filter the jobs list returned by specifying the
optional statuscode
parameter or completed
parameter, or both. Using the statuscode
parameter, you can
specify to return only jobs that match either the InProgress
,
Succeeded
, or Failed
status. Using the
completed
parameter, you can specify to return only jobs that
were completed (true
) or jobs that were not completed
(false
).
For more information about using this operation, see the documentation for the underlying REST API List Jobs.
May throw ResourceNotFoundException. May throw InvalidParameterValueException. May throw MissingParameterValueException. May throw ServiceUnavailableException.
Parameter accountId
:
The AccountId
value is the AWS account ID of the account that
owns the vault. You can either specify an AWS account ID or optionally a
single '-
' (hyphen), in which case Amazon S3 Glacier uses the
AWS account ID associated with the credentials used to sign the request.
If you use an account ID, do not include any hyphens ('-') in the ID.
Parameter vaultName
:
The name of the vault.
Parameter completed
:
The state of the jobs to return. You can specify true
or
false
.
Parameter limit
:
The maximum number of jobs to be returned. The default limit is 50. The
number of jobs returned might be fewer than the specified limit, but the
number of returned jobs never exceeds the limit.
Parameter marker
:
An opaque string used for pagination. This value specifies the job at
which the listing of jobs should begin. Get the marker value from a
previous List Jobs response. You only need to include the marker if you
are continuing the pagination of results started in a previous List Jobs
request.
Parameter statuscode
:
The type of job status to return. You can specify the following values:
InProgress
, Succeeded
, or Failed
.
Implementation
Future<ListJobsOutput> listJobs({
required String accountId,
required String vaultName,
String? completed,
String? limit,
String? marker,
String? statuscode,
}) async {
ArgumentError.checkNotNull(accountId, 'accountId');
ArgumentError.checkNotNull(vaultName, 'vaultName');
final $query = <String, List<String>>{
if (completed != null) 'completed': [completed],
if (limit != null) 'limit': [limit],
if (marker != null) 'marker': [marker],
if (statuscode != null) 'statuscode': [statuscode],
};
final response = await _protocol.send(
payload: null,
method: 'GET',
requestUri:
'/${Uri.encodeComponent(accountId)}/vaults/${Uri.encodeComponent(vaultName)}/jobs',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return ListJobsOutput.fromJson(response);
}