/AWS1/IF_WAF=>CREATEWEBACL()¶
About CreateWebACL¶
This is AWS WAF Classic documentation. For more information, see AWS WAF Classic in the developer guide.
For the latest version of AWS WAF, use the AWS WAFV2 API and see the AWS WAF Developer Guide. With the latest version, AWS WAF has a single set of endpoints for regional and global use.
Creates a WebACL, which contains the Rules that identify the CloudFront web requests that you want to allow, block, or count.
AWS WAF evaluates Rules in order based on the value of Priority for each Rule.
You also specify a default action, either ALLOW or BLOCK. If a web request doesn't match
any of the Rules in a WebACL, AWS WAF responds to the request with the default action.
To create and configure a WebACL, perform the following steps:
-
Create and update the
ByteMatchSetobjects and other predicates that you want to include inRules. For more information, see CreateByteMatchSet, UpdateByteMatchSet, CreateIPSet, UpdateIPSet, CreateSqlInjectionMatchSet, and UpdateSqlInjectionMatchSet. -
Create and update the
Rulesthat you want to include in theWebACL. For more information, see CreateRule and UpdateRule. -
Use GetChangeToken to get the change token that you provide in the
ChangeTokenparameter of aCreateWebACLrequest. -
Submit a
CreateWebACLrequest. -
Use
GetChangeTokento get the change token that you provide in theChangeTokenparameter of an UpdateWebACL request. -
Submit an UpdateWebACL request to specify the
Rulesthat you want to include in theWebACL, to specify the default action, and to associate theWebACLwith a CloudFront distribution.
For more information about how to use the AWS WAF API, see the AWS WAF Developer Guide.
Method Signature¶
METHODS /AWS1/IF_WAF~CREATEWEBACL
IMPORTING
!IV_NAME TYPE /AWS1/WAFRESOURCENAME OPTIONAL
!IV_METRICNAME TYPE /AWS1/WAFMETRICNAME OPTIONAL
!IO_DEFAULTACTION TYPE REF TO /AWS1/CL_WAFWAFACTION OPTIONAL
!IV_CHANGETOKEN TYPE /AWS1/WAFCHANGETOKEN OPTIONAL
!IT_TAGS TYPE /AWS1/CL_WAFTAG=>TT_TAGLIST OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_wafcreatewebaclrsp
RAISING
/AWS1/CX_WAFWAFBADREQUESTEX
/AWS1/CX_WAFWAFDISALWEDNAMEEX
/AWS1/CX_WAFWAFINTERNALERROREX
/AWS1/CX_WAFWAFINVACCOUNTEX
/AWS1/CX_WAFWAFINVALIDPARAMEX
/AWS1/CX_WAFWAFLIMITSEXCDEX
/AWS1/CX_WAFWAFSTALEDATAEX
/AWS1/CX_WAFWAFTAGOPERATIONEX
/AWS1/CX_WAFWAFTAGOPINTERNAL00
/AWS1/CX_WAFCLIENTEXC
/AWS1/CX_WAFSERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_name TYPE /AWS1/WAFRESOURCENAME /AWS1/WAFRESOURCENAME¶
A friendly name or description of the WebACL. You can't change
Nameafter you create theWebACL.
iv_metricname TYPE /AWS1/WAFMETRICNAME /AWS1/WAFMETRICNAME¶
A friendly name or description for the metrics for this
WebACL.The name can contain only alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't changeMetricNameafter you create theWebACL.
io_defaultaction TYPE REF TO /AWS1/CL_WAFWAFACTION /AWS1/CL_WAFWAFACTION¶
The action that you want AWS WAF to take when a request doesn't match the criteria specified in any of the
Ruleobjects that are associated with theWebACL.
iv_changetoken TYPE /AWS1/WAFCHANGETOKEN /AWS1/WAFCHANGETOKEN¶
The value returned by the most recent call to GetChangeToken.
Optional arguments:¶
it_tags TYPE /AWS1/CL_WAFTAG=>TT_TAGLIST TT_TAGLIST¶
RETURNING¶
oo_output TYPE REF TO /aws1/cl_wafcreatewebaclrsp /AWS1/CL_WAFCREATEWEBACLRSP¶
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->createwebacl(
io_defaultaction = new /aws1/cl_wafwafaction( |string| )
it_tags = VALUE /aws1/cl_waftag=>tt_taglist(
(
new /aws1/cl_waftag(
iv_key = |string|
iv_value = |string|
)
)
)
iv_changetoken = |string|
iv_metricname = |string|
iv_name = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lo_webacl = lo_result->get_webacl( ).
IF lo_webacl IS NOT INITIAL.
lv_resourceid = lo_webacl->get_webaclid( ).
lv_resourcename = lo_webacl->get_name( ).
lv_metricname = lo_webacl->get_metricname( ).
lo_wafaction = lo_webacl->get_defaultaction( ).
IF lo_wafaction IS NOT INITIAL.
lv_wafactiontype = lo_wafaction->get_type( ).
ENDIF.
LOOP AT lo_webacl->get_rules( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lv_rulepriority = lo_row_1->get_priority( ).
lv_resourceid = lo_row_1->get_ruleid( ).
lo_wafaction = lo_row_1->get_action( ).
IF lo_wafaction IS NOT INITIAL.
lv_wafactiontype = lo_wafaction->get_type( ).
ENDIF.
lo_wafoverrideaction = lo_row_1->get_overrideaction( ).
IF lo_wafoverrideaction IS NOT INITIAL.
lv_wafoverrideactiontype = lo_wafoverrideaction->get_type( ).
ENDIF.
lv_wafruletype = lo_row_1->get_type( ).
LOOP AT lo_row_1->get_excludedrules( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_resourceid = lo_row_3->get_ruleid( ).
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
lv_resourcearn = lo_webacl->get_webaclarn( ).
ENDIF.
lv_changetoken = lo_result->get_changetoken( ).
ENDIF.
To create a web ACL¶
The following example creates a web ACL named CreateExample.
DATA(lo_result) = lo_client->createwebacl(
io_defaultaction = new /aws1/cl_wafwafaction( |ALLOW| )
iv_changetoken = |abcd12f2-46da-4fdb-b8d5-fbd4c466928f|
iv_metricname = |CreateExample|
iv_name = |CreateExample|
).