/AWS1/IF_GDY=>GETUSAGESTATISTICS()¶
About GetUsageStatistics¶
Lists Amazon GuardDuty usage statistics over the last 30 days for the specified detector ID. For newly enabled detectors or data sources, the cost returned will include only the usage so far under 30 days. This may differ from the cost metrics in the console, which project usage over 30 days to provide a monthly cost estimate. For more information, see Understanding How Usage Costs are Calculated.
Method Signature¶
METHODS /AWS1/IF_GDY~GETUSAGESTATISTICS
IMPORTING
!IV_DETECTORID TYPE /AWS1/GDYDETECTORID OPTIONAL
!IV_USAGESTATISTICTYPE TYPE /AWS1/GDYUSAGESTATISTICTYPE OPTIONAL
!IO_USAGECRITERIA TYPE REF TO /AWS1/CL_GDYUSAGECRITERIA OPTIONAL
!IV_UNIT TYPE /AWS1/GDYSTRING OPTIONAL
!IV_MAXRESULTS TYPE /AWS1/GDYMAXRESULTS OPTIONAL
!IV_NEXTTOKEN TYPE /AWS1/GDYSTRING OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_gdygetusagestatsrsp
RAISING
/AWS1/CX_GDYBADREQUESTEX
/AWS1/CX_GDYINTERNALSERVERER00
/AWS1/CX_GDYCLIENTEXC
/AWS1/CX_GDYSERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_detectorid TYPE /AWS1/GDYDETECTORID /AWS1/GDYDETECTORID¶
The ID of the detector that specifies the GuardDuty service whose usage statistics you want to retrieve.
To find the
detectorIdin the current Region, see the Settings page in the GuardDuty console, or run the ListDetectors API.
iv_usagestatistictype TYPE /AWS1/GDYUSAGESTATISTICTYPE /AWS1/GDYUSAGESTATISTICTYPE¶
The type of usage statistics to retrieve.
io_usagecriteria TYPE REF TO /AWS1/CL_GDYUSAGECRITERIA /AWS1/CL_GDYUSAGECRITERIA¶
Represents the criteria used for querying usage.
Optional arguments:¶
iv_unit TYPE /AWS1/GDYSTRING /AWS1/GDYSTRING¶
The currency unit you would like to view your usage statistics in. Current valid values are USD.
iv_maxresults TYPE /AWS1/GDYMAXRESULTS /AWS1/GDYMAXRESULTS¶
The maximum number of results to return in the response.
iv_nexttoken TYPE /AWS1/GDYSTRING /AWS1/GDYSTRING¶
A token to use for paginating results that are returned in the response. Set the value of this parameter to null for the first request to a list action. For subsequent calls, use the NextToken value returned from the previous request to continue listing results after the first page.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_gdygetusagestatsrsp /AWS1/CL_GDYGETUSAGESTATSRSP¶
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->getusagestatistics(
io_usagecriteria = new /aws1/cl_gdyusagecriteria(
it_accountids = VALUE /aws1/cl_gdyaccountids_w=>tt_accountids(
( new /aws1/cl_gdyaccountids_w( |string| ) )
)
it_datasources = VALUE /aws1/cl_gdydatasourcelist_w=>tt_datasourcelist(
( new /aws1/cl_gdydatasourcelist_w( |string| ) )
)
it_features = VALUE /aws1/cl_gdyusagefeaturelist_w=>tt_usagefeaturelist(
( new /aws1/cl_gdyusagefeaturelist_w( |string| ) )
)
it_resources = VALUE /aws1/cl_gdyresourcelist_w=>tt_resourcelist(
( new /aws1/cl_gdyresourcelist_w( |string| ) )
)
)
iv_detectorid = |string|
iv_maxresults = 123
iv_nexttoken = |string|
iv_unit = |string|
iv_usagestatistictype = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lo_usagestatistics = lo_result->get_usagestatistics( ).
IF lo_usagestatistics IS NOT INITIAL.
LOOP AT lo_usagestatistics->get_sumbyaccount( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lv_accountid = lo_row_1->get_accountid( ).
lo_total = lo_row_1->get_total( ).
IF lo_total IS NOT INITIAL.
lv_string = lo_total->get_amount( ).
lv_string = lo_total->get_unit( ).
ENDIF.
ENDIF.
ENDLOOP.
LOOP AT lo_usagestatistics->get_topaccountsbyfeature( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_usagefeature = lo_row_3->get_feature( ).
LOOP AT lo_row_3->get_accounts( ) into lo_row_4.
lo_row_5 = lo_row_4.
IF lo_row_5 IS NOT INITIAL.
lv_accountid = lo_row_5->get_accountid( ).
lo_total = lo_row_5->get_total( ).
IF lo_total IS NOT INITIAL.
lv_string = lo_total->get_amount( ).
lv_string = lo_total->get_unit( ).
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
LOOP AT lo_usagestatistics->get_sumbydatasource( ) into lo_row_6.
lo_row_7 = lo_row_6.
IF lo_row_7 IS NOT INITIAL.
lv_datasource = lo_row_7->get_datasource( ).
lo_total = lo_row_7->get_total( ).
IF lo_total IS NOT INITIAL.
lv_string = lo_total->get_amount( ).
lv_string = lo_total->get_unit( ).
ENDIF.
ENDIF.
ENDLOOP.
LOOP AT lo_usagestatistics->get_sumbyresource( ) into lo_row_8.
lo_row_9 = lo_row_8.
IF lo_row_9 IS NOT INITIAL.
lv_string = lo_row_9->get_resource( ).
lo_total = lo_row_9->get_total( ).
IF lo_total IS NOT INITIAL.
lv_string = lo_total->get_amount( ).
lv_string = lo_total->get_unit( ).
ENDIF.
ENDIF.
ENDLOOP.
LOOP AT lo_usagestatistics->get_topresources( ) into lo_row_8.
lo_row_9 = lo_row_8.
IF lo_row_9 IS NOT INITIAL.
lv_string = lo_row_9->get_resource( ).
lo_total = lo_row_9->get_total( ).
IF lo_total IS NOT INITIAL.
lv_string = lo_total->get_amount( ).
lv_string = lo_total->get_unit( ).
ENDIF.
ENDIF.
ENDLOOP.
LOOP AT lo_usagestatistics->get_sumbyfeature( ) into lo_row_10.
lo_row_11 = lo_row_10.
IF lo_row_11 IS NOT INITIAL.
lv_usagefeature = lo_row_11->get_feature( ).
lo_total = lo_row_11->get_total( ).
IF lo_total IS NOT INITIAL.
lv_string = lo_total->get_amount( ).
lv_string = lo_total->get_unit( ).
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
lv_string = lo_result->get_nexttoken( ).
ENDIF.