NetboxPS/Functions/Setup/Set-NetboxCredential.ps1
Ben Claussen 739f5e98e2
Version 1.4 (#14)
* Connect(Setup): Fix indent (using Visual code Formatter)

* Setup(Functions): Fix indent (using Visual Code Formatter)

* Support(Setup): Fix indent (using Visual Code Formatter)

* InvokeNetboxRequest(Helpers): Fix indent (using Visual Code Formatter)

* Add Set-netboxCipherSSL for enable TLS1.1 and TLS1.2 (for PS 5.0)

From PowerAruba/FortiPower Module :)

* Add Set-NetboxUnstrustedSSL for disable SSL chain test (for PS 5.0

From PowerAruba/FortiPwoer Module :)

* Add Get/Set netboxInvokeParms for Get and Set Invoke Params (array)

Like -SkipCertificate, Timeout...

* InvokeNetboxRequest: Add to Splat NetboxInvokeParams

* Connect: Add SkipCertificateCheck parameter (for PS5 and Core)

Also enable TLS 1.1 and 1.2 for PS5

* PSSA: Add Github Actions for launch PSSA (PowerShell Script Analyzer) when launch PR (#11)

Add also vscode/PSScriptAnalyzerSettings.psd1 for Settings for PSSA (can be reuse also for vscode...)

* Update psproj

* Correct typo

* Correct brace formatting

* Add Get/Set timeout functions

* Add Get/Set timeout functions

* Add TimeoutSeconds parameter and logic to Connect-NetboxAPI
- Updated `InvokeNetboxRequest` to use `NetboxConfig.Timeout`
- Updated `Get-NetboxAPIDefinition` to use `NetboxConfig.Timeout`

* Trim whitespaces

* Add Get-NetboxVersion function

* Remove API Definition caching and replace with Netbox version check

* Increment version to 1.4

Co-authored-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Co-authored-by: Ben Claussen <claussen@neonet.org>
2021-07-22 12:00:12 -04:00

32 lines
No EOL
934 B
PowerShell

function Set-NetboxCredential {
[CmdletBinding(DefaultParameterSetName = 'CredsObject',
ConfirmImpact = 'Low',
SupportsShouldProcess = $true)]
[OutputType([pscredential])]
param
(
[Parameter(ParameterSetName = 'CredsObject',
Mandatory = $true)]
[pscredential]$Credential,
[Parameter(ParameterSetName = 'UserPass',
Mandatory = $true)]
[securestring]$Token
)
if ($PSCmdlet.ShouldProcess('Netbox Credentials', 'Set')) {
switch ($PsCmdlet.ParameterSetName) {
'CredsObject' {
$script:NetboxConfig.Credential = $Credential
break
}
'UserPass' {
$script:NetboxConfig.Credential = [System.Management.Automation.PSCredential]::new('notapplicable', $Token)
break
}
}
$script:NetboxConfig.Credential
}
}