Skip to content

/AWS1/CL_SHB=>GETRESOURCESV2()

About GetResourcesV2

Returns a list of resources. This API is in private preview and subject to change.

Method Signature

IMPORTING

Optional arguments:

io_filters TYPE REF TO /AWS1/CL_SHBRESOURCESFILTERS /AWS1/CL_SHBRESOURCESFILTERS

Filters resources based on a set of criteria.

it_sortcriteria TYPE /AWS1/CL_SHBSORTCRITERION=>TT_SORTCRITERIA TT_SORTCRITERIA

The finding attributes used to sort the list of returned findings.

iv_nexttoken TYPE /AWS1/SHBNEXTTOKEN /AWS1/SHBNEXTTOKEN

The token required for pagination. On your first call, set the value of this parameter to NULL. For subsequent calls, to continue listing data, set the value of this parameter to the value returned in the previous response.

iv_maxresults TYPE /AWS1/SHBMAXRESULTS /AWS1/SHBMAXRESULTS

The maximum number of results to return.

RETURNING

oo_output TYPE REF TO /aws1/cl_shbgetressv2response /AWS1/CL_SHBGETRESSV2RESPONSE

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_shb~getresourcesv2(
  io_filters = new /aws1/cl_shbresourcesfilters(
    it_compositefilters = VALUE /aws1/cl_shbresscompositefilt=>tt_resscompositefilterlist(
      (
        new /aws1/cl_shbresscompositefilt(
          it_datefilters = VALUE /aws1/cl_shbressdatefilter=>tt_resourcesdatefilterlist(
            (
              new /aws1/cl_shbressdatefilter(
                io_filter = new /aws1/cl_shbdatefilter(
                  io_daterange = new /aws1/cl_shbdaterange(
                    iv_unit = |string|
                    iv_value = 123
                  )
                  iv_end = |string|
                  iv_start = |string|
                )
                iv_fieldname = |string|
              )
            )
          )
          it_mapfilters = VALUE /aws1/cl_shbresourcesmapfilter=>tt_resourcesmapfilterlist(
            (
              new /aws1/cl_shbresourcesmapfilter(
                io_filter = new /aws1/cl_shbmapfilter(
                  iv_comparison = |string|
                  iv_key = |string|
                  iv_value = |string|
                )
                iv_fieldname = |string|
              )
            )
          )
          it_numberfilters = VALUE /aws1/cl_shbressnumberfilter=>tt_resourcesnumberfilterlist(
            (
              new /aws1/cl_shbressnumberfilter(
                io_filter = new /aws1/cl_shbnumberfilter(
                  iv_eq = '0.1'
                  iv_gt = '0.1'
                  iv_gte = '0.1'
                  iv_lt = '0.1'
                  iv_lte = '0.1'
                )
                iv_fieldname = |string|
              )
            )
          )
          it_stringfilters = VALUE /aws1/cl_shbressstringfilter=>tt_resourcesstringfilterlist(
            (
              new /aws1/cl_shbressstringfilter(
                io_filter = new /aws1/cl_shbstringfilter(
                  iv_comparison = |string|
                  iv_value = |string|
                )
                iv_fieldname = |string|
              )
            )
          )
          iv_operator = |string|
        )
      )
    )
    iv_compositeoperator = |string|
  )
  it_sortcriteria = VALUE /aws1/cl_shbsortcriterion=>tt_sortcriteria(
    (
      new /aws1/cl_shbsortcriterion(
        iv_field = |string|
        iv_sortorder = |string|
      )
    )
  )
  iv_maxresults = 123
  iv_nexttoken = |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_resources( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_nonemptystring = lo_row_1->get_resourcearn( ).
      lv_nonemptystring = lo_row_1->get_resourceid( ).
      lv_nonemptystring = lo_row_1->get_accountid( ).
      lv_nonemptystring = lo_row_1->get_region( ).
      lv_resourcecategory = lo_row_1->get_resourcecategory( ).
      lv_nonemptystring = lo_row_1->get_resourcetype( ).
      lv_nonemptystring = lo_row_1->get_resourcename( ).
      lv_nonemptystring = lo_row_1->get_resourcecreationtimedt( ).
      lv_nonemptystring = lo_row_1->get_resdetailcapturetimedt( ).
      LOOP AT lo_row_1->get_findingssummary( ) into lo_row_2.
        lo_row_3 = lo_row_2.
        IF lo_row_3 IS NOT INITIAL.
          lv_nonemptystring = lo_row_3->get_findingtype( ).
          lv_nonemptystring = lo_row_3->get_productname( ).
          lv_integer = lo_row_3->get_totalfindings( ).
          lo_resourceseveritybreakdo = lo_row_3->get_severities( ).
          IF lo_resourceseveritybreakdo IS NOT INITIAL.
            lv_integer = lo_resourceseveritybreakdo->get_other( ).
            lv_integer = lo_resourceseveritybreakdo->get_fatal( ).
            lv_integer = lo_resourceseveritybreakdo->get_critical( ).
            lv_integer = lo_resourceseveritybreakdo->get_high( ).
            lv_integer = lo_resourceseveritybreakdo->get_medium( ).
            lv_integer = lo_resourceseveritybreakdo->get_low( ).
            lv_integer = lo_resourceseveritybreakdo->get_informational( ).
            lv_integer = lo_resourceseveritybreakdo->get_unknown( ).
          ENDIF.
        ENDIF.
      ENDLOOP.
      LOOP AT lo_row_1->get_resourcetags( ) into lo_row_4.
        lo_row_5 = lo_row_4.
        IF lo_row_5 IS NOT INITIAL.
          lv_nonemptystring = lo_row_5->get_key( ).
          lv_nonemptystring = lo_row_5->get_value( ).
        ENDIF.
      ENDLOOP.
      lo_value = lo_row_1->get_resourceconfig( ).
      IF lo_value IS NOT INITIAL.
      ENDIF.
    ENDIF.
  ENDLOOP.
  lv_nexttoken = lo_result->get_nexttoken( ).
ENDIF.