Skip to content

/AWS1/IF_NWS=>GETPOLICY()

About GetPolicy

Retrieves the details of the specified policy.

Method Signature

METHODS /AWS1/IF_NWS~GETPOLICY
  IMPORTING
    !IV_POLICYIDENTIFIER TYPE /AWS1/NWSPOLICYIDENTIFIER OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_nwsgetpolicyoutput
  RAISING
    /AWS1/CX_NWSACCESSDENIEDEX
    /AWS1/CX_NWSINTERNALSERVEREX
    /AWS1/CX_NWSRESOURCENOTFOUNDEX
    /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_policyidentifier TYPE /AWS1/NWSPOLICYIDENTIFIER /AWS1/NWSPOLICYIDENTIFIER

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

RETURNING

oo_output TYPE REF TO /aws1/cl_nwsgetpolicyoutput /AWS1/CL_NWSGETPOLICYOUTPUT

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->getpolicy( |string| ).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_policyid = lo_result->get_policyid( ).
  lv_policyarn = lo_result->get_policyarn( ).
  lv_policyname = lo_result->get_policyname( ).
  lv_description = lo_result->get_policydescription( ).
  lv_entitystatus = lo_result->get_status( ).
  lv_priority = lo_result->get_priority( ).
  LOOP AT lo_result->get_assoctemplateandrulelist( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_templatearn = lo_row_1->get_templatearn( ).
      lv_rulearn = lo_row_1->get_rulearn( ).
    ENDIF.
  ENDLOOP.
  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_policyfirewalltype = lo_result->get_firewalltype( ).
  lo_policyconfiguration = lo_result->get_policyconfiguration( ).
  IF lo_policyconfiguration IS NOT INITIAL.
    lv_remediationenabled = lo_policyconfiguration->get_remediationenabled( ).
    lv_resourcescleanup = lo_policyconfiguration->get_resourcescleanup( ).
    lo_wafconfig = lo_policyconfiguration->get_wafconfig( ).
    IF lo_wafconfig IS NOT INITIAL.
      lv_existingcustomerwebaclr = lo_wafconfig->get_exstcustomerwebaclrsln( ).
      lv_wafconflictresolutionop = lo_wafconfig->get_conflictresolution( ).
    ENDIF.
  ENDIF.
  lv_datetimestamp = lo_result->get_updatedat( ).
ENDIF.

Get a policy

Retrieves the current published version of a policy by its base ARN, including its associated templates and rules and its enforcement configuration.

DATA(lo_result) = lo_client->getpolicy( |arn:aws:network-security-manager:us-east-1:123456789012:policy:xyz789| ).