runWithOutput method
Future<void>
runWithOutput(
- Configuration<
DbBackupRestoreOption> commandConfig, - CommandOutput output
override
Runs this command with prepared configuration and output.
Subclasses should override this method.
Implementation
@override
Future<void> runWithOutput(
final Configuration<DbBackupRestoreOption> commandConfig,
final CommandOutput output,
) async {
final projectId = commandConfig.value(DbBackupRestoreOption.projectId);
final snapshotId = commandConfig.value(DbBackupRestoreOption.snapshotId);
await confirmToContinue(
output,
message:
'''
WARNING: Restores the database for project "$projectId" to snapshot "$snapshotId".
The live database is replaced with the data from the snapshot.
This action cannot be undone.
Do you want to proceed?''',
defaultValue: false,
);
await renderCommand(
output,
operation: () async => Stream.fromFuture(
DbBackupOperations.restoreSnapshot(
runner.serviceProvider.cloudApiClient,
projectId: projectId,
snapshotId: snapshotId,
),
),
textOutputUi: BackupSnapshotRestoreTextUi(projectId: projectId),
);
}