From 6636fe74d88442d494fad5df4dddd57f0c57c78a Mon Sep 17 00:00:00 2001 From: Ben Claussen Date: Fri, 13 Nov 2020 12:16:56 -0500 Subject: [PATCH] Move Get-NetboxCircuit --- .../Circuits/Circuits/Get-NetboxCircuit.ps1 | 131 ++++++++++++++++++ Functions/Circuits/Get-NetboxCircuit.ps1 | 83 ----------- 2 files changed, 131 insertions(+), 83 deletions(-) create mode 100644 Functions/Circuits/Circuits/Get-NetboxCircuit.ps1 delete mode 100644 Functions/Circuits/Get-NetboxCircuit.ps1 diff --git a/Functions/Circuits/Circuits/Get-NetboxCircuit.ps1 b/Functions/Circuits/Circuits/Get-NetboxCircuit.ps1 new file mode 100644 index 0000000..319ee48 --- /dev/null +++ b/Functions/Circuits/Circuits/Get-NetboxCircuit.ps1 @@ -0,0 +1,131 @@ +<# + .NOTES + =========================================================================== + Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 + Created on: 3/23/2020 12:15 + Created by: Claussen + Organization: NEOnet + Filename: Get-NetboxCircuit.ps1 + =========================================================================== + .DESCRIPTION + A description of the file. +#> + + +function Get-NetboxCircuit { +<# + .SYNOPSIS + Gets one or more circuits + + .DESCRIPTION + A detailed description of the Get-NetboxCircuit function. + + .PARAMETER Id + Database ID of circuit. This will query for exactly the IDs provided + + .PARAMETER CID + Circuit ID + + .PARAMETER InstallDate + Date of installation + + .PARAMETER CommitRate + Committed rate in Kbps + + .PARAMETER Query + A raw search query... As if you were searching the web site + + .PARAMETER Provider + The name or ID of the provider. Provide either [string] or [int]. String will search provider names, integer will search database IDs + + .PARAMETER Type + Type of circuit. Provide either [string] or [int]. String will search provider type names, integer will search database IDs + + .PARAMETER Site + Location/site of circuit. Provide either [string] or [int]. String will search site names, integer will search database IDs + + .PARAMETER Tenant + Tenant assigned to circuit. Provide either [string] or [int]. String will search tenant names, integer will search database IDs + + .PARAMETER Limit + A description of the Limit parameter. + + .PARAMETER Offset + A description of the Offset parameter. + + .PARAMETER Raw + A description of the Raw parameter. + + .PARAMETER ID__IN + Multiple unique DB IDs to retrieve + + .EXAMPLE + PS C:\> Get-NetboxCircuit + + .NOTES + Additional information about the function. +#> + + [CmdletBinding(DefaultParameterSetName = 'Query')] + param + ( + [Parameter(ParameterSetName = 'ById')] + [uint16[]]$Id, + + [Parameter(ParameterSetName = 'Query')] + [string]$CID, + + [Parameter(ParameterSetName = 'Query')] + [datetime]$InstallDate, + + [Parameter(ParameterSetName = 'Query')] + [uint32]$CommitRate, + + [Parameter(ParameterSetName = 'Query')] + [string]$Query, + + [Parameter(ParameterSetName = 'Query')] + [object]$Provider, + + [Parameter(ParameterSetName = 'Query')] + [object]$Type, + + [Parameter(ParameterSetName = 'Query')] + [string]$Site, + + [Parameter(ParameterSetName = 'Query')] + [string]$Tenant, + + [Parameter(ParameterSetName = 'Query')] + [uint16]$Limit, + + [Parameter(ParameterSetName = 'Query')] + [uint16]$Offset, + + [switch]$Raw + ) + + switch ($PSCmdlet.ParameterSetName) { + 'ById' { + foreach ($i in $ID) { + $Segments = [System.Collections.ArrayList]::new(@('circuits', 'circuits', $i)) + + $URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName "Id" + + $URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters + + InvokeNetboxRequest -URI $URI -Raw:$Raw + } + } + + default { + $Segments = [System.Collections.ArrayList]::new(@('circuits', 'circuits')) + + $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/Circuits/Get-NetboxCircuit.ps1 b/Functions/Circuits/Get-NetboxCircuit.ps1 deleted file mode 100644 index 54c6b21..0000000 --- a/Functions/Circuits/Get-NetboxCircuit.ps1 +++ /dev/null @@ -1,83 +0,0 @@ -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/23/2020 12:15 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxCircuit.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - - -function Get-NetboxCircuit { -<# - .SYNOPSIS - Gets one or more circuits - - .DESCRIPTION - A detailed description of the Get-NetboxCircuit function. - - .PARAMETER CID - Circuit ID - - .PARAMETER InstallDate - Date of installation - - .PARAMETER CommitRate - Committed rate in Kbps - - .PARAMETER Query - A raw search query... As if you were searching the web site - - .PARAMETER Provider - The name or ID of the provider. Provide either [string] or [int]. String will search provider names, integer will search database IDs - - .PARAMETER Type - Type of circuit. Provide either [string] or [int]. String will search provider type names, integer will search database IDs - - .PARAMETER Site - Location/site of circuit. Provide either [string] or [int]. String will search site names, integer will search database IDs - - .PARAMETER Tenant - Tenant assigned to circuit. Provide either [string] or [int]. String will search tenant names, integer will search database IDs - - .PARAMETER Id - Database ID of circuit. This will query for exactly the IDs provided - - .PARAMETER ID__IN - Multiple unique DB IDs to retrieve - - .EXAMPLE - PS C:\> Get-NetboxCircuit - - .NOTES - Additional information about the function. -#> - - [CmdletBinding()] - param - ( - [string]$CID, - - [datetime]$InstallDate, - - [uint32]$CommitRate, - - [string]$Query, - - [object]$Provider, - - [object]$Type, - - [string]$Site, - - [string]$Tenant, - - [uint16[]]$Id - ) - - #TODO: Place script here -} \ No newline at end of file