createDbBackup method

Future<CreateDbBackupOutput> createDbBackup({
  1. required String dbResourceId,
  2. required String name,
  3. int? retentionDays,
  4. Map<String, String>? tags,
})

Creates a new on-demand backup of a Timestream for InfluxDB resource.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter dbResourceId : The id of the DB instance or DB cluster to back up.

Parameter name : The name of the backup. Must be unique within the account and region.

Parameter retentionDays : The number of days to retain the backup. Valid values are 1 to 3650.

Parameter tags : A list of key-value pairs to associate with the backup.

Implementation

Future<CreateDbBackupOutput> createDbBackup({
  required String dbResourceId,
  required String name,
  int? retentionDays,
  Map<String, String>? tags,
}) async {
  _s.validateNumRange(
    'retentionDays',
    retentionDays,
    1,
    3650,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AmazonTimestreamInfluxDB.CreateDbBackup'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'dbResourceId': dbResourceId,
      'name': name,
      if (retentionDays != null) 'retentionDays': retentionDays,
      if (tags != null) 'tags': tags,
    },
  );

  return CreateDbBackupOutput.fromJson(jsonResponse.body);
}