Skip to content

Commit 15f8462

Browse files
committed
Change updateBehavior to enum
1 parent 878e38d commit 15f8462

File tree

5 files changed

+27
-15
lines changed

5 files changed

+27
-15
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public class NewAzResourceGroupDeploymentStack : DeploymentStacksCmdletBase
4545
internal const string ParameterUriTemplateUriParameterSetName = "ByTemplateUriWithParameterUri";
4646
internal const string ParameterUriTemplateSpecParameterSetName = "ByTemplateSpecWithParameterUri";
4747

48+
[Flags]
49+
public enum updateBehvaiorEnum { detachResources, purgeResources }
50+
4851
[Alias("StackName")]
4952
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true,
5053
HelpMessage = "The name of the deploymentStack to create")]
@@ -102,8 +105,8 @@ public class NewAzResourceGroupDeploymentStack : DeploymentStacksCmdletBase
102105
public string Description { get; set; }
103106

104107
[Parameter(Mandatory = false, ValueFromPipeline = true,
105-
HelpMessage = "Update behavior for the stack. Value can be \"Detach\" or \"Purge\".")]
106-
public String UpdateBehavior { get; set; }
108+
HelpMessage = "Update behavior for the stack. Value can be detachResources or failedResources.")]
109+
public updateBehvaiorEnum UpdateBehavior { get; set; }
107110

108111
[Parameter(Mandatory = false,
109112
HelpMessage = "The scope at which the initial deployment should be created. If a scope isn't specified, it will default to the scope of the deployment stack.")]
@@ -163,7 +166,7 @@ public override void ExecuteCmdlet()
163166
ParameterUri,
164167
parameters,
165168
Description,
166-
UpdateBehavior == null ? "detach" : UpdateBehavior,
169+
(UpdateBehavior.ToString() == "detachResources") ? "detach" : "purge",
167170
DeploymentScope
168171
);
169172
WriteObject(deploymentStack);

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public class NewAzSubscriptionDeploymentStack : DeploymentStacksCmdletBase
4545
internal const string ParameterUriTemplateUriParameterSetName = "ByTemplateUriWithParameterUri";
4646
internal const string ParameterUriTemplateSpecParameterSetName = "ByTemplateSpecWithParameterUri";
4747

48+
[Flags]
49+
public enum updateBehvaiorEnum { detachResources, purgeResources }
50+
4851
[Alias("StackName")]
4952
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true,
5053
HelpMessage = "The name of the deploymentStack to create")]
@@ -100,9 +103,9 @@ public class NewAzSubscriptionDeploymentStack : DeploymentStacksCmdletBase
100103
public string Location { get; set; }
101104

102105
[Parameter(Mandatory = false, ValueFromPipeline = true,
103-
HelpMessage = "Update behavior for the stack. Value can be \"Detach\" or \"Purge\".")]
104-
public string UpdateBehavior { get; set; }
105-
106+
HelpMessage = "Update behavior for the stack. Value can be detachResources or failedResources.")]
107+
public updateBehvaiorEnum UpdateBehavior { get; set; }
108+
106109
[Parameter(Mandatory = false,
107110
HelpMessage = "The scope at which the initial deployment should be created. If a scope isn't specified, it will default to the scope of the deployment stack.")]
108111
public string DeploymentScope { get; set; }
@@ -161,7 +164,7 @@ public override void ExecuteCmdlet()
161164
ParameterUri,
162165
parameters,
163166
Description,
164-
UpdateBehavior == null ? "detach" : UpdateBehavior,
167+
(UpdateBehavior.ToString() == "detachResources") ? "detach" : "purge",
165168
DeploymentScope
166169
);
167170
WriteObject(deploymentStack);

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public class SetAzResourceGroupDeploymentStack : DeploymentStacksCmdletBase
4545
internal const string ParameterUriTemplateUriParameterSetName = "ByTemplateUriWithParameterUri";
4646
internal const string ParameterUriTemplateSpecParameterSetName = "ByTemplateSpecWithParameterUri";
4747

48+
[Flags]
49+
public enum updateBehvaiorEnum {detachResources,purgeResources}
50+
4851
[Alias("StackName")]
4952
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true,
5053
HelpMessage = "The name of the deploymentStack to create")]
@@ -102,8 +105,8 @@ public class SetAzResourceGroupDeploymentStack : DeploymentStacksCmdletBase
102105
public string Description { get; set; }
103106

104107
[Parameter(Mandatory = true, ValueFromPipeline = true,
105-
HelpMessage = "Update behavior for the stack. Value can be \"Detach\" or \"Purge\".")]
106-
public String UpdateBehavior { get; set; }
108+
HelpMessage = "Update behavior for the stack. Value can be detachResources or failedResources.")]
109+
public updateBehvaiorEnum UpdateBehavior { get; set; }
107110

108111
[Parameter(Mandatory = false,
109112
HelpMessage = "The scope at which the initial deployment should be created. If a scope isn't specified, it will default to the scope of the deployment stack.")]
@@ -163,7 +166,7 @@ public override void ExecuteCmdlet()
163166
ParameterUri,
164167
parameters,
165168
Description,
166-
UpdateBehavior,
169+
(UpdateBehavior.ToString() == "detachResources") ? "detach" : "purge",
167170
DeploymentScope
168171
);
169172
WriteObject(deploymentStack);

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public class SetAzSubscriptionDeploymentStack : DeploymentStacksCmdletBase
4545
internal const string ParameterUriTemplateUriParameterSetName = "ByTemplateUriWithParameterUri";
4646
internal const string ParameterUriTemplateSpecParameterSetName = "ByTemplateSpecWithParameterUri";
4747

48+
[Flags]
49+
public enum updateBehvaiorEnum { detachResources, purgeResources }
50+
4851
[Alias("StackName")]
4952
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true,
5053
HelpMessage = "The name of the deploymentStack to create")]
@@ -95,9 +98,9 @@ public class SetAzSubscriptionDeploymentStack : DeploymentStacksCmdletBase
9598
HelpMessage = "Description for the stack")]
9699
public string Description { get; set; }
97100

98-
[Parameter(Mandatory = true, ValueFromPipeline = true,
99-
HelpMessage = "Update behavior for the stack. Value can be \"Detach\" or \"Purge\".")]
100-
public String UpdateBehavior { get; set; }
101+
[Parameter(Mandatory = true, ValueFromPipeline = true,
102+
HelpMessage = "Update behavior for the stack. Value can be detachResources or failedResources.")]
103+
public updateBehvaiorEnum UpdateBehavior { get; set; }
101104

102105
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true,
103106
HelpMessage = "Location of the stack")]
@@ -161,7 +164,7 @@ public override void ExecuteCmdlet()
161164
ParameterUri,
162165
parameters,
163166
Description,
164-
UpdateBehavior,
167+
(UpdateBehavior.ToString() == "detachResources") ? "detach" : "purge",
165168
DeploymentScope
166169
);
167170

src/Resources/Resources/Az.Resources.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# RootModule = ''
1313

1414
# Version number of this module.
15-
ModuleVersion = '4.3.1'
15+
ModuleVersion = '4.3.6'
1616

1717
# Supported PSEditions
1818
CompatiblePSEditions = 'Core', 'Desktop'

0 commit comments

Comments
 (0)