/AWS1/IF_WA2=>GETSAMPLEDREQUESTS()¶
About GetSampledRequests¶
Gets detailed information about a specified number of requests--a sample--that WAF randomly selects from among the first 5,000 requests that your Amazon Web Services resource received during a time range that you choose. You can specify a sample size of up to 500 requests, and you can specify any time range in the previous three hours.
GetSampledRequests returns a time range, which is usually the time range that
you specified. However, if your resource (such as a CloudFront distribution) received 5,000
requests before the specified time range elapsed, GetSampledRequests returns
an updated time range. This new time range indicates the actual period during which WAF
selected the requests in the sample.
Method Signature¶
METHODS /AWS1/IF_WA2~GETSAMPLEDREQUESTS
IMPORTING
!IV_WEBACLARN TYPE /AWS1/WA2RESOURCEARN OPTIONAL
!IV_RULEMETRICNAME TYPE /AWS1/WA2METRICNAME OPTIONAL
!IV_SCOPE TYPE /AWS1/WA2SCOPE OPTIONAL
!IO_TIMEWINDOW TYPE REF TO /AWS1/CL_WA2TIMEWINDOW OPTIONAL
!IV_MAXITEMS TYPE /AWS1/WA2LISTMAXITEMS OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_wa2getsampledreqsrsp
RAISING
/AWS1/CX_WA2WAFINTERNALERROREX
/AWS1/CX_WA2WAFINVALIDPARAMEX
/AWS1/CX_WA2WAFNONEXENTITEMEX
/AWS1/CX_WA2CLIENTEXC
/AWS1/CX_WA2SERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_webaclarn TYPE /AWS1/WA2RESOURCEARN /AWS1/WA2RESOURCEARN¶
The Amazon resource name (ARN) of the
WebACLfor which you want a sample of requests.
iv_rulemetricname TYPE /AWS1/WA2METRICNAME /AWS1/WA2METRICNAME¶
The metric name assigned to the
RuleorRuleGroupdimension for which you want a sample of requests.
iv_scope TYPE /AWS1/WA2SCOPE /AWS1/WA2SCOPE¶
Specifies whether this is for a global resource type, such as a Amazon CloudFront distribution. For an Amplify application, use
CLOUDFRONT.To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows:
CLI - Specify the Region when you use the CloudFront scope:
--scope=CLOUDFRONT --region=us-east-1.API and SDKs - For all calls, use the Region endpoint us-east-1.
io_timewindow TYPE REF TO /AWS1/CL_WA2TIMEWINDOW /AWS1/CL_WA2TIMEWINDOW¶
The start date and time and the end date and time of the range for which you want
GetSampledRequeststo return a sample of requests. You must specify the times in Coordinated Universal Time (UTC) format. UTC format includes the special designator,Z. For example,"2016-09-27T14:50Z". You can specify any time range in the previous three hours. If you specify a start time that's earlier than three hours ago, WAF sets it to three hours ago.
iv_maxitems TYPE /AWS1/WA2LISTMAXITEMS /AWS1/WA2LISTMAXITEMS¶
The number of requests that you want WAF to return from among the first 5,000 requests that your Amazon Web Services resource received during the time range. If your resource received fewer requests than the value of
MaxItems,GetSampledRequestsreturns information about all of them.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_wa2getsampledreqsrsp /AWS1/CL_WA2GETSAMPLEDREQSRSP¶
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->getsampledrequests(
io_timewindow = new /aws1/cl_wa2timewindow(
iv_endtime = '20150101000000.0000000'
iv_starttime = '20150101000000.0000000'
)
iv_maxitems = 123
iv_rulemetricname = |string|
iv_scope = |string|
iv_webaclarn = |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_sampledrequests( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lo_httprequest = lo_row_1->get_request( ).
IF lo_httprequest IS NOT INITIAL.
lv_ipstring = lo_httprequest->get_clientip( ).
lv_country = lo_httprequest->get_country( ).
lv_uristring = lo_httprequest->get_uri( ).
lv_httpmethod = lo_httprequest->get_method( ).
lv_httpversion = lo_httprequest->get_httpversion( ).
LOOP AT lo_httprequest->get_headers( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_headername = lo_row_3->get_name( ).
lv_headervalue = lo_row_3->get_value( ).
ENDIF.
ENDLOOP.
ENDIF.
lv_sampleweight = lo_row_1->get_weight( ).
lv_timestamp = lo_row_1->get_timestamp( ).
lv_action = lo_row_1->get_action( ).
lv_entityname = lo_row_1->get_rulenamewithinrulegroup( ).
LOOP AT lo_row_1->get_requestheadersinserted( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_headername = lo_row_3->get_name( ).
lv_headervalue = lo_row_3->get_value( ).
ENDIF.
ENDLOOP.
lv_responsestatuscode = lo_row_1->get_responsecodesent( ).
LOOP AT lo_row_1->get_labels( ) into lo_row_4.
lo_row_5 = lo_row_4.
IF lo_row_5 IS NOT INITIAL.
lv_labelname = lo_row_5->get_name( ).
ENDIF.
ENDLOOP.
lo_captcharesponse = lo_row_1->get_captcharesponse( ).
IF lo_captcharesponse IS NOT INITIAL.
lv_responsecode = lo_captcharesponse->get_responsecode( ).
lv_solvetimestamp = lo_captcharesponse->get_solvetimestamp( ).
lv_failurereason = lo_captcharesponse->get_failurereason( ).
ENDIF.
lo_challengeresponse = lo_row_1->get_challengeresponse( ).
IF lo_challengeresponse IS NOT INITIAL.
lv_responsecode = lo_challengeresponse->get_responsecode( ).
lv_solvetimestamp = lo_challengeresponse->get_solvetimestamp( ).
lv_failurereason = lo_challengeresponse->get_failurereason( ).
ENDIF.
lv_action = lo_row_1->get_overriddenaction( ).
ENDIF.
ENDLOOP.
lv_populationsize = lo_result->get_populationsize( ).
lo_timewindow = lo_result->get_timewindow( ).
IF lo_timewindow IS NOT INITIAL.
lv_timestamp = lo_timewindow->get_starttime( ).
lv_timestamp = lo_timewindow->get_endtime( ).
ENDIF.
ENDIF.