- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
ListJobsCommand
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.
Amazon Glacier retains recently completed jobs for a period before deleting them; however, it eventually removes completed jobs. The output of completed jobs can be retrieved. Retaining completed jobs for a period of time after they have completed enables you to get a job output in the event you miss the job completion notification or your first attempt to download it fails. For example, suppose you start an archive retrieval job to download an archive. After the job completes, you start to download the archive but encounter a network error. In this scenario, you can retry and download the archive while the job exists.
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 .
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { GlacierClient, ListJobsCommand } from "@aws-sdk/client-glacier"; // ES Modules import
// const { GlacierClient, ListJobsCommand } = require("@aws-sdk/client-glacier"); // CommonJS import
const client = new GlacierClient(config);
const input = { // ListJobsInput
accountId: "STRING_VALUE", // required
vaultName: "STRING_VALUE", // required
limit: Number("int"),
marker: "STRING_VALUE",
statuscode: "STRING_VALUE",
completed: "STRING_VALUE",
};
const command = new ListJobsCommand(input);
const response = await client.send(command);
// { // ListJobsOutput
// JobList: [ // JobList
// { // GlacierJobDescription
// JobId: "STRING_VALUE",
// JobDescription: "STRING_VALUE",
// Action: "ArchiveRetrieval" || "InventoryRetrieval" || "Select",
// ArchiveId: "STRING_VALUE",
// VaultARN: "STRING_VALUE",
// CreationDate: "STRING_VALUE",
// Completed: true || false,
// StatusCode: "InProgress" || "Succeeded" || "Failed",
// StatusMessage: "STRING_VALUE",
// ArchiveSizeInBytes: Number("long"),
// InventorySizeInBytes: Number("long"),
// SNSTopic: "STRING_VALUE",
// CompletionDate: "STRING_VALUE",
// SHA256TreeHash: "STRING_VALUE",
// ArchiveSHA256TreeHash: "STRING_VALUE",
// RetrievalByteRange: "STRING_VALUE",
// Tier: "STRING_VALUE",
// InventoryRetrievalParameters: { // InventoryRetrievalJobDescription
// Format: "STRING_VALUE",
// StartDate: "STRING_VALUE",
// EndDate: "STRING_VALUE",
// Limit: "STRING_VALUE",
// Marker: "STRING_VALUE",
// },
// JobOutputPath: "STRING_VALUE",
// SelectParameters: { // SelectParameters
// InputSerialization: { // InputSerialization
// csv: { // CSVInput
// FileHeaderInfo: "USE" || "IGNORE" || "NONE",
// Comments: "STRING_VALUE",
// QuoteEscapeCharacter: "STRING_VALUE",
// RecordDelimiter: "STRING_VALUE",
// FieldDelimiter: "STRING_VALUE",
// QuoteCharacter: "STRING_VALUE",
// },
// },
// ExpressionType: "SQL",
// Expression: "STRING_VALUE",
// OutputSerialization: { // OutputSerialization
// csv: { // CSVOutput
// QuoteFields: "ALWAYS" || "ASNEEDED",
// QuoteEscapeCharacter: "STRING_VALUE",
// RecordDelimiter: "STRING_VALUE",
// FieldDelimiter: "STRING_VALUE",
// QuoteCharacter: "STRING_VALUE",
// },
// },
// },
// OutputLocation: { // OutputLocation
// S3: { // S3Location
// BucketName: "STRING_VALUE",
// Prefix: "STRING_VALUE",
// Encryption: { // Encryption
// EncryptionType: "aws:kms" || "AES256",
// KMSKeyId: "STRING_VALUE",
// KMSContext: "STRING_VALUE",
// },
// CannedACL: "private" || "public-read" || "public-read-write" || "aws-exec-read" || "authenticated-read" || "bucket-owner-read" || "bucket-owner-full-control",
// AccessControlList: [ // AccessControlPolicyList
// { // Grant
// Grantee: { // Grantee
// Type: "AmazonCustomerByEmail" || "CanonicalUser" || "Group", // required
// DisplayName: "STRING_VALUE",
// URI: "STRING_VALUE",
// ID: "STRING_VALUE",
// EmailAddress: "STRING_VALUE",
// },
// Permission: "FULL_CONTROL" || "WRITE" || "WRITE_ACP" || "READ" || "READ_ACP",
// },
// ],
// Tagging: { // hashmap
// "<keys>": "STRING_VALUE",
// },
// UserMetadata: {
// "<keys>": "STRING_VALUE",
// },
// StorageClass: "STANDARD" || "REDUCED_REDUNDANCY" || "STANDARD_IA",
// },
// },
// },
// ],
// Marker: "STRING_VALUE",
// };
Example Usage
ListJobsCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
accountId Required | string | undefined | The |
vaultName Required | string | undefined | The name of the vault. |
completed | string | undefined | The state of the jobs to return. You can specify |
limit | number | undefined | 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. |
marker | string | undefined | 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. |
statuscode | string | undefined | The type of job status to return. You can specify the following values: |
ListJobsCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
JobList | GlacierJobDescription[] | undefined | A list of job objects. Each job object contains metadata describing the job. |
Marker | string | undefined | An opaque string used for pagination that specifies the job at which the listing of jobs should begin. You get the |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
InvalidParameterValueException | client | Returned if a parameter of the request is incorrectly specified. |
MissingParameterValueException | client | Returned if a required header or parameter is missing from the request. |
ResourceNotFoundException | client | Returned if the specified resource (such as a vault, upload ID, or job ID) doesn't exist. |
ServiceUnavailableException | server | Returned if the service cannot complete the request. |
GlacierServiceException | Base exception class for all service exceptions from Glacier service. |