* Fixing Interface Type parameter (#42)

* Fixing #41

* Update `deploy.ps1` to remove trailing whitespaces from psd1

* Increase version to 1.7.3

* Fix location of whitespace cleanup in `deploy.ps1`

* Device port support (#44)

* Fixing #41

* Correct for OTBS

* Start work on Front and Rear ports

* Revert "Start work on Front and Rear ports"

This reverts commit 257709fe2af5af5fbe4496b2d5b68481d80bf101.

* Fixing #41

* Add-NetboxDCIMRearPort function

* Revert "Revert "Start work on Front and Rear ports""

This reverts commit 4f6625af2d.

* Fix incorrect parameter variable types

* Parameter type adjustments

* Create function to get tag information

* Added Mark_Connected parameter

* Add Set-NetboxDCIMRearPort function

* Added Remove-NetboxDCIMRearPort function

* Added validate pattern for Color parameter

* Added Add-NetboxDCIMFrontPort function

* Fixed param list missing Force parameter

* Added Set-NetboxDCIMFrontPort function

* Added Remove-NetboxDCIMFrontPort function

* Init. functions for cables and cable terminations

* Reformatting using OTBS
Also working on defining tags by slug as an extra parameter, which appears
only in Add-NetboxDCIMRearPort currently

* Remove Tags_Slug parameter
In hindsight implementing would create extra work that could be hard to
maintain. Can be easily achieved outside of the function.

* Update psproj

* Fix braces

* Update Postman for Netbox v3.4.5

* Update vscode settings

* Update version 1.8.0

---------

Co-authored-by: SheffSix <jbeck1867@gmail.com>
Co-authored-by: Ben Claussen <benclaussen@gmail.com>
Co-authored-by: James Beck <jim@beck81.co.uk>
This commit is contained in:
Ben Claussen 2023-03-17 16:04:52 -04:00 committed by GitHub
parent 29dd7ac038
commit ec5f9e810f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 65405 additions and 946 deletions

12
.vscode/settings.json vendored
View file

@ -4,6 +4,18 @@
"files.trimTrailingWhitespace": true,
"powershell.scriptAnalysis.settingsPath": ".vscode/PSScriptAnalyzerSettings.psd1",
"powershell.codeFormatting.newLineAfterCloseBrace": false,
"powershell.codeFormatting.useCorrectCasing": true,
"powershell.codeFormatting.preset": "OTBS",
"powershell.codeFormatting.addWhitespaceAroundPipe": true,
"powershell.codeFormatting.autoCorrectAliases": true,
"powershell.codeFormatting.newLineAfterCloseBrace": true,
"powershell.codeFormatting.newLineAfterOpenBrace": true,
"powershell.codeFormatting.openBraceOnSameLine": true,
"powershell.codeFormatting.whitespaceAfterSeparator": true,
"powershell.codeFormatting.whitespaceAroundOperator": true,
"powershell.codeFormatting.whitespaceBeforeOpenBrace": true,
"powershell.codeFormatting.whitespaceBeforeOpenParen": true,
"powershell.codeFormatting.trimWhitespaceAroundPipe": true,
"[markdown]": {
"files.trimTrailingWhitespace": false,
}

View file

@ -0,0 +1,35 @@
function Get-NetboxDCIMCableTermination {
[CmdletBinding()]
#region Parameters
param
(
[uint16]$Limit,
[uint16]$Offset,
[Parameter(ValueFromPipelineByPropertyName = $true)]
[uint16[]]$Id,
[uint16]$Cable,
[string]$Cable_End,
[string]$Termination_Type,
[uint16]$Termination_ID,
[switch]$Raw
)
#endregion Parameters
process {
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'cable-terminations'))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Raw'
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $URI -Raw:$Raw
}
}

View file

@ -0,0 +1,55 @@
function Get-NetboxDCIMCable {
[CmdletBinding()]
#region Parameters
param
(
[uint16]$Limit,
[uint16]$Offset,
[Parameter(ValueFromPipelineByPropertyName = $true)]
[uint16[]]$Id,
[string]$Label,
[string]$Termination_A_Type,
[uint16]$Termination_A_ID,
[string]$Termination_B_Type,
[UInt16]$Termination_B_ID,
[string]$Type,
[string]$Status,
[string]$Color,
[UInt16]$Device_ID,
[string]$Device,
[uint16]$Rack_Id,
[string]$Rack,
[uint16]$Location_ID,
[string]$Location,
[switch]$Raw
)
#endregion Parameters
process {
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'cables'))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Raw'
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $URI -Raw:$Raw
}
}

View file

@ -0,0 +1,42 @@
function Add-NetboxDCIMFrontPort {
[CmdletBinding()]
[OutputType([pscustomobject])]
param
(
[Parameter(Mandatory = $true)]
[uint16]$Device,
[uint16]$Module,
[Parameter(Mandatory = $true)]
[string]$Name,
[string]$Label,
[Parameter(Mandatory = $true)]
[string]$Type,
[ValidatePattern('^[0-9a-f]{6}$')]
[string]$Color,
[Parameter(Mandatory = $true)]
[uint16]$Rear_Port,
[uint16]$Rear_Port_Position,
[string]$Description,
[bool]$Mark_Connected,
[uint16[]]$Tags
)
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'front-ports'))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters
$URI = BuildNewURI -Segments $URIComponents.Segments
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method POST
}

View file

@ -0,0 +1,34 @@
function Get-NetboxDCIMFrontPort {
[CmdletBinding()]
[OutputType([pscustomobject])]
param
(
[uint16]$Limit,
[uint16]$Offset,
[Parameter(ValueFromPipelineByPropertyName = $true)]
[uint16]$Id,
[string]$Name,
[string]$Device,
[uint16]$Device_Id,
[string]$Type,
[switch]$Raw
)
process {
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'front-ports'))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $URI -Raw:$Raw
}
}

View file

@ -0,0 +1,35 @@
function Remove-NetboxDCIMFrontPort {
[CmdletBinding(ConfirmImpact = 'High',
SupportsShouldProcess = $true)]
param
(
[Parameter(Mandatory = $true,
ValueFromPipelineByPropertyName = $true)]
[uint16[]]$Id,
[switch]$Force
)
begin {
}
process {
foreach ($FrontPortID in $Id) {
$CurrentPort = Get-NetboxDCIMFrontPort -Id $FrontPortID -ErrorAction Stop
if ($Force -or $pscmdlet.ShouldProcess("Name: $($CurrentPort.Name) | ID: $($CurrentPort.Id)", "Remove")) {
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'front-ports', $CurrentPort.Id))
$URI = BuildNewURI -Segments $Segments
InvokeNetboxRequest -URI $URI -Method DELETE
}
}
}
end {
}
}

View file

@ -0,0 +1,60 @@
function Set-NetboxDCIMFrontPort {
[CmdletBinding(ConfirmImpact = 'Medium',
SupportsShouldProcess = $true)]
[OutputType([pscustomobject])]
param
(
[Parameter(Mandatory = $true,
ValueFromPipelineByPropertyName = $true)]
[uint16[]]$Id,
[uint16]$Device,
[uint16]$Module,
[string]$Name,
[string]$Label,
[string]$Type,
[ValidatePattern('^[0-9a-f]{6}$')]
[string]$Color,
[uint16]$Rear_Port,
[uint16]$Rear_Port_Position,
[string]$Description,
[bool]$Mark_Connected,
[uint16[]]$Tags,
[switch]$Force
)
begin {
}
process {
foreach ($FrontPortID in $Id) {
$CurrentPort = Get-NetboxDCIMFrontPort -Id $FrontPortID -ErrorAction Stop
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'front-ports', $CurrentPort.Id))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
$URI = BuildNewURI -Segments $Segments
if ($Force -or $pscmdlet.ShouldProcess("Front Port ID $($CurrentPort.Id)", "Set")) {
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
}
}
}
end {
}
}

View file

@ -1,5 +1,4 @@

function Get-NetboxDCIMInterface {
function Get-NetboxDCIMInterface {
[CmdletBinding()]
[OutputType([pscustomobject])]
param

View file

@ -1,6 +1,5 @@

function Remove-NetboxDCIMInterface {
<#
function Remove-NetboxDCIMInterface {
<#
.SYNOPSIS
Removes an interface
@ -21,11 +20,11 @@ function Remove-NetboxDCIMInterface {
#>
[CmdletBinding(ConfirmImpact = 'High',
SupportsShouldProcess = $true)]
SupportsShouldProcess = $true)]
param
(
[Parameter(Mandatory = $true,
ValueFromPipelineByPropertyName = $true)]
ValueFromPipelineByPropertyName = $true)]
[uint16[]]$Id,
[switch]$Force

View file

@ -1,5 +1,4 @@

function Set-NetboxDCIMInterface {
function Set-NetboxDCIMInterface {
[CmdletBinding(ConfirmImpact = 'Medium',
SupportsShouldProcess = $true)]
[OutputType([pscustomobject])]
@ -37,7 +36,9 @@ function Set-NetboxDCIMInterface {
[uint16]$Untagged_VLAN,
[ValidateRange(1, 4094)]
[uint16[]]$Tagged_VLANs
[uint16[]]$Tagged_VLANs,
[switch]$Force
)
begin {

View file

@ -0,0 +1,48 @@
function Add-NetboxDCIMRearPort {
[CmdletBinding()]
[OutputType([pscustomobject])]
param
(
[Parameter(Mandatory = $true)]
[uint16]$Device,
[uint16]$Module,
[Parameter(Mandatory = $true)]
[string]$Name,
[string]$Label,
[Parameter(Mandatory = $true)]
[string]$Type,
[ValidatePattern('^[0-9a-f]{6}$')]
[string]$Color,
[uint16]$Positions = 1,
[string]$Description,
[bool]$Mark_Connected,
[uint16[]]$Tags
)
begin {
}
process {
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'rear-ports'))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters
$URI = BuildNewURI -Segments $URIComponents.Segments
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method POST
}
end {
}
}

View file

@ -0,0 +1,34 @@
function Get-NetboxDCIMRearPort {
[CmdletBinding()]
[OutputType([pscustomobject])]
param
(
[uint16]$Limit,
[uint16]$Offset,
[Parameter(ValueFromPipelineByPropertyName = $true)]
[uint16]$Id,
[string]$Name,
[string]$Device,
[uint16]$Device_Id,
[string]$Type,
[switch]$Raw
)
process {
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'rear-ports'))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $URI -Raw:$Raw
}
}

View file

@ -0,0 +1,35 @@
function Remove-NetboxDCIMRearPort {
[CmdletBinding(ConfirmImpact = 'High',
SupportsShouldProcess = $true)]
param
(
[Parameter(Mandatory = $true,
ValueFromPipelineByPropertyName = $true)]
[uint16[]]$Id,
[switch]$Force
)
begin {
}
process {
foreach ($RearPortID in $Id) {
$CurrentPort = Get-NetboxDCIMRearPort -Id $RearPortID -ErrorAction Stop
if ($Force -or $pscmdlet.ShouldProcess("Name: $($CurrentPort.Name) | ID: $($CurrentPort.Id)", "Remove")) {
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'rear-ports', $CurrentPort.Id))
$URI = BuildNewURI -Segments $Segments
InvokeNetboxRequest -URI $URI -Method DELETE
}
}
}
end {
}
}

View file

@ -0,0 +1,59 @@

function Set-NetboxDCIMRearPort {
[CmdletBinding(ConfirmImpact = 'Medium',
SupportsShouldProcess = $true)]
[OutputType([pscustomobject])]
param
(
[Parameter(Mandatory = $true,
ValueFromPipelineByPropertyName = $true)]
[uint16[]]$Id,
[uint16]$Device,
[uint16]$Module,
[string]$Name,
[string]$Label,
[string]$Type,
[ValidatePattern('^[0-9a-f]{6}$')]
[string]$Color,
[uint16]$Positions,
[string]$Description,
[bool]$Mark_Connected,
[uint16[]]$Tags,
[switch]$Force
)
begin {
}
process {
foreach ($RearPortID in $Id) {
$CurrentPort = Get-NetboxDCIMRearPort -Id $RearPortID -ErrorAction Stop
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'rear-ports', $CurrentPort.Id))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
$URI = BuildNewURI -Segments $Segments
if ($Force -or $pscmdlet.ShouldProcess("Rear Port ID $($CurrentPort.Id)", "Set")) {
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
}
}
}
end {
}
}

View file

@ -0,0 +1,31 @@

function Get-NetboxTag {
[CmdletBinding()]
[OutputType([pscustomobject])]
param
(
[uint16]$Limit,
[uint16]$Offset,
[Parameter(ValueFromPipelineByPropertyName = $true)]
[uint16]$Id,
[string]$Name,
[string]$Slug,
[switch]$Raw
)
process {
$Segments = [System.Collections.ArrayList]::new(@('extras', 'tags'))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $URI -Raw:$Raw
}
}

View file

@ -3,7 +3,7 @@
#
# Generated by: Ben Claussen
#
# Generated on: 2023-03-13
# Generated on: 2023-03-17
#
@{
@ -12,7 +12,7 @@
RootModule = 'NetboxPS.psm1'
# Version number of this module.
ModuleVersion = '1.7.3'
ModuleVersion = '1.8.0'
# Supported PSEditions
# CompatiblePSEditions = @()
@ -69,36 +69,41 @@ CLRVersion = '2.0.50727'
NestedModules = @()
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Add-NetboxDCIMInterface', 'Add-NetboxDCIMInterfaceConnection',
FunctionsToExport = 'Add-NetboxDCIMFrontPort', 'Add-NetboxDCIMInterface',
'Add-NetboxDCIMInterfaceConnection', 'Add-NetboxDCIMRearPort',
'Add-NetboxVirtualMachineInterface', 'Clear-NetboxCredential',
'Connect-NetboxAPI', 'Get-ModelDefinition', 'Get-NetboxAPIDefinition',
'Get-NetboxCircuit', 'Get-NetboxCircuitProvider',
'Get-NetboxCircuitTermination', 'Get-NetboxCircuitType',
'Get-NetboxContact', 'Get-NetboxContactAssignment',
'Get-NetboxContactRole', 'Get-NetboxContentType',
'Get-NetboxCredential', 'Get-NetboxDCIMDevice',
'Get-NetboxCredential', 'Get-NetboxDCIMCable',
'Get-NetboxDCIMCableTermination', 'Get-NetboxDCIMDevice',
'Get-NetboxDCIMDeviceRole', 'Get-NetboxDCIMDeviceType',
'Get-NetboxDCIMInterface', 'Get-NetboxDCIMInterfaceConnection',
'Get-NetboxDCIMPlatform', 'Get-NetboxDCIMSite', 'Get-NetboxHostname',
'Get-NetboxDCIMFrontPort', 'Get-NetboxDCIMInterface',
'Get-NetboxDCIMInterfaceConnection', 'Get-NetboxDCIMPlatform',
'Get-NetboxDCIMRearPort', 'Get-NetboxDCIMSite', 'Get-NetboxHostname',
'Get-NetboxHostPort', 'Get-NetboxHostScheme',
'Get-NetboxInvokeParams', 'Get-NetboxIPAMAddress',
'Get-NetboxIPAMAggregate', 'Get-NetboxIPAMAvailableIP',
'Get-NetboxIPAMPrefix', 'Get-NetboxIPAMRole', 'Get-NetboxIPAMVLAN',
'Get-NetboxTenant', 'Get-NetboxTimeout', 'Get-NetboxVersion',
'Get-NetboxVirtualizationCluster',
'Get-NetboxTag', 'Get-NetboxTenant', 'Get-NetboxTimeout',
'Get-NetboxVersion', 'Get-NetboxVirtualizationCluster',
'Get-NetboxVirtualizationClusterGroup', 'Get-NetboxVirtualMachine',
'Get-NetboxVirtualMachineInterface', 'New-NetboxCircuit',
'New-NetboxContact', 'New-NetboxContactAssignment',
'New-NetboxContactRole', 'New-NetboxDCIMDevice', 'New-NetboxDCIMSite',
'New-NetboxIPAMAddress', 'New-NetboxIPAMPrefix', 'New-NetboxIPAMVLAN',
'New-NetboxTenant', 'New-NetboxVirtualMachine',
'Remove-NetboxDCIMDevice', 'Remove-NetboxDCIMInterface',
'Remove-NetboxDCIMInterfaceConnection', 'Remove-NetboxDCIMSite',
'Remove-NetboxIPAMAddress', 'Remove-NetboxVirtualMachine',
'Set-NetboxCipherSSL', 'Set-NetboxContact', 'Set-NetboxCredential',
'Set-NetboxDCIMDevice', 'Set-NetboxDCIMInterface',
'Set-NetboxDCIMInterfaceConnection', 'Set-NetboxHostName',
'Set-NetboxHostPort', 'Set-NetboxHostScheme',
'Remove-NetboxDCIMDevice', 'Remove-NetboxDCIMFrontPort',
'Remove-NetboxDCIMInterface',
'Remove-NetboxDCIMInterfaceConnection', 'Remove-NetboxDCIMRearPort',
'Remove-NetboxDCIMSite', 'Remove-NetboxIPAMAddress',
'Remove-NetboxVirtualMachine', 'Set-NetboxCipherSSL',
'Set-NetboxContact', 'Set-NetboxCredential', 'Set-NetboxDCIMDevice',
'Set-NetboxDCIMFrontPort', 'Set-NetboxDCIMInterface',
'Set-NetboxDCIMInterfaceConnection', 'Set-NetboxDCIMRearPort',
'Set-NetboxHostName', 'Set-NetboxHostPort', 'Set-NetboxHostScheme',
'Set-NetboxInvokeParams', 'Set-NetboxIPAMAddress',
'Set-NetboxIPAMPrefix', 'Set-NetboxTimeout',
'Set-NetboxUnstrustedSSL', 'Set-NetboxVirtualMachine',

View file

@ -34,6 +34,10 @@
<Folder>Functions\Tenancy\Tenants</Folder>
<Folder>Functions\Tenancy\ContactRoles</Folder>
<Folder>Functions\Tenancy\ContactAssignment</Folder>
<Folder>Functions\DCIM\Cable Terminations</Folder>
<Folder>Functions\DCIM\Cables</Folder>
<Folder>Functions\DCIM\FrontPorts</Folder>
<Folder>Functions\DCIM\RearPorts</Folder>
</Folders>
<Files>
<File Build="2">NetboxPS.psd1</File>
@ -126,10 +130,22 @@
<File Build="0" Shared="True" ReferenceFunction="Invoke-New-NetboxContactRole_ps1" ExportFunctions="True">Functions\Tenancy\ContactRoles\New-NetboxContactRole.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-New-NetboxTenant_ps1" ExportFunctions="True">Functions\Tenancy\Tenants\New-NetboxTenant.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxContactAssignment_ps1" ExportFunctions="True">Functions\Tenancy\ContactAssignment\Get-NetboxContactAssignment.ps1</File>
<File Build="2" Shared="True" ReferenceFunction="Invoke-Get-NetboxContentType_ps1" ExportFunctions="False">Functions\Setup\Support\Get-NetboxContentType.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxContentType_ps1" ExportFunctions="False">Functions\Setup\Support\Get-NetboxContentType.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-New-NetboxContactAssignment_ps1" ExportFunctions="True">Functions\Tenancy\ContactAssignment\New-NetboxContactAssignment.ps1</File>
<File Build="0" Shared="False" ReferenceFunction="Invoke-Set-NetboxContact_ps1" ExportFunctions="False">Functions\Tenancy\Contacts\Set-NetboxContact.ps1</File>
<File Build="2" Shared="True" ReferenceFunction="Invoke-Test-NetboxAPIConnected_ps1" ExportFunctions="False">Functions\Setup\Support\Test-NetboxAPIConnected.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Set-NetboxContact_ps1" ExportFunctions="False">Functions\Tenancy\Contacts\Set-NetboxContact.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Test-NetboxAPIConnected_ps1" ExportFunctions="False">Functions\Setup\Support\Test-NetboxAPIConnected.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxDCIMCableTermination_ps1" ExportFunctions="False">Functions\DCIM\Cable Terminations\Get-NetboxDCIMCableTermination.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxDCIMCable_ps1" ExportFunctions="False">Functions\DCIM\Cables\Get-NetboxDCIMCable.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Add-NetboxDCIMFrontPort_ps1" ExportFunctions="False">Functions\DCIM\FrontPorts\Add-NetboxDCIMFrontPort.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxDCIMFrontPort_ps1" ExportFunctions="False">Functions\DCIM\FrontPorts\Get-NetboxDCIMFrontPort.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Remove-NetboxDCIMFrontPort_ps1" ExportFunctions="False">Functions\DCIM\FrontPorts\Remove-NetboxDCIMFrontPort.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Set-NetboxDCIMFrontPort_ps1" ExportFunctions="False">Functions\DCIM\FrontPorts\Set-NetboxDCIMFrontPort.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Add-NetboxDCIMRearPort_ps1" ExportFunctions="False">Functions\DCIM\RearPorts\Add-NetboxDCIMRearPort.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxDCIMRearPort_ps1" ExportFunctions="False">Functions\DCIM\RearPorts\Get-NetboxDCIMRearPort.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Remove-NetboxDCIMRearPort_ps1" ExportFunctions="False">Functions\DCIM\RearPorts\Remove-NetboxDCIMRearPort.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Set-NetboxDCIMRearPort_ps1" ExportFunctions="False">Functions\DCIM\RearPorts\Set-NetboxDCIMRearPort.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-New-NetboxDCIMSite_ps1" ExportFunctions="False">Functions\DCIM\Sites\New-NetboxDCIMSite.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Remove-NetboxDCIMSite_ps1" ExportFunctions="False">Functions\DCIM\Sites\Remove-NetboxDCIMSite.ps1</File>
</Files>
<StartupScript>R:\Netbox\NetboxPS\Test-Module.ps1</StartupScript>
</Project>

View file

@ -3,7 +3,7 @@
#
# Generated by: Ben Claussen
#
# Generated on: 2023-03-13
# Generated on: 2023-03-17
#
@{
@ -12,7 +12,7 @@
RootModule = 'NetboxPS.psm1'
# Version number of this module.
ModuleVersion = '1.7.3'
ModuleVersion = '1.8.0'
# Supported PSEditions
# CompatiblePSEditions = @()
@ -69,36 +69,41 @@ CLRVersion = '2.0.50727'
NestedModules = @()
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Add-NetboxDCIMInterface', 'Add-NetboxDCIMInterfaceConnection',
FunctionsToExport = 'Add-NetboxDCIMFrontPort', 'Add-NetboxDCIMInterface',
'Add-NetboxDCIMInterfaceConnection', 'Add-NetboxDCIMRearPort',
'Add-NetboxVirtualMachineInterface', 'Clear-NetboxCredential',
'Connect-NetboxAPI', 'Get-ModelDefinition', 'Get-NetboxAPIDefinition',
'Get-NetboxCircuit', 'Get-NetboxCircuitProvider',
'Get-NetboxCircuitTermination', 'Get-NetboxCircuitType',
'Get-NetboxContact', 'Get-NetboxContactAssignment',
'Get-NetboxContactRole', 'Get-NetboxContentType',
'Get-NetboxCredential', 'Get-NetboxDCIMDevice',
'Get-NetboxCredential', 'Get-NetboxDCIMCable',
'Get-NetboxDCIMCableTermination', 'Get-NetboxDCIMDevice',
'Get-NetboxDCIMDeviceRole', 'Get-NetboxDCIMDeviceType',
'Get-NetboxDCIMInterface', 'Get-NetboxDCIMInterfaceConnection',
'Get-NetboxDCIMPlatform', 'Get-NetboxDCIMSite', 'Get-NetboxHostname',
'Get-NetboxDCIMFrontPort', 'Get-NetboxDCIMInterface',
'Get-NetboxDCIMInterfaceConnection', 'Get-NetboxDCIMPlatform',
'Get-NetboxDCIMRearPort', 'Get-NetboxDCIMSite', 'Get-NetboxHostname',
'Get-NetboxHostPort', 'Get-NetboxHostScheme',
'Get-NetboxInvokeParams', 'Get-NetboxIPAMAddress',
'Get-NetboxIPAMAggregate', 'Get-NetboxIPAMAvailableIP',
'Get-NetboxIPAMPrefix', 'Get-NetboxIPAMRole', 'Get-NetboxIPAMVLAN',
'Get-NetboxTenant', 'Get-NetboxTimeout', 'Get-NetboxVersion',
'Get-NetboxVirtualizationCluster',
'Get-NetboxTag', 'Get-NetboxTenant', 'Get-NetboxTimeout',
'Get-NetboxVersion', 'Get-NetboxVirtualizationCluster',
'Get-NetboxVirtualizationClusterGroup', 'Get-NetboxVirtualMachine',
'Get-NetboxVirtualMachineInterface', 'New-NetboxCircuit',
'New-NetboxContact', 'New-NetboxContactAssignment',
'New-NetboxContactRole', 'New-NetboxDCIMDevice', 'New-NetboxDCIMSite',
'New-NetboxIPAMAddress', 'New-NetboxIPAMPrefix', 'New-NetboxIPAMVLAN',
'New-NetboxTenant', 'New-NetboxVirtualMachine',
'Remove-NetboxDCIMDevice', 'Remove-NetboxDCIMInterface',
'Remove-NetboxDCIMInterfaceConnection', 'Remove-NetboxDCIMSite',
'Remove-NetboxIPAMAddress', 'Remove-NetboxVirtualMachine',
'Set-NetboxCipherSSL', 'Set-NetboxContact', 'Set-NetboxCredential',
'Set-NetboxDCIMDevice', 'Set-NetboxDCIMInterface',
'Set-NetboxDCIMInterfaceConnection', 'Set-NetboxHostName',
'Set-NetboxHostPort', 'Set-NetboxHostScheme',
'Remove-NetboxDCIMDevice', 'Remove-NetboxDCIMFrontPort',
'Remove-NetboxDCIMInterface',
'Remove-NetboxDCIMInterfaceConnection', 'Remove-NetboxDCIMRearPort',
'Remove-NetboxDCIMSite', 'Remove-NetboxIPAMAddress',
'Remove-NetboxVirtualMachine', 'Set-NetboxCipherSSL',
'Set-NetboxContact', 'Set-NetboxCredential', 'Set-NetboxDCIMDevice',
'Set-NetboxDCIMFrontPort', 'Set-NetboxDCIMInterface',
'Set-NetboxDCIMInterfaceConnection', 'Set-NetboxDCIMRearPort',
'Set-NetboxHostName', 'Set-NetboxHostPort', 'Set-NetboxHostScheme',
'Set-NetboxInvokeParams', 'Set-NetboxIPAMAddress',
'Set-NetboxIPAMPrefix', 'Set-NetboxTimeout',
'Set-NetboxUnstrustedSSL', 'Set-NetboxVirtualMachine',

View file

@ -1,5 +1,52 @@

#region File Add-NetboxDCIMFrontPort.ps1
function Add-NetboxDCIMFrontPort {
[CmdletBinding()]
[OutputType([pscustomobject])]
param
(
[Parameter(Mandatory = $true)]
[uint16]$Device,
[uint16]$Module,
[Parameter(Mandatory = $true)]
[string]$Name,
[string]$Label,
[Parameter(Mandatory = $true)]
[string]$Type,
[ValidatePattern('^[0-9a-f]{6}$')]
[string]$Color,
[Parameter(Mandatory = $true)]
[uint16]$Rear_Port,
[uint16]$Rear_Port_Position,
[string]$Description,
[bool]$Mark_Connected,
[uint16[]]$Tags
)
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'front-ports'))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters
$URI = BuildNewURI -Segments $URIComponents.Segments
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method POST
}
#endregion
#region File Add-NetboxDCIMInterface.ps1
@ -130,6 +177,59 @@ function Add-NetboxDCIMInterfaceConnection {
#endregion
#region File Add-NetboxDCIMRearPort.ps1
function Add-NetboxDCIMRearPort {
[CmdletBinding()]
[OutputType([pscustomobject])]
param
(
[Parameter(Mandatory = $true)]
[uint16]$Device,
[uint16]$Module,
[Parameter(Mandatory = $true)]
[string]$Name,
[string]$Label,
[Parameter(Mandatory = $true)]
[string]$Type,
[ValidatePattern('^[0-9a-f]{6}$')]
[string]$Color,
[uint16]$Positions = 1,
[string]$Description,
[bool]$Mark_Connected,
[uint16[]]$Tags
)
begin {
}
process {
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'rear-ports'))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters
$URI = BuildNewURI -Segments $URIComponents.Segments
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method POST
}
end {
}
}
#endregion
#region File Add-NetboxVirtualMachineInterface.ps1
@ -1415,6 +1515,106 @@ function Get-NetboxCredential {
#endregion
#region File Get-NetboxDCIMCable.ps1
function Get-NetboxDCIMCable {
[CmdletBinding()]
#region Parameters
param
(
[uint16]$Limit,
[uint16]$Offset,
[Parameter(ValueFromPipelineByPropertyName = $true)]
[uint16[]]$Id,
[string]$Label,
[string]$Termination_A_Type,
[uint16]$Termination_A_ID,
[string]$Termination_B_Type,
[UInt16]$Termination_B_ID,
[string]$Type,
[string]$Status,
[string]$Color,
[UInt16]$Device_ID,
[string]$Device,
[uint16]$Rack_Id,
[string]$Rack,
[uint16]$Location_ID,
[string]$Location,
[switch]$Raw
)
#endregion Parameters
process {
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'cables'))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Raw'
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $URI -Raw:$Raw
}
}
#endregion
#region File Get-NetboxDCIMCableTermination.ps1
function Get-NetboxDCIMCableTermination {
[CmdletBinding()]
#region Parameters
param
(
[uint16]$Limit,
[uint16]$Offset,
[Parameter(ValueFromPipelineByPropertyName = $true)]
[uint16[]]$Id,
[uint16]$Cable,
[string]$Cable_End,
[string]$Termination_Type,
[uint16]$Termination_ID,
[switch]$Raw
)
#endregion Parameters
process {
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'cable-terminations'))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Raw'
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $URI -Raw:$Raw
}
}
#endregion
#region File Get-NetboxDCIMDevice.ps1
@ -1611,8 +1811,46 @@ function Get-NetboxDCIMDeviceType {
#endregion
#region File Get-NetboxDCIMInterface.ps1
#region File Get-NetboxDCIMFrontPort.ps1
function Get-NetboxDCIMFrontPort {
[CmdletBinding()]
[OutputType([pscustomobject])]
param
(
[uint16]$Limit,
[uint16]$Offset,
[Parameter(ValueFromPipelineByPropertyName = $true)]
[uint16]$Id,
[string]$Name,
[string]$Device,
[uint16]$Device_Id,
[string]$Type,
[switch]$Raw
)
process {
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'front-ports'))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $URI -Raw:$Raw
}
}
#endregion
#region File Get-NetboxDCIMInterface.ps1
function Get-NetboxDCIMInterface {
[CmdletBinding()]
@ -1752,6 +1990,45 @@ function Get-NetboxDCIMPlatform {
#endregion
#region File Get-NetboxDCIMRearPort.ps1
function Get-NetboxDCIMRearPort {
[CmdletBinding()]
[OutputType([pscustomobject])]
param
(
[uint16]$Limit,
[uint16]$Offset,
[Parameter(ValueFromPipelineByPropertyName = $true)]
[uint16]$Id,
[string]$Name,
[string]$Device,
[uint16]$Device_Id,
[string]$Type,
[switch]$Raw
)
process {
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'rear-ports'))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $URI -Raw:$Raw
}
}
#endregion
#region File Get-NetboxDCIMSite.ps1
@ -2547,6 +2824,42 @@ function Get-NetboxIPAMVLAN {
#endregion
#region File Get-NetboxTag.ps1
function Get-NetboxTag {
[CmdletBinding()]
[OutputType([pscustomobject])]
param
(
[uint16]$Limit,
[uint16]$Offset,
[Parameter(ValueFromPipelineByPropertyName = $true)]
[uint16]$Id,
[string]$Name,
[string]$Slug,
[switch]$Raw
)
process {
$Segments = [System.Collections.ArrayList]::new(@('extras', 'tags'))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $URI -Raw:$Raw
}
}
#endregion
#region File Get-NetboxTenant.ps1
@ -4141,11 +4454,50 @@ function Remove-NetboxDCIMDevice {
#endregion
#region File Remove-NetboxDCIMFrontPort.ps1
function Remove-NetboxDCIMFrontPort {
[CmdletBinding(ConfirmImpact = 'High',
SupportsShouldProcess = $true)]
param
(
[Parameter(Mandatory = $true,
ValueFromPipelineByPropertyName = $true)]
[uint16[]]$Id,
[switch]$Force
)
begin {
}
process {
foreach ($FrontPortID in $Id) {
$CurrentPort = Get-NetboxDCIMFrontPort -Id $FrontPortID -ErrorAction Stop
if ($Force -or $pscmdlet.ShouldProcess("Name: $($CurrentPort.Name) | ID: $($CurrentPort.Id)", "Remove")) {
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'front-ports', $CurrentPort.Id))
$URI = BuildNewURI -Segments $Segments
InvokeNetboxRequest -URI $URI -Method DELETE
}
}
}
end {
}
}
#endregion
#region File Remove-NetboxDCIMInterface.ps1
function Remove-NetboxDCIMInterface {
<#
<#
.SYNOPSIS
Removes an interface
@ -4166,11 +4518,11 @@ function Remove-NetboxDCIMInterface {
#>
[CmdletBinding(ConfirmImpact = 'High',
SupportsShouldProcess = $true)]
SupportsShouldProcess = $true)]
param
(
[Parameter(Mandatory = $true,
ValueFromPipelineByPropertyName = $true)]
ValueFromPipelineByPropertyName = $true)]
[uint16[]]$Id,
[switch]$Force
@ -4244,6 +4596,46 @@ function Remove-NetboxDCIMInterfaceConnection {
#endregion
#region File Remove-NetboxDCIMRearPort.ps1
function Remove-NetboxDCIMRearPort {
[CmdletBinding(ConfirmImpact = 'High',
SupportsShouldProcess = $true)]
param
(
[Parameter(Mandatory = $true,
ValueFromPipelineByPropertyName = $true)]
[uint16[]]$Id,
[switch]$Force
)
begin {
}
process {
foreach ($RearPortID in $Id) {
$CurrentPort = Get-NetboxDCIMRearPort -Id $RearPortID -ErrorAction Stop
if ($Force -or $pscmdlet.ShouldProcess("Name: $($CurrentPort.Name) | ID: $($CurrentPort.Id)", "Remove")) {
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'rear-ports', $CurrentPort.Id))
$URI = BuildNewURI -Segments $Segments
InvokeNetboxRequest -URI $URI -Method DELETE
}
}
}
end {
}
}
#endregion
#region File Remove-NetboxDCIMSite.ps1
<#
@ -4681,8 +5073,72 @@ function Set-NetboxDCIMDevice {
#endregion
#region File Set-NetboxDCIMInterface.ps1
#region File Set-NetboxDCIMFrontPort.ps1
function Set-NetboxDCIMFrontPort {
[CmdletBinding(ConfirmImpact = 'Medium',
SupportsShouldProcess = $true)]
[OutputType([pscustomobject])]
param
(
[Parameter(Mandatory = $true,
ValueFromPipelineByPropertyName = $true)]
[uint16[]]$Id,
[uint16]$Device,
[uint16]$Module,
[string]$Name,
[string]$Label,
[string]$Type,
[ValidatePattern('^[0-9a-f]{6}$')]
[string]$Color,
[uint16]$Rear_Port,
[uint16]$Rear_Port_Position,
[string]$Description,
[bool]$Mark_Connected,
[uint16[]]$Tags,
[switch]$Force
)
begin {
}
process {
foreach ($FrontPortID in $Id) {
$CurrentPort = Get-NetboxDCIMFrontPort -Id $FrontPortID -ErrorAction Stop
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'front-ports', $CurrentPort.Id))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
$URI = BuildNewURI -Segments $Segments
if ($Force -or $pscmdlet.ShouldProcess("Front Port ID $($CurrentPort.Id)", "Set")) {
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
}
}
}
end {
}
}
#endregion
#region File Set-NetboxDCIMInterface.ps1
function Set-NetboxDCIMInterface {
[CmdletBinding(ConfirmImpact = 'Medium',
@ -4722,7 +5178,9 @@ function Set-NetboxDCIMInterface {
[uint16]$Untagged_VLAN,
[ValidateRange(1, 4094)]
[uint16[]]$Tagged_VLANs
[uint16[]]$Tagged_VLANs,
[switch]$Force
)
begin {
@ -4853,6 +5311,70 @@ function Set-NetboxDCIMInterfaceConnection {
#endregion
#region File Set-NetboxDCIMRearPort.ps1
function Set-NetboxDCIMRearPort {
[CmdletBinding(ConfirmImpact = 'Medium',
SupportsShouldProcess = $true)]
[OutputType([pscustomobject])]
param
(
[Parameter(Mandatory = $true,
ValueFromPipelineByPropertyName = $true)]
[uint16[]]$Id,
[uint16]$Device,
[uint16]$Module,
[string]$Name,
[string]$Label,
[string]$Type,
[ValidatePattern('^[0-9a-f]{6}$')]
[string]$Color,
[uint16]$Positions,
[string]$Description,
[bool]$Mark_Connected,
[uint16[]]$Tags,
[switch]$Force
)
begin {
}
process {
foreach ($RearPortID in $Id) {
$CurrentPort = Get-NetboxDCIMRearPort -Id $RearPortID -ErrorAction Stop
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'rear-ports', $CurrentPort.Id))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
$URI = BuildNewURI -Segments $Segments
if ($Force -or $pscmdlet.ShouldProcess("Rear Port ID $($CurrentPort.Id)", "Set")) {
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
}
}
}
end {
}
}
#endregion
#region File Set-NetboxHostName.ps1
function Set-NetboxHostName {

File diff suppressed because one or more lines are too long