deleteSnapshot static method
Future<void>
deleteSnapshot(
- Client cloudApiClient, {
- required CommandLogger logger,
- required String projectId,
- required String snapshotId,
- bool skipConfirmation = false,
Deletes a single snapshot of the project's database.
Implementation
static Future<void> deleteSnapshot(
final Client cloudApiClient, {
required final CommandLogger logger,
required final String projectId,
required final String snapshotId,
final bool skipConfirmation = false,
}) async {
if (!skipConfirmation) {
final confirmed = await logger.confirm(
'Permanently delete snapshot "$snapshotId" for project "$projectId"? '
'This action cannot be undone.',
defaultValue: false,
);
if (!confirmed) {
throw UserAbortException();
}
}
try {
await cloudApiClient.database.deleteSnapshot(
cloudCapsuleId: projectId,
snapshotId: snapshotId,
);
} on Exception catch (e, s) {
throw FailureException.nested(e, s, 'Failed to delete snapshot');
}
logger.success('Snapshot "$snapshotId" deleted.', newParagraph: true);
}