Skip to content

/AWS1/IF_NWS=>UPDATERULE()

About UpdateRule

Updates the specified rule. To prevent conflicting concurrent updates, provide the current updateToken. Use isPublished to publish the update or keep the rule as a draft.

Method Signature

METHODS /AWS1/IF_NWS~UPDATERULE
  IMPORTING
    !IV_RULEIDENTIFIER TYPE /AWS1/NWSRULEIDENTIFIER OPTIONAL
    !IV_UPDATETOKEN TYPE /AWS1/NWSUPDATETOKEN OPTIONAL
    !IV_RULETYPE TYPE /AWS1/NWSRULETYPE OPTIONAL
    !IV_RULEDESCRIPTION TYPE /AWS1/NWSDESCRIPTION OPTIONAL
    !IO_CONFIGURATION TYPE REF TO /AWS1/CL_RT_DOCUMENT OPTIONAL
    !IV_ISPUBLISHED TYPE /AWS1/NWSISPUBLISHED OPTIONAL
    !IV_CLIENTTOKEN TYPE /AWS1/NWSIDEMPOTENCYTOKEN OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_nwsupdateruleoutput
  RAISING
    /AWS1/CX_NWSACCESSDENIEDEX
    /AWS1/CX_NWSCONFLICTEXCEPTION
    /AWS1/CX_NWSINTERNALSERVEREX
    /AWS1/CX_NWSRESOURCENOTFOUNDEX
    /AWS1/CX_NWSSERVICEQUOTAEXCDEX
    /AWS1/CX_NWSTHROTTLINGEX
    /AWS1/CX_NWSVLDTNEXCEPTION
    /AWS1/CX_NWSCLIENTEXC
    /AWS1/CX_NWSSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_ruleidentifier TYPE /AWS1/NWSRULEIDENTIFIER /AWS1/NWSRULEIDENTIFIER

The identifier of the rule. This is the rule's Amazon Resource Name (ARN).

iv_updatetoken TYPE /AWS1/NWSUPDATETOKEN /AWS1/NWSUPDATETOKEN

A token used for optimistic concurrency control. Each read and write returns an updateToken. Provide the most recent value on your next update to detect and prevent conflicting concurrent modifications.

iv_ispublished TYPE /AWS1/NWSISPUBLISHED /AWS1/NWSISPUBLISHED

Specifies whether to publish the resource. When true, the resource is saved in published (ACTIVE) state. When false, it is saved as a draft (DRAFT).

Optional arguments:

iv_ruletype TYPE /AWS1/NWSRULETYPE /AWS1/NWSRULETYPE

The type of the rule. CONFIGURATION rules contain firewall settings, and INSPECTION rules contain rule groups.

iv_ruledescription TYPE /AWS1/NWSDESCRIPTION /AWS1/NWSDESCRIPTION

A description of the rule.

io_configuration TYPE REF TO /AWS1/CL_RT_DOCUMENT /AWS1/CL_RT_DOCUMENT

The firewall configuration for the rule, as a JSON document. The structure depends on the rule's firewall type and rule type. For an AWS WAF INSPECTION rule, provide an AWS WAF rule group. For an AWS WAF CONFIGURATION rule, provide a single web ACL setting, such as DefaultAction or VisibilityConfig; use wafConfigDataType to declare which setting the document contains. For the schema of each setting and complete examples, see Writing rule configurations in the AWS Network Security Manager Developer Guide.

iv_clienttoken TYPE /AWS1/NWSIDEMPOTENCYTOKEN /AWS1/NWSIDEMPOTENCYTOKEN

A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

RETURNING

oo_output TYPE REF TO /aws1/cl_nwsupdateruleoutput /AWS1/CL_NWSUPDATERULEOUTPUT

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->updaterule(
  io_configuration = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
  iv_clienttoken = |string|
  iv_ispublished = ABAP_TRUE
  iv_ruledescription = |string|
  iv_ruleidentifier = |string|
  iv_ruletype = |string|
  iv_updatetoken = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_ruleid = lo_result->get_ruleid( ).
  lv_rulearn = lo_result->get_rulearn( ).
  lv_rulename = lo_result->get_rulename( ).
  lv_rulefirewalltype = lo_result->get_firewalltype( ).
  lv_ruletype = lo_result->get_ruletype( ).
  lv_description = lo_result->get_ruledescription( ).
  lo_/aws1/cl_rt_document = lo_result->get_configuration( ).
  IF lo_/aws1/cl_rt_document IS NOT INITIAL.
  ENDIF.
  lv_entitystatus = lo_result->get_status( ).
  lv_entityversion = lo_result->get_version( ).
  lv_updatetoken = lo_result->get_updatetoken( ).
  lv_issnapshot = lo_result->get_issnapshot( ).
  lv_haspublishedversion = lo_result->get_haspublishedversion( ).
  lv_datetimestamp = lo_result->get_updatedat( ).
ENDIF.

Update a rule and publish it

Updates the rule's description and configuration and publishes the change. The updateToken from the most recent read is required for optimistic locking.

DATA(lo_result) = lo_client->updaterule(
  io_configuration = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{\}| )
  iv_ispublished = ABAP_TRUE
  iv_ruledescription = |Blocks requests from known malicious IP addresses - updated list|
  iv_ruleidentifier = |arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123|
  iv_ruletype = |INSPECTION|
  iv_updatetoken = |c1d2e3f4-4a5b-4c6d-9e7f-8a9b0c1d2e3f|
).