Skip to content

/AWS1/CL_RAM=>ASSOCIATERESOURCESHARE()

About AssociateResourceShare

Adds the specified list of principals and list of resources to a resource share. Principals that already have access to this resource share immediately receive access to the added resources. Newly added principals immediately receive access to the resources shared in this resource share.

Method Signature

IMPORTING

Required arguments:

iv_resourcesharearn TYPE /AWS1/RAMSTRING /AWS1/RAMSTRING

Specifies the Amazon Resource Name (ARN) of the resource share that you want to add principals or resources to.

Optional arguments:

it_resourcearns TYPE /AWS1/CL_RAMRESOURCEARNLIST_W=>TT_RESOURCEARNLIST TT_RESOURCEARNLIST

Specifies a list of Amazon Resource Names (ARNs) of the resources that you want to share. This can be null if you want to add only principals.

it_principals TYPE /AWS1/CL_RAMPRINCARNORIDLIST_W=>TT_PRINCIPALARNORIDLIST TT_PRINCIPALARNORIDLIST

Specifies a list of principals to whom you want to the resource share. This can be null if you want to add only resources.

What the principals can do with the resources in the share is determined by the RAM permissions that you associate with the resource share. See AssociateResourceSharePermission.

You can include the following values:

  • An Amazon Web Services account ID, for example: 123456789012

  • An Amazon Resource Name (ARN) of an organization in Organizations, for example: organizations::123456789012:organization/o-exampleorgid

  • An ARN of an organizational unit (OU) in Organizations, for example: organizations::123456789012:ou/o-exampleorgid/ou-examplerootid-exampleouid123

  • An ARN of an IAM role, for example: iam::123456789012:role/rolename

  • An ARN of an IAM user, for example: iam::123456789012user/username

Not all resource types can be shared with IAM roles and users. For more information, see Sharing with IAM roles and users in the Resource Access Manager User Guide.

iv_clienttoken TYPE /AWS1/RAMSTRING /AWS1/RAMSTRING

Specifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a UUID type of value..

If you don't provide this value, then Amazon Web Services generates a random one for you.

If you retry the operation with the same ClientToken, but with different parameters, the retry fails with an IdempotentParameterMismatch error.

it_sources TYPE /AWS1/CL_RAMSRCARNORACCTLIST_W=>TT_SOURCEARNORACCOUNTLIST TT_SOURCEARNORACCOUNTLIST

Specifies from which source accounts the service principal has access to the resources in this resource share.

RETURNING

oo_output TYPE REF TO /aws1/cl_ramassocresrcsharersp /AWS1/CL_RAMASSOCRESRCSHARERSP

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_ram~associateresourceshare(
  it_principals = VALUE /aws1/cl_ramprincarnoridlist_w=>tt_principalarnoridlist(
    ( new /aws1/cl_ramprincarnoridlist_w( |string| ) )
  )
  it_resourcearns = VALUE /aws1/cl_ramresourcearnlist_w=>tt_resourcearnlist(
    ( new /aws1/cl_ramresourcearnlist_w( |string| ) )
  )
  it_sources = VALUE /aws1/cl_ramsrcarnoracctlist_w=>tt_sourcearnoraccountlist(
    ( new /aws1/cl_ramsrcarnoracctlist_w( |string| ) )
  )
  iv_clienttoken = |string|
  iv_resourcesharearn = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  LOOP AT lo_result->get_resrcshareassociations( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_string = lo_row_1->get_resourcesharearn( ).
      lv_string = lo_row_1->get_resourcesharename( ).
      lv_string = lo_row_1->get_associatedentity( ).
      lv_resourceshareassociatio = lo_row_1->get_associationtype( ).
      lv_resourceshareassociatio_1 = lo_row_1->get_status( ).
      lv_string = lo_row_1->get_statusmessage( ).
      lv_datetime = lo_row_1->get_creationtime( ).
      lv_datetime = lo_row_1->get_lastupdatedtime( ).
      lv_boolean = lo_row_1->get_external( ).
    ENDIF.
  ENDLOOP.
  lv_string = lo_result->get_clienttoken( ).
ENDIF.