Skip to content

/AWS1/CL_AAN=>GETGENERATEDPOLICY()

About GetGeneratedPolicy

Retrieves the policy that was generated using StartPolicyGeneration.

Method Signature

IMPORTING

Required arguments:

iv_jobid TYPE /AWS1/AANJOBID /AWS1/AANJOBID

The JobId that is returned by the StartPolicyGeneration operation. The JobId can be used with GetGeneratedPolicy to retrieve the generated policies or used with CancelPolicyGeneration to cancel the policy generation request.

Optional arguments:

iv_inclresourceplaceholders TYPE /AWS1/AANBOOLEAN /AWS1/AANBOOLEAN

The level of detail that you want to generate. You can specify whether to generate policies with placeholders for resource ARNs for actions that support resource level granularity in policies.

For example, in the resource section of a policy, you can receive a placeholder such as "Resource":"arn:aws:s3:::${BucketName}" instead of "*".

iv_includeserviceleveltmpl TYPE /AWS1/AANBOOLEAN /AWS1/AANBOOLEAN

The level of detail that you want to generate. You can specify whether to generate service-level policies.

IAM Access Analyzer uses iam:servicelastaccessed to identify services that have been used recently to create this service-level template.

RETURNING

oo_output TYPE REF TO /aws1/cl_aangetgeneratedplyrsp /AWS1/CL_AANGETGENERATEDPLYRSP

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->/aws1/if_aan~getgeneratedpolicy(
  iv_inclresourceplaceholders = ABAP_TRUE
  iv_includeserviceleveltmpl = ABAP_TRUE
  iv_jobid = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lo_jobdetails = lo_result->get_jobdetails( ).
  IF lo_jobdetails IS NOT INITIAL.
    lv_jobid = lo_jobdetails->get_jobid( ).
    lv_jobstatus = lo_jobdetails->get_status( ).
    lv_timestamp = lo_jobdetails->get_startedon( ).
    lv_timestamp = lo_jobdetails->get_completedon( ).
    lo_joberror = lo_jobdetails->get_joberror( ).
    IF lo_joberror IS NOT INITIAL.
      lv_joberrorcode = lo_joberror->get_code( ).
      lv_string = lo_joberror->get_message( ).
    ENDIF.
  ENDIF.
  lo_generatedpolicyresult = lo_result->get_generatedpolicyresult( ).
  IF lo_generatedpolicyresult IS NOT INITIAL.
    lo_generatedpolicyproperti = lo_generatedpolicyresult->get_properties( ).
    IF lo_generatedpolicyproperti IS NOT INITIAL.
      lv_boolean = lo_generatedpolicyproperti->get_iscomplete( ).
      lv_principalarn = lo_generatedpolicyproperti->get_principalarn( ).
      lo_cloudtrailproperties = lo_generatedpolicyproperti->get_cloudtrailproperties( ).
      IF lo_cloudtrailproperties IS NOT INITIAL.
        LOOP AT lo_cloudtrailproperties->get_trailproperties( ) into lo_row.
          lo_row_1 = lo_row.
          IF lo_row_1 IS NOT INITIAL.
            lv_cloudtrailarn = lo_row_1->get_cloudtrailarn( ).
            LOOP AT lo_row_1->get_regions( ) into lo_row_2.
              lo_row_3 = lo_row_2.
              IF lo_row_3 IS NOT INITIAL.
                lv_string = lo_row_3->get_value( ).
              ENDIF.
            ENDLOOP.
            lv_boolean = lo_row_1->get_allregions( ).
          ENDIF.
        ENDLOOP.
        lv_timestamp = lo_cloudtrailproperties->get_starttime( ).
        lv_timestamp = lo_cloudtrailproperties->get_endtime( ).
      ENDIF.
    ENDIF.
    LOOP AT lo_generatedpolicyresult->get_generatedpolicies( ) into lo_row_4.
      lo_row_5 = lo_row_4.
      IF lo_row_5 IS NOT INITIAL.
        lv_string = lo_row_5->get_policy( ).
      ENDIF.
    ENDLOOP.
  ENDIF.
ENDIF.