/AWS1/IF_SSM=>SENDCOMMAND()¶
About SendCommand¶
Runs commands on one or more managed nodes.
Method Signature¶
METHODS /AWS1/IF_SSM~SENDCOMMAND
IMPORTING
!IT_INSTANCEIDS TYPE /AWS1/CL_SSMINSTANCEIDLIST_W=>TT_INSTANCEIDLIST OPTIONAL
!IT_TARGETS TYPE /AWS1/CL_SSMTARGET=>TT_TARGETS OPTIONAL
!IV_DOCUMENTNAME TYPE /AWS1/SSMDOCUMENTARN OPTIONAL
!IV_DOCUMENTVERSION TYPE /AWS1/SSMDOCUMENTVERSION OPTIONAL
!IV_DOCUMENTHASH TYPE /AWS1/SSMDOCUMENTHASH OPTIONAL
!IV_DOCUMENTHASHTYPE TYPE /AWS1/SSMDOCUMENTHASHTYPE OPTIONAL
!IV_TIMEOUTSECONDS TYPE /AWS1/SSMTIMEOUTSECONDS OPTIONAL
!IV_COMMENT TYPE /AWS1/SSMCOMMENT OPTIONAL
!IT_PARAMETERS TYPE /AWS1/CL_SSMPARAMVALUELIST_W=>TT_PARAMETERS OPTIONAL
!IV_OUTPUTS3REGION TYPE /AWS1/SSMS3REGION OPTIONAL
!IV_OUTPUTS3BUCKETNAME TYPE /AWS1/SSMS3BUCKETNAME OPTIONAL
!IV_OUTPUTS3KEYPREFIX TYPE /AWS1/SSMS3KEYPREFIX OPTIONAL
!IV_MAXCONCURRENCY TYPE /AWS1/SSMMAXCONCURRENCY OPTIONAL
!IV_MAXERRORS TYPE /AWS1/SSMMAXERRORS OPTIONAL
!IV_SERVICEROLEARN TYPE /AWS1/SSMSERVICEROLE OPTIONAL
!IO_NOTIFICATIONCONFIG TYPE REF TO /AWS1/CL_SSMNOTIFICATIONCONFIG OPTIONAL
!IO_CLOUDWATCHOUTPUTCONFIG TYPE REF TO /AWS1/CL_SSMCLOUDWATCHOUTCFG OPTIONAL
!IO_ALARMCONFIGURATION TYPE REF TO /AWS1/CL_SSMALARMCONFIGURATION OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_ssmsendcommandresult
RAISING
/AWS1/CX_SSMDUPLICATEINSTID
/AWS1/CX_SSMINTERNALSERVERERR
/AWS1/CX_SSMINVALIDDOCUMENT
/AWS1/CX_SSMINVALIDDOCVERSION
/AWS1/CX_SSMINVALIDINSTANCEID
/AWS1/CX_SSMINVALIDNOTIFCONFIG
/AWS1/CX_SSMINVOUTPUTFOLDER
/AWS1/CX_SSMINVALIDPARAMETERS
/AWS1/CX_SSMINVALIDROLE
/AWS1/CX_SSMMAXDOCSIZEEXCEEDED
/AWS1/CX_SSMUNSUPPEDPLATFORM00
/AWS1/CX_SSMCLIENTEXC
/AWS1/CX_SSMSERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_documentname TYPE /AWS1/SSMDOCUMENTARN /AWS1/SSMDOCUMENTARN¶
The name of the Amazon Web Services Systems Manager document (SSM document) to run. This can be a public document or a custom document. To run a shared document belonging to another account, specify the document Amazon Resource Name (ARN). For more information about how to use shared documents, see Sharing SSM documents in the Amazon Web Services Systems Manager User Guide.
If you specify a document name or ARN that hasn't been shared with your account, you receive an
InvalidDocumenterror.
Optional arguments:¶
it_instanceids TYPE /AWS1/CL_SSMINSTANCEIDLIST_W=>TT_INSTANCEIDLIST TT_INSTANCEIDLIST¶
The IDs of the managed nodes where the command should run. Specifying managed node IDs is most useful when you are targeting a limited number of managed nodes, though you can specify up to 50 IDs.
To target a larger number of managed nodes, or if you prefer not to list individual node IDs, we recommend using the
Targetsoption instead. UsingTargets, which accepts tag key-value pairs to identify the managed nodes to send commands to, you can a send command to tens, hundreds, or thousands of nodes at once.For more information about how to use targets, see Run commands at scale in the Amazon Web Services Systems Manager User Guide.
it_targets TYPE /AWS1/CL_SSMTARGET=>TT_TARGETS TT_TARGETS¶
An array of search criteria that targets managed nodes using a
Key,Valuecombination that you specify. Specifying targets is most useful when you want to send a command to a large number of managed nodes at once. UsingTargets, which accepts tag key-value pairs to identify managed nodes, you can send a command to tens, hundreds, or thousands of nodes at once.To send a command to a smaller number of managed nodes, you can use the
InstanceIdsoption instead.For more information about how to use targets, see Run commands at scale in the Amazon Web Services Systems Manager User Guide.
iv_documentversion TYPE /AWS1/SSMDOCUMENTVERSION /AWS1/SSMDOCUMENTVERSION¶
The SSM document version to use in the request. You can specify $DEFAULT, $LATEST, or a specific version number. If you run commands by using the Command Line Interface (Amazon Web Services CLI), then you must escape the first two options by using a backslash. If you specify a version number, then you don't need to use the backslash. For example:
--document-version "\$DEFAULT"
--document-version "\$LATEST"
--document-version "3"
iv_documenthash TYPE /AWS1/SSMDOCUMENTHASH /AWS1/SSMDOCUMENTHASH¶
The Sha256 or Sha1 hash created by the system when the document was created.
Sha1 hashes have been deprecated.
iv_documenthashtype TYPE /AWS1/SSMDOCUMENTHASHTYPE /AWS1/SSMDOCUMENTHASHTYPE¶
Sha256 or Sha1.
Sha1 hashes have been deprecated.
iv_timeoutseconds TYPE /AWS1/SSMTIMEOUTSECONDS /AWS1/SSMTIMEOUTSECONDS¶
If this time is reached and the command hasn't already started running, it won't run.
iv_comment TYPE /AWS1/SSMCOMMENT /AWS1/SSMCOMMENT¶
User-specified information about the command, such as a brief description of what the command should do.
it_parameters TYPE /AWS1/CL_SSMPARAMVALUELIST_W=>TT_PARAMETERS TT_PARAMETERS¶
The required and optional parameters specified in the document being run.
iv_outputs3region TYPE /AWS1/SSMS3REGION /AWS1/SSMS3REGION¶
(Deprecated) You can no longer specify this parameter. The system ignores it. Instead, Systems Manager automatically determines the Amazon Web Services Region of the S3 bucket.
iv_outputs3bucketname TYPE /AWS1/SSMS3BUCKETNAME /AWS1/SSMS3BUCKETNAME¶
The name of the S3 bucket where command execution responses should be stored.
iv_outputs3keyprefix TYPE /AWS1/SSMS3KEYPREFIX /AWS1/SSMS3KEYPREFIX¶
The directory structure within the S3 bucket where the responses should be stored.
iv_maxconcurrency TYPE /AWS1/SSMMAXCONCURRENCY /AWS1/SSMMAXCONCURRENCY¶
(Optional) The maximum number of managed nodes that are allowed to run the command at the same time. You can specify a number such as 10 or a percentage such as 10%. The default value is
50. For more information about how to useMaxConcurrency, see Using concurrency controls in the Amazon Web Services Systems Manager User Guide.
iv_maxerrors TYPE /AWS1/SSMMAXERRORS /AWS1/SSMMAXERRORS¶
The maximum number of errors allowed without the command failing. When the command fails one more time beyond the value of
MaxErrors, the systems stops sending the command to additional targets. You can specify a number like 10 or a percentage like 10%. The default value is0. For more information about how to useMaxErrors, see Using error controls in the Amazon Web Services Systems Manager User Guide.
iv_servicerolearn TYPE /AWS1/SSMSERVICEROLE /AWS1/SSMSERVICEROLE¶
The ARN of the Identity and Access Management (IAM) service role to use to publish Amazon Simple Notification Service (Amazon SNS) notifications for Run Command commands.
This role must provide the
sns:Publishpermission for your notification topic. For information about creating and using this service role, see Monitoring Systems Manager status changes using Amazon SNS notifications in the Amazon Web Services Systems Manager User Guide.
io_notificationconfig TYPE REF TO /AWS1/CL_SSMNOTIFICATIONCONFIG /AWS1/CL_SSMNOTIFICATIONCONFIG¶
Configurations for sending notifications.
io_cloudwatchoutputconfig TYPE REF TO /AWS1/CL_SSMCLOUDWATCHOUTCFG /AWS1/CL_SSMCLOUDWATCHOUTCFG¶
Enables Amazon Web Services Systems Manager to send Run Command output to Amazon CloudWatch Logs. Run Command is a tool in Amazon Web Services Systems Manager.
io_alarmconfiguration TYPE REF TO /AWS1/CL_SSMALARMCONFIGURATION /AWS1/CL_SSMALARMCONFIGURATION¶
The CloudWatch alarm you want to apply to your command.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_ssmsendcommandresult /AWS1/CL_SSMSENDCOMMANDRESULT¶
Domain /AWS1/RT_ACCOUNT_ID Primitive Type NUMC
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->sendcommand(
io_alarmconfiguration = new /aws1/cl_ssmalarmconfiguration(
it_alarms = VALUE /aws1/cl_ssmalarm=>tt_alarmlist(
( new /aws1/cl_ssmalarm( |string| ) )
)
iv_ignorepollalarmfailure = ABAP_TRUE
)
io_cloudwatchoutputconfig = new /aws1/cl_ssmcloudwatchoutcfg(
iv_cloudwatchloggroupname = |string|
iv_cloudwatchoutputenabled = ABAP_TRUE
)
io_notificationconfig = new /aws1/cl_ssmnotificationconfig(
it_notificationevents = VALUE /aws1/cl_ssmnotifeventlist_w=>tt_notificationeventlist(
( new /aws1/cl_ssmnotifeventlist_w( |string| ) )
)
iv_notificationarn = |string|
iv_notificationtype = |string|
)
it_instanceids = VALUE /aws1/cl_ssminstanceidlist_w=>tt_instanceidlist(
( new /aws1/cl_ssminstanceidlist_w( |string| ) )
)
it_parameters = VALUE /aws1/cl_ssmparamvaluelist_w=>tt_parameters(
(
VALUE /aws1/cl_ssmparamvaluelist_w=>ts_parameters_maprow(
key = |string|
value = VALUE /aws1/cl_ssmparamvaluelist_w=>tt_parametervaluelist(
( new /aws1/cl_ssmparamvaluelist_w( |string| ) )
)
)
)
)
it_targets = VALUE /aws1/cl_ssmtarget=>tt_targets(
(
new /aws1/cl_ssmtarget(
it_values = VALUE /aws1/cl_ssmtargetvalues_w=>tt_targetvalues(
( new /aws1/cl_ssmtargetvalues_w( |string| ) )
)
iv_key = |string|
)
)
)
iv_comment = |string|
iv_documenthash = |string|
iv_documenthashtype = |string|
iv_documentname = |string|
iv_documentversion = |string|
iv_maxconcurrency = |string|
iv_maxerrors = |string|
iv_outputs3bucketname = |string|
iv_outputs3keyprefix = |string|
iv_outputs3region = |string|
iv_servicerolearn = |string|
iv_timeoutseconds = 123
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lo_command = lo_result->get_command( ).
IF lo_command IS NOT INITIAL.
lv_commandid = lo_command->get_commandid( ).
lv_documentname = lo_command->get_documentname( ).
lv_documentversion = lo_command->get_documentversion( ).
lv_comment = lo_command->get_comment( ).
lv_datetime = lo_command->get_expiresafter( ).
LOOP AT lo_command->get_parameters( ) into ls_row.
lv_key = ls_row-key.
LOOP AT ls_row-value into lo_row_1.
lo_row_2 = lo_row_1.
IF lo_row_2 IS NOT INITIAL.
lv_parametervalue = lo_row_2->get_value( ).
ENDIF.
ENDLOOP.
ENDLOOP.
LOOP AT lo_command->get_instanceids( ) into lo_row_3.
lo_row_4 = lo_row_3.
IF lo_row_4 IS NOT INITIAL.
lv_instanceid = lo_row_4->get_value( ).
ENDIF.
ENDLOOP.
LOOP AT lo_command->get_targets( ) into lo_row_5.
lo_row_6 = lo_row_5.
IF lo_row_6 IS NOT INITIAL.
lv_targetkey = lo_row_6->get_key( ).
LOOP AT lo_row_6->get_values( ) into lo_row_7.
lo_row_8 = lo_row_7.
IF lo_row_8 IS NOT INITIAL.
lv_targetvalue = lo_row_8->get_value( ).
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
lv_datetime = lo_command->get_requesteddatetime( ).
lv_commandstatus = lo_command->get_status( ).
lv_statusdetails = lo_command->get_statusdetails( ).
lv_s3region = lo_command->get_outputs3region( ).
lv_s3bucketname = lo_command->get_outputs3bucketname( ).
lv_s3keyprefix = lo_command->get_outputs3keyprefix( ).
lv_maxconcurrency = lo_command->get_maxconcurrency( ).
lv_maxerrors = lo_command->get_maxerrors( ).
lv_targetcount = lo_command->get_targetcount( ).
lv_completedcount = lo_command->get_completedcount( ).
lv_errorcount = lo_command->get_errorcount( ).
lv_deliverytimedoutcount = lo_command->get_deliverytimedoutcount( ).
lv_servicerole = lo_command->get_servicerole( ).
lo_notificationconfig = lo_command->get_notificationconfig( ).
IF lo_notificationconfig IS NOT INITIAL.
lv_notificationarn = lo_notificationconfig->get_notificationarn( ).
LOOP AT lo_notificationconfig->get_notificationevents( ) into lo_row_9.
lo_row_10 = lo_row_9.
IF lo_row_10 IS NOT INITIAL.
lv_notificationevent = lo_row_10->get_value( ).
ENDIF.
ENDLOOP.
lv_notificationtype = lo_notificationconfig->get_notificationtype( ).
ENDIF.
lo_cloudwatchoutputconfig = lo_command->get_cloudwatchoutputconfig( ).
IF lo_cloudwatchoutputconfig IS NOT INITIAL.
lv_cloudwatchloggroupname = lo_cloudwatchoutputconfig->get_cloudwatchloggroupname( ).
lv_cloudwatchoutputenabled = lo_cloudwatchoutputconfig->get_cloudwatchoutputenabled( ).
ENDIF.
lv_timeoutseconds = lo_command->get_timeoutseconds( ).
lo_alarmconfiguration = lo_command->get_alarmconfiguration( ).
IF lo_alarmconfiguration IS NOT INITIAL.
lv_boolean = lo_alarmconfiguration->get_ignorepollalarmfailure( ).
LOOP AT lo_alarmconfiguration->get_alarms( ) into lo_row_11.
lo_row_12 = lo_row_11.
IF lo_row_12 IS NOT INITIAL.
lv_alarmname = lo_row_12->get_name( ).
ENDIF.
ENDLOOP.
ENDIF.
LOOP AT lo_command->get_triggeredalarms( ) into lo_row_13.
lo_row_14 = lo_row_13.
IF lo_row_14 IS NOT INITIAL.
lv_alarmname = lo_row_14->get_name( ).
lv_externalalarmstate = lo_row_14->get_state( ).
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.