-
Notifications
You must be signed in to change notification settings - Fork 30
Add Delay option #99
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
base: dev
Are you sure you want to change the base?
Add Delay option #99
Changes from 1 commit
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 |
|---|---|---|
|
|
@@ -38,7 +38,7 @@ function Disable-NSLBServer { | |
| Disable the load balancer server 'server01' without confirmation and return the resulting object. | ||
|
|
||
| .EXAMPLE | ||
| $server = Disable-NSLBServer -Name 'server01' -Graceful 60 -Force -PassThru | ||
| $server = Disable-NSLBServer -Name 'server01' -Graceful -Delay 60 -Force -PassThru | ||
|
|
||
| Disable the load balancer server 'server01' without confirmation, giving a 60 second grace period before disabling and return the resulting object. | ||
|
|
||
|
|
@@ -49,7 +49,10 @@ function Disable-NSLBServer { | |
| The name or names of the load balancer servers to disable. | ||
|
|
||
| .PARAMETER Graceful | ||
| Indicates graceful shutdown of the server. System will wait for all outstanding connections to this server to be closed before disabling the server. Wait time in seconds may be included before disabling happens. | ||
| Indicates graceful shutdown of the server. System will wait for all outstanding connections to this server to be closed before disabling the server. | ||
|
|
||
| .PARAMETER Delay | ||
| How many seconds to wait before disabling this server. | ||
|
|
||
| .PARAMETER Force | ||
| Suppress confirmation when disabling the server. | ||
|
|
@@ -64,6 +67,8 @@ function Disable-NSLBServer { | |
| [parameter(Mandatory,ValueFromPipeline = $true, ValueFromPipelineByPropertyName)] | ||
| [string[]]$Name = (Read-Host -Prompt 'LB server name'), | ||
|
|
||
| [int]$Delay, | ||
|
|
||
| [int]$Graceful, | ||
|
|
||
| [switch]$Force, | ||
|
|
@@ -87,7 +92,17 @@ function Disable-NSLBServer { | |
| if ($Graceful -gt 0) { | ||
| $params.Add('delay', $Graceful) | ||
| } else { | ||
| $params.Add('delay', 0) | ||
| if ($PSBoundParameters.ContainsKey('Delay')) { | ||
|
Collaborator
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. You don't need this check as
Contributor
Author
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. I simplified this section now that the Graceful and Delay are mutually exclusive. |
||
| $params.Add('delay', $Delay) | ||
| } else { | ||
| $params.Add('delay', 0) | ||
| } | ||
| } | ||
| } else { | ||
| if ($PSBoundParameters.ContainsKey('Delay')) { | ||
| if ($Delay -gt 0) { | ||
| $params.Add('delay', $Delay) | ||
| } | ||
| } | ||
| } | ||
| _InvokeNSRestApi -Session $Session -Method POST -Type server -Payload $params -Action disable | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the
-Gracefuland-Delayparameters should be mutually exclusive, e.g. use one or the other? If this is the case, we should introduce theDelayin a separate parameter set.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the code to use parameter sets that makes the Graceful and Delay options mutually exclusive.