diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/DataSource/Disable-AzureBackupProtection .cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/DataSource/Disable-AzureBackupProtection .cs index 901073e9c917..8cc27e56121a 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/DataSource/Disable-AzureBackupProtection .cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/DataSource/Disable-AzureBackupProtection .cs @@ -29,7 +29,7 @@ namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets.DataSource /// /// Disable Azure Backup protection /// - [Cmdlet(VerbsLifecycle.Disable, "AzureBackupProtection"), OutputType(typeof(OperationResponse))] + [Cmdlet(VerbsLifecycle.Disable, "AzureBackupProtection"), OutputType(typeof(Guid))] public class DisableAzureBackupProtection : AzureBackupDSCmdletBase { [Parameter(Position = 1, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.RemoveProtectionOption)] @@ -59,31 +59,16 @@ public override void ExecuteCmdlet() Reason = this.Reason, Comments = this.Comments, }; + WriteVerbose("RemoveProtectionOption is = " + input.RemoveProtectionOption); + Guid jobId = Guid.Empty; var disbaleAzureBackupProtection = AzureBackupClient.DataSource.DisableProtectionAsync(GetCustomRequestHeaders(), Item.ContainerUniqueName, Item.Type, Item.DataSourceId, input, CmdletCancellationToken).Result; - WriteVerbose("Received response"); - WriteVerbose("Converting response"); - WriteAzureBackupProtectionPolicy(disbaleAzureBackupProtection); + WriteVerbose("Received disable azure backup protection response"); + jobId = disbaleAzureBackupProtection.OperationId; + this.WriteObject(jobId); }); } - - public void WriteAzureBackupProtectionPolicy(OperationResponse sourceOperationResponse) - { - } - - public void WriteAzureBackupProtectionPolicy(IEnumerable sourceOperationResponseList) - { - List targetList = new List(); - - foreach (var sourceOperationResponse in sourceOperationResponseList) - { - targetList.Add(sourceOperationResponse); - } - - this.WriteObject(targetList, true); - } - public enum RemoveProtectionOptions { [EnumMember] diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/DataSource/Enable-AzureBackupProtection .cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/DataSource/Enable-AzureBackupProtection .cs index 8caf9dd47612..5f5c88f26377 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/DataSource/Enable-AzureBackupProtection .cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/DataSource/Enable-AzureBackupProtection .cs @@ -30,7 +30,7 @@ namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets /// /// Enable Azure Backup protection /// - [Cmdlet(VerbsLifecycle.Enable, "AzureBackupProtection"), OutputType(typeof(OperationResponse))] + [Cmdlet(VerbsLifecycle.Enable, "AzureBackupProtection"), OutputType(typeof(Guid))] public class EnableAzureBackupProtection : AzureBackupItemCmdletBase { [Parameter(Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.PolicyName)] @@ -69,29 +69,15 @@ public override void ExecuteCmdlet() throw new Exception("Uknown item type"); } + Guid jobId = Guid.Empty; var enableAzureBackupProtection = AzureBackupClient.DataSource.EnableProtectionAsync(GetCustomRequestHeaders(), input, CmdletCancellationToken).Result; - WriteVerbose("Received response"); - WriteVerbose("Converting response"); - WriteAzureBackupProtectionPolicy(enableAzureBackupProtection); + WriteVerbose("Received enable azure backup protection response"); + jobId = enableAzureBackupProtection.OperationId; + this.WriteObject(jobId); }); } - public void WriteAzureBackupProtectionPolicy(OperationResponse sourceOperationResponse) - { - } - - public void WriteAzureBackupProtectionPolicy(IEnumerable sourceOperationResponseList) - { - List targetList = new List(); - - foreach (var sourceOperationResponse in sourceOperationResponseList) - { - targetList.Add(sourceOperationResponse); - } - - this.WriteObject(targetList, true); - } public enum ContainerType { [EnumMember] diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/DataSource/GetAzureBackupItem.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/DataSource/GetAzureBackupItem.cs index 3dfb83912256..97ec79cbefe9 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/DataSource/GetAzureBackupItem.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/DataSource/GetAzureBackupItem.cs @@ -75,17 +75,17 @@ public override void ExecuteCmdlet() azureBackupPOObjects = azureBackupPOListResponse.ProtectableObject.Objects.Where(x => x.ContainerName.Equals(Container.ContainerUniqueName, System.StringComparison.InvariantCultureIgnoreCase)).ToList(); } - WriteVerbose("Received response"); - WriteAzureBackupProtectionPolicy(azureBackupDatasourceObjects, azureBackupPOObjects, Container); + WriteVerbose("Received azure backup item response"); + WriteAzureBackupItem(azureBackupDatasourceObjects, azureBackupPOObjects, Container); }); } - public void WriteAzureBackupProtectionPolicy(DataSourceInfo sourceItem, AzureBackupContainer azureBackupItem) + public void WriteAzureBackupItem(DataSourceInfo sourceItem, AzureBackupContainer azureBackupItem) { this.WriteObject(new AzureBackupItem(sourceItem, azureBackupItem)); } - public void WriteAzureBackupProtectionPolicy(List sourceDataSourceList, List sourcePOList, AzureBackupContainer azureBackupContainer) + public void WriteAzureBackupItem(List sourceDataSourceList, List sourcePOList, AzureBackupContainer azureBackupContainer) { List targetList = new List();