PSSA: Fix Command accepts pipeline input but has not defined a process block

This commit is contained in:
Alexis La Goutte 2021-07-23 21:09:06 +02:00
parent 76b891542e
commit 0217808bfc
8 changed files with 104 additions and 88 deletions

View file

@ -13,7 +13,7 @@
function Get-NetboxCircuit {
<#
<#
.SYNOPSIS
Gets one or more circuits
@ -105,6 +105,7 @@ function Get-NetboxCircuit {
[switch]$Raw
)
process {
switch ($PSCmdlet.ParameterSetName) {
'ById' {
foreach ($i in $ID) {
@ -128,4 +129,5 @@ function Get-NetboxCircuit {
InvokeNetboxRequest -URI $URI -Raw:$Raw
}
}
}
}

View file

@ -54,6 +54,7 @@ function New-NetboxCircuit {
[switch]$Raw
)
process {
$Segments = [System.Collections.ArrayList]::new(@('circuits', 'circuits'))
$Method = 'POST'
@ -64,4 +65,5 @@ function New-NetboxCircuit {
if ($Force -or $PSCmdlet.ShouldProcess($CID, 'Create new circuit')) {
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
}
}
}

View file

@ -85,6 +85,7 @@ function Get-NetboxDCIMDevice {
#endregion Parameters
process {
if ($null -ne $Status) {
$PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
}
@ -96,4 +97,5 @@ function Get-NetboxDCIMDevice {
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $URI -Raw:$Raw
}
}

View file

@ -47,6 +47,7 @@ function Get-NetboxDCIMInterface {
[switch]$Raw
)
process {
if ($null -ne $Form_Factor) {
$PSBoundParameters.Form_Factor = ValidateDCIMChoice -ProvidedValue $Form_Factor -InterfaceFormFactor
}
@ -58,4 +59,5 @@ function Get-NetboxDCIMInterface {
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $URI -Raw:$Raw
}
}

View file

@ -81,6 +81,7 @@ function Get-NetboxDCIMSite {
[switch]$Raw
)
process {
switch ($PSCmdlet.ParameterSetName) {
'ById' {
foreach ($Site_ID in $ID) {
@ -104,5 +105,6 @@ function Get-NetboxDCIMSite {
InvokeNetboxRequest -URI $URI -Raw:$Raw
}
}
}
}

View file

@ -13,7 +13,7 @@
function Get-NetboxVirtualMachine {
<#
<#
.SYNOPSIS
Obtains virtual machines from Netbox.
@ -141,6 +141,7 @@ function Get-NetboxVirtualMachine {
[switch]$Raw
)
process {
if ($null -ne $Status) {
$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
}
@ -152,4 +153,5 @@ function Get-NetboxVirtualMachine {
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $uri -Raw:$Raw
}
}

View file

@ -50,10 +50,11 @@ function Set-NetboxVirtualMachine {
[switch]$Force
)
# if ($null -ne $Status) {
# $PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
# }
# if ($null -ne $Status) {
# $PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
# }
process {
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines', $Id))
Write-Verbose "Obtaining VM from ID $Id"
@ -69,4 +70,5 @@ function Set-NetboxVirtualMachine {
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
}
}
}

View file

@ -13,7 +13,7 @@
function Get-NetboxVirtualMachineInterface {
<#
<#
.SYNOPSIS
Gets VM interfaces
@ -84,6 +84,7 @@ function Get-NetboxVirtualMachineInterface {
[switch]$Raw
)
process {
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'interfaces'))
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
@ -91,4 +92,5 @@ function Get-NetboxVirtualMachineInterface {
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $uri -Raw:$Raw
}
}