Skip to content

Commit

Permalink
Removed ContainerInfo and depending only on CSMContainerResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonfly91 committed Jul 8, 2015
1 parent 1411f87 commit ffc31bd
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public partial class AzureBackupClientAdapter
/// </summary>
/// <param name="filter"></param>
/// <returns></returns>
public IEnumerable<ContainerInfo> ListContainers(string filter)
public IEnumerable<CSMContainerResponse> ListContainers(string filter)
{
var listResponse = AzureBackupClient.Container.ListAsync(filter, GetCustomRequestHeaders(), CmdletCancellationToken).Result;
return listResponse.Objects;
return listResponse.CSMContainerListResponse.Value;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,16 @@ public override void ExecuteCmdlet()

WriteDebug(string.Format("Fetched {0} containers", containerList.Count()));

List<ContainerInfo> containerInfos = containerList.ToList();
List<CSMContainerResponse> containerInfos = containerList.ToList();

// When resource group name is specified, remove all containers whose resource group name
// doesn't match the given resource group name
if (!string.IsNullOrEmpty(ManagedResourceGroupName))
{
containerInfos.RemoveAll(containerInfo =>
{
return containerInfo.ParentContainerName != ManagedResourceGroupName;
// TODO: Parse ManagedResourceGroupName from ParentContainerId by getting the last segment
return containerInfo.Properties.ParentContainerId != ManagedResourceGroupName;
});
WriteDebug(string.Format("Count of containers after resource group filter = {0}", containerInfos.Count));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@
<Compile Include="AzureBackupCmdletHelpMessage.cs" />
<Compile Include="Cmdlets\Backup\TriggerBackUp.cs" />
<Compile Include="Cmdlets\Container\GetAzureBackupContainer.cs" />
<Compile Include="Cmdlets\Container\RegisterAzureBackupContainer.cs" />
<Compile Include="Cmdlets\Container\UnregisterAzureBackupContainer.cs" />
<Compile Include="Cmdlets\Item\Disable-AzureBackupProtection .cs" />
<Compile Include="Cmdlets\Item\Enable-AzureBackupProtection .cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ public AzureBackupContainerContextObject(AzureBackupContainer azureBackupContain
ContainerUniqueName = azureBackupContainer.ContainerUniqueName;
}

public AzureBackupContainerContextObject(AzurePSBackupVault vault, ContainerInfo containerInfo)
public AzureBackupContainerContextObject(AzurePSBackupVault vault, CSMContainerResponse containerInfo)
: base(vault.ResourceGroupName, vault.Name, vault.Region)
{
ContainerType = containerInfo.ContainerType;
ContainerType = containerInfo.Properties.ContainerType;
ContainerUniqueName = containerInfo.Name;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ public class AzureBackupContainer : AzureBackupContainerContextObject

public AzureBackupContainer() : base() { }

public AzureBackupContainer(AzurePSBackupVault vault, ContainerInfo containerInfo)
public AzureBackupContainer(AzurePSBackupVault vault, CSMContainerResponse containerInfo)
: base(vault, containerInfo)
{
ManagedResourceGroupName = containerInfo.ParentContainerFriendlyName;
ManagedResourceName = containerInfo.FriendlyName;
HealthStatus = containerInfo.HealthStatus;
RegistrationStatus = containerInfo.RegistrationStatus;
// TODO: Parse ManagedResourceGroupName from ParentContainerId by getting the last segment
//ManagedResourceGroupName = containerInfo.Properties.ParentContainerId;
ManagedResourceName = containerInfo.Properties.FriendlyName;
HealthStatus = containerInfo.Properties.HealthStatus;
RegistrationStatus = containerInfo.Properties.Status;
}
}
}
Binary file not shown.
Binary file not shown.

0 comments on commit ffc31bd

Please sign in to comment.