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 FileShareBackupStorageInfo Build()
            {
                var updatedObject = tempObject;

                tempObject = null;     // So that build cannot be invoked again, not an ideal solution but works for us
                return(updatedObject);
            }
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));
     }
 }
 public static bool CompareStorage(FileShareBackupStorageInfo fileShareBackupStorageInfo, FileShareBackupStorageInfo fileShareBackupStorageInfo1)
 {
     if (fileShareBackupStorageInfo.Path == fileShareBackupStorageInfo1.Path)
     {
         return(true);
     }
     return(false);
 }
 internal FileShareBackupStorageInfo(FileShareBackupStorageInfo other)
     : this()
 {
     this.Path                = other.Path;
     this.PrimaryUserName     = other.PrimaryUserName;
     this.PrimaryPassword     = other.PrimaryPassword;
     this.SecondaryUserName   = other.SecondaryUserName;
     this.SecondaryPassword   = other.SecondaryPassword;
     this.IsPasswordEncrypted = other.IsPasswordEncrypted;
 }
        internal static FileShareBackupStorageInfo FromfileShareBackupStorageInfoView(
            BackupRestoreView.FileShareBackupStorageInfo fileShareBackupStorageInfoView)
        {
            var fileShareBackupStorageInfo = new FileShareBackupStorageInfo
            {
                Path              = fileShareBackupStorageInfoView.Path,
                PrimaryUserName   = fileShareBackupStorageInfoView.PrimaryUserName,
                SecondaryUserName = fileShareBackupStorageInfoView.SecondaryUserName
            };

            string certThumbprint, certStore;

            EncryptionCertConfigHandler.GetEncryptionCertDetails(out certThumbprint, out certStore);

            // Encrypt the creds if cert configured
            if (!String.IsNullOrEmpty(certThumbprint))
            {
                if (!String.IsNullOrEmpty(fileShareBackupStorageInfoView.PrimaryPassword))
                {
                    fileShareBackupStorageInfo.PrimaryPassword = EncryptionUtility.EncryptText(fileShareBackupStorageInfoView.PrimaryPassword,
                                                                                               certThumbprint,
                                                                                               certStore);
                }

                if (!String.IsNullOrEmpty(fileShareBackupStorageInfoView.SecondaryPassword))
                {
                    fileShareBackupStorageInfo.SecondaryPassword =
                        EncryptionUtility.EncryptText(fileShareBackupStorageInfoView.SecondaryPassword, certThumbprint,
                                                      certStore);
                }

                fileShareBackupStorageInfo.IsPasswordEncrypted = true;
            }
            else
            {
                fileShareBackupStorageInfo.PrimaryPassword     = fileShareBackupStorageInfoView.PrimaryPassword;
                fileShareBackupStorageInfo.SecondaryPassword   = fileShareBackupStorageInfoView.SecondaryPassword;
                fileShareBackupStorageInfo.IsPasswordEncrypted = false;
            }

            return(fileShareBackupStorageInfo);
        }
 internal Builder(FileShareBackupStorageInfo originalObject)
 {
     this.tempObject = new FileShareBackupStorageInfo(originalObject);
 }
Exemplo n.º 8
0
 public FileShareRecoveryPointManager(Model.FileShareBackupStorageInfo fileShareStoreInformation)
 {
     this.storeInformation = fileShareStoreInformation;
 }