Skip to content

Commit 2efbf7f

Browse files
author
Samuel Anudeep
committed
Cmdlet layer changes - minor
Updated wxi
1 parent b151f74 commit 2efbf7f

File tree

6 files changed

+63
-46
lines changed

6 files changed

+63
-46
lines changed

setup/azurecmdfiles.wxi

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2443,9 +2443,6 @@
24432443
<Component Id="cmpA897C4AAFA31A4DD27E390513E23E222" Guid="*">
24442444
<File Id="fil41C35FC5CDA21CD060F5389083B5195B" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.RecoveryServices\Microsoft.Azure.Management.RecoveryServices.dll" />
24452445
</Component>
2446-
<Component Id="cmp216DD301C88D440007E12238AE5439BE" Guid="*">
2447-
<File Id="fil524B5609229381E732FF1F17430BB812" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.RecoveryServices\Microsoft.Azure.ResourceManager.dll" />
2448-
</Component>
24492446
<Component Id="cmpD3312FC95A31A56AC9D86F251A4C4746" Guid="*">
24502447
<File Id="fil4A3D41BE31A41217E17A4E05175FA8B2" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.RecoveryServices\Microsoft.IdentityModel.Clients.ActiveDirectory.dll" />
24512448
</Component>
@@ -3048,9 +3045,6 @@
30483045
<Component Id="cmp2F2D87277541559BE2814CD1BDFE6602" Guid="*">
30493046
<File Id="fil901CCBBA285B6CA89AA1139C8234A093" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.SiteRecovery\Microsoft.Azure.Management.SiteRecovery.dll" />
30503047
</Component>
3051-
<Component Id="cmp8FD26069866580D7EDF226036172E474" Guid="*">
3052-
<File Id="filD83CB38E0C6DE5FBB4415FA77E3D237D" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.SiteRecovery\Microsoft.Azure.ResourceManager.dll" />
3053-
</Component>
30543048
<Component Id="cmpD7239422EFCCBDB1157557C3F8DC97BE" Guid="*">
30553049
<File Id="fil020B9427D976887857582CD4A7BC71ED" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.SiteRecovery\Microsoft.IdentityModel.Clients.ActiveDirectory.dll" />
30563050
</Component>
@@ -6235,7 +6229,6 @@
62356229
<ComponentRef Id="cmp3629350DB44BADB48B9F7787CAEA966A" />
62366230
<ComponentRef Id="cmpF3A5F7B33754FB70A439E1CFC6358E76" />
62376231
<ComponentRef Id="cmpA897C4AAFA31A4DD27E390513E23E222" />
6238-
<ComponentRef Id="cmp216DD301C88D440007E12238AE5439BE" />
62396232
<ComponentRef Id="cmpD3312FC95A31A56AC9D86F251A4C4746" />
62406233
<ComponentRef Id="cmp28F1669150E6E4F533A073C5DC77C058" />
62416234
<ComponentRef Id="cmp1A78E4DE7491D05CD1AA7765C2268628" />
@@ -6432,7 +6425,6 @@
64326425
<ComponentRef Id="cmpDD973C16A81F8EFF2DD6D01131132870" />
64336426
<ComponentRef Id="cmpC06C4276E750A97B2875E0C017033BAD" />
64346427
<ComponentRef Id="cmp2F2D87277541559BE2814CD1BDFE6602" />
6435-
<ComponentRef Id="cmp8FD26069866580D7EDF226036172E474" />
64366428
<ComponentRef Id="cmpD7239422EFCCBDB1157557C3F8DC97BE" />
64376429
<ComponentRef Id="cmpFA0D75D8CA8A655DF7355F8982D6D1E1" />
64386430
<ComponentRef Id="cmp6EEC16C6468A4F3D696B0B42A3B398D5" />

src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Properties/Resources.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,4 +301,7 @@ Please provide a storage account with the same location as that of the vault.</v
301301
<data name="NoBackupPropertiesProvided" xml:space="preserve">
302302
<value>BackupStorageRedundancy is either null or empty.</value>
303303
</data>
304+
<data name="VaultTarget" xml:space="preserve">
305+
<value>Azure Recovery Services Vault</value>
306+
</data>
304307
</root>

src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Vault/NewAzureRMRecoveryServicesVault.cs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@
1414

1515
using System;
1616
using System.Management.Automation;
17+
using Microsoft.Azure.Commands.RecoveryServices.Properties;
1718
using Microsoft.Azure.Management.RecoveryServices.Models;
1819

1920
namespace Microsoft.Azure.Commands.RecoveryServices
2021
{
2122
/// <summary>
2223
/// Used to initiate a vault create operation.
2324
/// </summary>
24-
[Cmdlet(VerbsCommon.New, "AzureRmRecoveryServicesVault")]
25+
[Cmdlet(VerbsCommon.New, "AzureRmRecoveryServicesVault", SupportsShouldProcess = true),
26+
OutputType(typeof(ARSVault))]
2527
public class NewAzureRmRecoveryServicesVault : RecoveryServicesCmdletBase
2628
{
2729
#region Parameters
@@ -54,21 +56,24 @@ public class NewAzureRmRecoveryServicesVault : RecoveryServicesCmdletBase
5456
/// </summary>
5557
public override void ExecuteCmdlet()
5658
{
57-
try
59+
if (ShouldProcess(Resources.VaultTarget, "new"))
5860
{
59-
Vault vaultCreateArgs = new Vault();
60-
vaultCreateArgs.Location = this.Location;
61-
vaultCreateArgs.Properties = new VaultProperties();
62-
vaultCreateArgs.Sku = new Sku();
63-
vaultCreateArgs.Sku.Name = SkuName.Standard;
61+
try
62+
{
63+
Vault vaultCreateArgs = new Vault();
64+
vaultCreateArgs.Location = this.Location;
65+
vaultCreateArgs.Properties = new VaultProperties();
66+
vaultCreateArgs.Sku = new Sku();
67+
vaultCreateArgs.Sku.Name = SkuName.Standard;
6468

65-
Vault response = RecoveryServicesClient.CreateVault(this.ResourceGroupName, this.Name, vaultCreateArgs);
69+
Vault response = RecoveryServicesClient.CreateVault(this.ResourceGroupName, this.Name, vaultCreateArgs);
6670

67-
this.WriteObject(new ARSVault(response));
68-
}
69-
catch (Exception exception)
70-
{
71-
this.HandleException(exception);
71+
this.WriteObject(new ARSVault(response));
72+
}
73+
catch (Exception exception)
74+
{
75+
this.HandleException(exception);
76+
}
7277
}
7378
}
7479
}

src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Vault/RemoveAzureRMRecoveryServicesVault.cs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ namespace Microsoft.Azure.Commands.RecoveryServices
2323
/// <summary>
2424
/// Used to initiate a vault delete operation.
2525
/// </summary>
26-
[Cmdlet(VerbsCommon.Remove, "AzureRmRecoveryServicesVault")]
26+
[Cmdlet(VerbsCommon.Remove, "AzureRmRecoveryServicesVault", SupportsShouldProcess = true),
27+
OutputType(typeof(VaultOperationOutput))]
2728
public class RemoveAzureRmRecoveryServicesVault : RecoveryServicesCmdletBase
2829
{
2930
#region Parameters
@@ -42,20 +43,23 @@ public class RemoveAzureRmRecoveryServicesVault : RecoveryServicesCmdletBase
4243
/// </summary>
4344
public override void ExecuteCmdlet()
4445
{
45-
try
46+
if (ShouldProcess(Resources.VaultTarget, "remove"))
4647
{
47-
var response = RecoveryServicesClient.DeleteVault(this.Vault.ResourceGroupName, this.Vault.Name);
48-
49-
VaultOperationOutput output = new VaultOperationOutput()
48+
try
5049
{
51-
Response = response.Response.StatusCode == HttpStatusCode.OK ? Resources.VaultDeletionSuccessMessage : response.Response.StatusCode.ToString()
52-
};
50+
var response = RecoveryServicesClient.DeleteVault(this.Vault.ResourceGroupName, this.Vault.Name);
5351

54-
this.WriteObject(output, true);
55-
}
56-
catch (Exception exception)
57-
{
58-
this.HandleException(exception);
52+
VaultOperationOutput output = new VaultOperationOutput()
53+
{
54+
Response = response.Response.StatusCode == HttpStatusCode.OK ? Resources.VaultDeletionSuccessMessage : response.Response.StatusCode.ToString()
55+
};
56+
57+
this.WriteObject(output, true);
58+
}
59+
catch (Exception exception)
60+
{
61+
this.HandleException(exception);
62+
}
5963
}
6064
}
6165
}

src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Vault/SetAzureRmRecoveryServicesBackupProperties.cs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@
1616
using System.Collections.Generic;
1717
using System.Linq;
1818
using System.Management.Automation;
19+
using Microsoft.Azure.Commands.RecoveryServices.Properties;
1920
using Microsoft.Azure.Management.RecoveryServices.Models;
2021

2122
namespace Microsoft.Azure.Commands.RecoveryServices
2223
{
2324
/// <summary>
2425
/// Sets Azure Recovery Services Vault Backup Properties.
2526
/// </summary>
26-
[Cmdlet(VerbsCommon.Set, "AzureRmRecoveryServicesBackupProperties")]
27+
[Cmdlet(VerbsCommon.Set, "AzureRmRecoveryServicesBackupProperties", SupportsShouldProcess = true)]
2728
public class SetAzureRmRecoveryServicesBackupProperties : RecoveryServicesCmdletBase
2829
{
2930
#region Parameters
@@ -46,24 +47,27 @@ public class SetAzureRmRecoveryServicesBackupProperties : RecoveryServicesCmdlet
4647
/// </summary>
4748
public override void ExecuteCmdlet()
4849
{
49-
try
50+
if (ShouldProcess(Resources.VaultTarget, "set"))
5051
{
51-
if (this.BackupStorageRedundancy.HasValue)
52+
try
5253
{
53-
BackupStorageConfig vaultStorageRequest = new BackupStorageConfig();
54-
vaultStorageRequest.StorageModelType = BackupStorageRedundancy.ToString();
55-
RecoveryServicesClient.UpdateVaultStorageType(
56-
this.Vault.ResourceGroupName, this.Vault.Name, vaultStorageRequest);
54+
if (this.BackupStorageRedundancy.HasValue)
55+
{
56+
BackupStorageConfig vaultStorageRequest = new BackupStorageConfig();
57+
vaultStorageRequest.StorageModelType = BackupStorageRedundancy.ToString();
58+
RecoveryServicesClient.UpdateVaultStorageType(
59+
this.Vault.ResourceGroupName, this.Vault.Name, vaultStorageRequest);
60+
}
61+
else
62+
{
63+
throw new Exception(Properties.Resources.NoBackupPropertiesProvided);
64+
}
5765
}
58-
else
66+
catch (Exception exception)
5967
{
60-
throw new Exception(Properties.Resources.NoBackupPropertiesProvided);
68+
this.HandleException(exception);
6169
}
6270
}
63-
catch (Exception exception)
64-
{
65-
this.HandleException(exception);
66-
}
6771
}
6872
}
6973
}

0 commit comments

Comments
 (0)