mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 18:02:29 +00:00
Setup(Functions): Fix indent (using Visual Code Formatter)
This commit is contained in:
parent
b164ffe0b4
commit
5b1ee45769
4 changed files with 14 additions and 14 deletions
|
|
@ -2,10 +2,10 @@
|
|||
[CmdletBinding()]
|
||||
[OutputType([pscredential])]
|
||||
param ()
|
||||
|
||||
|
||||
if (-not $script:NetboxConfig.Credential) {
|
||||
throw "Netbox Credentials not set! You may set with Set-NetboxCredential"
|
||||
}
|
||||
|
||||
|
||||
$script:NetboxConfig.Credential
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
function Get-NetboxHostname {
|
||||
[CmdletBinding()]
|
||||
param ()
|
||||
|
||||
|
||||
Write-Verbose "Getting Netbox hostname"
|
||||
if ($null -eq $script:NetboxConfig.Hostname) {
|
||||
throw "Netbox Hostname is not set! You may set it with Set-NetboxHostname -Hostname 'hostname.domain.tld'"
|
||||
}
|
||||
|
||||
|
||||
$script:NetboxConfig.Hostname
|
||||
}
|
||||
|
|
@ -1,32 +1,32 @@
|
|||
function Set-NetboxCredential {
|
||||
[CmdletBinding(DefaultParameterSetName = 'CredsObject',
|
||||
ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess = $true)]
|
||||
ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([pscredential])]
|
||||
param
|
||||
(
|
||||
[Parameter(ParameterSetName = 'CredsObject',
|
||||
Mandatory = $true)]
|
||||
Mandatory = $true)]
|
||||
[pscredential]$Credential,
|
||||
|
||||
|
||||
[Parameter(ParameterSetName = 'UserPass',
|
||||
Mandatory = $true)]
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
function Set-NetboxHostName {
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess = $true)]
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([string])]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Hostname
|
||||
)
|
||||
|
||||
|
||||
if ($PSCmdlet.ShouldProcess('Netbox Hostname', 'Set')) {
|
||||
$script:NetboxConfig.Hostname = $Hostname.Trim()
|
||||
$script:NetboxConfig.Hostname
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue