tasks
Creates, updates, deletes, gets or lists a tasks resource.
Overview
| Name | tasks |
| Type | Resource |
| Id | aws.snow_device_management.tasks |
Fields
The following fields are returned by SELECT queries:
- describe_task
- list_tasks
| Name | Datatype | Description |
|---|---|---|
completed_at | string (date-time) | When the task was completed. |
created_at | string (date-time) | When the CreateTask operation was called. |
description | string | The description provided of the task and managed devices. (pattern: <code>[A-Za-z0-9 _.,!#]*</code>) |
last_updated_at | string (date-time) | When the state of the task was last updated. |
state | string | The current state of the task. (IN_PROGRESS, CANCELED, COMPLETED) |
tags | object | Optional metadata that you assign to a resource. You can use tags to categorize a resource in different ways, such as by purpose, owner, or environment. |
targets | array | The managed devices that the task was sent to. |
task_arn | string | The Amazon Resource Name (ARN) of the task. |
task_id | string | The ID of the task. |
| Name | Datatype | Description |
|---|---|---|
state | string | The state of the task assigned to one or many devices. (IN_PROGRESS, CANCELED, COMPLETED) |
tags | object | Optional metadata that you assign to a resource. You can use tags to categorize a resource in different ways, such as by purpose, owner, or environment. |
task_arn | string | The Amazon Resource Name (ARN) of the task. |
task_id | string | The task ID. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_task | select | task_id, region | Checks the metadata for a given task on a device. | |
list_tasks | select | region | maxResults, nextToken, state | Returns a list of tasks that can be filtered by state. |
create_task | insert | region, command, targets | Instructs one or more devices to start a task, such as unlocking or rebooting. | |
cancel_task | exec | task_id, region | Sends a cancel request for a specified task. You can cancel a task only if it's still in a QUEUED state. Tasks that are already running can't be cancelled. A task might still run if it's processed from the queue before the CancelTask operation changes the task's state. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
task_id | string | The ID of the task that you are attempting to cancel. You can retrieve a task ID by using the ListTasks operation. |
maxResults | integer | The maximum number of tasks per page. |
nextToken | string | A pagination token to continue to the next page of tasks. |
state | string | A structure used to filter the list of tasks. |
SELECT examples
- describe_task
- list_tasks
Checks the metadata for a given task on a device.
SELECT
completed_at,
created_at,
description,
last_updated_at,
state,
tags,
targets,
task_arn,
task_id
FROM aws.snow_device_management.tasks
WHERE task_id = '{{ task_id }}' -- required
AND region = '{{ region }}' -- required
;
Returns a list of tasks that can be filtered by state.
SELECT
state,
tags,
task_arn,
task_id
FROM aws.snow_device_management.tasks
WHERE region = '{{ region }}' -- required
AND maxResults = '{{ maxResults }}'
AND nextToken = '{{ nextToken }}'
AND state = '{{ state }}'
;
INSERT examples
- create_task
- Manifest
Instructs one or more devices to start a task, such as unlocking or rebooting.
INSERT INTO aws.snow_device_management.tasks (
clientToken,
command,
description,
tags,
targets,
region
)
SELECT
'{{ clientToken }}',
'{{ command }}' /* required */,
'{{ description }}',
'{{ tags }}',
'{{ targets }}' /* required */,
'{{ region }}'
RETURNING
task_arn,
task_id
;
# Description fields are for documentation purposes
- name: tasks
props:
- name: region
value: "{{ region }}"
description: Required parameter for the tasks resource.
- name: clientToken
value: "{{ clientToken }}"
- name: command
description: |
The command given to the device to execute.
value:
reboot: "{{ reboot }}"
unlock: "{{ unlock }}"
- name: description
value: "{{ description }}"
- name: tags
value: "{{ tags }}"
- name: targets
value:
- "{{ targets }}"
Lifecycle Methods
- cancel_task
Sends a cancel request for a specified task. You can cancel a task only if it's still in a QUEUED state. Tasks that are already running can't be cancelled. A task might still run if it's processed from the queue before the CancelTask operation changes the task's state.
EXEC aws.snow_device_management.tasks.cancel_task
@task_id='{{ task_id }}' --required,
@region='{{ region }}' --required
;