getTemporaryDataLocationCredentials method

Future<GetTemporaryDataLocationCredentialsResponse> getTemporaryDataLocationCredentials({
  1. AuditContext? auditContext,
  2. CredentialsScope? credentialsScope,
  3. List<String>? dataLocations,
  4. int? durationSeconds,
})

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.

May throw AccessDeniedException. May throw ConflictException. May throw EntityNotFoundException. May throw GlueEncryptionException. May throw InternalServiceException. May throw InvalidInputException. May throw OperationTimeoutException.

Parameter credentialsScope : 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.

Parameter dataLocations : The Amazon S3 data location that you want to access.

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

Implementation

Future<GetTemporaryDataLocationCredentialsResponse>
    getTemporaryDataLocationCredentials({
  AuditContext? auditContext,
  CredentialsScope? credentialsScope,
  List<String>? dataLocations,
  int? durationSeconds,
}) async {
  _s.validateNumRange(
    'durationSeconds',
    durationSeconds,
    900,
    43200,
  );
  final $payload = <String, dynamic>{
    if (auditContext != null) 'AuditContext': auditContext,
    if (credentialsScope != null) 'CredentialsScope': credentialsScope.value,
    if (dataLocations != null) 'DataLocations': dataLocations,
    if (durationSeconds != null) 'DurationSeconds': durationSeconds,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/GetTemporaryDataLocationCredentials',
    exceptionFnMap: _exceptionFns,
  );
  return GetTemporaryDataLocationCredentialsResponse.fromJson(response);
}