Skip to content

/AWS1/CL_SHB=>GETFINDINGSTATISTICSV2()

About GetFindingStatisticsV2

Returns aggregated statistical data about findings. GetFindingStatisticsV2 use securityhub:GetAdhocInsightResults in the Action element of an IAM policy statement. You must have permission to perform the s action. This API is in private preview and subject to change.

Method Signature

IMPORTING

Required arguments:

it_groupbyrules TYPE /AWS1/CL_SHBGROUPBYRULE=>TT_GROUPBYRULES TT_GROUPBYRULES

Specifies how security findings should be aggregated and organized in the statistical analysis. It can accept up to 5 groupBy fields in a single call.

Optional arguments:

iv_sortorder TYPE /AWS1/SHBSORTORDER /AWS1/SHBSORTORDER

Orders the aggregation count in descending or ascending order. Descending order is the default.

iv_maxstatisticresults TYPE /AWS1/SHBMAXSTATISTICRESULTS /AWS1/SHBMAXSTATISTICRESULTS

The maximum number of results to be returned.

RETURNING

oo_output TYPE REF TO /aws1/cl_shbgetfndgstatsv2rsp /AWS1/CL_SHBGETFNDGSTATSV2RSP

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~getfindingstatisticsv2(
  it_groupbyrules = VALUE /aws1/cl_shbgroupbyrule=>tt_groupbyrules(
    (
      new /aws1/cl_shbgroupbyrule(
        io_filters = new /aws1/cl_shbocsffindingfilters(
          it_compositefilters = VALUE /aws1/cl_shbcompositefilter=>tt_compositefilterlist(
            (
              new /aws1/cl_shbcompositefilter(
                it_booleanfilters = VALUE /aws1/cl_shbocsfbooleanfilter=>tt_ocsfbooleanfilterlist(
                  (
                    new /aws1/cl_shbocsfbooleanfilter(
                      io_filter = new /aws1/cl_shbbooleanfilter( ABAP_TRUE )
                      iv_fieldname = |string|
                    )
                  )
                )
                it_datefilters = VALUE /aws1/cl_shbocsfdatefilter=>tt_ocsfdatefilterlist(
                  (
                    new /aws1/cl_shbocsfdatefilter(
                      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_shbocsfmapfilter=>tt_ocsfmapfilterlist(
                  (
                    new /aws1/cl_shbocsfmapfilter(
                      io_filter = new /aws1/cl_shbmapfilter(
                        iv_comparison = |string|
                        iv_key = |string|
                        iv_value = |string|
                      )
                      iv_fieldname = |string|
                    )
                  )
                )
                it_numberfilters = VALUE /aws1/cl_shbocsfnumberfilter=>tt_ocsfnumberfilterlist(
                  (
                    new /aws1/cl_shbocsfnumberfilter(
                      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_shbocsfstringfilter=>tt_ocsfstringfilterlist(
                  (
                    new /aws1/cl_shbocsfstringfilter(
                      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.