- 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.
ListTasksCommand
Returns a list of the DataSync tasks you created.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { DataSyncClient, ListTasksCommand } from "@aws-sdk/client-datasync"; // ES Modules import
// const { DataSyncClient, ListTasksCommand } = require("@aws-sdk/client-datasync"); // CommonJS import
const client = new DataSyncClient(config);
const input = { // ListTasksRequest
MaxResults: Number("int"),
NextToken: "STRING_VALUE",
Filters: [ // TaskFilters
{ // TaskFilter
Name: "LocationId" || "CreationTime", // required
Values: [ // FilterValues // required
"STRING_VALUE",
],
Operator: "Equals" || "NotEquals" || "In" || "LessThanOrEqual" || "LessThan" || "GreaterThanOrEqual" || "GreaterThan" || "Contains" || "NotContains" || "BeginsWith", // required
},
],
};
const command = new ListTasksCommand(input);
const response = await client.send(command);
// { // ListTasksResponse
// Tasks: [ // TaskList
// { // TaskListEntry
// TaskArn: "STRING_VALUE",
// Status: "AVAILABLE" || "CREATING" || "QUEUED" || "RUNNING" || "UNAVAILABLE",
// Name: "STRING_VALUE",
// TaskMode: "BASIC" || "ENHANCED",
// },
// ],
// NextToken: "STRING_VALUE",
// };
ListTasksCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
Filters | TaskFilter[] | undefined | You can use API filters to narrow down the list of resources returned by |
MaxResults | number | undefined | The maximum number of tasks to return. |
NextToken | string | undefined | An opaque string that indicates the position at which to begin the next list of tasks. |
ListTasksCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
NextToken | string | undefined | An opaque string that indicates the position at which to begin returning the next list of tasks. |
Tasks | TaskListEntry[] | undefined | A list of all the tasks that are returned. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
InternalException | server | This exception is thrown when an error occurs in the DataSync service. |
InvalidRequestException | client | This exception is thrown when the client submits a malformed request. |
DataSyncServiceException | Base exception class for all service exceptions from DataSync service. |