Skip to content

/AWS1/IF_NWS=>UPDATETEMPLATE()

About UpdateTemplate

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

Method Signature

METHODS /AWS1/IF_NWS~UPDATETEMPLATE
  IMPORTING
    !IV_TEMPLATEIDENTIFIER TYPE /AWS1/NWSTEMPLATEIDENTIFIER OPTIONAL
    !IV_UPDATETOKEN TYPE /AWS1/NWSUPDATETOKEN OPTIONAL
    !IV_TEMPLATEDESCRIPTION TYPE /AWS1/NWSDESCRIPTION OPTIONAL
    !IT_ASSOCIATEDRULELIST TYPE /AWS1/CL_NWSRULEREFERENCE=>TT_RULEREFERENCELIST OPTIONAL
    !IV_ISPUBLISHED TYPE /AWS1/NWSISPUBLISHED OPTIONAL
    !IV_CLIENTTOKEN TYPE /AWS1/NWSIDEMPOTENCYTOKEN OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_nwsupdatetmploutput
  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_templateidentifier TYPE /AWS1/NWSTEMPLATEIDENTIFIER /AWS1/NWSTEMPLATEIDENTIFIER

The identifier of the template. This is the template'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_templatedescription TYPE /AWS1/NWSDESCRIPTION /AWS1/NWSDESCRIPTION

A description of the template.

it_associatedrulelist TYPE /AWS1/CL_NWSRULEREFERENCE=>TT_RULEREFERENCELIST TT_RULEREFERENCELIST

The rules associated with the template.

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_nwsupdatetmploutput /AWS1/CL_NWSUPDATETMPLOUTPUT

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->updatetemplate(
  it_associatedrulelist = VALUE /aws1/cl_nwsrulereference=>tt_rulereferencelist(
    ( new /aws1/cl_nwsrulereference( |string| ) )
  )
  iv_clienttoken = |string|
  iv_ispublished = ABAP_TRUE
  iv_templatedescription = |string|
  iv_templateidentifier = |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_templateid = lo_result->get_templateid( ).
  lv_templatearn = lo_result->get_templatearn( ).
  lv_templatename = lo_result->get_templatename( ).
  lv_description = lo_result->get_templatedescription( ).
  lv_entitystatus = lo_result->get_status( ).
  lv_entityversion = lo_result->get_version( ).
  LOOP AT lo_result->get_associatedrulelist( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_rulearn = lo_row_1->get_rulearn( ).
    ENDIF.
  ENDLOOP.
  lv_updatetoken = lo_result->get_updatetoken( ).
  lv_issnapshot = lo_result->get_issnapshot( ).
  lv_haspublishedversion = lo_result->get_haspublishedversion( ).
  lv_templatefirewalltype = lo_result->get_firewalltype( ).
  lv_datetimestamp = lo_result->get_updatedat( ).
ENDIF.

Update a template and publish it

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

DATA(lo_result) = lo_client->updatetemplate(
  it_associatedrulelist = VALUE /aws1/cl_nwsrulereference=>tt_rulereferencelist(
    ( new /aws1/cl_nwsrulereference( |arn:aws:network-security-manager:us-east-1:123456789012:rule:abc123| ) )
  )
  iv_ispublished = ABAP_TRUE
  iv_templatedescription = |Standard WAF template with baseline rule groups - updated|
  iv_templateidentifier = |arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789|
  iv_updatetoken = |d2e3f4a5-5b6c-4d7e-8f9a-9b0c1d2e3f4a|
).