commands
Creates, updates, deletes, gets or lists a commands resource.
Overview
| Name | commands |
| Type | Resource |
| Id | aws.iot.commands |
Fields
The following fields are returned by SELECT queries:
- get_command
- list_commands
| Name | Datatype | Description |
|---|---|---|
command_arn | string | The Amazon Resource Number (ARN) of the command. For example, arn:aws:iot:<region>:<accountid>:command/<commandId> |
command_id | string | The unique identifier of the command. (pattern: <code>[a-zA-Z0-9_-]+</code>) |
created_at | string (date-time) | The timestamp, when the command was created. |
deprecated_ | boolean | Indicates whether the command has been deprecated. |
description | string | A short text description of the command. (pattern: <code>[^\p{C}]*</code>) |
display_name | string | The user-friendly name in the console for the command. (pattern: <code>[^\p{C}]*</code>) |
last_updated_at | string (date-time) | The timestamp, when the command was last updated. |
mandatory_parameters | array | A list of parameters for the command created. |
namespace | string | The namespace of the command. (AWS-IoT, AWS-IoT-FleetWise) |
payload | object | The command payload object that contains the instructions for the device to process. |
payload_template | string | The payload template for the dynamic command. |
pending_deletion | boolean | Indicates whether the command is being deleted. |
preprocessor | object | Configuration that determines how the payloadTemplate is processed by the service to generate the final payload sent to devices at StartCommandExecution API invocation. |
role_arn | string | The IAM role that you provided when creating the command with AWS-IoT-FleetWise as the namespace. |
| Name | Datatype | Description |
|---|---|---|
command_arn | string | The Amazon Resource Name (ARN) of the command. |
command_id | string | The unique identifier of the command. (pattern: <code>[a-zA-Z0-9_-]+</code>) |
created_at | string (date-time) | The timestamp, when the command was created. |
deprecated_ | boolean | Indicates whether the command has been deprecated. |
display_name | string | The display name of the command. (pattern: <code>[^\p{C}]*</code>) |
last_updated_at | string (date-time) | The timestamp, when the command was last updated. |
pending_deletion | boolean | Indicates whether the command is pending deletion. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_command | select | command_id, region | Gets information about the specified command. | |
list_commands | select | region | maxResults, nextToken, namespace, commandParameterName, sortOrder | List all commands in your account. |
create_command | insert | command_id, region | Creates a command. A command contains reusable configurations that can be applied before they are sent to the devices. | |
update_command | update | command_id, region | Update information about a command or mark a command for deprecation. | |
delete_command | delete | command_id, region | Delete a command resource. |
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 |
|---|---|---|
command_id | string | The unique identifier of the command to be deleted. |
region | string | AWS region (default: us-east-1) |
commandParameterName | string | A filter that can be used to display the list of commands that have a specific command parameter name. |
maxResults | integer | The maximum number of results to return in this operation. By default, the API returns up to a maximum of 25 results. You can override this default value to return up to a maximum of 100 results for this operation. |
namespace | string | The namespace of the command. By default, the API returns all commands that have been created for both AWS-IoT and AWS-IoT-FleetWise namespaces. You can override this default value if you want to return all commands that have been created only for a specific namespace. |
nextToken | string | To retrieve the next set of results, the nextToken value from a previous response; otherwise null to receive the first set of results. |
sortOrder | string | Specify whether to list the commands that you have created in the ascending or descending order. By default, the API returns all commands in the descending order based on the time that they were created. |
SELECT examples
- get_command
- list_commands
Gets information about the specified command.
SELECT
command_arn,
command_id,
created_at,
deprecated_,
description,
display_name,
last_updated_at,
mandatory_parameters,
namespace,
payload,
payload_template,
pending_deletion,
preprocessor,
role_arn
FROM aws.iot.commands
WHERE command_id = '{{ command_id }}' -- required
AND region = '{{ region }}' -- required
;
List all commands in your account.
SELECT
command_arn,
command_id,
created_at,
deprecated_,
display_name,
last_updated_at,
pending_deletion
FROM aws.iot.commands
WHERE region = '{{ region }}' -- required
AND maxResults = '{{ maxResults }}'
AND nextToken = '{{ nextToken }}'
AND namespace = '{{ namespace }}'
AND commandParameterName = '{{ commandParameterName }}'
AND sortOrder = '{{ sortOrder }}'
;
INSERT examples
- create_command
- Manifest
Creates a command. A command contains reusable configurations that can be applied before they are sent to the devices.
INSERT INTO aws.iot.commands (
namespace,
displayName,
description,
payload,
payloadTemplate,
preprocessor,
mandatoryParameters,
roleArn,
tags,
command_id,
region
)
SELECT
'{{ namespace }}',
'{{ displayName }}',
'{{ description }}',
'{{ payload }}',
'{{ payloadTemplate }}',
'{{ preprocessor }}',
'{{ mandatoryParameters }}',
'{{ roleArn }}',
'{{ tags }}',
'{{ command_id }}',
'{{ region }}'
RETURNING
command_arn,
command_id
;
# Description fields are for documentation purposes
- name: commands
props:
- name: command_id
value: "{{ command_id }}"
description: Required parameter for the commands resource.
- name: region
value: "{{ region }}"
description: Required parameter for the commands resource.
- name: namespace
value: "{{ namespace }}"
valid_values: ['AWS-IoT', 'AWS-IoT-FleetWise']
- name: displayName
value: "{{ displayName }}"
- name: description
value: "{{ description }}"
- name: payload
description: |
The command payload object that contains the instructions for the device to process.
value:
content: "{{ content }}"
contentType: "{{ contentType }}"
- name: payloadTemplate
value: "{{ payloadTemplate }}"
- name: preprocessor
description: |
Configuration that determines how the payloadTemplate is processed by the service to generate the final payload sent to devices at StartCommandExecution API invocation.
value:
awsJsonSubstitution:
outputFormat: "{{ outputFormat }}"
- name: mandatoryParameters
value:
- name: "{{ name }}"
type_: "{{ type_ }}"
value:
S: "{{ S }}"
B: {{ B }}
I: {{ I }}
L: {{ L }}
D: {{ D }}
BIN: "{{ BIN }}"
UL: "{{ UL }}"
defaultValue:
S: "{{ S }}"
B: {{ B }}
I: {{ I }}
L: {{ L }}
D: {{ D }}
BIN: "{{ BIN }}"
UL: "{{ UL }}"
valueConditions: "{{ valueConditions }}"
description: "{{ description }}"
- name: roleArn
value: "{{ roleArn }}"
- name: tags
value:
- Key: "{{ Key }}"
Value: "{{ Value }}"
UPDATE examples
- update_command
Update information about a command or mark a command for deprecation.
UPDATE aws.iot.commands
SET
displayName = '{{ displayName }}',
description = '{{ description }}',
deprecated = {{ deprecated }}
WHERE
command_id = '{{ command_id }}' --required
AND region = '{{ region }}' --required
RETURNING
command_id,
deprecated_,
description,
display_name,
last_updated_at;
DELETE examples
- delete_command
Delete a command resource.
DELETE FROM aws.iot.commands
WHERE command_id = '{{ command_id }}' --required
AND region = '{{ region }}' --required
;