-
Notifications
You must be signed in to change notification settings - Fork 4k
Adding new parameters for CustomIpPrefix #15333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,11 +63,25 @@ public class UpdateAzureCustomIpPrefixCommand : CustomIpPrefixBaseCmdlet | |
[SupportsWildcards] | ||
public virtual string ResourceId { get; set; } | ||
|
||
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")] | ||
[Parameter(Mandatory = false, HelpMessage = "start commissioning process.")] | ||
public SwitchParameter Commission { get; set; } | ||
|
||
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")] | ||
public SwitchParameter Decomission { get; set; } | ||
[Alias("Decomission")] | ||
[Parameter(Mandatory = false, HelpMessage = "start decommissioning process.")] | ||
public SwitchParameter Decommission { get; set; } | ||
|
||
[Parameter(Mandatory = false, HelpMessage = "start provisioning process.")] | ||
public SwitchParameter Provision { get; set; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. type would change behavior of our command because we need to use like |
||
|
||
[Parameter(Mandatory = false, HelpMessage = "start deprovisioning process.")] | ||
public SwitchParameter Deprovision { get; set; } | ||
|
||
[Parameter( | ||
Mandatory = false, | ||
ValueFromPipelineByPropertyName = true, | ||
HelpMessage = "The customIpPrefix CIDR.")] | ||
[ValidateNotNullOrEmpty] | ||
public string Cidr { get; set; } | ||
|
||
[Parameter( | ||
Mandatory = false, | ||
|
@@ -103,7 +117,7 @@ public override void Execute() | |
throw new ArgumentException(Microsoft.Azure.Commands.Network.Properties.Resources.ResourceNotFound); | ||
} | ||
|
||
if (Commission && Decomission) | ||
if ((Commission ? 1 : 0) + (Decommission ? 1 : 0) + (Provision ? 1 : 0) + (Deprovision ? 1 : 0) > 1) | ||
{ | ||
throw new ArgumentException(Microsoft.Azure.Commands.Network.Properties.Resources.CommissioningStateConflict); | ||
} | ||
|
@@ -115,9 +129,26 @@ public override void Execute() | |
throw new PSArgumentException(Properties.Resources.ResourceNotFound, this.Name); | ||
} | ||
|
||
if (Commission || Decomission) | ||
if (Commission) | ||
{ | ||
customIpPrefixToUpdate.CommissionedState = "Commissioning"; | ||
} | ||
else if (Decommission) | ||
{ | ||
customIpPrefixToUpdate.CommissionedState = "Decommissioning"; | ||
} | ||
else if (Provision) | ||
{ | ||
customIpPrefixToUpdate.CommissionedState = "Provisioning"; | ||
} | ||
else if (Deprovision) | ||
{ | ||
customIpPrefixToUpdate.CommissionedState = "Deprovisioning"; | ||
} | ||
|
||
if (this.Cidr != null) | ||
{ | ||
customIpPrefixToUpdate.CommissionedState = Commission ? "Commissioning" : "Decomissioning"; | ||
customIpPrefixToUpdate.Cidr = this.Cidr; | ||
} | ||
|
||
var sdkModel = NetworkResourceManagerProfile.Mapper.Map<MNM.CustomIpPrefix>(customIpPrefixToUpdate); | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.