mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 18:02:29 +00:00
Add Get/Set timeout functions
This commit is contained in:
parent
06d758d7b3
commit
c48bfe78ad
2 changed files with 30 additions and 0 deletions
13
Functions/Setup/Get-NetboxTimeout.ps1
Normal file
13
Functions/Setup/Get-NetboxTimeout.ps1
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
function Get-NetboxTimeout {
|
||||||
|
[CmdletBinding()]
|
||||||
|
[OutputType([uint16])]
|
||||||
|
param ()
|
||||||
|
|
||||||
|
Write-Verbose "Getting Netbox Timeout"
|
||||||
|
if ($null -eq $script:NetboxConfig.Timeout) {
|
||||||
|
throw "Netbox Timeout is not set! You may set it with Set-NetboxTimeout -TimeoutSeconds [uint16]"
|
||||||
|
}
|
||||||
|
|
||||||
|
$script:NetboxConfig.Timeout
|
||||||
|
}
|
||||||
17
Functions/Setup/Set-NetboxTimeout.ps1
Normal file
17
Functions/Setup/Set-NetboxTimeout.ps1
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
function Set-NetboxTimeout {
|
||||||
|
[CmdletBinding(ConfirmImpact = 'Low',
|
||||||
|
SupportsShouldProcess = $true)]
|
||||||
|
[OutputType([uint16])]
|
||||||
|
param
|
||||||
|
(
|
||||||
|
[Parameter(Mandatory = $false)]
|
||||||
|
[ValidateRange(1, 65535)]
|
||||||
|
[uint16]$TimeoutSeconds = 30
|
||||||
|
)
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess('Netbox Timeout', 'Set')) {
|
||||||
|
$script:NetboxConfig.Timeout = $TimeoutSeconds
|
||||||
|
$script:NetboxConfig.Timeout
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue