@@ -67,6 +67,7 @@ CLASS ltc_awsex_cl_iam_actions DEFINITION FOR TESTING DURATION LONG RISK LEVEL D
6767 list_saml_providers FOR TESTING RAISING /aws1/cx_rt_generic,
6868 create_service_linked_role FOR TESTING RAISING /aws1/cx_rt_generic,
6969 list_policy_versions FOR TESTING RAISING /aws1/cx_rt_generic,
70+ get_policy_version FOR TESTING RAISING /aws1/cx_rt_generic,
7071 set_default_policy_version FOR TESTING RAISING /aws1/cx_rt_generic,
7172 delete_policy_version FOR TESTING RAISING /aws1/cx_rt_generic.
7273
@@ -1507,6 +1508,56 @@ CLASS ltc_awsex_cl_iam_actions IMPLEMENTATION.
15071508 msg = | Policy should have a default version| ).
15081509 ENDMETHOD .
15091510
1511+
1512+ METHOD get_policy_version .
1513+ DATA lo_result TYPE REF TO /aws1/cl_iamgetpolicyvrsrsp.
1514+ DATA lv_version_id TYPE /aws1/iampolicyversionidtype.
1515+
1516+ " Use test policy created in class_setup
1517+ " First get the list of versions to find the default version ID
1518+ DATA (lo_list_result ) = ao_iam->listpolicyversions( iv_policyarn = av_test_policy_arn ).
1519+ DATA (lt_versions ) = lo_list_result->get_versions( ).
1520+
1521+ " Find the default version
1522+ LOOP AT lt_versions INTO DATA (lo_version ).
1523+ IF lo_version->get_isdefaultversion( ) = abap_true .
1524+ lv_version_id = lo_version->get_versionid( ).
1525+ EXIT .
1526+ ENDIF .
1527+ ENDLOOP .
1528+
1529+ cl_abap_unit_assert=>assert_not_initial(
1530+ act = lv_version_id
1531+ msg = | Default policy version ID should be found| ).
1532+
1533+ " Now get the policy version details
1534+ ao_iam_actions->get_policy_version(
1535+ EXPORTING
1536+ iv_policy_arn = av_test_policy_arn
1537+ iv_version_id = lv_version_id
1538+ IMPORTING
1539+ oo_result = lo_result ).
1540+
1541+ cl_abap_unit_assert=>assert_bound(
1542+ act = lo_result
1543+ msg = | Get policy version result should not be initial| ).
1544+
1545+ DATA (lo_policy_version ) = lo_result->get_policyversion( ).
1546+ cl_abap_unit_assert=>assert_bound(
1547+ act = lo_policy_version
1548+ msg = | Policy version should not be initial| ).
1549+
1550+ cl_abap_unit_assert=>assert_equals(
1551+ exp = lv_version_id
1552+ act = lo_policy_version->get_versionid( )
1553+ msg = | Version ID should match| ).
1554+
1555+ cl_abap_unit_assert=>assert_not_initial(
1556+ act = lo_policy_version->get_document( )
1557+ msg = | Policy document should not be initial| ).
1558+ ENDMETHOD .
1559+
1560+
15101561 METHOD set_default_policy_version .
15111562 DATA lv_new_policy_doc TYPE string .
15121563 DATA lv_version_id TYPE /aws1/iampolicyversionidtype.
0 commit comments