listBackups method

Future<ListBackupsOutput> listBackups({
  1. BackupTypeFilter? backupType,
  2. String? exclusiveStartBackupArn,
  3. int? limit,
  4. String? tableName,
  5. DateTime? timeRangeLowerBound,
  6. DateTime? timeRangeUpperBound,
})

List DynamoDB backups that are associated with an Amazon Web Services account and weren't made with Amazon Web Services Backup. To list these backups for a given table, specify TableName. ListBackups returns a paginated list of results with at most 1 MB worth of items in a page. You can also specify a maximum number of entries to be returned in a page.

In the request, start time is inclusive, but end time is exclusive. Note that these boundaries are for the time at which the original backup was requested.

You can call ListBackups a maximum of five times per second.

If you want to retrieve the complete list of backups made with Amazon Web Services Backup, use the Amazon Web Services Backup list API.

May throw InternalServerError. May throw InvalidEndpointException.

Parameter backupType : The backups from the table specified by BackupType are listed.

Where BackupType can be:

  • USER - On-demand backup created by you. (The default setting if no other backup types are specified.)
  • SYSTEM - On-demand backup automatically created by DynamoDB.
  • ALL - All types of on-demand backups (USER and SYSTEM).

Parameter exclusiveStartBackupArn : LastEvaluatedBackupArn is the Amazon Resource Name (ARN) of the backup last evaluated when the current page of results was returned, inclusive of the current page of results. This value may be specified as the ExclusiveStartBackupArn of a new ListBackups operation in order to fetch the next page of results.

Parameter limit : Maximum number of backups to return at once.

Parameter tableName : Lists the backups from the table specified in TableName. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.

Parameter timeRangeLowerBound : Only backups created after this time are listed. TimeRangeLowerBound is inclusive.

Parameter timeRangeUpperBound : Only backups created before this time are listed. TimeRangeUpperBound is exclusive.

Implementation

Future<ListBackupsOutput> listBackups({
  BackupTypeFilter? backupType,
  String? exclusiveStartBackupArn,
  int? limit,
  String? tableName,
  DateTime? timeRangeLowerBound,
  DateTime? timeRangeUpperBound,
}) async {
  _s.validateNumRange(
    'limit',
    limit,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'DynamoDB_20120810.ListBackups'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (backupType != null) 'BackupType': backupType.value,
      if (exclusiveStartBackupArn != null)
        'ExclusiveStartBackupArn': exclusiveStartBackupArn,
      if (limit != null) 'Limit': limit,
      if (tableName != null) 'TableName': tableName,
      if (timeRangeLowerBound != null)
        'TimeRangeLowerBound': unixTimestampToJson(timeRangeLowerBound),
      if (timeRangeUpperBound != null)
        'TimeRangeUpperBound': unixTimestampToJson(timeRangeUpperBound),
    },
  );

  return ListBackupsOutput.fromJson(jsonResponse.body);
}