From 9eac0bfacfc35ce9d85cc20dd694fb0cdae89e7c Mon Sep 17 00:00:00 2001 From: sheffsix Date: Mon, 13 Mar 2023 13:59:54 +0000 Subject: [PATCH] Add-NetboxDCIMRearPort function --- .../DCIM/RearPorts/Add-NetboxDCIMRearPort.ps1 | 38 +++++++++++++++++++ Postman/Netbox.postman_collection.json | 31 +++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 Functions/DCIM/RearPorts/Add-NetboxDCIMRearPort.ps1 diff --git a/Functions/DCIM/RearPorts/Add-NetboxDCIMRearPort.ps1 b/Functions/DCIM/RearPorts/Add-NetboxDCIMRearPort.ps1 new file mode 100644 index 0000000..3a56507 --- /dev/null +++ b/Functions/DCIM/RearPorts/Add-NetboxDCIMRearPort.ps1 @@ -0,0 +1,38 @@ + +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, + + [string]$Color, + + [uint16]$Positions, + + [string]$Description, + + [string]$Tags + + ) + + $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 +} \ No newline at end of file diff --git a/Postman/Netbox.postman_collection.json b/Postman/Netbox.postman_collection.json index 427c372..a82c99e 100644 --- a/Postman/Netbox.postman_collection.json +++ b/Postman/Netbox.postman_collection.json @@ -983,6 +983,37 @@ } }, "response": [] + }, + { + "name": "Add Rear Port", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"device\": 62,\r\n \"name\": \"RearPort1\",\r\n \"type\": 110-punch\r\n}" + }, + "url": { + "raw": "{{SCHEME}}://{{HOSTNAME}}:{{PORT}}/api/dcim/rear-ports/", + "protocol": "{{SCHEME}}", + "host": [ + "{{HOSTNAME}}" + ], + "port": "{{PORT}}", + "path": [ + "api", + "dcim", + "rear-ports", + "" + ] + } + }, + "response": [] } ] },