Skip to content

Commit ba5cb9a

Browse files
committed
Merge pull request #33 from MabOneSdk/panbha10
Panbha10
2 parents 7abc07e + c439f43 commit ba5cb9a

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/RecoveryPoint/GetAzureBackupRecoveryPoint.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,25 @@ public override void ExecuteCmdlet()
5151
IEnumerable<RecoveryPointInfo> recoveryPointObjects = null;
5252
if (Id != null)
5353
{
54+
RecoveryPointInfo recoveryPointObject = null;
5455
recoveryPointObjects = recoveryPointListResponse.RecoveryPoints.Objects.Where(x => x.InstanceId.Equals(Id, System.StringComparison.InvariantCultureIgnoreCase));
56+
if (recoveryPointObjects != null && recoveryPointObjects.Any<RecoveryPointInfo>())
57+
{
58+
WriteVerbose("Converting response");
59+
recoveryPointObject = recoveryPointObjects.FirstOrDefault<RecoveryPointInfo>();
60+
WriteAzureBackupRecoveryPoint(recoveryPointObject, item);
61+
}
62+
else
63+
{
64+
WriteVerbose(string.Format("{0}{1}", "No recovery point exist with Id := ", Id));
65+
}
5566
}
5667
else
5768
{
58-
recoveryPointObjects = recoveryPointListResponse.RecoveryPoints.Objects;
59-
}
60-
61-
WriteVerbose("Converting response");
62-
WriteAzureBackupRecoveryPoint(recoveryPointObjects, item);
69+
WriteVerbose("Converting response");
70+
recoveryPointObjects = recoveryPointListResponse.RecoveryPoints.Objects.OrderByDescending(x => x.RecoveryPointTime);
71+
WriteAzureBackupRecoveryPoint(recoveryPointObjects, item);
72+
}
6373
});
6474
}
6575

src/ResourceManager/AzureBackup/Commands.AzureBackup/Microsoft.Azure.Commands.AzureBackup.format.ps1xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,15 +674,15 @@
674674
<TableHeaders>
675675
<TableColumnHeader>
676676
<Label>RecoveryPointId</Label>
677-
<Width>36</Width>
677+
<Width>18</Width>
678678
</TableColumnHeader>
679679
<TableColumnHeader>
680680
<Label>RecoveryPointType</Label>
681681
<Width>18</Width>
682682
</TableColumnHeader>
683683
<TableColumnHeader>
684684
<Label>RecoveryPointTime</Label>
685-
<Width>18</Width>
685+
<Width>36</Width>
686686
</TableColumnHeader>
687687
<TableColumnHeader>
688688
<Label>ContainerType</Label>

src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ FormatsToProcess = @(
7171
'.\Compute\Microsoft.Azure.Commands.Compute.format.ps1xml',
7272
'.\Network\Microsoft.Azure.Commands.Network.format.ps1xml',
7373
'.\Storage\Microsoft.WindowsAzure.Commands.Storage.format.ps1xml'
74+
'.\AzureBackup\Microsoft.Azure.Commands.AzureBackup.format.ps1xml'
7475
)
7576

7677
# Modules to import as nested modules of the module specified in ModuleToProcess

0 commit comments

Comments
 (0)