IoT / Client / create_command
create_command#
- IoT.Client.create_command(**kwargs)#
Creates a command. A command contains reusable configurations that can be applied before they are sent to the devices.
See also: AWS API Documentation
Request Syntax
response = client.create_command( commandId='string', namespace='AWS-IoT'|'AWS-IoT-FleetWise', displayName='string', description='string', payload={ 'content': b'bytes', 'contentType': 'string' }, mandatoryParameters=[ { 'name': 'string', 'value': { 'S': 'string', 'B': True|False, 'I': 123, 'L': 123, 'D': 123.0, 'BIN': b'bytes', 'UL': 'string' }, 'defaultValue': { 'S': 'string', 'B': True|False, 'I': 123, 'L': 123, 'D': 123.0, 'BIN': b'bytes', 'UL': 'string' }, 'description': 'string' }, ], roleArn='string', tags=[ { 'Key': 'string', 'Value': 'string' }, ] )
- Parameters:
commandId (string) –
[REQUIRED]
A unique identifier for the command. We recommend using UUID. Alpha-numeric characters, hyphens, and underscores are valid for use here.
namespace (string) – The namespace of the command. The MQTT reserved topics and validations will be used for command executions according to the namespace setting.
displayName (string) – The user-friendly name in the console for the command. This name doesn’t have to be unique. You can update the user-friendly name after you define it.
description (string) – A short text decription of the command.
payload (dict) –
The payload object for the command. You must specify this information when using the
AWS-IoT
namespace.You can upload a static payload file from your local storage that contains the instructions for the device to process. The payload file can use any format. To make sure that the device correctly interprets the payload, we recommend you to specify the payload content type.
content (bytes) –
The static payload file for the command.
contentType (string) –
The content type that specifies the format type of the payload file. This field must use a type/subtype format, such as
application/json
. For information about various content types, see Common MIME types.
mandatoryParameters (list) –
A list of parameters that are required by the
StartCommandExecution
API. These parameters need to be specified only when using theAWS-IoT-FleetWise
namespace. You can either specify them here or when running the command using theStartCommandExecution
API.(dict) –
A map of key-value pairs that describe the command.
name (string) – [REQUIRED]
The name of a specific parameter used in a command and command execution.
value (dict) –
The value used to describe the command. When you assign a value to a parameter, it will override any default value that you had already specified.
S (string) –
An attribute of type String. For example:
"S": "Hello"
B (boolean) –
An attribute of type Boolean. For example:
"BOOL": true
I (integer) –
An attribute of type Integer (Thirty-Two Bits).
L (integer) –
An attribute of type Long.
D (float) –
An attribute of type Double (Sixty-Four Bits).
BIN (bytes) –
An attribute of type Binary. For example:
"B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"
UL (string) –
An attribute of type unsigned long.
defaultValue (dict) –
The default value used to describe the command. This is the value assumed by the parameter if no other value is assigned to it.
S (string) –
An attribute of type String. For example:
"S": "Hello"
B (boolean) –
An attribute of type Boolean. For example:
"BOOL": true
I (integer) –
An attribute of type Integer (Thirty-Two Bits).
L (integer) –
An attribute of type Long.
D (float) –
An attribute of type Double (Sixty-Four Bits).
BIN (bytes) –
An attribute of type Binary. For example:
"B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"
UL (string) –
An attribute of type unsigned long.
description (string) –
The description of the command parameter.
roleArn (string) – The IAM role that allows access to create the command.
tags (list) –
Name-value pairs that are used as metadata to manage a command.
(dict) –
A set of key/value pairs that are used to manage the resource.
Key (string) – [REQUIRED]
The tag’s key.
Value (string) –
The tag’s value.
- Return type:
dict
- Returns:
Response Syntax
{ 'commandId': 'string', 'commandArn': 'string' }
Response Structure
(dict) –
commandId (string) –
The unique identifier for the command.
commandArn (string) –
The Amazon Resource Number (ARN) of the command. For example,
arn:aws:iot:<region>:<accountid>:command/<commandId>
Exceptions
IoT.Client.exceptions.ValidationException
IoT.Client.exceptions.ConflictException
IoT.Client.exceptions.ServiceQuotaExceededException
IoT.Client.exceptions.ThrottlingException
IoT.Client.exceptions.InternalServerException