Skip to content

Commit b66a587

Browse files
committed
Added help message.
1 parent b00e638 commit b66a587

File tree

5 files changed

+22
-8
lines changed

5 files changed

+22
-8
lines changed

src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,9 @@ internal static class AzureBackupCmdletHelpMessage
3333
public const string Type = "Type of Azure Backup Item.";
3434
public const string Status = "Status of Azure Backup Item";
3535
public const string AzureBackupContainer = "Azure Backup Container for Azure Backup Item.";
36+
public const string AzureBackupItem = "Azure Backup Item for enabling protection";
37+
public const string RemoveProtectionOption = "Remove Protection Option";
38+
public const string Reason = "Reson for removing protection";
39+
public const string Comments = "Comments for for removing protection";
3640
}
3741
}

src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupItemCmdletBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ public abstract class AzureBackupItemCmdletBase : AzureBackupCmdletBase
3030
{
3131
// ToDO:
3232
// Correct Help message and other attributes related to paameters
33-
[Parameter(Position = 0, Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.ResourceGroupName, ValueFromPipelineByPropertyName = true)]
33+
[Parameter(Position = 0, Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.AzureBackupItem, ValueFromPipelineByPropertyName = true)]
3434
[ValidateNotNullOrEmpty]
3535
public AzureBackupContainerContextObject Item { get; set; }
3636

3737
public override void ExecuteCmdlet()
3838
{
3939
base.ExecuteCmdlet();
40-
WriteDebug(String.Format("Cmdlet called for ResourceGroupName: {0}, ResourceName: {1}", Item.ResourceGroupName, Item.ResourceName));
40+
WriteDebug(String.Format("Cmdlet called for ResourceGroupName: {0}, ResourceName: {1}, Location: {2}", Item.ResourceGroupName, Item.ResourceName, Item.Location));
4141
InitializeAzureBackupCmdlet(Item.ResourceGroupName, Item.ResourceName, Item.Location);
4242
}
4343
}

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/DataSource/Disable-AzureBackupProtection .cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,30 @@ namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets.DataSource
2222
[Cmdlet(VerbsLifecycle.Disable, "AzureBackupProtection"), OutputType(typeof(OperationResponse))]
2323
public class DisableAzureBackupProtection : AzureBackupDSCmdletBase
2424
{
25-
[Parameter(Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.PolicyName)]
25+
[Parameter(Position = 1, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.RemoveProtectionOption)]
2626
[ValidateSet("Invalid", "RetainBackupData", "DeleteBackupData")]
2727
public string RemoveProtectionOption { get; set; }
28+
29+
[Parameter(Position = 2, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.Reason)]
30+
public string Reason { get; set; }
31+
32+
[Parameter(Position = 3, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.Comments)]
33+
public string Comments { get; set; }
34+
2835
public override void ExecuteCmdlet()
2936
{
3037
base.ExecuteCmdlet();
3138

3239
ExecutionBlock(() =>
3340
{
3441
WriteVerbose("Making client call");
35-
RemoveProtectionRequestInput input = new RemoveProtectionRequestInput();
36-
input.RemoveProtectionOption = this.RemoveProtectionOption == null ? "RetainBackupData" : this.RemoveProtectionOption;
42+
RemoveProtectionRequestInput input = new RemoveProtectionRequestInput()
43+
{
44+
RemoveProtectionOption = this.RemoveProtectionOption == null ? "RetainBackupData" : this.RemoveProtectionOption,
45+
Reason = this.Reason,
46+
Comments = this.Comments,
47+
};
48+
3749
WriteVerbose("RemoveProtectionOption = " + input.RemoveProtectionOption);
3850
var disbaleAzureBackupProtection = AzureBackupClient.DataSource.DisableProtectionAsync(GetCustomRequestHeaders(), item.ContainerUniqueName, item.Type, item.DataSourceId, input, CmdletCancellationToken).Result;
3951

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/DataSource/Enable-AzureBackupProtection .cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public override void ExecuteCmdlet()
6363
}
6464
else
6565
{
66-
66+
throw new Exception("Uknown item type");
6767
}
6868

6969
var enableAzureBackupProtection = AzureBackupClient.DataSource.EnableProtectionAsync(GetCustomRequestHeaders(), input, CmdletCancellationToken).Result;

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/DataSource/GetAzureBackupItem.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,13 @@ public void WriteAzureBackupProtectionPolicy(List<DataSourceInfo> sourceDataSour
9292

9393
foreach (var item in sourceDataSourceList)
9494
{
95-
WriteVerbose("Type of DS is = " + item.Type);
9695
targetList.Add(new AzureBackupItem(item, azureBackupContainer));
9796
}
9897

9998
if (sourcePOList != null)
10099
{
101100
foreach (var item in sourcePOList)
102101
{
103-
WriteVerbose("Type of PO is = " + item.Type);
104102
//If user has stopped protection for some datasoure then we will have duplicate items(po and ds).
105103
//So in this case removing poitems from the list.
106104
if (targetList.FindIndex(element => element.Name == item.Name) < 0)

0 commit comments

Comments
 (0)