restoreVolumeFromSnapshot method

Future<RestoreVolumeFromSnapshotResponse> restoreVolumeFromSnapshot({
  1. required String snapshotId,
  2. required String volumeId,
  3. String? clientRequestToken,
  4. List<RestoreOpenZFSVolumeOption>? options,
})

Returns an Amazon FSx for OpenZFS volume to the state saved by the specified snapshot.

May throw BadRequest. May throw InternalServerError. May throw VolumeNotFound.

Parameter snapshotId : The ID of the source snapshot. Specifies the snapshot that you are restoring from.

Parameter volumeId : The ID of the volume that you are restoring.

Parameter options : The settings used when restoring the specified volume from snapshot.

  • DELETE_INTERMEDIATE_SNAPSHOTS - Deletes snapshots between the current state and the specified snapshot. If there are intermediate snapshots and this option isn't used, RestoreVolumeFromSnapshot fails.
  • DELETE_CLONED_VOLUMES - Deletes any dependent clone volumes created from intermediate snapshots. If there are any dependent clone volumes and this option isn't used, RestoreVolumeFromSnapshot fails.

Implementation

Future<RestoreVolumeFromSnapshotResponse> restoreVolumeFromSnapshot({
  required String snapshotId,
  required String volumeId,
  String? clientRequestToken,
  List<RestoreOpenZFSVolumeOption>? options,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSSimbaAPIService_v20180301.RestoreVolumeFromSnapshot'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'SnapshotId': snapshotId,
      'VolumeId': volumeId,
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
      if (options != null) 'Options': options.map((e) => e.value).toList(),
    },
  );

  return RestoreVolumeFromSnapshotResponse.fromJson(jsonResponse.body);
}