From 15a2e98662b31e67dd11b5c92c5ebc5beda6c648 Mon Sep 17 00:00:00 2001 From: sheffsix Date: Mon, 13 Mar 2023 09:21:14 +0000 Subject: [PATCH] Start work on Front and Rear ports --- .../FrontPorts/Get-NetboxDCIMFrontPort.ps1 | 37 ++++++++++++++++ .../DCIM/RearPorts/Get-NetboxDCIMRearPort.ps1 | 37 ++++++++++++++++ Postman/Netbox.postman_collection.json | 44 +++++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 Functions/DCIM/FrontPorts/Get-NetboxDCIMFrontPort.ps1 create mode 100644 Functions/DCIM/RearPorts/Get-NetboxDCIMRearPort.ps1 diff --git a/Functions/DCIM/FrontPorts/Get-NetboxDCIMFrontPort.ps1 b/Functions/DCIM/FrontPorts/Get-NetboxDCIMFrontPort.ps1 new file mode 100644 index 0000000..1188bcb --- /dev/null +++ b/Functions/DCIM/FrontPorts/Get-NetboxDCIMFrontPort.ps1 @@ -0,0 +1,37 @@ + +function Get-NetboxDCIMFrontPort +{ + [CmdletBinding()] + [OutputType([pscustomobject])] + param + ( + [uint16]$Limit, + + [uint16]$Offset, + + [Parameter(ValueFromPipelineByPropertyName = $true)] + [uint16]$Id, + + [uint16]$Name, + + [string]$Device, + + [uint16]$Device_Id, + + [uint16]$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 + } +} \ No newline at end of file diff --git a/Functions/DCIM/RearPorts/Get-NetboxDCIMRearPort.ps1 b/Functions/DCIM/RearPorts/Get-NetboxDCIMRearPort.ps1 new file mode 100644 index 0000000..921f26a --- /dev/null +++ b/Functions/DCIM/RearPorts/Get-NetboxDCIMRearPort.ps1 @@ -0,0 +1,37 @@ + +function Get-NetboxDCIMRearPort +{ + [CmdletBinding()] + [OutputType([pscustomobject])] + param + ( + [uint16]$Limit, + + [uint16]$Offset, + + [Parameter(ValueFromPipelineByPropertyName = $true)] + [uint16]$Id, + + [uint16]$Name, + + [string]$Device, + + [uint16]$Device_Id, + + [uint16]$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 + } +} \ No newline at end of file diff --git a/Postman/Netbox.postman_collection.json b/Postman/Netbox.postman_collection.json index 427c372..9a41fdc 100644 --- a/Postman/Netbox.postman_collection.json +++ b/Postman/Netbox.postman_collection.json @@ -953,6 +953,50 @@ }, "response": [] }, + { + "name": "Get Device Rear Ports", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{SCHEME}}://{{HOSTNAME}}:{{PORT}}/api/dcim/rear-ports/", + "protocol": "{{SCHEME}}", + "host": [ + "{{HOSTNAME}}" + ], + "port": "{{PORT}}", + "path": [ + "api", + "dcim", + "rear-ports", + "" + ] + } + }, + "response": [] + }, + { + "name": "Get Device Front Ports", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{SCHEME}}://{{HOSTNAME}}:{{PORT}}/api/dcim/front-ports/", + "protocol": "{{SCHEME}}", + "host": [ + "{{HOSTNAME}}" + ], + "port": "{{PORT}}", + "path": [ + "api", + "dcim", + "rear-ports", + "" + ] + } + }, + "response": [] + }, { "name": "Add Interface", "request": {