Skip to content

Commit e012566

Browse files
committed
updated test recordings
1 parent 7781601 commit e012566

File tree

45 files changed

+972342
-392139
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+972342
-392139
lines changed

src/RecoveryServices/RecoveryServices.Backup.Helpers/RecoveryServices.Backup.Helpers.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="3.1.0-preview" />
15+
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="3.0.1-preview" />
1616
</ItemGroup>
1717

1818
<ItemGroup>

src/RecoveryServices/RecoveryServices.Backup.Models/BaseObjects.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,31 @@ public RecoveryPointBase()
294294
}
295295
}
296296

297+
/// <summary>
298+
/// Base class for recovery point.
299+
/// </summary>
300+
public class PointInTimeBase
301+
{
302+
/// <summary>
303+
/// Item Name
304+
/// </summary>
305+
public string ItemName { get; set; }
306+
307+
/// <summary>
308+
/// Gets or sets start time of the time range for log recovery.
309+
/// </summary>
310+
public DateTime? StartTime { get; set; }
311+
/// <summary>
312+
/// Gets or sets end time of the time range for log recovery.
313+
/// </summary>
314+
public DateTime? EndTime { get; set; }
315+
316+
public PointInTimeBase()
317+
: base()
318+
{
319+
}
320+
}
321+
297322
/// <summary>
298323
/// Details of script to mount recovery point.
299324
/// </summary>

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

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

src/RecoveryServices/RecoveryServices.Backup.Models/Properties/Resources.resx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,4 +547,13 @@ Please contact Microsoft for further assistance.</value>
547547
<data name="AzureFileTargetSANameMissingException" xml:space="preserve">
548548
<value>Provide TargetStorageAccountName for Alternate Location restore or remove TargetFileShareName for Original Location restore</value>
549549
</data>
550+
<data name="UnRegisterFailureErrorCode" xml:space="preserve">
551+
<value>UnRegister operation failed with ErrorCode: {0}</value>
552+
</data>
553+
<data name="AzureWorkloadAlreadyRegisteredException" xml:space="preserve">
554+
<value>The specified workload is already registered in the given resource ID</value>
555+
</data>
556+
<data name="AzureWorkloadRestoreProtectableItemException" xml:space="preserve">
557+
<value>Provide SQLInstance or SQLAvailabilityGroup protectable item in TargetItem</value>
558+
</data>
550559
</root>

src/RecoveryServices/RecoveryServices.Backup.Models/RecoveryServices.Backup.Models.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="3.1.0-preview" />
15+
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="3.0.1-preview" />
1616
</ItemGroup>
1717

1818
</Project>

src/RecoveryServices/RecoveryServices.Backup.Providers/AzureWorkloadProviderHelper.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ public List<RecoveryPointBase> ListRecoveryPoints(Dictionary<Enum, object> Provi
381381
return RecoveryPointConversions.GetPSAzureRecoveryPoints(rpListResponse, item);
382382
}
383383

384-
public List<PointInTimeRange> ListLogChains(Dictionary<Enum, object> ProviderData)
384+
public List<PointInTimeBase> ListLogChains(Dictionary<Enum, object> ProviderData)
385385
{
386386
string vaultName = (string)ProviderData[VaultParams.VaultName];
387387
string resourceGroupName = (string)ProviderData[VaultParams.ResourceGroupName];
@@ -420,7 +420,7 @@ public List<PointInTimeRange> ListLogChains(Dictionary<Enum, object> ProviderDat
420420
vaultName: vaultName,
421421
resourceGroupName: resourceGroupName);
422422

423-
List<PointInTimeRange> timeRanges = new List<PointInTimeRange>();
423+
List<PointInTimeBase> timeRanges = new List<PointInTimeBase>();
424424
foreach (RecoveryPointResource rp in rpListResponse)
425425
{
426426
if (rp.Properties.GetType() == typeof(AzureWorkloadSQLPointInTimeRecoveryPoint))
@@ -429,7 +429,13 @@ public List<PointInTimeRange> ListLogChains(Dictionary<Enum, object> ProviderDat
429429
rp.Properties as AzureWorkloadSQLPointInTimeRecoveryPoint;
430430
foreach (PointInTimeRange timeRange in recoveryPoint.TimeRanges)
431431
{
432-
timeRanges.Add(timeRange);
432+
timeRanges.Add(new PointInTimeBase()
433+
{
434+
435+
StartTime = timeRange.StartTime,
436+
EndTime = timeRange.EndTime,
437+
ItemName = item.Name
438+
});
433439
}
434440
}
435441

src/RecoveryServices/RecoveryServices.Backup.Providers/IPsBackupProvider.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ public interface IPsBackupProvider
2929
{
3030
void Initialize(Dictionary<System.Enum, object> providerData, ServiceClientAdapter serviceClientAdapter);
3131

32-
RestAzureNS.AzureOperationResponse<ProtectedItemResource> EnableProtection();
32+
RestAzureNS.AzureOperationResponse EnableProtection();
3333

34-
RestAzureNS.AzureOperationResponse<ProtectedItemResource> DisableProtection();
34+
RestAzureNS.AzureOperationResponse DisableProtection();
3535

3636
RestAzureNS.AzureOperationResponse DisableProtectionWithDeleteData();
3737

@@ -65,6 +65,6 @@ public interface IPsBackupProvider
6565

6666
void RegisterContainer();
6767

68-
List<PointInTimeRange> GetLogChains();
68+
List<PointInTimeBase> GetLogChains();
6969
}
7070
}

src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/AzureFilesPsBackupProvider.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void Initialize(
6363
/// Triggers the enable protection operation for the given item
6464
/// </summary>
6565
/// <returns>The job response returned from the service</returns>
66-
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> EnableProtection()
66+
public RestAzureNS.AzureOperationResponse EnableProtection()
6767
{
6868
return EnableOrModifyProtection();
6969
}
@@ -72,7 +72,7 @@ public RestAzureNS.AzureOperationResponse<ProtectedItemResource> EnableProtectio
7272
/// Triggers the disable protection operation for the given item
7373
/// </summary>
7474
/// <returns>The job response returned from the service</returns>
75-
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> DisableProtection()
75+
public RestAzureNS.AzureOperationResponse DisableProtection()
7676
{
7777
string vaultName = (string)ProviderData[VaultParams.VaultName];
7878
string vaultResourceGroupName = (string)ProviderData[VaultParams.ResourceGroupName];
@@ -682,7 +682,7 @@ public void RegisterContainer()
682682
throw new NotImplementedException();
683683
}
684684

685-
private RestAzureNS.AzureOperationResponse<ProtectedItemResource> EnableOrModifyProtection(bool disableWithRetentionData = false)
685+
private RestAzureNS.AzureOperationResponse EnableOrModifyProtection(bool disableWithRetentionData = false)
686686
{
687687
string vaultName = (string)ProviderData[VaultParams.VaultName];
688688
string vaultResourceGroupName = (string)ProviderData[VaultParams.ResourceGroupName];
@@ -897,7 +897,7 @@ private void ValidateLocationRestoreRequest(string targetFileShareName, string t
897897
}
898898
}
899899

900-
public List<PointInTimeRange> GetLogChains()
900+
public List<PointInTimeBase> GetLogChains()
901901
{
902902
throw new NotImplementedException();
903903
}

src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/AzureSqlPsBackupProvider.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public void Initialize(
5858
ServiceClientAdapter = serviceClientAdapter;
5959
}
6060

61-
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> EnableProtection()
61+
public RestAzureNS.AzureOperationResponse EnableProtection()
6262
{
6363
throw new NotImplementedException();
6464
}
@@ -67,7 +67,7 @@ public RestAzureNS.AzureOperationResponse<ProtectedItemResource> EnableProtectio
6767
/// Triggers the disable protection operation for the given item
6868
/// </summary>
6969
/// <returns>The job response returned from the service</returns>
70-
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> DisableProtection()
70+
public RestAzureNS.AzureOperationResponse DisableProtection()
7171
{
7272
string vaultName = (string)ProviderData[VaultParams.VaultName];
7373
string resourceGroupName = (string)ProviderData[VaultParams.ResourceGroupName];
@@ -500,7 +500,7 @@ public void RegisterContainer()
500500
throw new NotImplementedException();
501501
}
502502

503-
public List<PointInTimeRange> GetLogChains()
503+
public List<PointInTimeBase> GetLogChains()
504504
{
505505
throw new NotImplementedException();
506506
}

src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/AzureWorkloadPsBackupProvider.cs

Lines changed: 30 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public ProtectionPolicyResource CreatePolicy()
5959
return CreateorModifyPolicy().Body;
6060
}
6161

62-
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> DisableProtection()
62+
public RestAzureNS.AzureOperationResponse DisableProtection()
6363
{
6464
string vaultName = (string)ProviderData[VaultParams.VaultName];
6565
string vaultResourceGroupName = (string)ProviderData[VaultParams.ResourceGroupName];
@@ -102,7 +102,7 @@ public RestAzureNS.AzureOperationResponse DisableProtectionWithDeleteData()
102102
resourceGroupName: vaultResourceGroupName);
103103
}
104104

105-
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> EnableProtection()
105+
public RestAzureNS.AzureOperationResponse EnableProtection()
106106
{
107107
return EnableOrModifyProtection();
108108
}
@@ -549,7 +549,7 @@ private RestAzureNS.AzureOperationResponse<ProtectionPolicyResource> CreateorMod
549549
resourceGroupName: resourceGroupName);
550550
}
551551

552-
private RestAzureNS.AzureOperationResponse<ProtectedItemResource> EnableOrModifyProtection(bool disableWithRetentionData = false)
552+
private RestAzureNS.AzureOperationResponse EnableOrModifyProtection(bool disableWithRetentionData = false)
553553
{
554554
string vaultName = (string)ProviderData[VaultParams.VaultName];
555555
string vaultResourceGroupName = (string)ProviderData[VaultParams.ResourceGroupName];
@@ -629,62 +629,44 @@ public void RegisterContainer()
629629
string containerName = (string)ProviderData[ContainerParams.Name];
630630
string backupManagementType = (string)ProviderData[ContainerParams.BackupManagementType];
631631
string workloadType = (string)ProviderData[ContainerParams.ContainerType];
632-
ContainerBase containerBase = (ContainerBase)ProviderData[ContainerParams.Container];
633-
AzureVmWorkloadContainer container = (AzureVmWorkloadContainer)ProviderData[ContainerParams.Container];
634632

635633
ProtectionContainerResource protectionContainerResource = null;
636-
if (container == null)
637-
{
638-
//Trigger Discovery
639-
ODataQuery<BMSRefreshContainersQueryObject> queryParam = new ODataQuery<BMSRefreshContainersQueryObject>(
640-
q => q.BackupManagementType
641-
== ServiceClientModel.BackupManagementType.AzureWorkload);
642-
AzureWorkloadProviderHelper.RefreshContainer(vaultName, vaultResourceGroupName, queryParam);
643-
644-
List<ProtectableContainerResource> unregisteredVmContainers =
645-
GetUnRegisteredVmContainers(vaultName, vaultResourceGroupName);
646-
ProtectableContainerResource unregisteredVmContainer = unregisteredVmContainers.Find(
647-
vmContainer => string.Compare(vmContainer.Name.Split(';').Last(),
648-
containerName, true) == 0);
649-
650-
if (unregisteredVmContainer != null)
651-
{
652-
protectionContainerResource =
653-
new ProtectionContainerResource(unregisteredVmContainer.Id,
654-
unregisteredVmContainer.Name);
655-
AzureVMAppContainerProtectionContainer azureVMContainer = new AzureVMAppContainerProtectionContainer(
656-
friendlyName: containerName,
657-
backupManagementType: backupManagementType,
658-
sourceResourceId: unregisteredVmContainer.Properties.ContainerId,
659-
workloadType: workloadType.ToString());
660-
protectionContainerResource.Properties = azureVMContainer;
661-
AzureWorkloadProviderHelper.RegisterContainer(unregisteredVmContainer.Name,
662-
protectionContainerResource,
663-
vaultName,
664-
vaultResourceGroupName);
665-
}
666-
}
667-
else
634+
635+
//Trigger Discovery
636+
ODataQuery<BMSRefreshContainersQueryObject> queryParam = new ODataQuery<BMSRefreshContainersQueryObject>(
637+
q => q.BackupManagementType
638+
== ServiceClientModel.BackupManagementType.AzureWorkload);
639+
AzureWorkloadProviderHelper.RefreshContainer(vaultName, vaultResourceGroupName, queryParam);
640+
641+
List<ProtectableContainerResource> unregisteredVmContainers =
642+
GetUnRegisteredVmContainers(vaultName, vaultResourceGroupName);
643+
ProtectableContainerResource unregisteredVmContainer = unregisteredVmContainers.Find(
644+
vmContainer => string.Compare(vmContainer.Name.Split(';').Last(),
645+
containerName, true) == 0);
646+
647+
if (unregisteredVmContainer != null)
668648
{
669649
protectionContainerResource =
670-
new ProtectionContainerResource(container.Id,
671-
container.Name);
650+
new ProtectionContainerResource(unregisteredVmContainer.Id,
651+
unregisteredVmContainer.Name);
672652
AzureVMAppContainerProtectionContainer azureVMContainer = new AzureVMAppContainerProtectionContainer(
673653
friendlyName: containerName,
674654
backupManagementType: backupManagementType,
675-
sourceResourceId: container.SourceResourceId,
676-
workloadType: workloadType.ToString(),
677-
operationType: OperationType.Reregister);
678-
655+
sourceResourceId: unregisteredVmContainer.Properties.ContainerId,
656+
workloadType: workloadType.ToString());
679657
protectionContainerResource.Properties = azureVMContainer;
680-
AzureWorkloadProviderHelper.RegisterContainer(container.Name,
681-
protectionContainerResource,
682-
vaultName,
683-
vaultResourceGroupName);
658+
AzureWorkloadProviderHelper.RegisterContainer(unregisteredVmContainer.Name,
659+
protectionContainerResource,
660+
vaultName,
661+
vaultResourceGroupName);
662+
}
663+
else
664+
{
665+
throw new ArgumentException(string.Format(Resources.AzureWorkloadAlreadyRegisteredException));
684666
}
685667
}
686668

687-
public List<PointInTimeRange> GetLogChains()
669+
public List<PointInTimeBase> GetLogChains()
688670
{
689671
return AzureWorkloadProviderHelper.ListLogChains(ProviderData);
690672
}

src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/DpmPsBackupProvider.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ public void Initialize(
4545
ServiceClientAdapter = serviceClientAdapter;
4646
}
4747

48-
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> EnableProtection()
48+
public RestAzureNS.AzureOperationResponse EnableProtection()
4949
{
5050
throw new NotImplementedException();
5151
}
5252

53-
public RestAzureNS.AzureOperationResponse<ProtectedItemResource> DisableProtection()
53+
public RestAzureNS.AzureOperationResponse DisableProtection()
5454
{
5555
throw new NotImplementedException();
5656
}
@@ -166,7 +166,7 @@ public void RegisterContainer()
166166
throw new NotImplementedException();
167167
}
168168

169-
public List<ServiceClientModel.PointInTimeRange> GetLogChains()
169+
public List<PointInTimeBase> GetLogChains()
170170
{
171171
throw new NotImplementedException();
172172
}

0 commit comments

Comments
 (0)