private static async Task BackupAsync(IEnumerable <string> args) { if (args.Any() && args.First() == "-h") { DisplayBackupHelp(); } else { var command = new BackupCommand(); var parameters = command.ReadParameters(args); if (parameters.ConfigPath == null) { throw new CosbakException("Switch 'c' not specified, i.e. path to configuration"); } else { var configuration = await LoadBackupConfigurationAsync(parameters.ConfigPath); var metaController = new MetaController(); await metaController.BackupAsync(configuration, parameters.Mode); } } }
private static async Task BackupAsync(Container sourceContainer) { var metaController = new MetaController(); var backupConfiguration = new BackupConfiguration { CosmosAccount = CosmosCollectionRental.CosmosConfiguration, StorageAccount = Storage.StorageConfiguration, Collections = new[] { new CollectionBackupPlanOverride { Db = CosmosCollectionRental.DatabaseName, Collection = sourceContainer.Id } } }; await metaController.BackupAsync(backupConfiguration, BackupMode.Iterative); }