Exemplo n.º 1
0
        protected internal static BackupStorage FromBackupStorageView(BackupRestoreView.BackupStorage backupStorageView)
        {
            BackupStorage backupStorage = null;

            if (backupStorageView == null)
            {
                throw new ArgumentException("backupStorageView is null, it must be valid instance of BackupStorage.");
            }
            else if (backupStorageView.StorageKind == BackupStorageType.FileShare)
            {
                backupStorage = FileShareBackupStorageInfo.FromfileShareBackupStorageInfoView((BackupRestoreView.FileShareBackupStorageInfo)backupStorageView);
            }
            else if (backupStorageView.StorageKind == BackupStorageType.AzureBlobStore)
            {
                backupStorage = AzureBlobBackupStorageInfo.FromAzureBlobBackupStorageInfoView((BackupRestoreView.AzureBlobBackupStorageInfo)backupStorageView);
            }
            else if (backupStorageView.StorageKind == BackupStorageType.DsmsAzureBlobStore)
            {
                backupStorage = DsmsAzureBlobBackupStorageInfo.FromDsmsAzureBlobBackupStorageInfoView((BackupRestoreView.DsmsAzureBlobBackupStorageInfo)backupStorageView);
            }
            if (backupStorage != null)
            {
                backupStorage.FriendlyName = string.IsNullOrEmpty(backupStorageView.FriendlyName)
                    ? string.Empty
                    : backupStorageView.FriendlyName;
            }
            return(backupStorage);
        }
 internal AzureBlobBackupStorageInfo(AzureBlobBackupStorageInfo other)
     : this()
 {
     this.ConnectionString            = other.ConnectionString;
     this.IsConnectionStringEncrypted = other.IsConnectionStringEncrypted;
     this.ContainerName = other.ContainerName;
 }
Exemplo n.º 3
0
 internal bool CompareStorage(BackupStorage backupStorage)
 {
     if (this.BackupStorageType != backupStorage.BackupStorageType)
     {
         return(false);
     }
     else if (this.BackupStorageType == BackupStorageType.FileShare)
     {
         var fileStoreInfo  = (FileShareBackupStorageInfo)this;
         var fileStoreInfo1 = (FileShareBackupStorageInfo)backupStorage;
         return(FileShareBackupStorageInfo.CompareStorage(fileStoreInfo, fileStoreInfo1));
     }
     else if (this.BackupStorageType == BackupStorageType.AzureBlobStore)
     {
         // it means AzureBlobShare
         var azureStoreInfo  = (AzureBlobBackupStorageInfo)this;
         var azureStoreInfo1 = (AzureBlobBackupStorageInfo)backupStorage;
         return(AzureBlobBackupStorageInfo.CompareStorage(azureStoreInfo, azureStoreInfo1));
     }
     else
     {
         // it means AzureBlobShare
         var dsmsazureStoreInfo  = (DsmsAzureBlobBackupStorageInfo)this;
         var dsmsazureStoreInfo1 = (DsmsAzureBlobBackupStorageInfo)backupStorage;
         return(DsmsAzureBlobBackupStorageInfo.CompareStorage(dsmsazureStoreInfo, dsmsazureStoreInfo1));
     }
 }
        internal static AzureBlobBackupStorageInfo FromAzureBlobBackupStorageInfoView(
            BackupRestoreView.AzureBlobBackupStorageInfo azureBlobBackupStorageInfoView)
        {
            var azureBlobBackupStorageInfo = new AzureBlobBackupStorageInfo
            {
                ContainerName = azureBlobBackupStorageInfoView.ContainerName
            };

            string certThumbprint, certStore;

            EncryptionCertConfigHandler.GetEncryptionCertDetails(out certThumbprint, out certStore);

            // Encrypt the creds if cert configured
            if (!String.IsNullOrEmpty(certThumbprint))
            {
                azureBlobBackupStorageInfo.ConnectionString = EncryptionUtility.EncryptText(azureBlobBackupStorageInfoView.ConnectionString,
                                                                                            certThumbprint,
                                                                                            certStore);
                azureBlobBackupStorageInfo.IsConnectionStringEncrypted = true;
            }
            else
            {
                azureBlobBackupStorageInfo.ConnectionString            = azureBlobBackupStorageInfoView.ConnectionString;
                azureBlobBackupStorageInfo.IsConnectionStringEncrypted = false;
            }

            return(azureBlobBackupStorageInfo);
        }
            internal AzureBlobBackupStorageInfo Build()
            {
                var updatedObject = tempObject;

                tempObject = null;     // So that build cannot be invoked again, not an ideal solution but works for us
                return(updatedObject);
            }
 public static bool CompareStorage(AzureBlobBackupStorageInfo azureBlobBackupStorageInfo, AzureBlobBackupStorageInfo azureBlobBackupStorageInfo1)
 {
     if (azureBlobBackupStorageInfo.ConnectionString == azureBlobBackupStorageInfo1.ConnectionString &&
         azureBlobBackupStorageInfo.ContainerName == azureBlobBackupStorageInfo1.ContainerName)
     {
         return(true);
     }
     return(false);
 }
        public override bool Equals(object obj)
        {
            AzureBlobBackupStorageInfo azureBlobBackupStorageInfo = obj as AzureBlobBackupStorageInfo;

            if (this.ConnectionString.Equals(azureBlobBackupStorageInfo.ConnectionString))
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 8
0
        public AzureBlobRecoveryPointStore(Model.AzureBlobBackupStorageInfo azureBlobStoreInformation) : base(azureBlobStoreInformation)
        {
            this._storeInformation = azureBlobStoreInformation;

            if (azureBlobStoreInformation.IsConnectionStringEncrypted)
            {
                using (var secureString = EncryptionUtility.DecryptText(azureBlobStoreInformation.ConnectionString))
                {
                    this.container = AzureBlobStoreHelper.GetContainer(UtilityHelper.ConvertToUnsecureString(secureString), this._storeInformation.ContainerName);
                }
            }
            else
            {
                this.container = AzureBlobStoreHelper.GetContainer(this._storeInformation.ConnectionString, this._storeInformation.ContainerName);
            }
        }
 internal Builder(AzureBlobBackupStorageInfo originalObject)
 {
     this.tempObject = new AzureBlobBackupStorageInfo(originalObject);
 }
Exemplo n.º 10
0
 public AzureBlobStoreRecoveryPointManager(Model.AzureBlobBackupStorageInfo azureBlobStoreInformation)
 {
     this._storeInformation      = azureBlobStoreInformation;
     this.blobRecoveryPointStore = new Common.AzureBlobRecoveryPointStore(azureBlobStoreInformation);
 }