public FileDataSource(BackupDirection direction, string connectionString, string containerName, string filename) : base(direction) { this.filename = filename; // Ensure the file has a tsbak extension if (Path.GetExtension(filename) != ".tsbak") { Path.ChangeExtension(filename, ".tsbak"); } this.xmlFilename = Path.Combine(Path.GetDirectoryName(filename), Path.GetFileNameWithoutExtension(filename) + ".xml"); // Get blob container CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString); CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); this.container = blobClient.GetContainerReference(containerName.ToLower()); // Container names must be lowercase // Ensure the container exists this.container.CreateIfNotExist(); // Ensure the container is private this.container.SetPermissions(new BlobContainerPermissions() { PublicAccess = BlobContainerPublicAccessType.Off }); }
public TableStorageDataSource(BackupDirection direction, string connectionString) : base(direction) { try { this.account = CloudStorageAccount.Parse(connectionString); this.destAccountName = this.account.Credentials.AccountName; this.isDevelopmentStorage = this.destAccountName.Equals("devstoreaccount1", StringComparison.CurrentCultureIgnoreCase); } catch (Exception) { // The connection string is not valid throw new FormatException("The " + this.DirectionLabel + " connection string is not valid."); } this.cloudTableClient = new CloudTableClient(account.TableEndpoint.ToString(), account.Credentials); }
public TableStorageDataSource(BackupDirection direction, string connectionString) : base(direction) { try { this.account = CloudStorageAccount.Parse(connectionString); this.destAccountName = this.account.Credentials.AccountName; this.isDevelopmentStorage = this.destAccountName.Equals("devstoreaccount1", StringComparison.CurrentCultureIgnoreCase); } catch (Exception) { // The connection string is not valid throw new FormatException("The " + this.DirectionLabel + " connection string is not valid."); } this.cloudTableClient = new CloudTableClient(account.TableEndpoint.ToString(), account.Credentials); }
public FileDataSource(BackupDirection direction, string connectionString, string containerName, string filename) : base(direction) { this.filename = filename; // Ensure the file has a tsbak extension if (Path.GetExtension(filename) != ".tsbak") { Path.ChangeExtension(filename, ".tsbak"); } this.xmlFilename = Path.Combine(Path.GetDirectoryName(filename), Path.GetFileNameWithoutExtension(filename) + ".xml"); // Get blob container CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString); CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); this.container = blobClient.GetContainerReference(containerName.ToLower()); // Container names must be lowercase // Ensure the container exists this.container.CreateIfNotExist(); // Ensure the container is private this.container.SetPermissions(new BlobContainerPermissions() { PublicAccess = BlobContainerPublicAccessType.Off }); }
public BackupDataSource(BackupDirection direction) { this.DirectionLabel = direction.ToString().ToLower(); this.TotalOperations = 1; }
public BackupDataSource(BackupDirection direction) { this.DirectionLabel = direction.ToString().ToLower(); this.TotalOperations = 1; }