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

This commit is contained in:
Alexis La Goutte 2021-07-21 22:19:45 +02:00
parent b164ffe0b4
commit 5b1ee45769
4 changed files with 14 additions and 14 deletions

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}
}

View file

@ -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