From 254a2798ac872ede6152461afe70ad1aad3dfcb3 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Wed, 21 Jul 2021 22:41:26 +0200 Subject: [PATCH] Add Get/Set netboxInvokeParms for Get and Set Invoke Params (array) Like -SkipCertificate, Timeout... --- Functions/Setup/Get-NetboxInvokeParams.ps1 | 11 +++++++++++ Functions/Setup/Set-NetboxInvokeParams.ps1 | 15 +++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 Functions/Setup/Get-NetboxInvokeParams.ps1 create mode 100644 Functions/Setup/Set-NetboxInvokeParams.ps1 diff --git a/Functions/Setup/Get-NetboxInvokeParams.ps1 b/Functions/Setup/Get-NetboxInvokeParams.ps1 new file mode 100644 index 0000000..0cd33c7 --- /dev/null +++ b/Functions/Setup/Get-NetboxInvokeParams.ps1 @@ -0,0 +1,11 @@ +function Get-NetboxInvokeParams { + [CmdletBinding()] + param () + + Write-Verbose "Getting Netbox InvokeParams" + if ($null -eq $script:NetboxConfig.InvokeParams) { + throw "Netbox Invoke Parms is not set! You may set it with Set-NetboxInvokeParams -InvokeParams ..." + } + + $script:NetboxConfig.InvokeParams +} \ No newline at end of file diff --git a/Functions/Setup/Set-NetboxInvokeParams.ps1 b/Functions/Setup/Set-NetboxInvokeParams.ps1 new file mode 100644 index 0000000..ca5dbf5 --- /dev/null +++ b/Functions/Setup/Set-NetboxInvokeParams.ps1 @@ -0,0 +1,15 @@ +function Set-NetboxInvokeParams { + [CmdletBinding(ConfirmImpact = 'Low', + SupportsShouldProcess = $true)] + [OutputType([string])] + param + ( + [Parameter(Mandatory = $true)] + [array]$InvokeParams + ) + + if ($PSCmdlet.ShouldProcess('Netbox Invoke Params', 'Set')) { + $script:NetboxConfig.InvokeParams = $InvokeParams + $script:NetboxConfig.InvokeParams + } +} \ No newline at end of file