mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-15 18:55:46 +00:00
Fix PSSA Warning (#20)
* Fix trailing white space using Invoke-ScriptAnalyzer -Fix -Path . -Recurse * add settings.json for configure Visual Code (Formatter) * PSSA: Fix Command accepts pipeline input but has not defined a process block * PSSA: Fix PSUseDeclaredVarsMoreThanAssignments The variable 'I_B' is assigned but never used The variable 'I_A' is assigned but never used * PSSA: Fix PSUseShouldProcessForStateChangingFunctions Function New-/Set-... has verb that could change system state. Therefore, the function has to support 'ShouldProcess'
This commit is contained in:
parent
ddf1d22e18
commit
8167b0dbf0
61 changed files with 2779 additions and 2737 deletions
10
.vscode/settings.json
vendored
Normal file
10
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
// Place your settings in this file to overwrite default and user settings.
|
||||||
|
{
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"files.trimTrailingWhitespace": true,
|
||||||
|
"powershell.scriptAnalysis.settingsPath": ".vscode/PSScriptAnalyzerSettings.psd1",
|
||||||
|
"powershell.codeFormatting.newLineAfterCloseBrace": false,
|
||||||
|
"[markdown]": {
|
||||||
|
"files.trimTrailingWhitespace": false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
|
|
||||||
function Get-NetboxCircuit {
|
function Get-NetboxCircuit {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Gets one or more circuits
|
Gets one or more circuits
|
||||||
|
|
||||||
|
|
@ -105,6 +105,7 @@ function Get-NetboxCircuit {
|
||||||
[switch]$Raw
|
[switch]$Raw
|
||||||
)
|
)
|
||||||
|
|
||||||
|
process {
|
||||||
switch ($PSCmdlet.ParameterSetName) {
|
switch ($PSCmdlet.ParameterSetName) {
|
||||||
'ById' {
|
'ById' {
|
||||||
foreach ($i in $ID) {
|
foreach ($i in $ID) {
|
||||||
|
|
@ -128,4 +129,5 @@ function Get-NetboxCircuit {
|
||||||
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -54,6 +54,7 @@ function New-NetboxCircuit {
|
||||||
[switch]$Raw
|
[switch]$Raw
|
||||||
)
|
)
|
||||||
|
|
||||||
|
process {
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('circuits', 'circuits'))
|
$Segments = [System.Collections.ArrayList]::new(@('circuits', 'circuits'))
|
||||||
$Method = 'POST'
|
$Method = 'POST'
|
||||||
|
|
||||||
|
|
@ -64,4 +65,5 @@ function New-NetboxCircuit {
|
||||||
if ($Force -or $PSCmdlet.ShouldProcess($CID, 'Create new circuit')) {
|
if ($Force -or $PSCmdlet.ShouldProcess($CID, 'Create new circuit')) {
|
||||||
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -85,6 +85,7 @@ function Get-NetboxDCIMDevice {
|
||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
|
process {
|
||||||
if ($null -ne $Status) {
|
if ($null -ne $Status) {
|
||||||
$PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
|
$PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
|
||||||
}
|
}
|
||||||
|
|
@ -96,4 +97,5 @@ function Get-NetboxDCIMDevice {
|
||||||
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||||
|
|
||||||
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -13,7 +13,8 @@
|
||||||
|
|
||||||
|
|
||||||
function New-NetboxDCIMDevice {
|
function New-NetboxDCIMDevice {
|
||||||
[CmdletBinding()]
|
[CmdletBinding(ConfirmImpact = 'low',
|
||||||
|
SupportsShouldProcess = $true)]
|
||||||
[OutputType([pscustomobject])]
|
[OutputType([pscustomobject])]
|
||||||
#region Parameters
|
#region Parameters
|
||||||
param
|
param
|
||||||
|
|
@ -64,21 +65,21 @@ function New-NetboxDCIMDevice {
|
||||||
)
|
)
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
# if ($null -ne $Device_Role) {
|
# if ($null -ne $Device_Role) {
|
||||||
# # Validate device role?
|
# # Validate device role?
|
||||||
# }
|
# }
|
||||||
#
|
|
||||||
# if ($null -ne $Device_Type) {
|
# if ($null -ne $Device_Type) {
|
||||||
# # Validate device type?
|
# # Validate device type?
|
||||||
# }
|
# }
|
||||||
#
|
|
||||||
# if ($null -ne $Status) {
|
# if ($null -ne $Status) {
|
||||||
# $PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
|
# $PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
|
||||||
# }
|
# }
|
||||||
#
|
|
||||||
# if ($null -ne $Face) {
|
# if ($null -ne $Face) {
|
||||||
# $PSBoundParameters.Face = ValidateDCIMChoice -ProvidedValue $Face -DeviceFace
|
# $PSBoundParameters.Face = ValidateDCIMChoice -ProvidedValue $Face -DeviceFace
|
||||||
# }
|
# }
|
||||||
|
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'devices'))
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'devices'))
|
||||||
|
|
||||||
|
|
@ -86,5 +87,7 @@ function New-NetboxDCIMDevice {
|
||||||
|
|
||||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess($Name, 'Create new Device')) {
|
||||||
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method POST
|
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method POST
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -67,7 +67,7 @@ function Set-NetboxDCIMDevice {
|
||||||
# if ($null -ne $Status) {
|
# if ($null -ne $Status) {
|
||||||
# $PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
|
# $PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
|
||||||
# }
|
# }
|
||||||
#
|
|
||||||
# if ($null -ne $Face) {
|
# if ($null -ne $Face) {
|
||||||
# $PSBoundParameters.Face = ValidateDCIMChoice -ProvidedValue $Face -DeviceFace
|
# $PSBoundParameters.Face = ValidateDCIMChoice -ProvidedValue $Face -DeviceFace
|
||||||
# }
|
# }
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
|
|
||||||
function Add-NetboxDCIMInterfaceConnection {
|
function Add-NetboxDCIMInterfaceConnection {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Create a new connection between two interfaces
|
Create a new connection between two interfaces
|
||||||
|
|
||||||
|
|
@ -54,8 +54,8 @@ function Add-NetboxDCIMInterfaceConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Verify if both Interfaces exist
|
# Verify if both Interfaces exist
|
||||||
$I_A = Get-NetboxDCIMInterface -Id $Interface_A -ErrorAction Stop
|
Get-NetboxDCIMInterface -Id $Interface_A -ErrorAction Stop | Out-null
|
||||||
$I_B = Get-NetboxDCIMInterface -Id $Interface_B -ErrorAction Stop
|
Get-NetboxDCIMInterface -Id $Interface_B -ErrorAction Stop | Out-null
|
||||||
|
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'interface-connections'))
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'interface-connections'))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ function Get-NetboxDCIMInterface {
|
||||||
[switch]$Raw
|
[switch]$Raw
|
||||||
)
|
)
|
||||||
|
|
||||||
|
process {
|
||||||
if ($null -ne $Form_Factor) {
|
if ($null -ne $Form_Factor) {
|
||||||
$PSBoundParameters.Form_Factor = ValidateDCIMChoice -ProvidedValue $Form_Factor -InterfaceFormFactor
|
$PSBoundParameters.Form_Factor = ValidateDCIMChoice -ProvidedValue $Form_Factor -InterfaceFormFactor
|
||||||
}
|
}
|
||||||
|
|
@ -58,4 +59,5 @@ function Get-NetboxDCIMInterface {
|
||||||
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||||
|
|
||||||
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -13,7 +13,8 @@
|
||||||
|
|
||||||
|
|
||||||
function Set-NetboxDCIMInterface {
|
function Set-NetboxDCIMInterface {
|
||||||
[CmdletBinding()]
|
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||||
|
SupportsShouldProcess = $true)]
|
||||||
[OutputType([pscustomobject])]
|
[OutputType([pscustomobject])]
|
||||||
param
|
param
|
||||||
(
|
(
|
||||||
|
|
@ -50,9 +51,9 @@ function Set-NetboxDCIMInterface {
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
# if ($null -ne $Form_Factor) {
|
# if ($null -ne $Form_Factor) {
|
||||||
# $PSBoundParameters.Form_Factor = ValidateDCIMChoice -ProvidedValue $Form_Factor -InterfaceFormFactor
|
# $PSBoundParameters.Form_Factor = ValidateDCIMChoice -ProvidedValue $Form_Factor -InterfaceFormFactor
|
||||||
# }
|
# }
|
||||||
|
|
||||||
if (-not [System.String]::IsNullOrWhiteSpace($Mode)) {
|
if (-not [System.String]::IsNullOrWhiteSpace($Mode)) {
|
||||||
$PSBoundParameters.Mode = switch ($Mode) {
|
$PSBoundParameters.Mode = switch ($Mode) {
|
||||||
|
|
@ -88,9 +89,11 @@ function Set-NetboxDCIMInterface {
|
||||||
|
|
||||||
$URI = BuildNewURI -Segments $Segments
|
$URI = BuildNewURI -Segments $Segments
|
||||||
|
|
||||||
|
if ($Force -or $pscmdlet.ShouldProcess("Interface ID $($CurrentInterface.Id)", "Set")) {
|
||||||
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
|
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
end {
|
end {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ function Get-NetboxDCIMSite {
|
||||||
[switch]$Raw
|
[switch]$Raw
|
||||||
)
|
)
|
||||||
|
|
||||||
|
process {
|
||||||
switch ($PSCmdlet.ParameterSetName) {
|
switch ($PSCmdlet.ParameterSetName) {
|
||||||
'ById' {
|
'ById' {
|
||||||
foreach ($Site_ID in $ID) {
|
foreach ($Site_ID in $ID) {
|
||||||
|
|
@ -104,5 +105,6 @@ function Get-NetboxDCIMSite {
|
||||||
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@
|
||||||
|
|
||||||
|
|
||||||
function New-NetboxIPAMPrefix {
|
function New-NetboxIPAMPrefix {
|
||||||
|
[CmdletBinding(ConfirmImpact = 'low',
|
||||||
|
SupportsShouldProcess = $true)]
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param
|
param
|
||||||
(
|
(
|
||||||
|
|
@ -40,7 +42,7 @@ function New-NetboxIPAMPrefix {
|
||||||
[switch]$Raw
|
[switch]$Raw
|
||||||
)
|
)
|
||||||
|
|
||||||
# $PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -PrefixStatus
|
# $PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -PrefixStatus
|
||||||
|
|
||||||
<#
|
<#
|
||||||
# As of 2018/10/18, this does not appear to be a validated IPAM choice
|
# As of 2018/10/18, this does not appear to be a validated IPAM choice
|
||||||
|
|
@ -55,5 +57,7 @@ function New-NetboxIPAMPrefix {
|
||||||
|
|
||||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess($Prefix, 'Create new Prefix')) {
|
||||||
InvokeNetboxRequest -URI $URI -Method POST -Body $URIComponents.Parameters -Raw:$Raw
|
InvokeNetboxRequest -URI $URI -Method POST -Body $URIComponents.Parameters -Raw:$Raw
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
function New-NetboxIPAMVLAN {
|
function New-NetboxIPAMVLAN {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Create a new VLAN
|
Create a new VLAN
|
||||||
|
|
||||||
|
|
@ -40,7 +40,8 @@
|
||||||
Additional information about the function.
|
Additional information about the function.
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdletBinding()]
|
[CmdletBinding(ConfirmImpact = 'low',
|
||||||
|
SupportsShouldProcess = $true)]
|
||||||
[OutputType([pscustomobject])]
|
[OutputType([pscustomobject])]
|
||||||
param
|
param
|
||||||
(
|
(
|
||||||
|
|
@ -63,11 +64,11 @@
|
||||||
[switch]$Raw
|
[switch]$Raw
|
||||||
)
|
)
|
||||||
|
|
||||||
# $PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -VLANStatus
|
# $PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -VLANStatus
|
||||||
#
|
|
||||||
# if ($null -ne $Role) {
|
# if ($null -ne $Role) {
|
||||||
# $PSBoundParameters.Role = ValidateIPAMChoice -ProvidedValue $Role -IPAddressRole
|
# $PSBoundParameters.Role = ValidateIPAMChoice -ProvidedValue $Role -IPAddressRole
|
||||||
# }
|
# }
|
||||||
|
|
||||||
$segments = [System.Collections.ArrayList]::new(@('ipam', 'vlans'))
|
$segments = [System.Collections.ArrayList]::new(@('ipam', 'vlans'))
|
||||||
|
|
||||||
|
|
@ -75,5 +76,7 @@
|
||||||
|
|
||||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess($nae, 'Create new Vlan $($vid)')) {
|
||||||
InvokeNetboxRequest -URI $URI -Method POST -Body $URIComponents.Parameters -Raw:$Raw
|
InvokeNetboxRequest -URI $URI -Method POST -Body $URIComponents.Parameters -Raw:$Raw
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
|
|
||||||
function Get-NetboxVirtualMachine {
|
function Get-NetboxVirtualMachine {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Obtains virtual machines from Netbox.
|
Obtains virtual machines from Netbox.
|
||||||
|
|
||||||
|
|
@ -141,6 +141,7 @@ function Get-NetboxVirtualMachine {
|
||||||
[switch]$Raw
|
[switch]$Raw
|
||||||
)
|
)
|
||||||
|
|
||||||
|
process {
|
||||||
if ($null -ne $Status) {
|
if ($null -ne $Status) {
|
||||||
$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
||||||
}
|
}
|
||||||
|
|
@ -152,4 +153,5 @@ function Get-NetboxVirtualMachine {
|
||||||
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||||
|
|
||||||
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -13,7 +13,8 @@
|
||||||
|
|
||||||
|
|
||||||
function New-NetboxVirtualMachine {
|
function New-NetboxVirtualMachine {
|
||||||
[CmdletBinding()]
|
[CmdletBinding(ConfirmImpact = 'low',
|
||||||
|
SupportsShouldProcess = $true)]
|
||||||
[OutputType([pscustomobject])]
|
[OutputType([pscustomobject])]
|
||||||
param
|
param
|
||||||
(
|
(
|
||||||
|
|
@ -46,13 +47,13 @@ function New-NetboxVirtualMachine {
|
||||||
[string]$Comments
|
[string]$Comments
|
||||||
)
|
)
|
||||||
|
|
||||||
# $ModelDefinition = $script:NetboxConfig.APIDefinition.definitions.WritableVirtualMachineWithConfigContext
|
# $ModelDefinition = $script:NetboxConfig.APIDefinition.definitions.WritableVirtualMachineWithConfigContext
|
||||||
#
|
|
||||||
# # Validate the status against the APIDefinition
|
# # Validate the status against the APIDefinition
|
||||||
# if ($ModelDefinition.properties.status.enum -inotcontains $Status) {
|
# if ($ModelDefinition.properties.status.enum -inotcontains $Status) {
|
||||||
# throw ("Invalid value [] for Status. Must be one of []" -f $Status, ($ModelDefinition.properties.status.enum -join ', '))
|
# throw ("Invalid value [] for Status. Must be one of []" -f $Status, ($ModelDefinition.properties.status.enum -join ', '))
|
||||||
# }
|
# }
|
||||||
#
|
|
||||||
#$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
#$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
||||||
|
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines'))
|
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines'))
|
||||||
|
|
@ -61,7 +62,9 @@ function New-NetboxVirtualMachine {
|
||||||
|
|
||||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess($name, 'Create new Virtual Machine')) {
|
||||||
InvokeNetboxRequest -URI $URI -Method POST -Body $URIComponents.Parameters
|
InvokeNetboxRequest -URI $URI -Method POST -Body $URIComponents.Parameters
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,10 +50,11 @@ function Set-NetboxVirtualMachine {
|
||||||
[switch]$Force
|
[switch]$Force
|
||||||
)
|
)
|
||||||
|
|
||||||
# if ($null -ne $Status) {
|
# if ($null -ne $Status) {
|
||||||
# $PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
# $PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
||||||
# }
|
# }
|
||||||
#
|
|
||||||
|
process {
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines', $Id))
|
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines', $Id))
|
||||||
|
|
||||||
Write-Verbose "Obtaining VM from ID $Id"
|
Write-Verbose "Obtaining VM from ID $Id"
|
||||||
|
|
@ -69,4 +70,5 @@ function Set-NetboxVirtualMachine {
|
||||||
|
|
||||||
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
|
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
|
|
||||||
function Get-NetboxVirtualMachineInterface {
|
function Get-NetboxVirtualMachineInterface {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Gets VM interfaces
|
Gets VM interfaces
|
||||||
|
|
||||||
|
|
@ -84,6 +84,7 @@ function Get-NetboxVirtualMachineInterface {
|
||||||
[switch]$Raw
|
[switch]$Raw
|
||||||
)
|
)
|
||||||
|
|
||||||
|
process {
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'interfaces'))
|
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'interfaces'))
|
||||||
|
|
||||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
||||||
|
|
@ -91,4 +92,5 @@ function Get-NetboxVirtualMachineInterface {
|
||||||
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||||
|
|
||||||
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3323,15 +3323,15 @@ function New-NetboxDCIMDevice {
|
||||||
# if ($null -ne $Device_Role) {
|
# if ($null -ne $Device_Role) {
|
||||||
# # Validate device role?
|
# # Validate device role?
|
||||||
# }
|
# }
|
||||||
#
|
|
||||||
# if ($null -ne $Device_Type) {
|
# if ($null -ne $Device_Type) {
|
||||||
# # Validate device type?
|
# # Validate device type?
|
||||||
# }
|
# }
|
||||||
#
|
|
||||||
# if ($null -ne $Status) {
|
# if ($null -ne $Status) {
|
||||||
# $PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
|
# $PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
|
||||||
# }
|
# }
|
||||||
#
|
|
||||||
# if ($null -ne $Face) {
|
# if ($null -ne $Face) {
|
||||||
# $PSBoundParameters.Face = ValidateDCIMChoice -ProvidedValue $Face -DeviceFace
|
# $PSBoundParameters.Face = ValidateDCIMChoice -ProvidedValue $Face -DeviceFace
|
||||||
# }
|
# }
|
||||||
|
|
@ -3610,7 +3610,7 @@ function New-NetboxIPAMVLAN {
|
||||||
)
|
)
|
||||||
|
|
||||||
# $PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -VLANStatus
|
# $PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -VLANStatus
|
||||||
#
|
|
||||||
# if ($null -ne $Role) {
|
# if ($null -ne $Role) {
|
||||||
# $PSBoundParameters.Role = ValidateIPAMChoice -ProvidedValue $Role -IPAddressRole
|
# $PSBoundParameters.Role = ValidateIPAMChoice -ProvidedValue $Role -IPAddressRole
|
||||||
# }
|
# }
|
||||||
|
|
@ -3677,12 +3677,12 @@ function New-NetboxVirtualMachine {
|
||||||
)
|
)
|
||||||
|
|
||||||
# $ModelDefinition = $script:NetboxConfig.APIDefinition.definitions.WritableVirtualMachineWithConfigContext
|
# $ModelDefinition = $script:NetboxConfig.APIDefinition.definitions.WritableVirtualMachineWithConfigContext
|
||||||
#
|
|
||||||
# # Validate the status against the APIDefinition
|
# # Validate the status against the APIDefinition
|
||||||
# if ($ModelDefinition.properties.status.enum -inotcontains $Status) {
|
# if ($ModelDefinition.properties.status.enum -inotcontains $Status) {
|
||||||
# throw ("Invalid value [] for Status. Must be one of []" -f $Status, ($ModelDefinition.properties.status.enum -join ', '))
|
# throw ("Invalid value [] for Status. Must be one of []" -f $Status, ($ModelDefinition.properties.status.enum -join ', '))
|
||||||
# }
|
# }
|
||||||
#
|
|
||||||
#$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
#$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
||||||
|
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines'))
|
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines'))
|
||||||
|
|
@ -4160,7 +4160,7 @@ function Set-NetboxDCIMDevice {
|
||||||
# if ($null -ne $Status) {
|
# if ($null -ne $Status) {
|
||||||
# $PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
|
# $PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
|
||||||
# }
|
# }
|
||||||
#
|
|
||||||
# if ($null -ne $Face) {
|
# if ($null -ne $Face) {
|
||||||
# $PSBoundParameters.Face = ValidateDCIMChoice -ProvidedValue $Face -DeviceFace
|
# $PSBoundParameters.Face = ValidateDCIMChoice -ProvidedValue $Face -DeviceFace
|
||||||
# }
|
# }
|
||||||
|
|
@ -4774,7 +4774,7 @@ function Set-NetboxVirtualMachine {
|
||||||
# if ($null -ne $Status) {
|
# if ($null -ne $Status) {
|
||||||
# $PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
# $PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
||||||
# }
|
# }
|
||||||
#
|
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines', $Id))
|
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines', $Id))
|
||||||
|
|
||||||
Write-Verbose "Obtaining VM from ID $Id"
|
Write-Verbose "Obtaining VM from ID $Id"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue