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()]
|
[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
|
||||||
}
|
}
|
||||||
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue