listSnapshots static method
Future<void>
listSnapshots(
- Client cloudApiClient, {
- required CommandLogger logger,
- required String projectId,
- bool utc = false,
Lists all snapshots of the project's database.
Implementation
static Future<void> listSnapshots(
final Client cloudApiClient, {
required final CommandLogger logger,
required final String projectId,
final bool utc = false,
}) async {
final List<DatabaseSnapshot> snapshots;
try {
snapshots = await cloudApiClient.database.listSnapshots(
cloudCapsuleId: projectId,
);
} on Exception catch (e, s) {
throw FailureException.nested(e, s, 'Failed to list snapshots');
}
if (snapshots.isEmpty) {
logger.info('No snapshots found for project "$projectId".');
logger.terminalCommand(
message: 'Create a snapshot with:',
'scloud db backup create --project $projectId',
);
return;
}
_snapshotsTable(snapshots, utc: utc).writeLines(logger.line);
}