/AWS1/IF_IOT=>CREATECOMMAND()¶
About CreateCommand¶
Creates a command. A command contains reusable configurations that can be applied before they are sent to the devices.
Method Signature¶
METHODS /AWS1/IF_IOT~CREATECOMMAND
IMPORTING
!IV_COMMANDID TYPE /AWS1/IOTCOMMANDID OPTIONAL
!IV_NAMESPACE TYPE /AWS1/IOTCOMMANDNAMESPACE OPTIONAL
!IV_DISPLAYNAME TYPE /AWS1/IOTDISPLAYNAME OPTIONAL
!IV_DESCRIPTION TYPE /AWS1/IOTCOMMANDDESCRIPTION OPTIONAL
!IO_PAYLOAD TYPE REF TO /AWS1/CL_IOTCOMMANDPAYLOAD OPTIONAL
!IV_PAYLOADTEMPLATE TYPE /AWS1/IOTCMDPAYLOADTMPLSTRING OPTIONAL
!IO_PREPROCESSOR TYPE REF TO /AWS1/CL_IOTCOMMANDPREPROCOR OPTIONAL
!IT_MANDATORYPARAMETERS TYPE /AWS1/CL_IOTCOMMANDPARAMETER=>TT_COMMANDPARAMETERLIST OPTIONAL
!IV_ROLEARN TYPE /AWS1/IOTROLEARN OPTIONAL
!IT_TAGS TYPE /AWS1/CL_IOTTAG=>TT_TAGLIST OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_iotcreatecommandrsp
RAISING
/AWS1/CX_IOTCONFLICTEXCEPTION
/AWS1/CX_IOTINTERNALSERVEREX
/AWS1/CX_IOTSERVICEQUOTAEXCDEX
/AWS1/CX_IOTTHROTTLINGEX
/AWS1/CX_IOTVALIDATIONEX
/AWS1/CX_IOTCLIENTEXC
/AWS1/CX_IOTSERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_commandid TYPE /AWS1/IOTCOMMANDID /AWS1/IOTCOMMANDID¶
A unique identifier for the command. We recommend using UUID. Alpha-numeric characters, hyphens, and underscores are valid for use here.
Optional arguments:¶
iv_namespace TYPE /AWS1/IOTCOMMANDNAMESPACE /AWS1/IOTCOMMANDNAMESPACE¶
The namespace of the command. The MQTT reserved topics and validations will be used for command executions according to the namespace setting.
iv_displayname TYPE /AWS1/IOTDISPLAYNAME /AWS1/IOTDISPLAYNAME¶
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.
iv_description TYPE /AWS1/IOTCOMMANDDESCRIPTION /AWS1/IOTCOMMANDDESCRIPTION¶
A short text decription of the command.
io_payload TYPE REF TO /AWS1/CL_IOTCOMMANDPAYLOAD /AWS1/CL_IOTCOMMANDPAYLOAD¶
The payload object for the static command.
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.
iv_payloadtemplate TYPE /AWS1/IOTCMDPAYLOADTMPLSTRING /AWS1/IOTCMDPAYLOADTMPLSTRING¶
The payload template for the dynamic command.
This parameter is required for dynamic commands where the command execution placeholders are supplied either from
mandatoryParametersor whenStartCommandExecutionis invoked.
io_preprocessor TYPE REF TO /AWS1/CL_IOTCOMMANDPREPROCOR /AWS1/CL_IOTCOMMANDPREPROCOR¶
Configuration that determines how
payloadTemplateis processed to generate command execution payload.This parameter is required for dynamic commands, along with
payloadTemplate, andmandatoryParameters.
it_mandatoryparameters TYPE /AWS1/CL_IOTCOMMANDPARAMETER=>TT_COMMANDPARAMETERLIST TT_COMMANDPARAMETERLIST¶
A list of parameters that are used by
StartCommandExecutionAPI for execution payload generation.
iv_rolearn TYPE /AWS1/IOTROLEARN /AWS1/IOTROLEARN¶
The IAM role that you must provide when using the
AWS-IoT-FleetWisenamespace. The role grants IoT Device Management the permission to access IoT FleetWise resources for generating the payload for the command. This field is not supported when you use theAWS-IoTnamespace.
it_tags TYPE /AWS1/CL_IOTTAG=>TT_TAGLIST TT_TAGLIST¶
Name-value pairs that are used as metadata to manage a command.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_iotcreatecommandrsp /AWS1/CL_IOTCREATECOMMANDRSP¶
Examples¶
Syntax Example¶
This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.
DATA(lo_result) = lo_client->createcommand(
io_payload = new /aws1/cl_iotcommandpayload(
iv_content = '5347567362473873563239796247513D'
iv_contenttype = |string|
)
io_preprocessor = new /aws1/cl_iotcommandpreprocor( new /aws1/cl_iotawsjsonsubstitut00( |string| ) )
it_mandatoryparameters = VALUE /aws1/cl_iotcommandparameter=>tt_commandparameterlist(
(
new /aws1/cl_iotcommandparameter(
io_defaultvalue = new /aws1/cl_iotcommandparamvalue(
iv_b = ABAP_TRUE
iv_bin = '5347567362473873563239796247513D'
iv_d = '0.1'
iv_i = 123
iv_l = 123
iv_s = |string|
iv_ul = |string|
)
io_value = new /aws1/cl_iotcommandparamvalue(
iv_b = ABAP_TRUE
iv_bin = '5347567362473873563239796247513D'
iv_d = '0.1'
iv_i = 123
iv_l = 123
iv_s = |string|
iv_ul = |string|
)
it_valueconditions = VALUE /aws1/cl_iotcmdparamvaluecond=>tt_commandparamvaluecondlist(
(
new /aws1/cl_iotcmdparamvaluecond(
io_operand = new /aws1/cl_iotcmdprmvalcompari00(
io_numberrange = new /aws1/cl_iotcmdparmvalnorange(
iv_max = |string|
iv_min = |string|
)
it_numbers = VALUE /aws1/cl_iotcmdparmvalstrlst_w=>tt_commandparamvaluestringlist(
( new /aws1/cl_iotcmdparmvalstrlst_w( |string| ) )
)
it_strings = VALUE /aws1/cl_iotcmdparmvalstrlst_w=>tt_commandparamvaluestringlist(
( new /aws1/cl_iotcmdparmvalstrlst_w( |string| ) )
)
iv_number = |string|
iv_string = |string|
)
iv_comparisonoperator = |string|
)
)
)
iv_description = |string|
iv_name = |string|
iv_type = |string|
)
)
)
it_tags = VALUE /aws1/cl_iottag=>tt_taglist(
(
new /aws1/cl_iottag(
iv_key = |string|
iv_value = |string|
)
)
)
iv_commandid = |string|
iv_description = |string|
iv_displayname = |string|
iv_namespace = |string|
iv_payloadtemplate = |string|
iv_rolearn = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lv_commandid = lo_result->get_commandid( ).
lv_commandarn = lo_result->get_commandarn( ).
ENDIF.