deleteDiskSnapshot method

Future<DeleteDiskSnapshotResult> deleteDiskSnapshot({
  1. required String diskSnapshotName,
})

Deletes the specified disk snapshot.

When you make periodic snapshots of a disk, the snapshots are incremental, and only the blocks on the device that have changed since your last snapshot are saved in the new snapshot. When you delete a snapshot, only the data not needed for any other snapshot is removed. So regardless of which prior snapshots have been deleted, all active snapshots will have access to all the information needed to restore the disk.

The delete disk snapshot operation supports tag-based access control via resource tags applied to the resource identified by disk snapshot name. For more information, see the Lightsail Dev Guide.

May throw ServiceException. May throw InvalidInputException. May throw NotFoundException. May throw OperationFailureException. May throw AccessDeniedException. May throw AccountSetupInProgressException. May throw UnauthenticatedException.

Parameter diskSnapshotName : The name of the disk snapshot you want to delete (e.g., my-disk-snapshot).

Implementation

Future<DeleteDiskSnapshotResult> deleteDiskSnapshot({
  required String diskSnapshotName,
}) async {
  ArgumentError.checkNotNull(diskSnapshotName, 'diskSnapshotName');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Lightsail_20161128.DeleteDiskSnapshot'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'diskSnapshotName': diskSnapshotName,
    },
  );

  return DeleteDiskSnapshotResult.fromJson(jsonResponse.body);
}