Skip to content

Commit 0d4af69

Browse files
author
Samuel Anudeep
committed
Merge pull request #20 from MabOneSdk/anudeeb
Get-AzureBackupContainer bug fixes
2 parents 1727bce + a76f1a6 commit 0d4af69

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureBackupContainer.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ public override void ExecuteCmdlet()
5757
ListContainerResponse listContainerResponse = AzureBackupClient.Container.ListAsync(queryFilterString,
5858
GetCustomRequestHeaders(), CmdletCancellationToken).Result;
5959

60+
WriteVerbose(string.Format("# of fetched containers = {0}", listContainerResponse.Objects.Count));
61+
6062
List<ContainerInfo> containerInfos = listContainerResponse.Objects.ToList();
6163

6264
// When resource group name is specified, remove all containers whose resource group name
@@ -69,10 +71,24 @@ public override void ExecuteCmdlet()
6971
});
7072
}
7173

72-
WriteObject(containerInfos.ConvertAll(containerInfo =>
74+
WriteVerbose(string.Format("# of containers after resource group filter = {0}", listContainerResponse.Objects.Count));
75+
76+
List<AzureBackupContainer> containers = containerInfos.ConvertAll(containerInfo =>
77+
{
78+
return new AzureBackupContainer(containerInfo, ResourceGroupName, ResourceName, Location);
79+
});
80+
81+
if (!string.IsNullOrEmpty(ResourceName) & !string.IsNullOrEmpty(ResourceGroupName))
7382
{
74-
return new AzureBackupContainer(containerInfo, ResourceGroupName, ResourceName, Location);
75-
}));
83+
if (containers.Any())
84+
{
85+
WriteObject(containers.First());
86+
}
87+
}
88+
else
89+
{
90+
WriteObject(containers);
91+
}
7692
});
7793
}
7894

src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupContainerStatus.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
2222
{
2323
public enum AzureBackupContainerStatus
2424
{
25+
All,
2526
Registered,
2627
Registering,
27-
NotRegistered
28+
NotRegistered,
2829
}
2930
}

src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupContainerType.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
2222
{
2323
public enum AzureBackupContainerType
2424
{
25-
AzureVirtualMachine
25+
All,
26+
AzureVirtualMachine,
2627
}
2728
}

0 commit comments

Comments
 (0)