Skip to content

Commit 8ea5788

Browse files
authored
Added missing validators and completers in Deployment Stacks cmdlets. (Azure#23817)
For Deployment Stacks new cmdlets, added validation for location parameters and completers for RG parameters that were missing completers. In addition, some minor reformatting was done.
1 parent db50240 commit 8ea5788

File tree

40 files changed

+166120
-76806
lines changed

40 files changed

+166120
-76806
lines changed

src/Resources/ResourceManager/Implementation/DeploymentStacks/NewAzManagementGroupDeploymentStack.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public class NewAzManagementGroupDeploymentStack : DeploymentStacksCreateCmdletB
5656

5757
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true,
5858
HelpMessage = "Location of the stack")]
59+
[ValidateNotNullOrEmpty]
5960
public string Location { get; set; }
6061

6162
[Parameter(Mandatory = false, HelpMessage = "Signal to delete both unmanaged Resources and ResourceGroups after updating stack.")]
@@ -83,8 +84,7 @@ public class NewAzManagementGroupDeploymentStack : DeploymentStacksCreateCmdletB
8384
[Parameter(Mandatory = false, HelpMessage = "The tags to put on the deployment.")]
8485
public Hashtable Tag { get; set; }
8586

86-
[Parameter(Mandatory = false,
87-
HelpMessage = "Do not ask for confirmation when overwriting an existing stack.")]
87+
[Parameter(Mandatory = false, HelpMessage = "Do not ask for confirmation when overwriting an existing stack.")]
8888
public SwitchParameter Force { get; set; }
8989

9090
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background.")]

src/Resources/ResourceManager/Implementation/DeploymentStacks/NewAzSubscriptionDeploymentStack.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
1717
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.CmdletBase;
1818
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels;
1919
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Utilities;
20+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
2021
using Microsoft.Azure.Commands.ResourceManager.Common.Tags;
2122
using Microsoft.Azure.Management.Resources.Models;
2223
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
@@ -45,6 +46,7 @@ public class NewAzSubscriptionDeploymentStack : DeploymentStacksCreateCmdletBase
4546

4647
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true,
4748
HelpMessage = "Location of the stack.")]
49+
[ValidateNotNullOrEmpty]
4850
public string Location { get; set; }
4951

5052
[Parameter(Mandatory = false, HelpMessage = "Signal to delete both resources and resource groups after updating stack.")]
@@ -69,16 +71,16 @@ public class NewAzSubscriptionDeploymentStack : DeploymentStacksCreateCmdletBase
6971
[Parameter(Mandatory = false, HelpMessage = "Apply to child scopes.")]
7072
public SwitchParameter DenySettingsApplyToChildScopes { get; set; }
7173

72-
[Parameter(Mandatory = false,
73-
HelpMessage = "The ResourceGroup at which the deployment will be created. If none is specified, it will default to the " +
74-
"subscription level scope of the deployment stack.")]
74+
[Parameter(Mandatory = false, HelpMessage = "The ResourceGroup at which the deployment will be created. If none is specified, " +
75+
"it will default to the subscription level scope of the deployment stack.")]
76+
[ResourceGroupCompleter]
77+
[ValidateNotNullOrEmpty]
7578
public string DeploymentResourceGroupName { get; set; }
7679

7780
[Parameter(Mandatory = false, HelpMessage = "The tags to put on the deployment.")]
7881
public Hashtable Tag { get; set; }
7982

80-
[Parameter(Mandatory = false,
81-
HelpMessage = "Do not ask for confirmation when overwriting an existing stack.")]
83+
[Parameter(Mandatory = false, HelpMessage = "Do not ask for confirmation when overwriting an existing stack.")]
8284
public SwitchParameter Force { get; set; }
8385

8486
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background.")]

src/Resources/ResourceManager/Implementation/DeploymentStacks/SetAzSubscriptionDeploymentStack.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
1717
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.CmdletBase;
1818
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels;
1919
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Utilities;
20+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
2021
using Microsoft.Azure.Commands.ResourceManager.Common.Tags;
2122
using Microsoft.Azure.Management.Resources.Models;
2223
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
@@ -46,11 +47,14 @@ public class SetAzSubscriptionDeploymentStack : DeploymentStacksCreateCmdletBase
4647

4748
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true,
4849
HelpMessage = "Location of the stack.")]
50+
[ValidateNotNullOrEmpty]
4951
public string Location { get; set; }
5052

5153
[Parameter(Mandatory = false,
5254
HelpMessage = "The ResourceGroup at which the deployment will be created. If none is specified, it will default to the " +
5355
"subscription level scope of the deployment stack.")]
56+
[ResourceGroupCompleter]
57+
[ValidateNotNullOrEmpty]
5458
public string DeploymentResourceGroupName { get; set; }
5559

5660
[Parameter(Mandatory = false, HelpMessage = "Signal to delete both unmanaged Resources and ResourceGroups after deleting stack.")]

0 commit comments

Comments
 (0)