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 @@ -41,7 +41,7 @@
</Reference>
<Reference Include="Microsoft.Azure.Management.BackupServicesManagement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.BackupServices.1.0.3-preview\lib\net40\Microsoft.Azure.Management.BackupServicesManagement.dll</HintPath>
<HintPath>..\Commands.AzureBackup\Resources\Microsoft.Azure.Management.BackupServicesManagement.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,12 @@ public IEnumerable<AzureBackupVault> GetVaultsInResourceGroup(string resourceGro
/// </summary>
/// <param name="resourceGroupName"></param>
/// <param name="vaultName"></param>
public void DeleteVault(string resourceGroupName, string vaultName)
public bool DeleteVault(string resourceGroupName, string vaultName)
{
AzureBackupVaultClient.Vault.DeleteAsync(resourceGroupName, vaultName, GetCustomRequestHeaders(), CmdletCancellationToken).Wait();
AzureBackupVaultGetResponse response = AzureBackupVaultClient.Vault.DeleteAsync(resourceGroupName, vaultName, GetCustomRequestHeaders(), CmdletCancellationToken).Result;

// OneSDK will return only either OK or NoContent
return response.StatusCode == System.Net.HttpStatusCode.OK;

Choose a reason for hiding this comment

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

How will you differentiate with case where exception will come due to any other reason like service is done, etc? Those which doesn't give NoContent?

Copy link
Author

Choose a reason for hiding this comment

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

Those will be taken care of at the hydra layer itself.

}

public VaultCredUploadCertResponse UploadCertificate(string resourceGroupName, string resourceName, string certName, VaultCredUploadCertRequest request)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.AzureBackup.Properties;
using System;
using System.Management.Automation;

namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
Expand All @@ -28,7 +30,10 @@ public override void ExecuteCmdlet()
{
base.ExecuteCmdlet();

AzureBackupClient.DeleteVault(Vault.ResourceGroupName, Vault.Name);
if (!AzureBackupClient.DeleteVault(Vault.ResourceGroupName, Vault.Name))
{
throw new Exception(Resources.ResourceNotFoundMessage);
}
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</Reference>
<Reference Include="Microsoft.Azure.Management.BackupServicesManagement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.BackupServices.1.0.3-preview\lib\net40\Microsoft.Azure.Management.BackupServicesManagement.dll</HintPath>
<HintPath>Resources\Microsoft.Azure.Management.BackupServicesManagement.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
Binary file not shown.