listBackups method

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

List backups associated with an AWS account. To list 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.

May throw InternalServerError.

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

Where BackupType can be:

  • USER - On-demand backup created by you.
  • 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 : The backups from the table specified by TableName are listed.

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.validateStringLength(
    'exclusiveStartBackupArn',
    exclusiveStartBackupArn,
    37,
    1024,
  );
  _s.validateNumRange(
    'limit',
    limit,
    1,
    100,
  );
  _s.validateStringLength(
    'tableName',
    tableName,
    3,
    255,
  );
  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.toValue(),
      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);
}