Skip to content

[RecoveryServices.Backup] Removing name param from container #8088

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 13, 2018
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 @@ -194,23 +194,12 @@ public List<ProtectedItemResource> ListProtectedItemsByContainer(
{
string vaultName = (string)providerData[CmdletModel.VaultParams.VaultName];
string vaultResourceGroupName = (string)providerData[CmdletModel.VaultParams.ResourceGroupName];
string name = (string)providerData[CmdletModel.ContainerParams.Name];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the file change above - remove this file 'set'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

string friendlyName = (string)providerData[CmdletModel.ContainerParams.FriendlyName];
CmdletModel.ContainerRegistrationStatus status =
(CmdletModel.ContainerRegistrationStatus)providerData[CmdletModel.ContainerParams.Status];

string nameQueryFilter = friendlyName;

if (!string.IsNullOrEmpty(name))
{
Logger.Instance.WriteWarning(Resources.GetContainerNameParamDeprecated);

if (string.IsNullOrEmpty(friendlyName))
{
nameQueryFilter = name;
}
}

ODataQuery<ServiceClientModel.BMSContainerQueryObject> queryParams = null;
if (status == 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public List<ContainerBase> ListProtectionContainers()
{
string vaultName = (string)ProviderData[VaultParams.VaultName];
string resourceGroupName = (string)ProviderData[VaultParams.ResourceGroupName];
string name = (string)ProviderData[ContainerParams.Name];
string name = (string)ProviderData[ContainerParams.FriendlyName];

ODataQuery<BMSContainerQueryObject> queryParams =
new ODataQuery<BMSContainerQueryObject>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public List<ContainerBase> ListProtectionContainers()
{
string vaultName = (string)ProviderData[VaultParams.VaultName];
string resourceGroupName = (string)ProviderData[VaultParams.ResourceGroupName];
string name = (string)ProviderData[ContainerParams.Name];
string name = (string)ProviderData[ContainerParams.FriendlyName];

ODataQuery<BMSContainerQueryObject> queryParams =
new ODataQuery<BMSContainerQueryObject>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function Test-AzureFSContainer
-VaultId $vault.ID `
-ContainerType AzureStorage `
-Status Registered `
-Name $saName;
-FriendlyName $saName;
Assert-True { $containers.FriendlyName -contains $saName }

# VARIATION-3: Get Containers with resource group filter
Expand All @@ -78,7 +78,7 @@ function Test-AzureFSContainer
-VaultId $vault.ID `
-ContainerType AzureStorage `
-Status Registered `
-Name $saName `
-FriendlyName $saName `
-ResourceGroupName $resourceGroupName;
Assert-True { $containers.FriendlyName -contains $saName }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function Test-AzureFSItem
-VaultId $vault.ID `
-ContainerType AzureStorage `
-Status Registered `
-Name $saName
-FriendlyName $saName

# VARIATION-1: Get all items for container
$items = Get-AzureRmRecoveryServicesBackupItem `
Expand Down Expand Up @@ -149,7 +149,7 @@ function Test-AzureFSBackup
-VaultId $vault.ID `
-ContainerType AzureStorage `
-Status Registered `
-Name $saName
-FriendlyName $saName

# Trigger backup and wait for completion
$backupJob = Backup-AzureRmRecoveryServicesBackupItem `
Expand Down Expand Up @@ -230,7 +230,7 @@ function Test-AzureFSGetRPs
-VaultId $vault.ID `
-ContainerType AzureStorage `
-Status Registered `
-Name $saName
-FriendlyName $saName
$backupJob = Backup-Item $vault $item

$backupStartTime = $backupJob.StartTime.AddMinutes(-1);
Expand Down Expand Up @@ -269,7 +269,7 @@ function Test-AzureFSFullRestore
-VaultId $vault.ID `
-ContainerType AzureStorage `
-Status Registered `
-Name $saName
-FriendlyName $saName
$backupJob = Backup-Item $vault $item

$backupStartTime = $backupJob.StartTime.AddMinutes(-1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function Test-AzureFSGetJob
-VaultId $vault.ID `
-ContainerType AzureStorage `
-Status Registered `
-Name $saName
-FriendlyName $saName
}
finally
{
Expand Down Expand Up @@ -100,7 +100,7 @@ function Test-AzureFSWaitJob
-VaultId $vault.ID `
-ContainerType AzureStorage `
-Status Registered `
-Name $saName
-FriendlyName $saName
}
finally
{
Expand Down Expand Up @@ -128,7 +128,7 @@ function Test-AzureFSCancelJob
-VaultId $vault.ID `
-ContainerType AzureStorage `
-Status Registered `
-Name $saName
-FriendlyName $saName
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function Test-AzureFSProtectionCheck
-VaultId $vault.ID `
-ContainerType AzureStorage `
-Status Registered `
-Name $saName
-FriendlyName $saName
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public ContainerTests(Xunit.Abstractions.ITestOutputHelper output)
XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Fact(Skip = "This workload is not supported anymore")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this test if it is not supported - same for all the other skips

[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureSql)]
public void TestAzureSqlGetContainers()
Expand All @@ -39,7 +39,7 @@ public void TestAzureSqlGetContainers()
_logger, PsBackupProviderTypes.AzureSql, "Test-AzureSqlGetContainers");
}

[Fact]
[Fact(Skip = "This workload is not supported anymore")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to remove these unsupported scenario tests, not skip them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I take this is next release? We have a whole cleanup to do related to this workload

[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureSql)]
public void TestAzureSqlUnregisterContainer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public ItemTests(Xunit.Abstractions.ITestOutputHelper output)
XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Fact(Skip = "This workload is not supported anymore")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above - remove skipped tests if this is no longer supported

[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureSql)]
public void TestAzureSqlGetItems()
Expand All @@ -39,7 +39,7 @@ public void TestAzureSqlGetItems()
_logger, PsBackupProviderTypes.AzureSql, "Test-AzureSqlGetItems");
}

[Fact]
[Fact(Skip = "This workload is not supported anymore")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureSql)]
public void TestAzureSqlDisableProtection()
Expand All @@ -48,7 +48,7 @@ public void TestAzureSqlDisableProtection()
_logger, PsBackupProviderTypes.AzureSql, "Test-AzureSqlDisableProtection");
}

[Fact]
[Fact(Skip = "This workload is not supported anymore")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureSql)]
public void TestAzureSqlGetRPs()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests
{
public partial class PolicyTests : RMTestBase
{
[Fact]
[Fact(Skip = "This workload is not supported anymore")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(TestConstants.Workload, TestConstants.AzureSql)]
public void TestAzureSqlPolicy()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function Enable-Protection(
$container = Get-AzureRmRecoveryServicesBackupContainer `
-VaultId $vault.ID `
-ContainerType AzureVM `
-Name $vm.Name;
-FriendlyName $vm.Name;

if ($container -eq $null)
{
Expand All @@ -188,7 +188,7 @@ function Enable-Protection(
$container = Get-AzureRmRecoveryServicesBackupContainer `
-VaultId $vault.ID `
-ContainerType AzureVM `
-Name $vm.Name;
-FriendlyName $vm.Name;
}

$item = Get-AzureRmRecoveryServicesBackupItem `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ function Test-AzureVMGetContainers
-VaultId $vault.ID `
-ContainerType AzureVM `
-Status Registered `
-Name $vm.Name;
-FriendlyName $vm.Name;
Assert-True { $containers.FriendlyName -contains $vm.Name }

# VARIATION-3: Get Containers with friendly name and resource group filters
$containers = Get-AzureRmRecoveryServicesBackupContainer `
-VaultId $vault.ID `
-ContainerType AzureVM `
-Status Registered `
-Name $vm.Name `
-FriendlyName $vm.Name `
-ResourceGroupName $vm.ResourceGroupName;
Assert-True { $containers.FriendlyName -contains $vm.Name }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void TestAzureVMRPMountScript()
}

#if NETSTANDARD
[Fact(Skip = "Needs investigation, TestManagementClientHelper class wasn't initialized with the ResourceManagementClient client.")]
[Fact(Skip = "Needs investigation, TestManagementClientHelper class wasn't initialized with the ResourceManagementClient client.")]
#else
[Fact]
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function Test-AzureVMGetItems
-VaultId $vault.ID `
-ContainerType AzureVM `
-Status Registered `
-Name $vm.Name
-FriendlyName $vm.Name

# VARIATION-1: Get all items for container
$items = Get-AzureRmRecoveryServicesBackupItem `
Expand Down Expand Up @@ -360,10 +360,9 @@ function Test-AzureVMSetVaultContext
# Setup
$vm = Create-VM $resourceGroupName $location
$vault = Create-RecoveryServicesVault $resourceGroupName $location
$saName = Create-SA $resourceGroupName $location

# Sleep to give the service time to add the default policy to the vault
Start-TestSleep 5000
Start-TestSleep 5000

Set-AzureRmRecoveryServicesVaultContext -Vault $vault

Expand All @@ -385,29 +384,6 @@ function Test-AzureVMSetVaultContext
-Container $container `
-WorkloadType AzureVM

$job = Backup-AzureRmRecoveryServicesBackupItem `
-Item $item

Wait-AzureRmRecoveryServicesBackupJob -Job $job

$backupJob = Get-AzureRmRecoveryServicesBackupJobDetails -Job $job

# Get Recovery Point
$backupStartTime = $backupJob.StartTime.AddMinutes(-1);
$backupEndTime = $backupJob.EndTime.AddMinutes(1);
$rps = Get-AzureRmRecoveryServicesBackupRecoveryPoint `
-Item $item `
-StartDate $backupStartTime `
-EndDate $backupEndTime

# Restore item
$restoreJob1 = Restore-AzureRmRecoveryServicesBackupItem `
-RecoveryPoint $rps[0] `
-StorageAccountName $saName `
-StorageAccountResourceGroupName $resourceGroupName

Wait-AzureRmRecoveryServicesBackupJob -Job $restoreJob1

# Disable protection
Disable-AzureRmRecoveryServicesBackupProtection `
-Item $item `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function Test-MabGetContainers
-VaultId $vault.ID `
-ContainerType "Windows" `
-BackupManagementType "MARS" `
-Name "ADIT-PC.FAREAST.CORP.MICROSOFT.COM";
-FriendlyName "ADIT-PC.FAREAST.CORP.MICROSOFT.COM";
Assert-AreEqual $namedContainer.FriendlyName "ADIT-PC.FAREAST.CORP.MICROSOFT.COM";
}

Expand All @@ -38,14 +38,14 @@ function Test-MabUnregisterContainer
-VaultId $vault.ID `
-ContainerType "Windows" `
-BackupManagementType "MARS" `
-Name "ADIT-PC.FAREAST.CORP.MICROSOFT.COM";
-FriendlyName "ADIT-PC.FAREAST.CORP.MICROSOFT.COM";
Assert-AreEqual $container.FriendlyName "ADIT-PC.FAREAST.CORP.MICROSOFT.COM";

Unregister-AzureRmRecoveryServicesBackupContainer -VaultId $vault.ID -Container $container;
$container = Get-AzureRmRecoveryServicesBackupContainer `
-VaultId $vault.ID `
-ContainerType "Windows" `
-BackupManagementType "MARS" `
-Name "ADIT-PC.FAREAST.CORP.MICROSOFT.COM";
-FriendlyName "ADIT-PC.FAREAST.CORP.MICROSOFT.COM";
Assert-Null $container;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* Overview of change #1
- Additional information about change #1
-->
## Current Release

## Version 1.0.0
* General availability of `Az.RecoveryServices` module
* General availability of `Az.RecoveryServices` module
* Removed Name Parameter in Get-Container cmdlet.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
/// <summary>
/// Fetches containers registered to the vault according to the filters passed via the cmdlet parameters.
/// </summary>
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "RecoveryServicesBackupContainer"),OutputType(typeof(ContainerBase))]
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "RecoveryServicesBackupContainer"), OutputType(typeof(ContainerBase))]
public class GetAzureRmRecoveryServicesBackupContainer : RSBackupVaultCmdletBase
{
/// <summary>
Expand All @@ -44,14 +44,6 @@ public class GetAzureRmRecoveryServicesBackupContainer : RSBackupVaultCmdletBase
[ValidateSet("AzureVM", "MARS", "AzureSQL", "AzureStorage")]
public string BackupManagementType { get; set; }

/// <summary>
/// Friendly name of the container(s) to be fetched. This will be deprecated.
/// </summary>
[Parameter(Mandatory = false, Position = 3,
HelpMessage = ParamHelpMsgs.Container.Name)]
[ValidateNotNullOrEmpty]
public string Name { get; set; }

/// <summary>
/// Friendly name of the container(s) to be fetched.
/// </summary>
Expand Down Expand Up @@ -106,7 +98,6 @@ public override void ExecuteCmdlet()
{ VaultParams.ResourceGroupName, resourceGroupName },
{ ContainerParams.ContainerType, ContainerType },
{ ContainerParams.BackupManagementType, backupManagementTypeNullable },
{ ContainerParams.Name, Name },
{ ContainerParams.FriendlyName, FriendlyName },
{ ContainerParams.ResourceGroupName, ResourceGroupName },
{ ContainerParams.Status, Status },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<TableControl>
<TableHeaders>
<TableColumnHeader>
<Label>Name</Label>
<Label>FriendlyName</Label>
<Width>40</Width>
</TableColumnHeader>
<TableColumnHeader>
Expand Down Expand Up @@ -287,7 +287,7 @@
<TableControl>
<TableHeaders>
<TableColumnHeader>
<Label>Name</Label>
<Label>FriendlyName</Label>
<Width>40</Width>
</TableColumnHeader>
<TableColumnHeader>
Expand Down Expand Up @@ -331,7 +331,7 @@
<TableControl>
<TableHeaders>
<TableColumnHeader>
<Label>Name</Label>
<Label>FriendlyName</Label>
<Width>40</Width>
</TableColumnHeader>
<TableColumnHeader>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ function Test-RecoveryServicesVaultCRUD
Assert-NotNull($vault1.ID)
Assert-NotNull($vault1.Type)

# 2. Set-AzureRmRecoveryServicesVaultContext
# 2. Set-AzureRmRecoveryServicesVault
Set-AzureRmRecoveryServicesVaultContext -Vault $vault1

# 3. Get-AzureRmRecoveryServicesVault
$vaults = Get-AzureRmRecoveryServicesVault -Name $name -ResourceGroupName $resourceGroupName

Expand Down
Loading