Skip to content

/AWS1/IF_LKF=>GETTEMPDATALOCATIONCREDS()

About GetTemporaryDataLocationCredentials

Allows a user or application in a secure environment to access data in a specific Amazon S3 location registered with Lake Formation by providing temporary scoped credentials that are limited to the requested data location and the caller's authorized access level.

GetDataAccess is logged in CloudTrail whenever a principal requests temporary data location credentials to access data in a data lake location that is registered with Lake Formation.

The API operation returns an error in the following scenarios:

  • The data location is not registered with Lake Formation.

  • No Glue table is associated with the data location.

  • The caller doesn't have required permissions on the associated table. The caller must have SELECT or SUPER permissions on the associated table, and credential vending for full table access must be enabled in the data lake settings.

    For more information, see Application integration for full table access.

  • The data location is in a different Amazon Web Services Region. Lake Formation doesn't support cross-Region access when vending credentials for a data location. Lake Formation only supports Amazon S3 paths registered within the same Region as the API call.

Method Signature

METHODS /AWS1/IF_LKF~GETTEMPDATALOCATIONCREDS
  IMPORTING
    !IV_DURATIONSECONDS TYPE /AWS1/LKFCREDTODURSECINTEGER OPTIONAL
    !IO_AUDITCONTEXT TYPE REF TO /AWS1/CL_LKFAUDITCONTEXT OPTIONAL
    !IT_DATALOCATIONS TYPE /AWS1/CL_LKFPATHSTRINGLIST_W=>TT_PATHSTRINGLIST OPTIONAL
    !IV_CREDENTIALSSCOPE TYPE /AWS1/LKFCREDENTIALSSCOPE OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_lkfgettmpdataloccre01
  RAISING
    /AWS1/CX_LKFACCESSDENIEDEX
    /AWS1/CX_LKFCONFLICTEXCEPTION
    /AWS1/CX_LKFENTITYNOTFOUNDEX
    /AWS1/CX_LKFGLUEENCEXCEPTION
    /AWS1/CX_LKFINTERNALSERVICEEX
    /AWS1/CX_LKFINVALIDINPUTEX
    /AWS1/CX_LKFOPERATIONTIMEOUTEX
    /AWS1/CX_LKFCLIENTEXC
    /AWS1/CX_LKFSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Optional arguments:

iv_durationseconds TYPE /AWS1/LKFCREDTODURSECINTEGER /AWS1/LKFCREDTODURSECINTEGER

The time period, between 900 and 43,200 seconds, for the timeout of the temporary credentials.

io_auditcontext TYPE REF TO /AWS1/CL_LKFAUDITCONTEXT /AWS1/CL_LKFAUDITCONTEXT

A structure used to include auditing information on the privileged API.

it_datalocations TYPE /AWS1/CL_LKFPATHSTRINGLIST_W=>TT_PATHSTRINGLIST TT_PATHSTRINGLIST

The Amazon S3 data location that you want to access.

iv_credentialsscope TYPE /AWS1/LKFCREDENTIALSSCOPE /AWS1/LKFCREDENTIALSSCOPE

The credential scope is determined by the caller's Lake Formation permission on the associated table. Credential scope can be either:

  • READ - Provides read-only access to the data location.

  • READ_WRITE - Provides both read and write access to the data location.

RETURNING

oo_output TYPE REF TO /aws1/cl_lkfgettmpdataloccre01 /AWS1/CL_LKFGETTMPDATALOCCRE01

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->gettempdatalocationcreds(
  io_auditcontext = new /aws1/cl_lkfauditcontext( |string| )
  it_datalocations = VALUE /aws1/cl_lkfpathstringlist_w=>tt_pathstringlist(
    ( new /aws1/cl_lkfpathstringlist_w( |string| ) )
  )
  iv_credentialsscope = |string|
  iv_durationseconds = 123
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lo_temporarycredentials = lo_result->get_credentials( ).
  IF lo_temporarycredentials IS NOT INITIAL.
    lv_accesskeyidstring = lo_temporarycredentials->get_accesskeyid( ).
    lv_secretaccesskeystring = lo_temporarycredentials->get_secretaccesskey( ).
    lv_sessiontokenstring = lo_temporarycredentials->get_sessiontoken( ).
    lv_expirationtimestamp = lo_temporarycredentials->get_expiration( ).
  ENDIF.
  LOOP AT lo_result->get_accessibledatalocations( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_pathstring = lo_row_1->get_value( ).
    ENDIF.
  ENDLOOP.
  lv_credentialsscope = lo_result->get_credentialsscope( ).
ENDIF.