Skip to content

Commit 19dd290

Browse files
merge with dev1
2 parents 2e0cc87 + 0a2a030 commit 19dd290

File tree

51 files changed

+6696
-2805
lines changed

Some content is hidden

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

51 files changed

+6696
-2805
lines changed

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/JobConversions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ private static AzureRmRecoveryServicesAzureVmJob GetPSAzureVmJob(JobResource hyd
8787
}
8888

8989
response.InstanceId = GetLastIdFromFullId(hydraJob.Id);
90-
response.StartTime = vmJob.StartTime.ToLocalTime();
90+
response.StartTime = vmJob.StartTime;
9191
response.EndTime = vmJob.EndTime;
9292
response.Duration = vmJob.Duration;
9393
response.Status = vmJob.Status;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static List<AzureRmRecoveryServicesBackupRecoveryPointBase> GetPSAzureRec
3939
{
4040
RecoveryPoint recPoint = rp.Properties as RecoveryPoint;
4141

42-
DateTime recPointTime = DateTime.ParseExact(recPoint.RecoveryPointTime, @"MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture).ToLocalTime();
42+
DateTime recPointTime = DateTime.ParseExact(recPoint.RecoveryPointTime, @"MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
4343
AzureRmRecoveryServicesIaasVmRecoveryPoint rpBase = new AzureRmRecoveryServicesIaasVmRecoveryPoint()
4444
{
4545
Name = rp.Name,

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Commands.RecoveryServices.Backup.Models.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
<Compile Include="AzureVmModels\AzureRmRecoveryServicesAzureVmItem.cs" />
5555
<Compile Include="AzureVmModels\AzureRmRecoveryServicesAzureVmContainer.cs" />
5656
<Compile Include="DpmModels\AzureRmRecoveryServicesDpmBackupEngine.cs" />
57-
<Compile Include="DpmModels\AzureRmRecoveryServicesDpmContainer.cs" />
5857
<Compile Include="MabModels\AzureRmRecoveryServicesMabContainer.cs" />
5958
<Compile Include="Properties\AssemblyInfo.cs" />
6059
<Compile Include="Properties\Resources.Designer.cs">

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ public enum JobOperation
133133
Backup,
134134
Restore,
135135
ConfigureBackup,
136-
RemoveBackup
136+
DisableBackup,
137+
DeleteBackupData
137138
}
138139

139140
public enum JobStatus

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/DpmModels/AzureRmRecoveryServicesDpmContainer.cs

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

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

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

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,9 @@ Please contact Microsoft for further assistant.</value>
416416
<data name="UnsupportedContainerException" xml:space="preserve">
417417
<value>Please provide Container of containerType as Windows and backupManagementType as MARS. Provided Container has containerType {0} and backupManagementType {1} which is invalid.</value>
418418
</data>
419+
<data name="GetRPErrorInputDatesShouldBeInUTC" xml:space="preserve">
420+
<value>Both EndDate and StartDate should be in UTC format</value>
421+
</data>
419422
<data name="BackupManagementTypeNotExpectedForWorkloadType" xml:space="preserve">
420423
<value>BackupManagementType is not expected for WorkloadType: {0}</value>
421424
</data>

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Providers/IaasVmPsBackupProvider.cs

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -439,31 +439,48 @@ public List<AzureRmRecoveryServicesBackupItemBase> ListProtectedItems()
439439
}
440440
} while (skipToken != null);
441441

442-
List<AzureRmRecoveryServicesBackupItemBase> itemModels = ConversionHelpers.GetItemModelList(protectedItems, container);
443-
444442
// 1. Filter by container
445-
itemModels = itemModels.Where(itemModel =>
443+
protectedItems = protectedItems.Where(protectedItem =>
446444
{
447-
// return itemModel.ContainerName == container.Name;
448-
return container.Name.Contains(itemModel.ContainerName);
445+
Dictionary<UriEnums, string> dictionary = HelperUtils.ParseUri(protectedItem.Id);
446+
string containerUri = HelperUtils.GetContainerUri(dictionary, protectedItem.Id);
447+
return containerUri.Contains(container.Name);
449448
}).ToList();
450449

450+
List<ProtectedItemResponse> protectedItemGetResponses = new List<ProtectedItemResponse>();
451+
451452
// 2. Filter by item's friendly name
452453
if (!string.IsNullOrEmpty(name))
453454
{
454-
itemModels = itemModels.Where(itemModel =>
455+
protectedItems = protectedItems.Where(protectedItem =>
455456
{
456-
return ((AzureRmRecoveryServicesBackupIaasVmItem)itemModel).Name == name;
457+
Dictionary<UriEnums, string> dictionary = HelperUtils.ParseUri(protectedItem.Id);
458+
string protectedItemUri = HelperUtils.GetProtectedItemUri(dictionary, protectedItem.Id);
459+
return protectedItemUri.ToLower().Contains(name.ToLower());
457460
}).ToList();
458461

459462
GetProtectedItemQueryParam getItemQueryParams = new GetProtectedItemQueryParam();
460463
getItemQueryParams.Expand = "extendedinfo";
461464

465+
for (int i = 0; i < protectedItems.Count; i++)
466+
{
467+
Dictionary<UriEnums, string> dictionary = HelperUtils.ParseUri(protectedItems[i].Id);
468+
string containerUri = HelperUtils.GetContainerUri(dictionary, protectedItems[i].Id);
469+
string protectedItemUri = HelperUtils.GetProtectedItemUri(dictionary, protectedItems[i].Id);
470+
471+
var getResponse = HydraAdapter.GetProtectedItem(containerUri, protectedItemUri, getItemQueryParams);
472+
protectedItemGetResponses.Add(getResponse);
473+
}
474+
}
475+
476+
List<AzureRmRecoveryServicesBackupItemBase> itemModels = ConversionHelpers.GetItemModelList(protectedItems, container);
477+
478+
if (!string.IsNullOrEmpty(name))
479+
{
462480
for (int i = 0; i < itemModels.Count; i++)
463481
{
464-
var getResponse = HydraAdapter.GetProtectedItem(container.Name, itemModels[i].Name, getItemQueryParams);
465482
AzureRmRecoveryServicesBackupIaasVmItemExtendedInfo extendedInfo = new AzureRmRecoveryServicesBackupIaasVmItemExtendedInfo();
466-
var hydraExtendedInfo = ((AzureIaaSVMProtectedItem)getResponse.Item.Properties).ExtendedInfo;
483+
var hydraExtendedInfo = ((AzureIaaSVMProtectedItem)protectedItemGetResponses[i].Item.Properties).ExtendedInfo;
467484
if (hydraExtendedInfo.OldestRecoveryPoint.HasValue)
468485
{
469486
extendedInfo.OldestRecoveryPoint = hydraExtendedInfo.OldestRecoveryPoint;

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Test/Commands.RecoveryServices.Backup.Test.csproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@
143143
<None Include="SessionRecords\Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests.ItemTests\TestBackupItemScenario.json">
144144
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
145145
</None>
146+
<None Include="SessionRecords\Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests.ItemTests\TestEnableAzureVMProtectionScenario.json">
147+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
148+
</None>
149+
<None Include="SessionRecords\Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests.ItemTests\TestDisableAzureVMProtectionScenario.json">
150+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
151+
</None>
146152
<None Include="SessionRecords\Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests.JobTests\TestCancelJobScenario.json" />
147153
<None Include="SessionRecords\Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests.JobTests\TestGetJobDetails.json">
148154
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
@@ -171,6 +177,7 @@
171177
<None Include="SessionRecords\Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests.ItemTests\TestGetItemScenario.json">
172178
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
173179
</None>
180+
<None Include="SessionRecords\Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests.PolicyTests\TestPolicyScenario.json" />
174181
</ItemGroup>
175182
<ItemGroup />
176183
<ItemGroup>
@@ -190,6 +197,10 @@
190197
<Project>{30b92759-50b3-494e-b9f0-ec9a2ce9d57b}</Project>
191198
<Name>Commands.RecoveryServices.Backup.Models</Name>
192199
</ProjectReference>
200+
<ProjectReference Include="..\Commands.RecoveryServices.Backup\Commands.RecoveryServices.Backup.Cmdlets.csproj">
201+
<Project>{3b3e879a-f856-46bf-aff9-8ad6760cf7b9}</Project>
202+
<Name>Commands.RecoveryServices.Backup.Cmdlets</Name>
203+
</ProjectReference>
193204
</ItemGroup>
194205
<ItemGroup>
195206
<WCFMetadata Include="Service References\" />

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Test/ScenarioTests/IaasVm/ContainerTests.ps1

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,29 @@
1414

1515
function Test-GetContainerScenario
1616
{
17-
$vault = Get-AzureRmRecoveryServicesVault -ResourceGroupName "phaniktRSV" -Name "phaniktRs1";
17+
# 1. Get the vault
18+
$vault = Get-AzureRmRecoveryServicesVault -ResourceGroupName "RsvTestRG" -Name "PsTestRsVault";
19+
20+
# 2. Set the vault context
1821
Set-AzureRmRecoveryServicesVaultContext -Vault $vault;
19-
$containers = Get-AzureRmRecoveryServicesContainer -ContainerType "AzureVM" -Status "Registered";
22+
23+
# VAR-1: Get All Containers with only mandatory parameters
24+
$containers = Get-AzureRmRecoveryServicesBackupContainer -ContainerType "AzureVM" -Status "Registered";
2025
foreach ($container in $containers)
2126
{
2227
echo $container.Name $container.ResourceGroupName;
2328
}
24-
Assert-AreEqual $containers[0].FriendlyName "mylinux1";
29+
Assert-AreEqual $containers[2].FriendlyName "mkheranirmvm1";
30+
31+
# VAR-2: Get Containers with friendly name filter
32+
$namedContainer = Get-AzureRmRecoveryServicesBackupContainer -ContainerType "AzureVM" -Status "Registered" -Name "mkheraniRMVM1";
33+
Assert-AreEqual $namedContainer.FriendlyName "mkheraniRMVM1";
2534

26-
$namedContainer = Get-AzureRmRecoveryServicesContainer -ContainerType "AzureVM" -Status "Registered" -Name "mylinux1";
27-
Assert-AreEqual $namedContainer.FriendlyName "mylinux1";
35+
# VAR-3: Get Containers with friendly name and resource group filters
36+
$rgFilteredContainer = Get-AzureRmRecoveryServicesBackupContainer -ContainerType "AzureVM" -Status "Registered" -Name "mkheraniRMVM1" -ResourceGroupName "RsvTestRG";
37+
Assert-AreEqual $namedContainer.FriendlyName "mkheraniRMVM1";
2838

29-
$rgFilteredContainer = Get-AzureRmRecoveryServicesContainer -ContainerType "AzureVM" -Status "Registered" -Name "mylinux1" -ResourceGroupName "00prjai12";
30-
echo $rgFilteredContainer.Name $rgFilteredContainer.ResourceGroupName;
39+
# VAR-4: Get Containers with resource group filter
40+
$rgFilteredContainer = Get-AzureRmRecoveryServicesBackupContainer -ContainerType "AzureVM" -Status "Registered" -ResourceGroupName "RsvTestRG";
41+
Assert-AreEqual $namedContainer.FriendlyName "mkheraniRMVM1";
3142
}

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Test/ScenarioTests/IaasVm/ItemTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ public void TestGetItemScenario()
3232
this.RunPowerShellTest(PsBackupProviderTypes.IaasVm.ToString(), "Test-GetItemScenario");
3333
}
3434

35+
[Fact]
36+
[Trait(Category.AcceptanceType, Category.CheckIn)]
3537
public void TestEnableAzureVMProtectionScenario()
3638
{
3739
this.RunPowerShellTest(PsBackupProviderTypes.IaasVm.ToString(), "Test-EnableAzureVMProtectionScenario");
3840
}
3941

42+
[Fact]
43+
[Trait(Category.AcceptanceType, Category.CheckIn)]
4044
public void TestDisableAzureVMProtectionScenario()
4145
{
4246
this.RunPowerShellTest(PsBackupProviderTypes.IaasVm.ToString(), "Test-DisableAzureVMProtectionScenario");

0 commit comments

Comments
 (0)