restoreClusterFromSnapshot method

Future<RestoreClusterFromSnapshotOutput> restoreClusterFromSnapshot({
  1. required String clusterName,
  2. required String snapshotArn,
  3. String? kmsKeyId,
  4. int? shardCapacity,
  5. int? shardInstanceCount,
  6. List<String>? subnetIds,
  7. Map<String, String>? tags,
  8. List<String>? vpcSecurityGroupIds,
})

Restores an elastic cluster from a snapshot.

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

Parameter clusterName : The name of the elastic cluster.

Parameter snapshotArn : The ARN identifier of the elastic cluster snapshot.

Parameter kmsKeyId : The KMS key identifier to use to encrypt the new Amazon DocumentDB elastic clusters cluster.

The KMS key identifier is the Amazon Resource Name (ARN) for the KMS encryption key. If you are creating a cluster using the same Amazon account that owns this KMS encryption key, you can use the KMS key alias instead of the ARN as the KMS encryption key.

If an encryption key is not specified here, Amazon DocumentDB uses the default encryption key that KMS creates for your account. Your account has a different default encryption key for each Amazon Region.

Parameter shardCapacity : The capacity of each shard in the new restored elastic cluster.

Parameter shardInstanceCount : The number of replica instances applying to all shards in the elastic cluster. A shardInstanceCount value of 1 means there is one writer instance, and any additional instances are replicas that can be used for reads and to improve availability.

Parameter subnetIds : The Amazon EC2 subnet IDs for the elastic cluster.

Parameter tags : A list of the tag names to be assigned to the restored elastic cluster, in the form of an array of key-value pairs in which the key is the tag name and the value is the key value.

Parameter vpcSecurityGroupIds : A list of EC2 VPC security groups to associate with the elastic cluster.

Implementation

Future<RestoreClusterFromSnapshotOutput> restoreClusterFromSnapshot({
  required String clusterName,
  required String snapshotArn,
  String? kmsKeyId,
  int? shardCapacity,
  int? shardInstanceCount,
  List<String>? subnetIds,
  Map<String, String>? tags,
  List<String>? vpcSecurityGroupIds,
}) async {
  final $payload = <String, dynamic>{
    'clusterName': clusterName,
    if (kmsKeyId != null) 'kmsKeyId': kmsKeyId,
    if (shardCapacity != null) 'shardCapacity': shardCapacity,
    if (shardInstanceCount != null) 'shardInstanceCount': shardInstanceCount,
    if (subnetIds != null) 'subnetIds': subnetIds,
    if (tags != null) 'tags': tags,
    if (vpcSecurityGroupIds != null)
      'vpcSecurityGroupIds': vpcSecurityGroupIds,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/cluster-snapshot/${Uri.encodeComponent(snapshotArn)}/restore',
    exceptionFnMap: _exceptionFns,
  );
  return RestoreClusterFromSnapshotOutput.fromJson(response);
}