mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 01:42:28 +00:00
* Add `OPTIONS` method validation * Remove parameter validation as workaround for CHOICES API endpoint until further testing * Add help block for Get-NetboxTenant * SkipConnectedCheck for Get-NetboxAPIDefinition * Correct help block for New-NetboxIPAMAddress * Add parameter position 0 for 'Address' in Get-NetboxIPAMAddress * Allow pipeline input for Address parameter in New-NetboxIPAMAddress * Update parameter types * Add parameter sets and logic for ID/Query searches * Add Get-NetboxDCIMSite * Update psproj * Update deploy.ps1 * Move Get-NetboxCircuit * Add Circuit cmdlets - New-NetboxCircuit - Get-NetboxCircuitProvider - Get-NetboxCircuitTermination - Get-NetboxCircuitType * Update deploy script output path * Update Set-NetboxIPAMAddress - Replace Interface parameter with Assigned_Object_Type and Assigned_Object_Id - Add validation logic for Assigned_Object_ parameters - Change Status parameter to string * Add Get-ModelDefinition function * Update psproj * Update deploy.ps1 variables * Update exported files * Remove references to `_choices` API calls * Add Postman collection * Add Postman collection * Update deploy.ps1 * Add Set-NetboxIPAMPrefix function * Increment version to 1.3.0 Co-authored-by: Ben Claussen <claussen@neonet.org>
108 lines
3.2 KiB
PowerShell
108 lines
3.2 KiB
PowerShell
<#
|
|
.NOTES
|
|
===========================================================================
|
|
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.181
|
|
Created on: 2020-10-02 15:52
|
|
Created by: Claussen
|
|
Organization: NEOnet
|
|
Filename: Get-NetboxDCIMSite.ps1
|
|
===========================================================================
|
|
.DESCRIPTION
|
|
A description of the file.
|
|
#>
|
|
|
|
|
|
|
|
function Get-NetboxDCIMSite {
|
|
[CmdletBinding()]
|
|
[OutputType([pscustomobject])]
|
|
param
|
|
(
|
|
[Parameter(ParameterSetName = 'ByID', ValueFromPipelineByPropertyName = $true)]
|
|
[uint32]$Id,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[string]$Name,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[string]$Query,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[string]$Slug,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[string]$Facility,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[uint32]$ASN,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[decimal]$Latitude,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[decimal]$Longitude,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[string]$Contact_Name,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[string]$Contact_Phone,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[string]$Contact_Email,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[uint32]$Tenant_Group_ID,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[string]$Tenant_Group,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[uint32]$Tenant_ID,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[string]$Tenant,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[string]$Status,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[uint32]$Region_ID,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[string]$Region,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[uint16]$Limit,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[uint16]$Offset,
|
|
|
|
[switch]$Raw
|
|
)
|
|
|
|
switch ($PSCmdlet.ParameterSetName) {
|
|
'ById' {
|
|
foreach ($Site_ID in $ID) {
|
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'sites', $Site_Id))
|
|
|
|
$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(@('dcim', 'sites'))
|
|
|
|
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters
|
|
|
|
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
|
|
|
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
|
}
|
|
}
|
|
}
|
|
|