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()] [CmdletBinding()]
[OutputType([pscredential])] [OutputType([pscredential])]
param () param ()
if (-not $script:NetboxConfig.Credential) { if (-not $script:NetboxConfig.Credential) {
throw "Netbox Credentials not set! You may set with Set-NetboxCredential" throw "Netbox Credentials not set! You may set with Set-NetboxCredential"
} }
$script:NetboxConfig.Credential $script:NetboxConfig.Credential
} }

View file

@ -1,11 +1,11 @@
function Get-NetboxHostname { function Get-NetboxHostname {
[CmdletBinding()] [CmdletBinding()]
param () param ()
Write-Verbose "Getting Netbox hostname" Write-Verbose "Getting Netbox hostname"
if ($null -eq $script:NetboxConfig.Hostname) { if ($null -eq $script:NetboxConfig.Hostname) {
throw "Netbox Hostname is not set! You may set it with Set-NetboxHostname -Hostname 'hostname.domain.tld'" throw "Netbox Hostname is not set! You may set it with Set-NetboxHostname -Hostname 'hostname.domain.tld'"
} }
$script:NetboxConfig.Hostname $script:NetboxConfig.Hostname
} }

View file

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

View file

@ -1,13 +1,13 @@
function Set-NetboxHostName { function Set-NetboxHostName {
[CmdletBinding(ConfirmImpact = 'Low', [CmdletBinding(ConfirmImpact = 'Low',
SupportsShouldProcess = $true)] SupportsShouldProcess = $true)]
[OutputType([string])] [OutputType([string])]
param param
( (
[Parameter(Mandatory = $true)] [Parameter(Mandatory = $true)]
[string]$Hostname [string]$Hostname
) )
if ($PSCmdlet.ShouldProcess('Netbox Hostname', 'Set')) { if ($PSCmdlet.ShouldProcess('Netbox Hostname', 'Set')) {
$script:NetboxConfig.Hostname = $Hostname.Trim() $script:NetboxConfig.Hostname = $Hostname.Trim()
$script:NetboxConfig.Hostname $script:NetboxConfig.Hostname