Skip to content

/AWS1/IF_SHB=>GETRESOURCESSTATISTICSV2()

About GetResourcesStatisticsV2

Retrieves statistical information about Amazon Web Services resources and their associated security findings.

You can use the Scopes parameter to define the data boundary for the query. Currently, Scopes supports AwsOrganizations, which lets you aggregate resources from your entire organization or from specific organizational units. Only the delegated administrator account can use Scopes.

Method Signature

METHODS /AWS1/IF_SHB~GETRESOURCESSTATISTICSV2
  IMPORTING
    !IT_GROUPBYRULES TYPE /AWS1/CL_SHBRESGROUPBYRULE=>TT_RESOURCEGROUPBYRULES OPTIONAL
    !IO_SCOPES TYPE REF TO /AWS1/CL_SHBRESOURCESCOPES OPTIONAL
    !IV_SORTORDER TYPE /AWS1/SHBSORTORDER OPTIONAL
    !IV_MAXSTATISTICRESULTS TYPE /AWS1/SHBMAXSTATISTICRESULTS OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_shbgetressstatsv2rsp
  RAISING
    /AWS1/CX_SHBACCESSDENIEDEX
    /AWS1/CX_SHBCONFLICTEXCEPTION
    /AWS1/CX_SHBINTERNALSERVEREX
    /AWS1/CX_SHBORGALUNITNOTFNDEX
    /AWS1/CX_SHBORGNOTFOUNDEX
    /AWS1/CX_SHBRESOURCENOTFOUNDEX
    /AWS1/CX_SHBTHROTTLINGEX
    /AWS1/CX_SHBVALIDATIONEX
    /AWS1/CX_SHBCLIENTEXC
    /AWS1/CX_SHBSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

it_groupbyrules TYPE /AWS1/CL_SHBRESGROUPBYRULE=>TT_RESOURCEGROUPBYRULES TT_RESOURCEGROUPBYRULES

How resource statistics should be aggregated and organized in the response.

Optional arguments:

io_scopes TYPE REF TO /AWS1/CL_SHBRESOURCESCOPES /AWS1/CL_SHBRESOURCESCOPES

Limits the results to resources from specific organizational units or from the delegated administrator's organization. Only the delegated administrator account can use this parameter. Other accounts receive an AccessDeniedException.

This parameter is optional. If you omit it, the delegated administrator sees statistics from all accounts across the entire organization. Other accounts see only statistics for their own resources.

You can specify up to 10 entries in Scopes.AwsOrganizations. If multiple entries are specified, the entries are combined using OR logic.

iv_sortorder TYPE /AWS1/SHBSORTORDER /AWS1/SHBSORTORDER

Sorts aggregated statistics.

iv_maxstatisticresults TYPE /AWS1/SHBMAXSTATISTICRESULTS /AWS1/SHBMAXSTATISTICRESULTS

The maximum number of results to be returned.

RETURNING

oo_output TYPE REF TO /aws1/cl_shbgetressstatsv2rsp /AWS1/CL_SHBGETRESSSTATSV2RSP

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->getresourcesstatisticsv2(
  io_scopes = new /aws1/cl_shbresourcescopes(
    it_awsorganizations = VALUE /aws1/cl_shbawsorgscope=>tt_awsorganizationscopelist(
      (
        new /aws1/cl_shbawsorgscope(
          iv_organizationalunitid = |string|
          iv_organizationid = |string|
        )
      )
    )
  )
  it_groupbyrules = VALUE /aws1/cl_shbresgroupbyrule=>tt_resourcegroupbyrules(
    (
      new /aws1/cl_shbresgroupbyrule(
        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_nestedcompositefilters = VALUE /aws1/cl_shbresscompositefilt=>tt_resscompositefilterlist(
                )
                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|
        )
        iv_groupbyfield = |string|
      )
    )
  )
  iv_maxstatisticresults = 123
  iv_sortorder = |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_groupbyresults( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_nonemptystring = lo_row_1->get_groupbyfield( ).
      LOOP AT lo_row_1->get_groupbyvalues( ) into lo_row_2.
        lo_row_3 = lo_row_2.
        IF lo_row_3 IS NOT INITIAL.
          lv_nonemptystring = lo_row_3->get_fieldvalue( ).
          lv_integer = lo_row_3->get_count( ).
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDLOOP.
ENDIF.