restoreTable method
- required String sourceKeyspaceName,
- required String sourceTableName,
- required String targetKeyspaceName,
- required String targetTableName,
- AutoScalingSpecification? autoScalingSpecification,
- CapacitySpecification? capacitySpecificationOverride,
- EncryptionSpecification? encryptionSpecificationOverride,
- PointInTimeRecovery? pointInTimeRecoveryOverride,
- List<
ReplicaSpecification> ? replicaSpecifications, - DateTime? restoreTimestamp,
- List<
Tag> ? tagsOverride,
Restores the table to the specified point in time within the
earliest_restorable_timestamp and the current time. For more
information about restore points, see
Time window for PITR continuous backups in the Amazon Keyspaces
Developer Guide.
Any number of users can execute up to 4 concurrent restores (any type of restore) in a given account.
When you restore using point in time recovery, Amazon Keyspaces restores
your source table's schema and data to the state based on the selected
timestamp (day:hour:minute:second) to a new table. The Time
to Live (TTL) settings are also restored to the state based on the
selected timestamp.
In addition to the table's schema, data, and TTL settings,
RestoreTable restores the capacity mode, auto scaling
settings, encryption settings, and point-in-time recovery settings from
the source table. Unlike the table's schema data and TTL settings, which
are restored based on the selected timestamp, these settings are always
restored based on the table's settings as of the current time or when the
table was deleted.
You can also overwrite these settings during restore:
- Read/write capacity mode
- Provisioned throughput capacity units
- Auto scaling settings
- Point-in-time (PITR) settings
- Tags
Note that the following settings are not restored, and you must configure them manually for the new table:
- Identity and Access Management (IAM) policies
- Amazon CloudWatch metrics and alarms
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ValidationException.
Parameter sourceKeyspaceName :
The keyspace name of the source table.
Parameter sourceTableName :
The name of the source table.
Parameter targetKeyspaceName :
The name of the target keyspace.
Parameter targetTableName :
The name of the target table.
Parameter autoScalingSpecification :
The optional auto scaling settings for the restored table in provisioned
capacity mode. Specifies if the service can manage throughput capacity of
a provisioned table automatically on your behalf. Amazon Keyspaces auto
scaling helps you provision throughput capacity for variable workloads
efficiently by increasing and decreasing your table's read and write
capacity automatically in response to application traffic.
For more information, see Managing throughput capacity automatically with Amazon Keyspaces auto scaling in the Amazon Keyspaces Developer Guide.
Parameter capacitySpecificationOverride :
Specifies the read/write throughput capacity mode for the target table.
The options are:
-
throughputMode:PAY_PER_REQUEST -
throughputMode:PROVISIONED- Provisioned capacity mode requiresreadCapacityUnitsandwriteCapacityUnitsas input.
throughput_mode:PAY_PER_REQUEST.
For more information, see Read/write capacity modes in the Amazon Keyspaces Developer Guide.
Parameter encryptionSpecificationOverride :
Specifies the encryption settings for the target table. You can choose one
of the following KMS key (KMS key):
-
type:AWS_OWNED_KMS_KEY- This key is owned by Amazon Keyspaces. -
type:CUSTOMER_MANAGED_KMS_KEY- This key is stored in your account and is created, owned, and managed by you. This option requires thekms_key_identifierof the KMS key in Amazon Resource Name (ARN) format as input.
type:AWS_OWNED_KMS_KEY.
For more information, see Encryption at rest in the Amazon Keyspaces Developer Guide.
Parameter pointInTimeRecoveryOverride :
Specifies the pointInTimeRecovery settings for the target
table. The options are:
-
status=ENABLED -
status=DISABLED
status=DISABLED.
For more information, see Point-in-time recovery in the Amazon Keyspaces Developer Guide.
Parameter replicaSpecifications :
The optional Region specific settings of a multi-Regional table.
Parameter restoreTimestamp :
The restore timestamp in ISO 8601 format.
Parameter tagsOverride :
A list of key-value pair tags to be attached to the restored table.
For more information, see Adding tags and labels to Amazon Keyspaces resources in the Amazon Keyspaces Developer Guide.
Implementation
Future<RestoreTableResponse> restoreTable({
required String sourceKeyspaceName,
required String sourceTableName,
required String targetKeyspaceName,
required String targetTableName,
AutoScalingSpecification? autoScalingSpecification,
CapacitySpecification? capacitySpecificationOverride,
EncryptionSpecification? encryptionSpecificationOverride,
PointInTimeRecovery? pointInTimeRecoveryOverride,
List<ReplicaSpecification>? replicaSpecifications,
DateTime? restoreTimestamp,
List<Tag>? tagsOverride,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'KeyspacesService.RestoreTable'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'sourceKeyspaceName': sourceKeyspaceName,
'sourceTableName': sourceTableName,
'targetKeyspaceName': targetKeyspaceName,
'targetTableName': targetTableName,
if (autoScalingSpecification != null)
'autoScalingSpecification': autoScalingSpecification,
if (capacitySpecificationOverride != null)
'capacitySpecificationOverride': capacitySpecificationOverride,
if (encryptionSpecificationOverride != null)
'encryptionSpecificationOverride': encryptionSpecificationOverride,
if (pointInTimeRecoveryOverride != null)
'pointInTimeRecoveryOverride': pointInTimeRecoveryOverride,
if (replicaSpecifications != null)
'replicaSpecifications': replicaSpecifications,
if (restoreTimestamp != null)
'restoreTimestamp': unixTimestampToJson(restoreTimestamp),
if (tagsOverride != null) 'tagsOverride': tagsOverride,
},
);
return RestoreTableResponse.fromJson(jsonResponse.body);
}