Skip to content

Commit 93b88dd

Browse files
committed
Backup support for mercury
1 parent 4ee302b commit 93b88dd

File tree

34 files changed

+51144
-469
lines changed

34 files changed

+51144
-469
lines changed

src/Network/Network/Properties/Resources.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/RecoveryServices/RecoveryServices.Backup.Helpers/Conversions/ConversionHelpers.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,10 @@ public static PolicyBase GetPolicyModelForAzureVmWorkload(ServiceClientModel.Pro
314314
azureVmWorkloadPolicyModel.BackupManagementType = BackupManagementType.AzureWorkload;
315315
azureVmWorkloadPolicyModel.IsCompression =
316316
((ServiceClientModel.AzureVmWorkloadProtectionPolicy)serviceClientResponse.Properties).Settings.IsCompression;
317+
azureVmWorkloadPolicyModel.IsDifferentialBackupEnabled = false;
318+
azureVmWorkloadPolicyModel.IsLogBackupEnabled = false;
317319
GetPSSubProtectionPolicy(azureVmWorkloadPolicyModel, serviceClientResponse,
318320
((ServiceClientModel.AzureVmWorkloadProtectionPolicy)serviceClientResponse.Properties).Settings.TimeZone);
319-
320321
return policyModel;
321322
}
322323

@@ -620,6 +621,7 @@ public static void GetPSSubProtectionPolicy(AzureVmWorkloadPolicy azureVmWorkloa
620621
azureVmWorkloadPolicyModel.DifferentialBackupRetentionPolicy = PolicyHelpers.GetPSSimpleRetentionPolicy(
621622
(ServiceClientModel.SimpleRetentionPolicy)subProtectionPolicy.RetentionPolicy,
622623
((ServiceClientModel.AzureVmWorkloadProtectionPolicy)serviceClientResponse.Properties).Settings.TimeZone, "AzureWorkload");
624+
azureVmWorkloadPolicyModel.IsDifferentialBackupEnabled = true;
623625
}
624626
else if (string.Compare(subProtectionPolicy.PolicyType, "Log") == 0)
625627
{
@@ -629,6 +631,7 @@ public static void GetPSSubProtectionPolicy(AzureVmWorkloadPolicy azureVmWorkloa
629631
azureVmWorkloadPolicyModel.LogBackupRetentionPolicy = PolicyHelpers.GetPSSimpleRetentionPolicy((ServiceClientModel.SimpleRetentionPolicy)
630632
subProtectionPolicy.RetentionPolicy,
631633
((ServiceClientModel.AzureVmWorkloadProtectionPolicy)serviceClientResponse.Properties).Settings.TimeZone, "AzureWorkload");
634+
azureVmWorkloadPolicyModel.IsLogBackupEnabled = true;
632635
}
633636
}
634637
}

src/RecoveryServices/RecoveryServices.Backup.Helpers/Conversions/RecoveryPointConversions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ public static RecoveryPointBase GetPSAzureWorkloadRecoveryPoint(
223223
string containerName = IdUtils.GetNameFromUri(containerUri);
224224
string protectedItemName = IdUtils.GetNameFromUri(protectedItemUri);
225225

226-
ServiceClientModel.AzureWorkloadRecoveryPoint recoveryPoint =
227-
rp.Properties as ServiceClientModel.AzureWorkloadRecoveryPoint;
226+
ServiceClientModel.AzureWorkloadSQLRecoveryPoint recoveryPoint =
227+
rp.Properties as ServiceClientModel.AzureWorkloadSQLRecoveryPoint;
228228

229229
DateTime recoveryPointTime = DateTime.MinValue;
230230

@@ -248,6 +248,7 @@ public static RecoveryPointBase GetPSAzureWorkloadRecoveryPoint(
248248
RecoveryPointType = recoveryPoint.Type,
249249
Id = rp.Id,
250250
WorkloadType = item.WorkloadType,
251+
DataDirectoryPaths = recoveryPoint.ExtendedInfo != null ? recoveryPoint.ExtendedInfo.DataDirectoryPaths : null
251252
};
252253
return rpBase;
253254
}

src/RecoveryServices/RecoveryServices.Backup.Models/AzureVmWorkloadModels/AzureWorkloadProtectableItem.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using Microsoft.Azure.Management.RecoveryServices.Backup.Models;
16+
using CmdletModel = Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models;
1617

1718
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
1819
{
@@ -21,6 +22,11 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
2122
/// </summary>
2223
public class AzureWorkloadProtectableItem : ProtectableItemBase
2324
{
25+
/// <summary>
26+
/// Type of protectable item
27+
/// </summary>
28+
public string ProtectableItemType { get; set; }
29+
2430
/// <summary>
2531
/// name for instance or AG
2632
/// </summary>
@@ -75,6 +81,20 @@ public AzureWorkloadProtectableItem(WorkloadProtectableItemResource workloadProt
7581
IsAutoProtectable = protectedItem.IsAutoProtectable;
7682
Subinquireditemcount = protectedItem.Subinquireditemcount;
7783
Subprotectableitemcount = protectedItem.Subprotectableitemcount;
84+
Prebackupvalidation = protectedItem.Prebackupvalidation;
85+
ProtectableItemType = workloadProtectableItemResource.Properties.GetType().ToString();
86+
if(workloadProtectableItemResource.Properties.GetType() == typeof(AzureVmWorkloadSQLAvailabilityGroupProtectableItem))
87+
{
88+
ProtectableItemType = CmdletModel.ProtectableItemType.SQLAvailabilityGroup.ToString();
89+
}
90+
else if (workloadProtectableItemResource.Properties.GetType() == typeof(AzureVmWorkloadSQLInstanceProtectableItem))
91+
{
92+
ProtectableItemType = CmdletModel.ProtectableItemType.SQLInstance.ToString();
93+
}
94+
else if (workloadProtectableItemResource.Properties.GetType() == typeof(AzureVmWorkloadSQLDatabaseProtectableItem))
95+
{
96+
ProtectableItemType = CmdletModel.ProtectableItemType.SQLDataBase.ToString();
97+
}
7898
}
7999
}
80100
}

src/RecoveryServices/RecoveryServices.Backup.Models/AzureVmWorkloadModels/AzureWorkloadRecoveryConfig.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using Microsoft.Azure.Management.RecoveryServices.Backup.Models;
16-
using System;
1716
using System.Collections.Generic;
1817

1918
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
@@ -53,6 +52,8 @@ public class AzureWorkloadRecoveryConfig : RecoveryConfigBase
5352
/// </summary>
5453
public IList<SQLDataDirectoryMapping> targetPhysicalPath { get; set; }
5554

55+
public string ContainerId { get; set; }
56+
5657
public AzureWorkloadRecoveryConfig()
5758
{
5859
}

src/RecoveryServices/RecoveryServices.Backup.Models/AzureVmWorkloadModels/AzureWorkloadRecoveryPoint.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using Microsoft.Azure.Management.RecoveryServices.Backup.Models;
16+
using System.Collections.Generic;
17+
1518
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
1619
{
1720
/// <summary>
1821
/// Azure workload specific recovery point class.
1922
/// </summary>
2023
public class AzureWorkloadRecoveryPoint : AzureRecoveryPoint
2124
{
25+
public IList<SQLDataDirectory> DataDirectoryPaths { get; set; }
2226
public AzureWorkloadRecoveryPoint()
2327
{
2428

src/RecoveryServices/RecoveryServices.Backup.Models/CmdletParamEnums.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ public enum ItemParams
114114
BackupManagementType,
115115
ExpiryDateTimeUTC,
116116
StorageAccountName,
117+
BackupType,
118+
EnableCompression
117119
}
118120

119121
public enum ProtectionCheckParams

src/RecoveryServices/RecoveryServices.Backup.Models/CommonModels/Enums.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,24 @@ public enum SourceFileType
351351
Directory
352352
}
353353

354+
/// <summary>
355+
/// Type of the backup.
356+
/// </summary>
357+
public enum BackupType
358+
{
359+
Full,
360+
Differential,
361+
Log,
362+
CopyOnlyFull
363+
}
364+
354365
/// <summary>
355366
/// Options to select the protectable type
356367
/// </summary>
357368
public enum ProtectableItemType
358369
{
359370
SQLDataBase,
360371
SQLInstance,
361-
SQLAvailabilityGroupContainer,
372+
SQLAvailabilityGroup
362373
}
363374
}

src/RecoveryServices/RecoveryServices.Backup.Models/CommonModels/Utils.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,14 @@ public static string GetARMResourceType(string workloadType)
334334
{
335335
return "Microsoft.Compute/virtualMachines";
336336
}
337-
if (workloadType == WorkloadType.AzureFiles.ToString())
337+
else if (workloadType == WorkloadType.AzureFiles.ToString())
338338
{
339339
return "Microsoft.Storage/storageAccounts";
340340
}
341+
else if (workloadType == WorkloadType.MSSQL.ToString())
342+
{
343+
return "VMAppContainer";
344+
}
341345

342346
throw new Exception("Unsupported WorkloadType: " + workloadType);
343347
}
@@ -354,10 +358,14 @@ public static string GetWorkloadTypeFromArmType(string armType)
354358
{
355359
return WorkloadType.AzureVM.ToString();
356360
}
357-
if (string.Compare(armType, "Microsoft.Storage/storageAccounts", ignoreCase: true) == 0)
361+
else if (string.Compare(armType, "Microsoft.Storage/storageAccounts", ignoreCase: true) == 0)
358362
{
359363
return WorkloadType.AzureFiles.ToString();
360364
}
365+
else if (string.Compare(armType, "VMAppContainer", ignoreCase: true) == 0)
366+
{
367+
return WorkloadType.MSSQL.ToString();
368+
}
361369

362370
throw new Exception("Unsupported ArmType: " + armType);
363371
}

src/RecoveryServices/RecoveryServices.Backup.Models/Properties/Resources.Designer.cs

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/RecoveryServices/RecoveryServices.Backup.Providers/Commands.RecoveryServices.Backup.Providers.csproj

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)