Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using BCI = Microsoft.BackupManagementService.CommonInterface;
using BMI = Microsoft.BackupManagementService.ManagementInterface;
using Microsoft.Azure.Management.BackupServices.Models;
using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -29,11 +32,7 @@ public class GetAzureBackupContainer : AzureBackupVaultCmdletBase
{
[Parameter(Position = 2, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.ContainerName)]
[ValidateNotNullOrEmpty]
public string Name { get; set; }

[Parameter(Position = 2, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.ContainerId)]
[ValidateNotNullOrEmpty]
public string Id { get; set; }
public string VirtualMachine { get; set; }

[Parameter(Position = 2, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.ContainerRegistrationStatus)]
[ValidateNotNullOrEmpty]
Expand All @@ -49,12 +48,75 @@ public override void ExecuteCmdlet()

ExecutionBlock(() =>
{
IEnumerable<AzureBackupContainer> containers = new List<AzureBackupContainer>();
string queryFilterString = string.Empty;
// TODO: Construct query filter string based on input filters.
//queryFilterString = ConstructQueryFilterString();

// TODO: Call Hydra
ListContainerResponse listContainerResponse = AzureBackupClient.Container.ListAsync(queryFilterString,
GetCustomRequestHeaders(), CmdletCancellationToken).Result;

IEnumerable<AzureBackupContainer> containers = listContainerResponse.Objects.ToList().ConvertAll(containerInfo =>
{
return new AzureBackupContainer()
{
ContainerType = containerInfo.ContainerType,
FriendlyName = containerInfo.FriendlyName,
HealthStatus = containerInfo.HealthStatus,
InstanceId = containerInfo.InstanceId,
Name = containerInfo.Name,
ParentContainerFriendlyName = containerInfo.ParentContainerFriendlyName,
ParentContainerName = containerInfo.ParentContainerName,
RegistrationStatus = containerInfo.RegistrationStatus,
ResourceGroupName = ResourceGroupName,
ResourceName = ResourceName,
};
});

WriteObject(containers);
});
}

private string ConstructQueryFilterString()
{
string queryFilterString = string.Empty;
BMI.ContainerQueryObject containerQueryObject = new BMI.ContainerQueryObject();

if (Type != null)
{
switch (Type)
{
case AzureBackupContainerType.AzureVirtualMachine:
containerQueryObject.Type = BCI.ContainerType.IaasVMContainer.ToString();
break;
default:
break;
}
}

if (Status != null)
{
switch (Status)
{
case AzureBackupContainerStatus.Registered:
containerQueryObject.Status = BCI.RegistrationStatus.Registered.ToString();
break;
case AzureBackupContainerStatus.Registering:
containerQueryObject.Status = BCI.RegistrationStatus.Registering.ToString();
break;
case AzureBackupContainerStatus.NotRegistered:
containerQueryObject.Status = BCI.RegistrationStatus.NotRegistered.ToString();
break;
default:
break;
}
}

if (VirtualMachine != null)
{

}

return queryFilterString;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="BackupManagementInterface, Version=1.0.523.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Resources\BackupManagementInterface.dll</HintPath>
</Reference>
<Reference Include="BMSCommonInterface, Version=1.0.523.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Resources\BMSCommonInterface.dll</HintPath>
</Reference>
<Reference Include="Hyak.Common">
<HintPath>..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -169,6 +177,8 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\BackupManagementInterface.dll" />
<Content Include="Resources\BMSCommonInterface.dll" />
<Content Include="Resources\Microsoft.WindowsAzure.Management.Common.dll" />
<Content Include="Resources\Security.Cryptography.dll" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ public class AzureBackupContainer : AzureBackupContainerContextObject
/// </summary>
public string ParentContainerName { get; set; }

/// <summary>
/// Region where this container is present
/// </summary>
public string Region { get; set; }

/// <summary>
/// Status of registration of the container
/// </summary>
Expand Down
Binary file not shown.
Binary file not shown.