Skip to content

/AWS1/IF_ORG=>PUTRESOURCEPOLICY()

About PutResourcePolicy

Creates or updates a resource policy.

This operation can be called only from the organization's management account..

Method Signature

IMPORTING

Required arguments:

iv_content TYPE /AWS1/ORGRESOURCEPOLICYCONTENT /AWS1/ORGRESOURCEPOLICYCONTENT

If provided, the new content for the resource policy. The text must be correctly formatted JSON that complies with the syntax for the resource policy's type. For more information, see SCP syntax in the Organizations User Guide.

Optional arguments:

it_tags TYPE /AWS1/CL_ORGTAG=>TT_TAGS TT_TAGS

A list of tags that you want to attach to the newly created resource policy. For each tag in the list, you must specify both a tag key and a value. You can set the value to an empty string, but you can't set it to null. For more information about tagging, see Tagging Organizations resources in the Organizations User Guide.

Calls with tags apply to the initial creation of the resource policy, otherwise an exception is thrown. If any one of the tags is not valid or if you exceed the allowed number of tags for the resource policy, then the entire request fails and the resource policy is not created.

RETURNING

oo_output TYPE REF TO /aws1/cl_orgputresourceplyrsp /AWS1/CL_ORGPUTRESOURCEPLYRSP

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_org~putresourcepolicy(
  it_tags = VALUE /aws1/cl_orgtag=>tt_tags(
    (
      new /aws1/cl_orgtag(
        iv_key = |string|
        iv_value = |string|
      )
    )
  )
  iv_content = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lo_resourcepolicy = lo_result->get_resourcepolicy( ).
  IF lo_resourcepolicy IS NOT INITIAL.
    lo_resourcepolicysummary = lo_resourcepolicy->get_resourcepolicysummary( ).
    IF lo_resourcepolicysummary IS NOT INITIAL.
      lv_resourcepolicyid = lo_resourcepolicysummary->get_id( ).
      lv_resourcepolicyarn = lo_resourcepolicysummary->get_arn( ).
    ENDIF.
    lv_resourcepolicycontent = lo_resourcepolicy->get_content( ).
  ENDIF.
ENDIF.