Skip to content

/AWS1/CL_SSM=>CREATEASSOCIATIONBATCH()

About CreateAssociationBatch

Associates the specified Amazon Web Services Systems Manager document (SSM document) with the specified managed nodes or targets.

When you associate a document with one or more managed nodes using IDs or tags, Amazon Web Services Systems Manager Agent (SSM Agent) running on the managed node processes the document and configures the node as specified.

If you associate a document with a managed node that already has an associated document, the system returns the AssociationAlreadyExists exception.

Method Signature

IMPORTING

Required arguments:

it_entries TYPE /AWS1/CL_SSMCREASSOCIATIONBT01=>TT_CREASSOCIATIONBTCREQENTRIES TT_CREASSOCIATIONBTCREQENTRIES

One or more associations.

RETURNING

oo_output TYPE REF TO /aws1/cl_ssmcreassociationbt02 /AWS1/CL_SSMCREASSOCIATIONBT02

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->/aws1/if_ssm~createassociationbatch(
  it_entries = VALUE /aws1/cl_ssmcreassociationbt01=>tt_creassociationbtcreqentries(
    (
      new /aws1/cl_ssmcreassociationbt01(
        io_alarmconfiguration = new /aws1/cl_ssmalarmconfiguration(
          it_alarms = VALUE /aws1/cl_ssmalarm=>tt_alarmlist(
            ( new /aws1/cl_ssmalarm( |string| ) )
          )
          iv_ignorepollalarmfailure = ABAP_TRUE
        )
        io_outputlocation = new /aws1/cl_ssminstassociationo00(
          io_s3location = new /aws1/cl_ssms3outputlocation(
            iv_outputs3bucketname = |string|
            iv_outputs3keyprefix = |string|
            iv_outputs3region = |string|
          )
        )
        it_calendarnames = VALUE /aws1/cl_ssmcalendarnameorar00=>tt_calendarnameorarnlist(
          ( new /aws1/cl_ssmcalendarnameorar00( |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_targetlocations = VALUE /aws1/cl_ssmtargetlocation=>tt_targetlocations(
          (
            new /aws1/cl_ssmtargetlocation(
              io_targetlocationalarmconf = new /aws1/cl_ssmalarmconfiguration(
                it_alarms = VALUE /aws1/cl_ssmalarm=>tt_alarmlist(
                  ( new /aws1/cl_ssmalarm( |string| ) )
                )
                iv_ignorepollalarmfailure = ABAP_TRUE
              )
              it_accounts = VALUE /aws1/cl_ssmaccounts_w=>tt_accounts(
                ( new /aws1/cl_ssmaccounts_w( |string| ) )
              )
              it_excludeaccounts = VALUE /aws1/cl_ssmexcludeaccounts_w=>tt_excludeaccounts(
                ( new /aws1/cl_ssmexcludeaccounts_w( |string| ) )
              )
              it_regions = VALUE /aws1/cl_ssmregions_w=>tt_regions(
                ( new /aws1/cl_ssmregions_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_executionrolename = |string|
              iv_includechildorgunits = ABAP_TRUE
              iv_targetlocationmaxerrors = |string|
              iv_targetlocmaxconcurrency = |string|
              iv_targetsmaxconcurrency = |string|
              iv_targetsmaxerrors = |string|
            )
          )
        )
        it_targetmaps = VALUE /aws1/cl_ssmtgtmapvaluelist_w=>tt_targetmaps(
          (
            VALUE /aws1/cl_ssmtgtmapvaluelist_w=>tt_targetmap(
              (
                VALUE /aws1/cl_ssmtgtmapvaluelist_w=>ts_targetmap_maprow(
                  value = VALUE /aws1/cl_ssmtgtmapvaluelist_w=>tt_targetmapvaluelist(
                    ( new /aws1/cl_ssmtgtmapvaluelist_w( |string| ) )
                  )
                  key = |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_applyonlyatcroninterval = ABAP_TRUE
        iv_associationname = |string|
        iv_automationtargetparamname = |string|
        iv_complianceseverity = |string|
        iv_documentversion = |string|
        iv_duration = 123
        iv_instanceid = |string|
        iv_maxconcurrency = |string|
        iv_maxerrors = |string|
        iv_name = |string|
        iv_scheduleexpression = |string|
        iv_scheduleoffset = 123
        iv_synccompliance = |string|
      )
    )
  )
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  LOOP AT lo_result->get_successful( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_documentarn = lo_row_1->get_name( ).
      lv_instanceid = lo_row_1->get_instanceid( ).
      lv_associationversion = lo_row_1->get_associationversion( ).
      lv_datetime = lo_row_1->get_date( ).
      lv_datetime = lo_row_1->get_lastupdassociationdate( ).
      lo_associationstatus = lo_row_1->get_status( ).
      IF lo_associationstatus IS NOT INITIAL.
        lv_datetime = lo_associationstatus->get_date( ).
        lv_associationstatusname = lo_associationstatus->get_name( ).
        lv_statusmessage = lo_associationstatus->get_message( ).
        lv_statusadditionalinfo = lo_associationstatus->get_additionalinfo( ).
      ENDIF.
      lo_associationoverview = lo_row_1->get_overview( ).
      IF lo_associationoverview IS NOT INITIAL.
        lv_statusname = lo_associationoverview->get_status( ).
        lv_statusname = lo_associationoverview->get_detailedstatus( ).
        LOOP AT lo_associationoverview->get_associationstataggrega00( ) into ls_row_2.
          lv_key = ls_row_2-key.
          lo_value = ls_row_2-value.
          IF lo_value IS NOT INITIAL.
            lv_instancecount = lo_value->get_value( ).
          ENDIF.
        ENDLOOP.
      ENDIF.
      lv_documentversion = lo_row_1->get_documentversion( ).
      lv_automationtargetparamet = lo_row_1->get_automationtgtparamname( ).
      LOOP AT lo_row_1->get_parameters( ) into ls_row_3.
        lv_key_1 = ls_row_3-key.
        LOOP AT ls_row_3-value into lo_row_4.
          lo_row_5 = lo_row_4.
          IF lo_row_5 IS NOT INITIAL.
            lv_parametervalue = lo_row_5->get_value( ).
          ENDIF.
        ENDLOOP.
      ENDLOOP.
      lv_associationid = lo_row_1->get_associationid( ).
      LOOP AT lo_row_1->get_targets( ) into lo_row_6.
        lo_row_7 = lo_row_6.
        IF lo_row_7 IS NOT INITIAL.
          lv_targetkey = lo_row_7->get_key( ).
          LOOP AT lo_row_7->get_values( ) into lo_row_8.
            lo_row_9 = lo_row_8.
            IF lo_row_9 IS NOT INITIAL.
              lv_targetvalue = lo_row_9->get_value( ).
            ENDIF.
          ENDLOOP.
        ENDIF.
      ENDLOOP.
      lv_scheduleexpression = lo_row_1->get_scheduleexpression( ).
      lo_instanceassociationoutp = lo_row_1->get_outputlocation( ).
      IF lo_instanceassociationoutp IS NOT INITIAL.
        lo_s3outputlocation = lo_instanceassociationoutp->get_s3location( ).
        IF lo_s3outputlocation IS NOT INITIAL.
          lv_s3region = lo_s3outputlocation->get_outputs3region( ).
          lv_s3bucketname = lo_s3outputlocation->get_outputs3bucketname( ).
          lv_s3keyprefix = lo_s3outputlocation->get_outputs3keyprefix( ).
        ENDIF.
      ENDIF.
      lv_datetime = lo_row_1->get_lastexecutiondate( ).
      lv_datetime = lo_row_1->get_lastsuccessfulexecdate( ).
      lv_associationname = lo_row_1->get_associationname( ).
      lv_maxerrors = lo_row_1->get_maxerrors( ).
      lv_maxconcurrency = lo_row_1->get_maxconcurrency( ).
      lv_associationcompliancese = lo_row_1->get_complianceseverity( ).
      lv_associationsynccomplian = lo_row_1->get_synccompliance( ).
      lv_applyonlyatcroninterval = lo_row_1->get_applyonlyatcroninterval( ).
      LOOP AT lo_row_1->get_calendarnames( ) into lo_row_10.
        lo_row_11 = lo_row_10.
        IF lo_row_11 IS NOT INITIAL.
          lv_calendarnameorarn = lo_row_11->get_value( ).
        ENDIF.
      ENDLOOP.
      LOOP AT lo_row_1->get_targetlocations( ) into lo_row_12.
        lo_row_13 = lo_row_12.
        IF lo_row_13 IS NOT INITIAL.
          LOOP AT lo_row_13->get_accounts( ) into lo_row_14.
            lo_row_15 = lo_row_14.
            IF lo_row_15 IS NOT INITIAL.
              lv_account = lo_row_15->get_value( ).
            ENDIF.
          ENDLOOP.
          LOOP AT lo_row_13->get_regions( ) into lo_row_16.
            lo_row_17 = lo_row_16.
            IF lo_row_17 IS NOT INITIAL.
              lv_region = lo_row_17->get_value( ).
            ENDIF.
          ENDLOOP.
          lv_maxconcurrency = lo_row_13->get_targetlocmaxconcurrency( ).
          lv_maxerrors = lo_row_13->get_targetlocationmaxerrors( ).
          lv_executionrolename = lo_row_13->get_executionrolename( ).
          lo_alarmconfiguration = lo_row_13->get_targetlocationalarmconf( ).
          IF lo_alarmconfiguration IS NOT INITIAL.
            lv_boolean = lo_alarmconfiguration->get_ignorepollalarmfailure( ).
            LOOP AT lo_alarmconfiguration->get_alarms( ) into lo_row_18.
              lo_row_19 = lo_row_18.
              IF lo_row_19 IS NOT INITIAL.
                lv_alarmname = lo_row_19->get_name( ).
              ENDIF.
            ENDLOOP.
          ENDIF.
          lv_boolean = lo_row_13->get_includechildorgunits( ).
          LOOP AT lo_row_13->get_excludeaccounts( ) into lo_row_20.
            lo_row_21 = lo_row_20.
            IF lo_row_21 IS NOT INITIAL.
              lv_excludeaccount = lo_row_21->get_value( ).
            ENDIF.
          ENDLOOP.
          LOOP AT lo_row_13->get_targets( ) into lo_row_6.
            lo_row_7 = lo_row_6.
            IF lo_row_7 IS NOT INITIAL.
              lv_targetkey = lo_row_7->get_key( ).
              LOOP AT lo_row_7->get_values( ) into lo_row_8.
                lo_row_9 = lo_row_8.
                IF lo_row_9 IS NOT INITIAL.
                  lv_targetvalue = lo_row_9->get_value( ).
                ENDIF.
              ENDLOOP.
            ENDIF.
          ENDLOOP.
          lv_maxconcurrency = lo_row_13->get_targetsmaxconcurrency( ).
          lv_maxerrors = lo_row_13->get_targetsmaxerrors( ).
        ENDIF.
      ENDLOOP.
      lv_scheduleoffset = lo_row_1->get_scheduleoffset( ).
      lv_duration = lo_row_1->get_duration( ).
      LOOP AT lo_row_1->get_targetmaps( ) into lt_row_22.
        LOOP AT lt_row_22 into ls_row_23.
          lv_key_2 = ls_row_23-key.
          LOOP AT ls_row_23-value into lo_row_24.
            lo_row_25 = lo_row_24.
            IF lo_row_25 IS NOT INITIAL.
              lv_targetmapvalue = lo_row_25->get_value( ).
            ENDIF.
          ENDLOOP.
        ENDLOOP.
      ENDLOOP.
      lo_alarmconfiguration = lo_row_1->get_alarmconfiguration( ).
      IF lo_alarmconfiguration IS NOT INITIAL.
        lv_boolean = lo_alarmconfiguration->get_ignorepollalarmfailure( ).
        LOOP AT lo_alarmconfiguration->get_alarms( ) into lo_row_18.
          lo_row_19 = lo_row_18.
          IF lo_row_19 IS NOT INITIAL.
            lv_alarmname = lo_row_19->get_name( ).
          ENDIF.
        ENDLOOP.
      ENDIF.
      LOOP AT lo_row_1->get_triggeredalarms( ) into lo_row_26.
        lo_row_27 = lo_row_26.
        IF lo_row_27 IS NOT INITIAL.
          lv_alarmname = lo_row_27->get_name( ).
          lv_externalalarmstate = lo_row_27->get_state( ).
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDLOOP.
  LOOP AT lo_result->get_failed( ) into lo_row_28.
    lo_row_29 = lo_row_28.
    IF lo_row_29 IS NOT INITIAL.
      lo_createassociationbatchr = lo_row_29->get_entry( ).
      IF lo_createassociationbatchr IS NOT INITIAL.
        lv_documentarn = lo_createassociationbatchr->get_name( ).
        lv_instanceid = lo_createassociationbatchr->get_instanceid( ).
        LOOP AT lo_createassociationbatchr->get_parameters( ) into ls_row_3.
          lv_key_1 = ls_row_3-key.
          LOOP AT ls_row_3-value into lo_row_4.
            lo_row_5 = lo_row_4.
            IF lo_row_5 IS NOT INITIAL.
              lv_parametervalue = lo_row_5->get_value( ).
            ENDIF.
          ENDLOOP.
        ENDLOOP.
        lv_automationtargetparamet = lo_createassociationbatchr->get_automationtgtparamname( ).
        lv_documentversion = lo_createassociationbatchr->get_documentversion( ).
        LOOP AT lo_createassociationbatchr->get_targets( ) into lo_row_6.
          lo_row_7 = lo_row_6.
          IF lo_row_7 IS NOT INITIAL.
            lv_targetkey = lo_row_7->get_key( ).
            LOOP AT lo_row_7->get_values( ) into lo_row_8.
              lo_row_9 = lo_row_8.
              IF lo_row_9 IS NOT INITIAL.
                lv_targetvalue = lo_row_9->get_value( ).
              ENDIF.
            ENDLOOP.
          ENDIF.
        ENDLOOP.
        lv_scheduleexpression = lo_createassociationbatchr->get_scheduleexpression( ).
        lo_instanceassociationoutp = lo_createassociationbatchr->get_outputlocation( ).
        IF lo_instanceassociationoutp IS NOT INITIAL.
          lo_s3outputlocation = lo_instanceassociationoutp->get_s3location( ).
          IF lo_s3outputlocation IS NOT INITIAL.
            lv_s3region = lo_s3outputlocation->get_outputs3region( ).
            lv_s3bucketname = lo_s3outputlocation->get_outputs3bucketname( ).
            lv_s3keyprefix = lo_s3outputlocation->get_outputs3keyprefix( ).
          ENDIF.
        ENDIF.
        lv_associationname = lo_createassociationbatchr->get_associationname( ).
        lv_maxerrors = lo_createassociationbatchr->get_maxerrors( ).
        lv_maxconcurrency = lo_createassociationbatchr->get_maxconcurrency( ).
        lv_associationcompliancese = lo_createassociationbatchr->get_complianceseverity( ).
        lv_associationsynccomplian = lo_createassociationbatchr->get_synccompliance( ).
        lv_applyonlyatcroninterval = lo_createassociationbatchr->get_applyonlyatcroninterval( ).
        LOOP AT lo_createassociationbatchr->get_calendarnames( ) into lo_row_10.
          lo_row_11 = lo_row_10.
          IF lo_row_11 IS NOT INITIAL.
            lv_calendarnameorarn = lo_row_11->get_value( ).
          ENDIF.
        ENDLOOP.
        LOOP AT lo_createassociationbatchr->get_targetlocations( ) into lo_row_12.
          lo_row_13 = lo_row_12.
          IF lo_row_13 IS NOT INITIAL.
            LOOP AT lo_row_13->get_accounts( ) into lo_row_14.
              lo_row_15 = lo_row_14.
              IF lo_row_15 IS NOT INITIAL.
                lv_account = lo_row_15->get_value( ).
              ENDIF.
            ENDLOOP.
            LOOP AT lo_row_13->get_regions( ) into lo_row_16.
              lo_row_17 = lo_row_16.
              IF lo_row_17 IS NOT INITIAL.
                lv_region = lo_row_17->get_value( ).
              ENDIF.
            ENDLOOP.
            lv_maxconcurrency = lo_row_13->get_targetlocmaxconcurrency( ).
            lv_maxerrors = lo_row_13->get_targetlocationmaxerrors( ).
            lv_executionrolename = lo_row_13->get_executionrolename( ).
            lo_alarmconfiguration = lo_row_13->get_targetlocationalarmconf( ).
            IF lo_alarmconfiguration IS NOT INITIAL.
              lv_boolean = lo_alarmconfiguration->get_ignorepollalarmfailure( ).
              LOOP AT lo_alarmconfiguration->get_alarms( ) into lo_row_18.
                lo_row_19 = lo_row_18.
                IF lo_row_19 IS NOT INITIAL.
                  lv_alarmname = lo_row_19->get_name( ).
                ENDIF.
              ENDLOOP.
            ENDIF.
            lv_boolean = lo_row_13->get_includechildorgunits( ).
            LOOP AT lo_row_13->get_excludeaccounts( ) into lo_row_20.
              lo_row_21 = lo_row_20.
              IF lo_row_21 IS NOT INITIAL.
                lv_excludeaccount = lo_row_21->get_value( ).
              ENDIF.
            ENDLOOP.
            LOOP AT lo_row_13->get_targets( ) into lo_row_6.
              lo_row_7 = lo_row_6.
              IF lo_row_7 IS NOT INITIAL.
                lv_targetkey = lo_row_7->get_key( ).
                LOOP AT lo_row_7->get_values( ) into lo_row_8.
                  lo_row_9 = lo_row_8.
                  IF lo_row_9 IS NOT INITIAL.
                    lv_targetvalue = lo_row_9->get_value( ).
                  ENDIF.
                ENDLOOP.
              ENDIF.
            ENDLOOP.
            lv_maxconcurrency = lo_row_13->get_targetsmaxconcurrency( ).
            lv_maxerrors = lo_row_13->get_targetsmaxerrors( ).
          ENDIF.
        ENDLOOP.
        lv_scheduleoffset = lo_createassociationbatchr->get_scheduleoffset( ).
        lv_duration = lo_createassociationbatchr->get_duration( ).
        LOOP AT lo_createassociationbatchr->get_targetmaps( ) into lt_row_22.
          LOOP AT lt_row_22 into ls_row_23.
            lv_key_2 = ls_row_23-key.
            LOOP AT ls_row_23-value into lo_row_24.
              lo_row_25 = lo_row_24.
              IF lo_row_25 IS NOT INITIAL.
                lv_targetmapvalue = lo_row_25->get_value( ).
              ENDIF.
            ENDLOOP.
          ENDLOOP.
        ENDLOOP.
        lo_alarmconfiguration = lo_createassociationbatchr->get_alarmconfiguration( ).
        IF lo_alarmconfiguration IS NOT INITIAL.
          lv_boolean = lo_alarmconfiguration->get_ignorepollalarmfailure( ).
          LOOP AT lo_alarmconfiguration->get_alarms( ) into lo_row_18.
            lo_row_19 = lo_row_18.
            IF lo_row_19 IS NOT INITIAL.
              lv_alarmname = lo_row_19->get_name( ).
            ENDIF.
          ENDLOOP.
        ENDIF.
      ENDIF.
      lv_batcherrormessage = lo_row_29->get_message( ).
      lv_fault = lo_row_29->get_fault( ).
    ENDIF.
  ENDLOOP.
ENDIF.