mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-15 18:55:46 +00:00
Compare commits
121 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7129e7d3c7 | ||
|
|
bb43ac490c | ||
|
|
59a28faff5 | ||
|
|
b441e02e2b | ||
|
|
40c7aac059 | ||
|
|
e4eb42a7a3 | ||
|
|
bf01b354bd | ||
|
|
cceb8fe765 | ||
|
|
8326e3eb29 | ||
|
|
26cc2b3c0d | ||
|
|
44dcb252b8 | ||
|
|
88647882cc | ||
|
|
2233de974d | ||
|
|
9e00636fbe | ||
|
|
bb0dfc0aa4 | ||
|
|
4897d6b71f | ||
|
|
6c2d358171 | ||
|
|
383ca2b002 | ||
|
|
985f920900 | ||
|
|
a63478a8d6 | ||
|
|
080d655f8d | ||
|
|
914b245f24 | ||
|
|
58fbbeb0cd | ||
|
|
46068dcc04 | ||
|
|
5b0c2897e0 | ||
|
|
ec5f9e810f | ||
|
|
c2a3dc285b | ||
|
|
bea65f0b06 | ||
|
|
cf1bcb3691 | ||
|
|
0049ba4985 | ||
|
|
7c03023bb8 | ||
|
|
0fd989c82a | ||
|
|
d441a1ddac | ||
|
|
7caf1a1d93 | ||
|
|
29dd7ac038 | ||
|
|
eb4d0eeb3b | ||
|
|
6f4309aa04 | ||
|
|
5421febdd1 | ||
|
|
a4c1886a23 | ||
|
|
441b06eb04 | ||
|
|
5d6fb23e91 | ||
|
|
e2a5157790 | ||
|
|
27209d6917 | ||
|
|
6965f61e6e | ||
|
|
ddf0a081b4 | ||
|
|
d09e20baee | ||
|
|
7925db838f | ||
|
|
3e0d817267 | ||
|
|
010fb0410b | ||
|
|
44dc6c86a2 | ||
|
|
5b7f0c658b | ||
|
|
5333d10ce0 | ||
|
|
f289854ddf | ||
|
|
1fed2d27e6 | ||
|
|
c1a0675b02 | ||
|
|
6654f798b0 | ||
|
|
aa444871a4 | ||
|
|
1f3626f319 | ||
|
|
356bd71ac8 | ||
|
|
f5c94b206f | ||
|
|
35916a5ab7 | ||
|
|
c47d787447 | ||
|
|
1ec38d3da2 | ||
|
|
4a0bd1d2d0 | ||
|
|
8b8ca091b1 | ||
|
|
b720c03851 | ||
|
|
c0e18ec134 | ||
|
|
049745554e | ||
|
|
c91d5fd32c | ||
|
|
458a4ae7c2 | ||
|
|
6dd82ee688 | ||
|
|
d85f675469 | ||
|
|
d7c008871d | ||
|
|
ea75e796ef | ||
|
|
6b8caf0bd7 | ||
|
|
e7a67328bf | ||
|
|
ff0c0127cd | ||
|
|
c3621f237e | ||
|
|
cad361c1b4 | ||
|
|
cd0d6383e6 | ||
|
|
7aedcf8338 | ||
|
|
cb4e2f2f57 | ||
|
|
e29299022e | ||
|
|
9dd6bc2b0e | ||
|
|
3e03e1e3ad | ||
|
|
7edbae953f | ||
|
|
a608d6ebd7 | ||
|
|
e8a5fdf15d | ||
|
|
e162c05900 | ||
|
|
c8e0a96690 | ||
|
|
30ae377493 | ||
|
|
c11680a20e | ||
|
|
f9fc02756c | ||
|
|
48452ce686 | ||
|
|
42b00279cb | ||
|
|
8167b0dbf0 | ||
|
|
ddf1d22e18 | ||
|
|
11ae767a6c | ||
|
|
01335bd225 | ||
|
|
2b7c1b4be3 | ||
|
|
68161a78b0 | ||
|
|
17c4d9d779 | ||
|
|
ea9f6c41bc | ||
|
|
22607fde48 | ||
|
|
802ab317f6 | ||
|
|
218114d8fe | ||
|
|
c48bfe78ad | ||
|
|
06d758d7b3 | ||
|
|
989c5eaac2 | ||
|
|
6122fd2301 | ||
|
|
1f66348205 | ||
|
|
fcbb25c088 | ||
|
|
4800cc6564 | ||
|
|
1a2484db2c | ||
|
|
254a2798ac | ||
|
|
c8233ab572 | ||
|
|
c8c6d48ee4 | ||
|
|
2bf4ed6f6f | ||
|
|
4ad0562466 | ||
|
|
5b1ee45769 | ||
|
|
b164ffe0b4 |
104 changed files with 69234 additions and 2922 deletions
12
.vscode/settings.json
vendored
12
.vscode/settings.json
vendored
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.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
|
||||
|
|
@ -36,16 +23,16 @@ function Get-NetboxCircuit {
|
|||
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
|
||||
The name or ID of the provider. Provide either [string] or [uint64]. 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
|
||||
Type of circuit. Provide either [string] or [uint64]. 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
|
||||
Location/site of circuit. Provide either [string] or [uint64]. 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
|
||||
Tenant assigned to circuit. Provide either [string] or [uint64]. String will search tenant names, integer will search database IDs
|
||||
|
||||
.PARAMETER Limit
|
||||
A description of the Limit parameter.
|
||||
|
|
@ -70,7 +57,7 @@ function Get-NetboxCircuit {
|
|||
param
|
||||
(
|
||||
[Parameter(ParameterSetName = 'ById')]
|
||||
[uint16[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$CID,
|
||||
|
|
@ -79,7 +66,7 @@ function Get-NetboxCircuit {
|
|||
[datetime]$InstallDate,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$CommitRate,
|
||||
[uint64]$CommitRate,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Query,
|
||||
|
|
|
|||
|
|
@ -1,18 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.181
|
||||
Created on: 2020-11-04 11:48
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: New-NetboxCircuit.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
|
||||
function New-NetboxCircuit {
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess = $true)]
|
||||
|
|
@ -24,17 +10,17 @@ function New-NetboxCircuit {
|
|||
[string]$CID,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[uint32]$Provider,
|
||||
[uint64]$Provider,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[uint32]$Type,
|
||||
[uint64]$Type,
|
||||
|
||||
#[ValidateSet('Active', 'Planned', 'Provisioning', 'Offline', 'Deprovisioning', 'Decommissioned ')]
|
||||
[uint16]$Status = 'Active',
|
||||
|
||||
[string]$Description,
|
||||
|
||||
[uint32]$Tenant,
|
||||
[uint64]$Tenant,
|
||||
|
||||
[string]$Termination_A,
|
||||
|
||||
|
|
@ -43,7 +29,7 @@ function New-NetboxCircuit {
|
|||
[string]$Termination_Z,
|
||||
|
||||
[ValidateRange(0, 2147483647)]
|
||||
[uint32]$Commit_Rate,
|
||||
[uint64]$Commit_Rate,
|
||||
|
||||
[string]$Comments,
|
||||
|
||||
|
|
|
|||
|
|
@ -1,25 +1,11 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.181
|
||||
Created on: 2020-11-04 12:06
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-NetboxCircuitProvider.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
|
||||
function Get-NetboxCircuitProvider {
|
||||
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
||||
param
|
||||
(
|
||||
[Parameter(ParameterSetName = 'ById',
|
||||
Mandatory = $true)]
|
||||
[uint16[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query',
|
||||
Mandatory = $false)]
|
||||
|
|
|
|||
|
|
@ -1,25 +1,11 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.181
|
||||
Created on: 2020-11-04 10:22
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-NetboxCircuitTermination.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
|
||||
function Get-NetboxCircuitTermination {
|
||||
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
||||
param
|
||||
(
|
||||
[Parameter(ParameterSetName = 'ById',
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint32[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Circuit_ID,
|
||||
|
|
@ -28,7 +14,7 @@ function Get-NetboxCircuitTermination {
|
|||
[string]$Term_Side,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$Port_Speed,
|
||||
[uint64]$Port_Speed,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Query,
|
||||
|
|
|
|||
|
|
@ -1,24 +1,10 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.181
|
||||
Created on: 2020-11-04 12:34
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-NetboxCircuitType.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
|
||||
function Get-NetboxCircuitType {
|
||||
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
||||
param
|
||||
(
|
||||
[Parameter(ParameterSetName = 'ById')]
|
||||
[uint16[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Name,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
function Get-NetboxDCIMCableTermination {
|
||||
[CmdletBinding()]
|
||||
#region Parameters
|
||||
param
|
||||
(
|
||||
[uint16]$Limit,
|
||||
|
||||
[uint16]$Offset,
|
||||
|
||||
[Parameter(ValueFromPipelineByPropertyName = $true)]
|
||||
[uint64[]]$Id,
|
||||
|
||||
[uint64]$Cable,
|
||||
|
||||
[string]$Cable_End,
|
||||
|
||||
[string]$Termination_Type,
|
||||
|
||||
[uint64]$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
|
||||
}
|
||||
}
|
||||
55
Functions/DCIM/Cables/Get-NetboxDCIMCable.ps1
Normal file
55
Functions/DCIM/Cables/Get-NetboxDCIMCable.ps1
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
function Get-NetboxDCIMCable {
|
||||
[CmdletBinding()]
|
||||
#region Parameters
|
||||
param
|
||||
(
|
||||
[uint16]$Limit,
|
||||
|
||||
[uint16]$Offset,
|
||||
|
||||
[Parameter(ValueFromPipelineByPropertyName = $true)]
|
||||
[uint64[]]$Id,
|
||||
|
||||
[string]$Label,
|
||||
|
||||
[string]$Termination_A_Type,
|
||||
|
||||
[uint64]$Termination_A_ID,
|
||||
|
||||
[string]$Termination_B_Type,
|
||||
|
||||
[uint64]$Termination_B_ID,
|
||||
|
||||
[string]$Type,
|
||||
|
||||
[string]$Status,
|
||||
|
||||
[string]$Color,
|
||||
|
||||
[uint64]$Device_ID,
|
||||
|
||||
[string]$Device,
|
||||
|
||||
[uint64]$Rack_Id,
|
||||
|
||||
[string]$Rack,
|
||||
|
||||
[uint64]$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
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/23/2020 12:06
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-NetboxDCIMDevice.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Get-NetboxDCIMDevice {
|
||||
[CmdletBinding()]
|
||||
#region Parameters
|
||||
|
|
@ -22,43 +9,43 @@ function Get-NetboxDCIMDevice {
|
|||
[uint16]$Offset,
|
||||
|
||||
[Parameter(ValueFromPipelineByPropertyName = $true)]
|
||||
[uint16[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[string]$Query,
|
||||
|
||||
[string]$Name,
|
||||
|
||||
[uint16]$Manufacturer_Id,
|
||||
[uint64]$Manufacturer_Id,
|
||||
|
||||
[string]$Manufacturer,
|
||||
|
||||
[uint16]$Device_Type_Id,
|
||||
[uint64]$Device_Type_Id,
|
||||
|
||||
[uint16]$Role_Id,
|
||||
[uint64]$Role_Id,
|
||||
|
||||
[string]$Role,
|
||||
|
||||
[uint16]$Tenant_Id,
|
||||
[uint64]$Tenant_Id,
|
||||
|
||||
[string]$Tenant,
|
||||
|
||||
[uint16]$Platform_Id,
|
||||
[uint64]$Platform_Id,
|
||||
|
||||
[string]$Platform,
|
||||
|
||||
[string]$Asset_Tag,
|
||||
|
||||
[uint16]$Site_Id,
|
||||
[uint64]$Site_Id,
|
||||
|
||||
[string]$Site,
|
||||
|
||||
[uint16]$Rack_Group_Id,
|
||||
[uint64]$Rack_Group_Id,
|
||||
|
||||
[uint16]$Rack_Id,
|
||||
[uint64]$Rack_Id,
|
||||
|
||||
[uint16]$Cluster_Id,
|
||||
[uint64]$Cluster_Id,
|
||||
|
||||
[uint16]$Model,
|
||||
[uint64]$Model,
|
||||
|
||||
[object]$Status,
|
||||
|
||||
|
|
@ -74,7 +61,7 @@ function Get-NetboxDCIMDevice {
|
|||
|
||||
[bool]$Has_Primary_IP,
|
||||
|
||||
[uint16]$Virtual_Chassis_Id,
|
||||
[uint64]$Virtual_Chassis_Id,
|
||||
|
||||
[uint16]$Position,
|
||||
|
||||
|
|
@ -86,10 +73,6 @@ function Get-NetboxDCIMDevice {
|
|||
#endregion Parameters
|
||||
|
||||
process {
|
||||
if ($null -ne $Status) {
|
||||
$PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
|
||||
}
|
||||
|
||||
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'devices'))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Raw'
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/23/2020 12:07
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-NetboxDCIMDeviceRole.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Get-NetboxDCIMDeviceRole {
|
||||
[CmdletBinding()]
|
||||
param
|
||||
|
|
@ -21,7 +8,7 @@ function Get-NetboxDCIMDeviceRole {
|
|||
[uint16]$Offset,
|
||||
|
||||
[Parameter(ParameterSetName = 'ById')]
|
||||
[uint16[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[string]$Name,
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/23/2020 12:07
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-NetboxDCIMDeviceType.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Get-NetboxDCIMDeviceType {
|
||||
[CmdletBinding()]
|
||||
#region Parameters
|
||||
|
|
@ -21,7 +8,7 @@ function Get-NetboxDCIMDeviceType {
|
|||
|
||||
[uint16]$Limit,
|
||||
|
||||
[uint16[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[string]$Query,
|
||||
|
||||
|
|
@ -29,7 +16,7 @@ function Get-NetboxDCIMDeviceType {
|
|||
|
||||
[string]$Manufacturer,
|
||||
|
||||
[uint16]$Manufacturer_Id,
|
||||
[uint64]$Manufacturer_Id,
|
||||
|
||||
[string]$Model,
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/23/2020 12:08
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: New-NetboxDCIMDevice.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function New-NetboxDCIMDevice {
|
||||
[CmdletBinding(ConfirmImpact = 'low',
|
||||
SupportsShouldProcess = $true)]
|
||||
|
|
@ -29,17 +16,17 @@ function New-NetboxDCIMDevice {
|
|||
[object]$Device_Type,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[uint16]$Site,
|
||||
[uint64]$Site,
|
||||
|
||||
[object]$Status = 'Active',
|
||||
|
||||
[uint16]$Platform,
|
||||
[uint64]$Platform,
|
||||
|
||||
[uint16]$Tenant,
|
||||
[uint64]$Tenant,
|
||||
|
||||
[uint16]$Cluster,
|
||||
[uint64]$Cluster,
|
||||
|
||||
[uint16]$Rack,
|
||||
[uint64]$Rack,
|
||||
|
||||
[uint16]$Position,
|
||||
|
||||
|
|
@ -49,15 +36,15 @@ function New-NetboxDCIMDevice {
|
|||
|
||||
[string]$Asset_Tag,
|
||||
|
||||
[uint16]$Virtual_Chassis,
|
||||
[uint64]$Virtual_Chassis,
|
||||
|
||||
[uint16]$VC_Priority,
|
||||
[uint64]$VC_Priority,
|
||||
|
||||
[uint16]$VC_Position,
|
||||
[uint64]$VC_Position,
|
||||
|
||||
[uint16]$Primary_IP4,
|
||||
[uint64]$Primary_IP4,
|
||||
|
||||
[uint16]$Primary_IP6,
|
||||
[uint64]$Primary_IP6,
|
||||
|
||||
[string]$Comments,
|
||||
|
||||
|
|
@ -65,22 +52,6 @@ function New-NetboxDCIMDevice {
|
|||
)
|
||||
#endregion Parameters
|
||||
|
||||
# if ($null -ne $Device_Role) {
|
||||
# # Validate device role?
|
||||
# }
|
||||
|
||||
# if ($null -ne $Device_Type) {
|
||||
# # Validate device type?
|
||||
# }
|
||||
|
||||
# if ($null -ne $Status) {
|
||||
# $PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
|
||||
# }
|
||||
|
||||
# if ($null -ne $Face) {
|
||||
# $PSBoundParameters.Face = ValidateDCIMChoice -ProvidedValue $Face -DeviceFace
|
||||
# }
|
||||
|
||||
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'devices'))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/23/2020 12:08
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Remove-NetboxDCIMDevice.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Remove-NetboxDCIMDevice {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
|
@ -39,7 +26,7 @@ function Remove-NetboxDCIMDevice {
|
|||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint16[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[switch]$Force
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,24 +1,11 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/23/2020 12:08
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Set-NetboxDCIMDevice.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Set-NetboxDCIMDevice {
|
||||
[CmdletBinding(SupportsShouldProcess = $true)]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint16[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[string]$Name,
|
||||
|
||||
|
|
@ -26,17 +13,17 @@ function Set-NetboxDCIMDevice {
|
|||
|
||||
[object]$Device_Type,
|
||||
|
||||
[uint16]$Site,
|
||||
[uint64]$Site,
|
||||
|
||||
[object]$Status,
|
||||
|
||||
[uint16]$Platform,
|
||||
[uint64]$Platform,
|
||||
|
||||
[uint16]$Tenant,
|
||||
[uint64]$Tenant,
|
||||
|
||||
[uint16]$Cluster,
|
||||
[uint64]$Cluster,
|
||||
|
||||
[uint16]$Rack,
|
||||
[uint64]$Rack,
|
||||
|
||||
[uint16]$Position,
|
||||
|
||||
|
|
@ -46,15 +33,15 @@ function Set-NetboxDCIMDevice {
|
|||
|
||||
[string]$Asset_Tag,
|
||||
|
||||
[uint16]$Virtual_Chassis,
|
||||
[uint64]$Virtual_Chassis,
|
||||
|
||||
[uint16]$VC_Priority,
|
||||
[uint64]$VC_Priority,
|
||||
|
||||
[uint16]$VC_Position,
|
||||
[uint64]$VC_Position,
|
||||
|
||||
[uint16]$Primary_IP4,
|
||||
[uint64]$Primary_IP4,
|
||||
|
||||
[uint16]$Primary_IP6,
|
||||
[uint64]$Primary_IP6,
|
||||
|
||||
[string]$Comments,
|
||||
|
||||
|
|
@ -64,13 +51,7 @@ function Set-NetboxDCIMDevice {
|
|||
)
|
||||
|
||||
begin {
|
||||
# if ($null -ne $Status) {
|
||||
# $PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
|
||||
# }
|
||||
|
||||
# if ($null -ne $Face) {
|
||||
# $PSBoundParameters.Face = ValidateDCIMChoice -ProvidedValue $Face -DeviceFace
|
||||
# }
|
||||
}
|
||||
|
||||
process {
|
||||
|
|
|
|||
42
Functions/DCIM/FrontPorts/Add-NetboxDCIMFrontPort.ps1
Normal file
42
Functions/DCIM/FrontPorts/Add-NetboxDCIMFrontPort.ps1
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
function Add-NetboxDCIMFrontPort {
|
||||
[CmdletBinding()]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[uint64]$Device,
|
||||
|
||||
[uint64]$Module,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Name,
|
||||
|
||||
[string]$Label,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Type,
|
||||
|
||||
[ValidatePattern('^[0-9a-f]{6}$')]
|
||||
[string]$Color,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[uint64]$Rear_Port,
|
||||
|
||||
[uint64]$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
|
||||
}
|
||||
34
Functions/DCIM/FrontPorts/Get-NetboxDCIMFrontPort.ps1
Normal file
34
Functions/DCIM/FrontPorts/Get-NetboxDCIMFrontPort.ps1
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
function Get-NetboxDCIMFrontPort {
|
||||
[CmdletBinding()]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
[uint16]$Limit,
|
||||
|
||||
[uint16]$Offset,
|
||||
|
||||
[Parameter(ValueFromPipelineByPropertyName = $true)]
|
||||
[uint64]$Id,
|
||||
|
||||
[string]$Name,
|
||||
|
||||
[string]$Device,
|
||||
|
||||
[uint64]$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
|
||||
}
|
||||
}
|
||||
35
Functions/DCIM/FrontPorts/Remove-NetboxDCIMFrontPort.ps1
Normal file
35
Functions/DCIM/FrontPorts/Remove-NetboxDCIMFrontPort.ps1
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
function Remove-NetboxDCIMFrontPort {
|
||||
|
||||
[CmdletBinding(ConfirmImpact = 'High',
|
||||
SupportsShouldProcess = $true)]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint64[]]$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 {
|
||||
|
||||
}
|
||||
}
|
||||
60
Functions/DCIM/FrontPorts/Set-NetboxDCIMFrontPort.ps1
Normal file
60
Functions/DCIM/FrontPorts/Set-NetboxDCIMFrontPort.ps1
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
function Set-NetboxDCIMFrontPort {
|
||||
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint64[]]$Id,
|
||||
|
||||
[uint16]$Device,
|
||||
|
||||
[uint16]$Module,
|
||||
|
||||
[string]$Name,
|
||||
|
||||
[string]$Label,
|
||||
|
||||
[string]$Type,
|
||||
|
||||
[ValidatePattern('^[0-9a-f]{6}$')]
|
||||
[string]$Color,
|
||||
|
||||
[uint64]$Rear_Port,
|
||||
|
||||
[uint16]$Rear_Port_Position,
|
||||
|
||||
[string]$Description,
|
||||
|
||||
[bool]$Mark_Connected,
|
||||
|
||||
[uint64[]]$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 {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/23/2020 12:13
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-NetboxDCIMPlatform.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Get-NetboxDCIMPlatform {
|
||||
[CmdletBinding()]
|
||||
[OutputType([pscustomobject])]
|
||||
|
|
@ -22,13 +9,13 @@ function Get-NetboxDCIMPlatform {
|
|||
[uint16]$Offset,
|
||||
|
||||
[Parameter(ParameterSetName = 'ById')]
|
||||
[uint16[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[string]$Name,
|
||||
|
||||
[string]$Slug,
|
||||
|
||||
[uint16]$Manufacturer_Id,
|
||||
[uint64]$Manufacturer_Id,
|
||||
|
||||
[string]$Manufacturer,
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,18 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/23/2020 12:10
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Add-NetboxDCIMInterface.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Add-NetboxDCIMInterface {
|
||||
[CmdletBinding()]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[uint16]$Device,
|
||||
[uint64]$Device,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Name,
|
||||
|
||||
[ValidateSet('virtual', 'bridge', 'lag', '100base-tx', '1000base-t', '2.5gbase-t', '5gbase-t', '10gbase-t', '10gbase-cx4', '1000base-x-gbic', '1000base-x-sfp', '10gbase-x-sfpp', '10gbase-x-xfp', '10gbase-x-xenpak', '10gbase-x-x2', '25gbase-x-sfp28', '50gbase-x-sfp56', '40gbase-x-qsfpp', '50gbase-x-sfp28', '100gbase-x-cfp', '100gbase-x-cfp2', '200gbase-x-cfp2', '100gbase-x-cfp4', '100gbase-x-cpak', '100gbase-x-qsfp28', '200gbase-x-qsfp56', '400gbase-x-qsfpdd', '400gbase-x-osfp', '1000base-kx', '10gbase-kr', '10gbase-kx4', '25gbase-kr', '40gbase-kr4', '50gbase-kr', '100gbase-kp4', '100gbase-kr2', '100gbase-kr4', 'ieee802.11a', 'ieee802.11g', 'ieee802.11n', 'ieee802.11ac', 'ieee802.11ad', 'ieee802.11ax', 'ieee802.11ay', 'ieee802.15.1', 'other-wireless', 'gsm', 'cdma', 'lte', 'sonet-oc3', 'sonet-oc12', 'sonet-oc48', 'sonet-oc192', 'sonet-oc768', 'sonet-oc1920', 'sonet-oc3840', '1gfc-sfp', '2gfc-sfp', '4gfc-sfp', '8gfc-sfpp', '16gfc-sfpp', '32gfc-sfp28', '64gfc-qsfpp', '128gfc-qsfp28', 'infiniband-sdr', 'infiniband-ddr', 'infiniband-qdr', 'infiniband-fdr10', 'infiniband-fdr', 'infiniband-edr', 'infiniband-hdr', 'infiniband-ndr', 'infiniband-xdr', 't1', 'e1', 't3', 'e3', 'xdsl', 'docsis', 'gpon', 'xg-pon', 'xgs-pon', 'ng-pon2', 'epon', '10g-epon', 'cisco-stackwise', 'cisco-stackwise-plus', 'cisco-flexstack', 'cisco-flexstack-plus', 'cisco-stackwise-80', 'cisco-stackwise-160', 'cisco-stackwise-320', 'cisco-stackwise-480', 'juniper-vcp', 'extreme-summitstack', 'extreme-summitstack-128', 'extreme-summitstack-256', 'extreme-summitstack-512', 'other', IgnoreCase = $true)]
|
||||
[string]$Type,
|
||||
|
||||
[bool]$Enabled,
|
||||
|
||||
[object]$Form_Factor,
|
||||
|
|
@ -33,7 +23,7 @@ function Add-NetboxDCIMInterface {
|
|||
|
||||
[bool]$MGMT_Only,
|
||||
|
||||
[uint16]$LAG,
|
||||
[uint64]$LAG,
|
||||
|
||||
[string]$Description,
|
||||
|
||||
|
|
@ -47,10 +37,6 @@ function Add-NetboxDCIMInterface {
|
|||
[uint16[]]$Tagged_VLANs
|
||||
)
|
||||
|
||||
# if ($null -ne $Form_Factor) {
|
||||
# $PSBoundParameters.Form_Factor = ValidateDCIMChoice -ProvidedValue $Form_Factor -InterfaceFormFactor
|
||||
# }
|
||||
|
||||
if (-not [System.String]::IsNullOrWhiteSpace($Mode)) {
|
||||
$PSBoundParameters.Mode = switch ($Mode) {
|
||||
'Access' {
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/23/2020 12:10
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Add-NetboxDCIMInterfaceConnection.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Add-NetboxDCIMInterfaceConnection {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
|
@ -43,16 +30,12 @@ function Add-NetboxDCIMInterfaceConnection {
|
|||
[object]$Connection_Status,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[uint16]$Interface_A,
|
||||
[uint64]$Interface_A,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[uint16]$Interface_B
|
||||
[uint64]$Interface_B
|
||||
)
|
||||
|
||||
if ($null -ne $Connection_Status) {
|
||||
$PSBoundParameters.Connection_Status = ValidateDCIMChoice -ProvidedValue $Connection_Status -InterfaceConnectionStatus
|
||||
}
|
||||
|
||||
# Verify if both Interfaces exist
|
||||
Get-NetboxDCIMInterface -Id $Interface_A -ErrorAction Stop | Out-null
|
||||
Get-NetboxDCIMInterface -Id $Interface_B -ErrorAction Stop | Out-null
|
||||
|
|
|
|||
|
|
@ -1,18 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/23/2020 12:09
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-NetboxDCIMInterface.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
function Get-NetboxDCIMInterface {
|
||||
function Get-NetboxDCIMInterface {
|
||||
[CmdletBinding()]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
|
|
@ -22,9 +8,9 @@ function Get-NetboxDCIMInterface {
|
|||
[uint16]$Offset,
|
||||
|
||||
[Parameter(ValueFromPipelineByPropertyName = $true)]
|
||||
[uint16]$Id,
|
||||
[uint64]$Id,
|
||||
|
||||
[uint16]$Name,
|
||||
[uint64]$Name,
|
||||
|
||||
[object]$Form_Factor,
|
||||
|
||||
|
|
@ -36,11 +22,12 @@ function Get-NetboxDCIMInterface {
|
|||
|
||||
[string]$Device,
|
||||
|
||||
[uint16]$Device_Id,
|
||||
[uint64]$Device_Id,
|
||||
|
||||
[uint16]$Type,
|
||||
[ValidateSet('virtual', 'bridge', 'lag', '100base-tx', '1000base-t', '2.5gbase-t', '5gbase-t', '10gbase-t', '10gbase-cx4', '1000base-x-gbic', '1000base-x-sfp', '10gbase-x-sfpp', '10gbase-x-xfp', '10gbase-x-xenpak', '10gbase-x-x2', '25gbase-x-sfp28', '50gbase-x-sfp56', '40gbase-x-qsfpp', '50gbase-x-sfp28', '100gbase-x-cfp', '100gbase-x-cfp2', '200gbase-x-cfp2', '100gbase-x-cfp4', '100gbase-x-cpak', '100gbase-x-qsfp28', '200gbase-x-qsfp56', '400gbase-x-qsfpdd', '400gbase-x-osfp', '1000base-kx', '10gbase-kr', '10gbase-kx4', '25gbase-kr', '40gbase-kr4', '50gbase-kr', '100gbase-kp4', '100gbase-kr2', '100gbase-kr4', 'ieee802.11a', 'ieee802.11g', 'ieee802.11n', 'ieee802.11ac', 'ieee802.11ad', 'ieee802.11ax', 'ieee802.11ay', 'ieee802.15.1', 'other-wireless', 'gsm', 'cdma', 'lte', 'sonet-oc3', 'sonet-oc12', 'sonet-oc48', 'sonet-oc192', 'sonet-oc768', 'sonet-oc1920', 'sonet-oc3840', '1gfc-sfp', '2gfc-sfp', '4gfc-sfp', '8gfc-sfpp', '16gfc-sfpp', '32gfc-sfp28', '64gfc-qsfpp', '128gfc-qsfp28', 'infiniband-sdr', 'infiniband-ddr', 'infiniband-qdr', 'infiniband-fdr10', 'infiniband-fdr', 'infiniband-edr', 'infiniband-hdr', 'infiniband-ndr', 'infiniband-xdr', 't1', 'e1', 't3', 'e3', 'xdsl', 'docsis', 'gpon', 'xg-pon', 'xgs-pon', 'ng-pon2', 'epon', '10g-epon', 'cisco-stackwise', 'cisco-stackwise-plus', 'cisco-flexstack', 'cisco-flexstack-plus', 'cisco-stackwise-80', 'cisco-stackwise-160', 'cisco-stackwise-320', 'cisco-stackwise-480', 'juniper-vcp', 'extreme-summitstack', 'extreme-summitstack-128', 'extreme-summitstack-256', 'extreme-summitstack-512', 'other', IgnoreCase = $true)]
|
||||
[string]$Type,
|
||||
|
||||
[uint16]$LAG_Id,
|
||||
[uint64]$LAG_Id,
|
||||
|
||||
[string]$MAC_Address,
|
||||
|
||||
|
|
@ -48,10 +35,6 @@ function Get-NetboxDCIMInterface {
|
|||
)
|
||||
|
||||
process {
|
||||
if ($null -ne $Form_Factor) {
|
||||
$PSBoundParameters.Form_Factor = ValidateDCIMChoice -ProvidedValue $Form_Factor -InterfaceFormFactor
|
||||
}
|
||||
|
||||
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'interfaces'))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/23/2020 12:10
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-NetboxDCIMInterfaceConnection.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Get-NetboxDCIMInterfaceConnection {
|
||||
[CmdletBinding()]
|
||||
[OutputType([pscustomobject])]
|
||||
|
|
@ -21,21 +8,17 @@ function Get-NetboxDCIMInterfaceConnection {
|
|||
|
||||
[uint16]$Offset,
|
||||
|
||||
[uint16]$Id,
|
||||
[uint64]$Id,
|
||||
|
||||
[object]$Connection_Status,
|
||||
|
||||
[uint16]$Site,
|
||||
[uint64]$Site,
|
||||
|
||||
[uint16]$Device,
|
||||
[uint64]$Device,
|
||||
|
||||
[switch]$Raw
|
||||
)
|
||||
|
||||
if ($null -ne $Connection_Status) {
|
||||
$PSBoundParameters.Connection_Status = ValidateDCIMChoice -ProvidedValue $Connection_Status -InterfaceConnectionStatus
|
||||
}
|
||||
|
||||
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'interface-connections'))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Raw'
|
||||
|
|
|
|||
|
|
@ -1,19 +1,5 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/23/2020 12:11
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Remove-NetboxDCIMInterface.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
function Remove-NetboxDCIMInterface {
|
||||
<#
|
||||
function Remove-NetboxDCIMInterface {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Removes an interface
|
||||
|
||||
|
|
@ -34,12 +20,12 @@ function Remove-NetboxDCIMInterface {
|
|||
#>
|
||||
|
||||
[CmdletBinding(ConfirmImpact = 'High',
|
||||
SupportsShouldProcess = $true)]
|
||||
SupportsShouldProcess = $true)]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint16[]]$Id,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint64[]]$Id,
|
||||
|
||||
[switch]$Force
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/23/2020 12:12
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Remove-NetboxDCIMInterfaceConnection.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Remove-NetboxDCIMInterfaceConnection {
|
||||
[CmdletBinding(ConfirmImpact = 'High',
|
||||
SupportsShouldProcess = $true)]
|
||||
|
|
@ -20,7 +7,7 @@ function Remove-NetboxDCIMInterfaceConnection {
|
|||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint16[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[switch]$Force
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,18 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/23/2020 12:11
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Set-NetboxDCIMInterface.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
function Set-NetboxDCIMInterface {
|
||||
function Set-NetboxDCIMInterface {
|
||||
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([pscustomobject])]
|
||||
|
|
@ -20,9 +6,9 @@ function Set-NetboxDCIMInterface {
|
|||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint16[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[uint16]$Device,
|
||||
[uint64]$Device,
|
||||
|
||||
[string]$Name,
|
||||
|
||||
|
|
@ -30,13 +16,16 @@ function Set-NetboxDCIMInterface {
|
|||
|
||||
[object]$Form_Factor,
|
||||
|
||||
[ValidateSet('virtual', 'bridge', 'lag', '100base-tx', '1000base-t', '2.5gbase-t', '5gbase-t', '10gbase-t', '10gbase-cx4', '1000base-x-gbic', '1000base-x-sfp', '10gbase-x-sfpp', '10gbase-x-xfp', '10gbase-x-xenpak', '10gbase-x-x2', '25gbase-x-sfp28', '50gbase-x-sfp56', '40gbase-x-qsfpp', '50gbase-x-sfp28', '100gbase-x-cfp', '100gbase-x-cfp2', '200gbase-x-cfp2', '100gbase-x-cfp4', '100gbase-x-cpak', '100gbase-x-qsfp28', '200gbase-x-qsfp56', '400gbase-x-qsfpdd', '400gbase-x-osfp', '1000base-kx', '10gbase-kr', '10gbase-kx4', '25gbase-kr', '40gbase-kr4', '50gbase-kr', '100gbase-kp4', '100gbase-kr2', '100gbase-kr4', 'ieee802.11a', 'ieee802.11g', 'ieee802.11n', 'ieee802.11ac', 'ieee802.11ad', 'ieee802.11ax', 'ieee802.11ay', 'ieee802.15.1', 'other-wireless', 'gsm', 'cdma', 'lte', 'sonet-oc3', 'sonet-oc12', 'sonet-oc48', 'sonet-oc192', 'sonet-oc768', 'sonet-oc1920', 'sonet-oc3840', '1gfc-sfp', '2gfc-sfp', '4gfc-sfp', '8gfc-sfpp', '16gfc-sfpp', '32gfc-sfp28', '64gfc-qsfpp', '128gfc-qsfp28', 'infiniband-sdr', 'infiniband-ddr', 'infiniband-qdr', 'infiniband-fdr10', 'infiniband-fdr', 'infiniband-edr', 'infiniband-hdr', 'infiniband-ndr', 'infiniband-xdr', 't1', 'e1', 't3', 'e3', 'xdsl', 'docsis', 'gpon', 'xg-pon', 'xgs-pon', 'ng-pon2', 'epon', '10g-epon', 'cisco-stackwise', 'cisco-stackwise-plus', 'cisco-flexstack', 'cisco-flexstack-plus', 'cisco-stackwise-80', 'cisco-stackwise-160', 'cisco-stackwise-320', 'cisco-stackwise-480', 'juniper-vcp', 'extreme-summitstack', 'extreme-summitstack-128', 'extreme-summitstack-256', 'extreme-summitstack-512', 'other', IgnoreCase = $true)]
|
||||
[string]$Type,
|
||||
|
||||
[uint16]$MTU,
|
||||
|
||||
[string]$MAC_Address,
|
||||
|
||||
[bool]$MGMT_Only,
|
||||
|
||||
[uint16]$LAG,
|
||||
[uint64]$LAG,
|
||||
|
||||
[string]$Description,
|
||||
|
||||
|
|
@ -47,14 +36,12 @@ function Set-NetboxDCIMInterface {
|
|||
[uint16]$Untagged_VLAN,
|
||||
|
||||
[ValidateRange(1, 4094)]
|
||||
[uint16[]]$Tagged_VLANs
|
||||
[uint16[]]$Tagged_VLANs,
|
||||
|
||||
[switch]$Force
|
||||
)
|
||||
|
||||
begin {
|
||||
# if ($null -ne $Form_Factor) {
|
||||
# $PSBoundParameters.Form_Factor = ValidateDCIMChoice -ProvidedValue $Form_Factor -InterfaceFormFactor
|
||||
# }
|
||||
|
||||
if (-not [System.String]::IsNullOrWhiteSpace($Mode)) {
|
||||
$PSBoundParameters.Mode = switch ($Mode) {
|
||||
'Access' {
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/23/2020 12:11
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Set-NetboxDCIMInterfaceConnection.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Set-NetboxDCIMInterfaceConnection {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
|
@ -48,22 +35,18 @@ function Set-NetboxDCIMInterfaceConnection {
|
|||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint16[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[object]$Connection_Status,
|
||||
|
||||
[uint16]$Interface_A,
|
||||
[uint64]$Interface_A,
|
||||
|
||||
[uint16]$Interface_B,
|
||||
[uint64]$Interface_B,
|
||||
|
||||
[switch]$Force
|
||||
)
|
||||
|
||||
begin {
|
||||
# if ($null -ne $Connection_Status) {
|
||||
# $PSBoundParameters.Connection_Status = ValidateDCIMChoice -ProvidedValue $Connection_Status -InterfaceConnectionStatus
|
||||
# }
|
||||
|
||||
if ((@($ID).Count -gt 1) -and ($Interface_A -or $Interface_B)) {
|
||||
throw "Cannot set multiple connections to the same interface"
|
||||
}
|
||||
|
|
|
|||
48
Functions/DCIM/RearPorts/Add-NetboxDCIMRearPort.ps1
Normal file
48
Functions/DCIM/RearPorts/Add-NetboxDCIMRearPort.ps1
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
function Add-NetboxDCIMRearPort {
|
||||
[CmdletBinding()]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[uint64]$Device,
|
||||
|
||||
[uint64]$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 {
|
||||
|
||||
}
|
||||
}
|
||||
34
Functions/DCIM/RearPorts/Get-NetboxDCIMRearPort.ps1
Normal file
34
Functions/DCIM/RearPorts/Get-NetboxDCIMRearPort.ps1
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
function Get-NetboxDCIMRearPort {
|
||||
[CmdletBinding()]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
[uint16]$Limit,
|
||||
|
||||
[uint16]$Offset,
|
||||
|
||||
[Parameter(ValueFromPipelineByPropertyName = $true)]
|
||||
[uint64]$Id,
|
||||
|
||||
[string]$Name,
|
||||
|
||||
[string]$Device,
|
||||
|
||||
[uint64]$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
|
||||
}
|
||||
}
|
||||
35
Functions/DCIM/RearPorts/Remove-NetboxDCIMRearPort.ps1
Normal file
35
Functions/DCIM/RearPorts/Remove-NetboxDCIMRearPort.ps1
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
function Remove-NetboxDCIMRearPort {
|
||||
|
||||
[CmdletBinding(ConfirmImpact = 'High',
|
||||
SupportsShouldProcess = $true)]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint64[]]$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 {
|
||||
|
||||
}
|
||||
}
|
||||
59
Functions/DCIM/RearPorts/Set-NetboxDCIMRearPort.ps1
Normal file
59
Functions/DCIM/RearPorts/Set-NetboxDCIMRearPort.ps1
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
|
||||
function Set-NetboxDCIMRearPort {
|
||||
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint64[]]$Id,
|
||||
|
||||
[uint64]$Device,
|
||||
|
||||
[uint64]$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 {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +1,11 @@
|
|||
<#
|
||||
.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()]
|
||||
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
[Parameter(ParameterSetName = 'ByID', ValueFromPipelineByPropertyName = $true)]
|
||||
[uint32]$Id,
|
||||
[uint64]$Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Name,
|
||||
|
|
@ -34,7 +20,7 @@ function Get-NetboxDCIMSite {
|
|||
[string]$Facility,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$ASN,
|
||||
[uint64]$ASN,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[decimal]$Latitude,
|
||||
|
|
@ -52,13 +38,13 @@ function Get-NetboxDCIMSite {
|
|||
[string]$Contact_Email,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$Tenant_Group_ID,
|
||||
[uint64]$Tenant_Group_ID,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Tenant_Group,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$Tenant_ID,
|
||||
[uint64]$Tenant_ID,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Tenant,
|
||||
|
|
@ -67,7 +53,7 @@ function Get-NetboxDCIMSite {
|
|||
[string]$Status,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$Region_ID,
|
||||
[uint64]$Region_ID,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Region,
|
||||
|
|
@ -107,4 +93,3 @@ function Get-NetboxDCIMSite {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
86
Functions/DCIM/Sites/New-NetboxDCIMSite.ps1
Normal file
86
Functions/DCIM/Sites/New-NetboxDCIMSite.ps1
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
<#
|
||||
.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: New-NetboxDCIMSite.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function New-NetboxDCIMSite {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Create a new Site to Netbox
|
||||
|
||||
.DESCRIPTION
|
||||
Create a new Site to Netbox
|
||||
|
||||
.EXAMPLE
|
||||
New-NetboxDCIMSite -name MySite
|
||||
|
||||
Add new Site MySite on Netbox
|
||||
|
||||
#>
|
||||
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Name,
|
||||
|
||||
[string]$Slug,
|
||||
|
||||
[string]$Facility,
|
||||
|
||||
[uint64]$ASN,
|
||||
|
||||
[decimal]$Latitude,
|
||||
|
||||
[decimal]$Longitude,
|
||||
|
||||
[string]$Contact_Name,
|
||||
|
||||
[string]$Contact_Phone,
|
||||
|
||||
[string]$Contact_Email,
|
||||
|
||||
[uint64]$Tenant_Group,
|
||||
|
||||
[uint64]$Tenant,
|
||||
|
||||
[string]$Status,
|
||||
|
||||
[uint64]$Region,
|
||||
|
||||
[string]$Description,
|
||||
|
||||
[string]$Comments,
|
||||
|
||||
[switch]$Raw
|
||||
)
|
||||
|
||||
process {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'sites'))
|
||||
$Method = 'POST'
|
||||
|
||||
if (-not $PSBoundParameters.ContainsKey('slug')) {
|
||||
$PSBoundParameters.Add('slug', $name)
|
||||
}
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
||||
|
||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($name, 'Create new Site')) {
|
||||
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
||||
}
|
||||
}
|
||||
}
|
||||
64
Functions/DCIM/Sites/Remove-NetboxDCIMSite.ps1
Normal file
64
Functions/DCIM/Sites/Remove-NetboxDCIMSite.ps1
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<#
|
||||
.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: New-NetboxDCIMSite.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
function Remove-NetboxDCIMSite {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Remove a Site
|
||||
|
||||
.DESCRIPTION
|
||||
Remove a DCIM Site from Netbox
|
||||
|
||||
.EXAMPLE
|
||||
Remove-NetboxDCIMSite -Id 1
|
||||
|
||||
Remove DCM Site with id 1
|
||||
|
||||
.EXAMPLE
|
||||
Get-NetboxDCIMSite -name My Site | Remove-NetboxDCIMSite -confirm:$false
|
||||
|
||||
Remove DCM Site with name My Site without confirmation
|
||||
|
||||
#>
|
||||
|
||||
[CmdletBinding(ConfirmImpact = 'High',
|
||||
SupportsShouldProcess = $true)]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint]$Id
|
||||
|
||||
)
|
||||
|
||||
begin {
|
||||
|
||||
}
|
||||
|
||||
process {
|
||||
$CurrentSite = Get-NetboxDCIMSite -Id $Id -ErrorAction Stop
|
||||
|
||||
if ($pscmdlet.ShouldProcess("$($CurrentSite.Name)/$($CurrentSite.Id)", "Remove Site")) {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'sites', $CurrentSite.Id))
|
||||
|
||||
$URI = BuildNewURI -Segments $Segments
|
||||
|
||||
InvokeNetboxRequest -URI $URI -Method DELETE
|
||||
}
|
||||
}
|
||||
|
||||
end {
|
||||
|
||||
}
|
||||
}
|
||||
31
Functions/Extras/Tags/Get-NetboxTag.ps1
Normal file
31
Functions/Extras/Tags/Get-NetboxTag.ps1
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
function Get-NetboxTag {
|
||||
[CmdletBinding()]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
[Parameter(ValueFromPipelineByPropertyName = $true)]
|
||||
[uint64]$Id,
|
||||
|
||||
[string]$Name,
|
||||
|
||||
[string]$Slug,
|
||||
|
||||
[uint16]$Limit,
|
||||
|
||||
[uint16]$Offset,
|
||||
|
||||
[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
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/26/2020 14:22
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: BuildNewURI.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function BuildNewURI {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/26/2020 14:23
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: BuildURIComponents.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function BuildURIComponents {
|
||||
[CmdletBinding()]
|
||||
[OutputType([hashtable])]
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/26/2020 14:22
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: CheckNetboxIsConnected.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function CheckNetboxIsConnected {
|
||||
[CmdletBinding()]
|
||||
param ()
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/26/2020 14:25
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: CreateEnum.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function CreateEnum {
|
||||
[CmdletBinding()]
|
||||
param
|
||||
|
|
|
|||
|
|
@ -1,18 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.181
|
||||
Created on: 2020-11-04 14:23
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-ModelDefinition.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
|
||||
function Get-ModelDefinition {
|
||||
[CmdletBinding(DefaultParameterSetName = 'ByName')]
|
||||
param
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/26/2020 14:23
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: GetNetboxAPIErrorBody.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function GetNetboxAPIErrorBody {
|
||||
param
|
||||
(
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/26/2020 14:24
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: InvokeNetboxRequest.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function InvokeNetboxRequest {
|
||||
[CmdletBinding()]
|
||||
param
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/26/2020 14:25
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: ThrowNetboxRESTError.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function ThrowNetboxRESTError {
|
||||
$uriSegments = [System.Collections.ArrayList]::new(@('fake', 'url'))
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
[string]$Address,
|
||||
|
||||
[Parameter(ParameterSetName = 'ByID')]
|
||||
[uint32[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Query,
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
[object]$Family,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$Parent,
|
||||
[string]$Parent,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[byte]$Mask_Length,
|
||||
|
|
@ -25,28 +25,28 @@
|
|||
[string]$VRF,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$VRF_Id,
|
||||
[uint64]$VRF_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Tenant,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$Tenant_Id,
|
||||
[uint64]$Tenant_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Device,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$Device_ID,
|
||||
[uint64]$Device_ID,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Virtual_Machine,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$Virtual_Machine_Id,
|
||||
[uint64]$Virtual_Machine_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$Interface_Id,
|
||||
[uint64]$Interface_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[object]$Status,
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/19/2020 11:50
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-NetboxIPAMAvailableIP.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Get-NetboxIPAMAvailableIP {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
|
@ -53,10 +40,10 @@ function Get-NetboxIPAMAvailableIP {
|
|||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[Alias('Id')]
|
||||
[int]$Prefix_ID,
|
||||
[uint64]$Prefix_ID,
|
||||
|
||||
[Alias('NumberOfIPs')]
|
||||
[int]$Limit,
|
||||
[uint64]$Limit,
|
||||
|
||||
[switch]$Raw
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/19/2020 11:51
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: New-NetboxIPAMAddress.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function New-NetboxIPAMAddress {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
|
@ -79,17 +66,17 @@ function New-NetboxIPAMAddress {
|
|||
|
||||
[object]$Status = 'Active',
|
||||
|
||||
[int]$Tenant,
|
||||
[uint64]$Tenant,
|
||||
|
||||
[int]$VRF,
|
||||
[uint64]$VRF,
|
||||
|
||||
[object]$Role,
|
||||
|
||||
[int]$NAT_Inside,
|
||||
[uint64]$NAT_Inside,
|
||||
|
||||
[hashtable]$Custom_Fields,
|
||||
|
||||
[int]$Interface,
|
||||
[uint64]$Interface,
|
||||
|
||||
[string]$Description,
|
||||
|
||||
|
|
@ -98,7 +85,7 @@ function New-NetboxIPAMAddress {
|
|||
[ValidateSet('dcim.interface', 'virtualization.vminterface', IgnoreCase = $true)]
|
||||
[string]$Assigned_Object_Type,
|
||||
|
||||
[int]$Assigned_Object_Id,
|
||||
[uint64]$Assigned_Object_Id,
|
||||
|
||||
[switch]$Raw
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,16 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/19/2020 11:52
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Remove-NetboxIPAMAddress.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
function Remove-NetboxIPAMAddress {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
|
@ -38,7 +26,7 @@ function Remove-NetboxIPAMAddress {
|
|||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[int[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[switch]$Force
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/19/2020 11:53
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Set-NetboxIPAMAddress.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Set-NetboxIPAMAddress {
|
||||
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||
SupportsShouldProcess = $true)]
|
||||
|
|
@ -19,26 +6,26 @@ function Set-NetboxIPAMAddress {
|
|||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[int[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[string]$Address,
|
||||
|
||||
[string]$Status,
|
||||
|
||||
[int]$Tenant,
|
||||
[uint64]$Tenant,
|
||||
|
||||
[int]$VRF,
|
||||
[uint64]$VRF,
|
||||
|
||||
[object]$Role,
|
||||
|
||||
[int]$NAT_Inside,
|
||||
[uint64]$NAT_Inside,
|
||||
|
||||
[hashtable]$Custom_Fields,
|
||||
|
||||
[ValidateSet('dcim.interface', 'virtualization.vminterface', IgnoreCase = $true)]
|
||||
[string]$Assigned_Object_Type,
|
||||
|
||||
[uint16]$Assigned_Object_Id,
|
||||
[uint64]$Assigned_Object_Id,
|
||||
|
||||
[string]$Description,
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/19/2020 11:49
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-NetboxIPAMAggregate.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Get-NetboxIPAMAggregate {
|
||||
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
||||
param
|
||||
|
|
@ -20,7 +7,7 @@ function Get-NetboxIPAMAggregate {
|
|||
[string]$Query,
|
||||
|
||||
[Parameter(ParameterSetName = 'ByID')]
|
||||
[uint16[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Prefix,
|
||||
|
|
@ -29,7 +16,7 @@ function Get-NetboxIPAMAggregate {
|
|||
[object]$Family,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint16]$RIR_Id,
|
||||
[uint64]$RIR_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$RIR,
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/19/2020 11:51
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-NetboxIPAMPrefix.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Get-NetboxIPAMPrefix {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
|
@ -104,7 +91,7 @@ function Get-NetboxIPAMPrefix {
|
|||
[string]$Query,
|
||||
|
||||
[Parameter(ParameterSetName = 'ByID')]
|
||||
[uint32[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[object]$Family,
|
||||
|
|
@ -129,25 +116,25 @@ function Get-NetboxIPAMPrefix {
|
|||
[string]$VRF,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$VRF_Id,
|
||||
[uint64]$VRF_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Tenant,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$Tenant_Id,
|
||||
[uint64]$Tenant_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Site,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$Site_Id,
|
||||
[uint64]$Site_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Vlan_VId,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$Vlan_Id,
|
||||
[uint64]$Vlan_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[object]$Status,
|
||||
|
|
@ -156,7 +143,7 @@ function Get-NetboxIPAMPrefix {
|
|||
[string]$Role,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$Role_Id,
|
||||
[uint64]$Role_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint16]$Limit,
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/19/2020 11:52
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: New-NetboxIPAMPrefix.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function New-NetboxIPAMPrefix {
|
||||
[CmdletBinding(ConfirmImpact = 'low',
|
||||
SupportsShouldProcess = $true)]
|
||||
|
|
@ -23,7 +10,7 @@ function New-NetboxIPAMPrefix {
|
|||
|
||||
[object]$Status = 'Active',
|
||||
|
||||
[uint16]$Tenant,
|
||||
[uint64]$Tenant,
|
||||
|
||||
[object]$Role,
|
||||
|
||||
|
|
@ -31,11 +18,11 @@ function New-NetboxIPAMPrefix {
|
|||
|
||||
[string]$Description,
|
||||
|
||||
[uint16]$Site,
|
||||
[uint64]$Site,
|
||||
|
||||
[uint16]$VRF,
|
||||
[uint64]$VRF,
|
||||
|
||||
[uint16]$VLAN,
|
||||
[uint64]$VLAN,
|
||||
|
||||
[hashtable]$Custom_Fields,
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2021 v5.8.186
|
||||
Created on: 2021-03-23 13:54
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Set-NetboxIPAMPrefix.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Set-NetboxIPAMPrefix {
|
||||
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||
SupportsShouldProcess = $true)]
|
||||
|
|
@ -19,19 +6,19 @@ function Set-NetboxIPAMPrefix {
|
|||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint16[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[string]$Prefix,
|
||||
|
||||
[string]$Status,
|
||||
|
||||
[uint16]$Tenant,
|
||||
[uint64]$Tenant,
|
||||
|
||||
[uint16]$Site,
|
||||
[uint64]$Site,
|
||||
|
||||
[uint16]$VRF,
|
||||
[uint64]$VRF,
|
||||
|
||||
[uint16]$VLAN,
|
||||
[uint64]$VLAN,
|
||||
|
||||
[object]$Role,
|
||||
|
||||
|
|
|
|||
73
Functions/IPAM/Range/Get-NetboxIPAMAddressRange.ps1
Normal file
73
Functions/IPAM/Range/Get-NetboxIPAMAddressRange.ps1
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
|
||||
function Get-NetboxIPAMAddressRange {
|
||||
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
||||
param
|
||||
(
|
||||
[Parameter(ParameterSetName = 'Query',
|
||||
Position = 0)]
|
||||
[string]$Range,
|
||||
|
||||
[Parameter(ParameterSetName = 'ByID')]
|
||||
[uint64[]]$Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Query,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[object]$Family,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$VRF,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$VRF_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Tenant,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$Tenant_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[object]$Status,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[object]$Role,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint16]$Limit,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint16]$Offset,
|
||||
|
||||
[switch]$Raw
|
||||
)
|
||||
|
||||
switch ($PSCmdlet.ParameterSetName) {
|
||||
'ById' {
|
||||
foreach ($Range_ID in $Id) {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-ranges', $Range_ID))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
|
||||
|
||||
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||
|
||||
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
default {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-ranges'))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
||||
|
||||
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||
|
||||
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
106
Functions/IPAM/Range/New-NetboxIPAMAddressRange.ps1
Normal file
106
Functions/IPAM/Range/New-NetboxIPAMAddressRange.ps1
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
|
||||
|
||||
function New-NetboxIPAMAddressRange {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Create a new IP address range to Netbox
|
||||
|
||||
.DESCRIPTION
|
||||
Create a new IP address range to Netbox with a status of Active by default. The maximum supported
|
||||
size of an IP range is 2^32 - 1.
|
||||
|
||||
.PARAMETER Start_Address
|
||||
Starting IPv4 or IPv6 address (with mask). The maximum supported size of an IP range is 2^32 - 1.
|
||||
|
||||
.PARAMETER End_Address
|
||||
Ending IPv4 or IPv6 address (with mask). The maximum supported size of an IP range is 2^32 - 1.
|
||||
|
||||
.PARAMETER Status
|
||||
Operational status of this range. Defaults to Active
|
||||
|
||||
.PARAMETER Tenant
|
||||
Tenant ID
|
||||
|
||||
.PARAMETER VRF
|
||||
VRF ID
|
||||
|
||||
.PARAMETER Role
|
||||
Role such as backup, customer, development, etc... Defaults to nothing
|
||||
|
||||
.PARAMETER Custom_Fields
|
||||
Custom field hash table. Will be validated by the API service
|
||||
|
||||
.PARAMETER Description
|
||||
Description of IP address range
|
||||
|
||||
.PARAMETER Comments
|
||||
Extra comments (markdown supported).
|
||||
|
||||
.PARAMETER Tags
|
||||
One or more tags.
|
||||
|
||||
.PARAMETER Mark_Utilized
|
||||
Treat as 100% utilized
|
||||
|
||||
.PARAMETER Raw
|
||||
Return raw results from API service
|
||||
|
||||
.EXAMPLE
|
||||
New-NetboxIPAMAddressRange -Start_Address 192.0.2.20/24 -End_Address 192.0.2.20/24
|
||||
|
||||
Add new IP Address range from 192.0.2.20/24 to 192.0.2.20/24 with status active
|
||||
|
||||
.NOTES
|
||||
https://netbox.neonet.org/static/docs/models/ipam/iprange/
|
||||
#>
|
||||
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Start_Address,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$End_Address,
|
||||
|
||||
[object]$Status = 'Active',
|
||||
|
||||
[uint64]$Tenant,
|
||||
|
||||
[uint64]$VRF,
|
||||
|
||||
[object]$Role,
|
||||
|
||||
[hashtable]$Custom_Fields,
|
||||
|
||||
[string]$Description,
|
||||
|
||||
[string]$Comments,
|
||||
|
||||
[object[]]$Tags,
|
||||
|
||||
[switch]$Mark_Utilized,
|
||||
|
||||
[switch]$Raw
|
||||
)
|
||||
|
||||
process {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-ranges'))
|
||||
$Method = 'POST'
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
||||
|
||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($Start_Address, 'Create new IP address range')) {
|
||||
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
47
Functions/IPAM/Range/Remove-NetboxIPAMAddressRange.ps1
Normal file
47
Functions/IPAM/Range/Remove-NetboxIPAMAddressRange.ps1
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
|
||||
function Remove-NetboxIPAMAddressRange {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Remove an IP address range from Netbox
|
||||
|
||||
.DESCRIPTION
|
||||
Removes/deletes an IP address range from Netbox by ID
|
||||
|
||||
.PARAMETER Id
|
||||
Database ID of the IP address range object.
|
||||
|
||||
.PARAMETER Force
|
||||
Do not confirm.
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> Remove-NetboxIPAMAddressRange -Id 1234
|
||||
|
||||
.NOTES
|
||||
Additional information about the function.
|
||||
#>
|
||||
|
||||
[CmdletBinding(ConfirmImpact = 'High',
|
||||
SupportsShouldProcess = $true)]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint64[]]$Id,
|
||||
|
||||
[switch]$Force
|
||||
)
|
||||
|
||||
process {
|
||||
foreach ($Range_Id in $Id) {
|
||||
$CurrentRange = Get-NetboxIPAMAddressRange -Id $Range_Id -ErrorAction Stop
|
||||
|
||||
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-ranges', $Range_Id))
|
||||
|
||||
if ($Force -or $pscmdlet.ShouldProcess($CurrentRange.start_address, "Delete")) {
|
||||
$URI = BuildNewURI -Segments $Segments
|
||||
|
||||
InvokeNetboxRequest -URI $URI -Method DELETE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
58
Functions/IPAM/Range/Set-NetboxIPAMAddressRange.ps1
Normal file
58
Functions/IPAM/Range/Set-NetboxIPAMAddressRange.ps1
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
|
||||
function Set-NetboxIPAMAddressRange {
|
||||
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||
SupportsShouldProcess = $true)]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint64[]]$Id,
|
||||
|
||||
[string]$Start_Address,
|
||||
|
||||
[string]$End_Address,
|
||||
|
||||
[object]$Status,
|
||||
|
||||
[uint64]$Tenant,
|
||||
|
||||
[uint64]$VRF,
|
||||
|
||||
[object]$Role,
|
||||
|
||||
[hashtable]$Custom_Fields,
|
||||
|
||||
[string]$Description,
|
||||
|
||||
[string]$Comments,
|
||||
|
||||
[object[]]$Tags,
|
||||
|
||||
[switch]$Mark_Utilized,
|
||||
|
||||
[switch]$Force,
|
||||
|
||||
[switch]$Raw
|
||||
)
|
||||
|
||||
begin {
|
||||
$Method = 'PATCH'
|
||||
}
|
||||
|
||||
process {
|
||||
foreach ($RangeID in $Id) {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-ranges', $RangeID))
|
||||
|
||||
Write-Verbose "Obtaining IP range from ID $RangeID"
|
||||
$CurrentRange = Get-NetboxIPAMAddressRange -Id $RangeID -ErrorAction Stop
|
||||
|
||||
if ($Force -or $PSCmdlet.ShouldProcess("$($CurrentRange.Start_Address) - $($CurrentRange.End_Address)", 'Set')) {
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id', 'Force'
|
||||
|
||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||
|
||||
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method $Method
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -49,7 +49,7 @@ function Get-NetboxIPAMRole {
|
|||
[string]$Query,
|
||||
|
||||
[Parameter(ParameterSetName = 'ByID')]
|
||||
[uint32[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Slug,
|
||||
|
|
|
|||
|
|
@ -1,19 +1,6 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/16/2020 16:34
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-NetboxIPAMVLAN.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Get-NetboxIPAMVLAN {
|
||||
[CmdletBinding()]
|
||||
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
||||
param
|
||||
(
|
||||
[Parameter(ParameterSetName = 'Query',
|
||||
|
|
@ -22,7 +9,7 @@ function Get-NetboxIPAMVLAN {
|
|||
[uint16]$VID,
|
||||
|
||||
[Parameter(ParameterSetName = 'ByID')]
|
||||
[uint32[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Query,
|
||||
|
|
@ -34,13 +21,13 @@ function Get-NetboxIPAMVLAN {
|
|||
[string]$Tenant,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$Tenant_Id,
|
||||
[uint64]$Tenant_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$TenantGroup,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$TenantGroup_Id,
|
||||
[uint64]$TenantGroup_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[object]$Status,
|
||||
|
|
@ -52,19 +39,19 @@ function Get-NetboxIPAMVLAN {
|
|||
[string]$Site,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$Site_Id,
|
||||
[uint64]$Site_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Group,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$Group_Id,
|
||||
[uint64]$Group_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Role,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint32]$Role_Id,
|
||||
[uint64]$Role_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint16]$Limit,
|
||||
|
|
@ -75,10 +62,6 @@ function Get-NetboxIPAMVLAN {
|
|||
[switch]$Raw
|
||||
)
|
||||
|
||||
# if ($null -ne $Status) {
|
||||
# $PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -VLANStatus
|
||||
# }
|
||||
|
||||
switch ($PSCmdlet.ParameterSetName) {
|
||||
'ById' {
|
||||
foreach ($VLAN_ID in $Id) {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
|
||||
[object]$Status = 'Active',
|
||||
|
||||
[uint16]$Tenant,
|
||||
[uint64]$Tenant,
|
||||
|
||||
[object]$Role,
|
||||
|
||||
|
|
|
|||
11
Functions/Setup/Clear-NetboxCredential.ps1
Normal file
11
Functions/Setup/Clear-NetboxCredential.ps1
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
function Clear-NetboxCredential {
|
||||
[CmdletBinding(ConfirmImpact = 'Medium', SupportsShouldProcess = $true)]
|
||||
param
|
||||
(
|
||||
[switch]$Force
|
||||
)
|
||||
|
||||
if ($Force -or ($PSCmdlet.ShouldProcess('Netbox Credentials', 'Clear'))) {
|
||||
$script:NetboxConfig.Credential = $null
|
||||
}
|
||||
}
|
||||
|
|
@ -85,6 +85,8 @@
|
|||
|
||||
#for PowerShell (<=) 5 (Desktop), Enable TLS 1.1, 1.2 and Disable SSL chain trust
|
||||
if ("Desktop" -eq $PSVersionTable.PsEdition) {
|
||||
#Add System.web (Need for ParseQueryString)
|
||||
Add-Type -AssemblyName System.Web
|
||||
#Enable TLS 1.1 and 1.2
|
||||
Set-NetboxCipherSSL
|
||||
if ($SkipCertificateCheck) {
|
||||
|
|
@ -146,14 +148,7 @@
|
|||
$script:NetboxConfig.Connected = $true
|
||||
Write-Verbose "Successfully connected!"
|
||||
|
||||
#Write-Verbose "Caching static choices"
|
||||
#$script:NetboxConfig.Choices.Circuits = Get-NetboxCircuitsChoices
|
||||
#$script:NetboxConfig.Choices.DCIM = Get-NetboxDCIMChoices # Not completed yet
|
||||
#$script:NetboxConfig.Choices.Extras = Get-NetboxExtrasChoices
|
||||
#$script:NetboxConfig.Choices.IPAM = Get-NetboxIPAMChoices
|
||||
##$script:NetboxConfig.Choices.Secrets = Get-NetboxSecretsChoices # Not completed yet
|
||||
##$script:NetboxConfig.Choices.Tenancy = Get-NetboxTenancyChoices
|
||||
#$script:NetboxConfig.Choices.Virtualization = Get-NetboxVirtualizationChoices
|
||||
$script:NetboxConfig.ContentTypes = Get-NetboxContentType -Limit 500
|
||||
|
||||
Write-Verbose "Connection process completed"
|
||||
}
|
||||
|
|
@ -1,27 +1,19 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.174
|
||||
Created on: 4/28/2020 11:57
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-NetboxAPIDefinition.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
|
||||
function Get-NetboxAPIDefinition {
|
||||
[CmdletBinding()]
|
||||
param ()
|
||||
param
|
||||
(
|
||||
[ValidateSet('json', 'yaml', IgnoreCase = $true)]
|
||||
[string]$Format = 'json'
|
||||
)
|
||||
|
||||
#$URI = "https://netbox.neonet.org/api/docs/?format=openapi"
|
||||
#$URI = "https://netbox.neonet.org/api/schema/?format=json"
|
||||
|
||||
$Segments = [System.Collections.ArrayList]::new(@('docs'))
|
||||
$Segments = [System.Collections.ArrayList]::new(@('schema'))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary @{'format' = 'openapi' }
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary @{
|
||||
'format' = $Format.ToLower()
|
||||
}
|
||||
|
||||
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters -SkipConnectedCheck
|
||||
|
||||
|
|
|
|||
89
Functions/Setup/Support/Get-NetboxContentType.ps1
Normal file
89
Functions/Setup/Support/Get-NetboxContentType.ps1
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
function Get-NetboxContentType {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Get a content type definition from Netbox
|
||||
|
||||
.DESCRIPTION
|
||||
A detailed description of the Get-NetboxContentType function.
|
||||
|
||||
.PARAMETER Model
|
||||
A description of the Model parameter.
|
||||
|
||||
.PARAMETER Id
|
||||
The database ID of the contact role
|
||||
|
||||
.PARAMETER App_Label
|
||||
A description of the App_Label parameter.
|
||||
|
||||
.PARAMETER Query
|
||||
A standard search query that will match one or more contact roles.
|
||||
|
||||
.PARAMETER Limit
|
||||
Limit the number of results to this number
|
||||
|
||||
.PARAMETER Offset
|
||||
Start the search at this index in results
|
||||
|
||||
.PARAMETER Raw
|
||||
Return the unparsed data from the HTTP request
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> Get-NetboxContentType
|
||||
|
||||
.NOTES
|
||||
Additional information about the function.
|
||||
#>
|
||||
|
||||
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
||||
param
|
||||
(
|
||||
[Parameter(ParameterSetName = 'Query',
|
||||
Position = 0)]
|
||||
[string]$Model,
|
||||
|
||||
[Parameter(ParameterSetName = 'ByID')]
|
||||
[uint64[]]$Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$App_Label,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Query,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint16]$Limit,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint16]$Offset,
|
||||
|
||||
[switch]$Raw
|
||||
)
|
||||
|
||||
switch ($PSCmdlet.ParameterSetName) {
|
||||
'ById' {
|
||||
foreach ($ContentType_ID in $Id) {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('extras', 'content-types', $ContentType_ID))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
|
||||
|
||||
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||
|
||||
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
default {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('extras', 'content-types'))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
||||
|
||||
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||
|
||||
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@
|
|||
'Choices' = @{
|
||||
}
|
||||
'APIDefinition' = $null
|
||||
'ContentTypes' = $null
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
7
Functions/Setup/Support/Test-NetboxAPIConnected.ps1
Normal file
7
Functions/Setup/Support/Test-NetboxAPIConnected.ps1
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
function Test-NetboxAPIConnected {
|
||||
[CmdletBinding()]
|
||||
param ()
|
||||
|
||||
$script:NetboxConfig.Connected
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
|
||||
function Get-NetboxContactAssignment {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Get a contact Assignment from Netbox
|
||||
|
||||
.DESCRIPTION
|
||||
A detailed description of the Get-NetboxContactAssignment function.
|
||||
|
||||
.PARAMETER Name
|
||||
The specific name of the contact Assignment. Must match exactly as is defined in Netbox
|
||||
|
||||
.PARAMETER Id
|
||||
The database ID of the contact Assignment
|
||||
|
||||
.PARAMETER Content_Type_Id
|
||||
A description of the Content_Type_Id parameter.
|
||||
|
||||
.PARAMETER Content_Type
|
||||
A description of the Content_Type parameter.
|
||||
|
||||
.PARAMETER Object_Id
|
||||
A description of the Object_Id parameter.
|
||||
|
||||
.PARAMETER Contact_Id
|
||||
A description of the Contact_Id parameter.
|
||||
|
||||
.PARAMETER Role_Id
|
||||
A description of the Role_Id parameter.
|
||||
|
||||
.PARAMETER Limit
|
||||
Limit the number of results to this number
|
||||
|
||||
.PARAMETER Offset
|
||||
Start the search at this index in results
|
||||
|
||||
.PARAMETER Raw
|
||||
Return the unparsed data from the HTTP request
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> Get-NetboxContactAssignment
|
||||
|
||||
.NOTES
|
||||
Additional information about the function.
|
||||
#>
|
||||
|
||||
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
||||
param
|
||||
(
|
||||
[Parameter(ParameterSetName = 'Query',
|
||||
Position = 0)]
|
||||
[string]$Name,
|
||||
|
||||
[Parameter(ParameterSetName = 'ByID')]
|
||||
[uint64[]]$Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint64]$Content_Type_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Content_Type,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint64]$Object_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint64]$Contact_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint64]$Role_Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint16]$Limit,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint16]$Offset,
|
||||
|
||||
[switch]$Raw
|
||||
)
|
||||
|
||||
switch ($PSCmdlet.ParameterSetName) {
|
||||
'ById' {
|
||||
foreach ($ContactAssignment_ID in $Id) {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('tenancy', 'contact-assignments', $ContactAssignment_ID))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
|
||||
|
||||
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||
|
||||
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
default {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('tenancy', 'contact-assignments'))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
||||
|
||||
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||
|
||||
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
|
||||
function New-NetboxContactAssignment {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Create a new contact role assignment in Netbox
|
||||
|
||||
.DESCRIPTION
|
||||
Creates a new contact role assignment in Netbox
|
||||
|
||||
.PARAMETER Content_Type
|
||||
The content type for this assignment.
|
||||
|
||||
.PARAMETER Object_Id
|
||||
ID of the object to assign.
|
||||
|
||||
.PARAMETER Contact
|
||||
ID of the contact to assign.
|
||||
|
||||
.PARAMETER Role
|
||||
ID of the contact role to assign.
|
||||
|
||||
.PARAMETER Priority
|
||||
Piority of the contact assignment.
|
||||
|
||||
.PARAMETER Raw
|
||||
Return the unparsed data from the HTTP request
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> New-NetboxContactAssignment -Content_Type 'dcim.location' -Object_id 10 -Contact 15 -Role 10 -Priority 'Primary'
|
||||
|
||||
.NOTES
|
||||
Valid content types: https://docs.netbox.dev/en/stable/features/contacts/#contacts_1
|
||||
#>
|
||||
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[ValidateSet('circuits.circuit', 'circuits.provider', 'circuits.provideraccount', 'dcim.device', 'dcim.location', 'dcim.manufacturer', 'dcim.powerpanel', 'dcim.rack', 'dcim.region', 'dcim.site', 'dcim.sitegroup', 'tenancy.tenant', 'virtualization.cluster', 'virtualization.clustergroup', 'virtualization.virtualmachine', IgnoreCase = $true)]
|
||||
[string]$Content_Type,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[uint64]$Object_Id,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[uint64]$Contact,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[uint64]$Role,
|
||||
|
||||
[ValidateSet('primary', 'secondary', 'tertiary', 'inactive', IgnoreCase = $true)]
|
||||
[string]$Priority,
|
||||
|
||||
[switch]$Raw
|
||||
)
|
||||
|
||||
begin {
|
||||
$Method = 'POST'
|
||||
}
|
||||
|
||||
process {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('tenancy', 'contact-assignments'))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
||||
|
||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($Content_Type, 'Create new contact assignment')) {
|
||||
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
|
||||
|
||||
function Set-NetboxContactAssignment {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Update a contact role assignment in Netbox
|
||||
|
||||
.DESCRIPTION
|
||||
Updates a contact role assignment in Netbox
|
||||
|
||||
.PARAMETER Content_Type
|
||||
The content type for this assignment.
|
||||
|
||||
.PARAMETER Object_Id
|
||||
ID of the object to assign.
|
||||
|
||||
.PARAMETER Contact
|
||||
ID of the contact to assign.
|
||||
|
||||
.PARAMETER Role
|
||||
ID of the contact role to assign.
|
||||
|
||||
.PARAMETER Priority
|
||||
Priority of the contact assignment.
|
||||
|
||||
.PARAMETER Raw
|
||||
Return the unparsed data from the HTTP request
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> Set-NetboxContactAssignment -Id 11 -Content_Type 'dcim.location' -Object_id 10 -Contact 15 -Role 10 -Priority 'Primary'
|
||||
|
||||
.NOTES
|
||||
Valid content types: https://docs.netbox.dev/en/stable/features/contacts/#contacts_1
|
||||
#>
|
||||
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint64[]]$Id,
|
||||
|
||||
[Parameter(ValueFromPipelineByPropertyName = $true)]
|
||||
[ValidateSet('circuits.circuit', 'circuits.provider', 'circuits.provideraccount', 'dcim.device', 'dcim.location', 'dcim.manufacturer', 'dcim.powerpanel', 'dcim.rack', 'dcim.region', 'dcim.site', 'dcim.sitegroup', 'tenancy.tenant', 'virtualization.cluster', 'virtualization.clustergroup', 'virtualization.virtualmachine', IgnoreCase = $true)]
|
||||
[string]$Content_Type,
|
||||
|
||||
[uint64]$Object_Id,
|
||||
|
||||
[uint64]$Contact,
|
||||
|
||||
[uint64]$Role,
|
||||
|
||||
[ValidateSet('primary', 'secondary', 'tertiary', 'inactive', IgnoreCase = $true)]
|
||||
[string]$Priority,
|
||||
|
||||
[switch]$Raw
|
||||
)
|
||||
|
||||
begin {
|
||||
$Method = 'Patch'
|
||||
}
|
||||
|
||||
process {
|
||||
foreach ($ContactAssignmentId in $Id) {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('tenancy', 'contact-assignments', $ContactAssignmentId))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id', 'Force'
|
||||
|
||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||
|
||||
$CurrentContactAssignment = Get-NetboxContactAssignment -Id $ContactAssignmentId -ErrorAction Stop
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($CurrentContactAssignment.Id, 'Update contact assignment')) {
|
||||
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
90
Functions/Tenancy/ContactRoles/Get-NetboxContactRole.ps1
Normal file
90
Functions/Tenancy/ContactRoles/Get-NetboxContactRole.ps1
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
|
||||
function Get-NetboxContactRole {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Get a contact role from Netbox
|
||||
|
||||
.DESCRIPTION
|
||||
A detailed description of the Get-NetboxContactRole function.
|
||||
|
||||
.PARAMETER Name
|
||||
The specific name of the contact role. Must match exactly as is defined in Netbox
|
||||
|
||||
.PARAMETER Id
|
||||
The database ID of the contact role
|
||||
|
||||
.PARAMETER Query
|
||||
A standard search query that will match one or more contact roles.
|
||||
|
||||
.PARAMETER Limit
|
||||
Limit the number of results to this number
|
||||
|
||||
.PARAMETER Offset
|
||||
Start the search at this index in results
|
||||
|
||||
.PARAMETER Raw
|
||||
Return the unparsed data from the HTTP request
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> Get-NetboxContactRole
|
||||
|
||||
.NOTES
|
||||
Additional information about the function.
|
||||
#>
|
||||
|
||||
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
||||
param
|
||||
(
|
||||
[Parameter(ParameterSetName = 'Query',
|
||||
Position = 0)]
|
||||
[string]$Name,
|
||||
|
||||
[Parameter(ParameterSetName = 'ByID')]
|
||||
[uint64[]]$Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Query,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Slug,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Description,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint16]$Limit,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint16]$Offset,
|
||||
|
||||
[switch]$Raw
|
||||
)
|
||||
|
||||
switch ($PSCmdlet.ParameterSetName) {
|
||||
'ById' {
|
||||
foreach ($ContactRole_ID in $Id) {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('tenancy', 'contact-roles', $ContactRole_ID))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
|
||||
|
||||
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||
|
||||
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
default {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('tenancy', 'contact-roles'))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
||||
|
||||
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||
|
||||
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
71
Functions/Tenancy/ContactRoles/New-NetboxContactRole.ps1
Normal file
71
Functions/Tenancy/ContactRoles/New-NetboxContactRole.ps1
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
|
||||
function New-NetboxContactRole {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Create a new contact role in Netbox
|
||||
|
||||
.DESCRIPTION
|
||||
Creates a new contact role object in Netbox
|
||||
|
||||
.PARAMETER Name
|
||||
The contact role name, e.g "Network Support"
|
||||
|
||||
.PARAMETER Slug
|
||||
The unique URL for the role. Can only contain hypens, A-Z, a-z, 0-9, and underscores
|
||||
|
||||
.PARAMETER Description
|
||||
Short description of the contact role
|
||||
|
||||
.PARAMETER Custom_Fields
|
||||
A description of the Custom_Fields parameter.
|
||||
|
||||
.PARAMETER Raw
|
||||
Return the unparsed data from the HTTP request
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> New-NetboxContact -Name 'Leroy Jenkins' -Email 'leroy.jenkins@example.com'
|
||||
|
||||
.NOTES
|
||||
Additional information about the function.
|
||||
#>
|
||||
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[ValidateLength(1, 100)]
|
||||
[string]$Name,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[ValidateLength(1, 100)]
|
||||
[ValidatePattern('^[-a-zA-Z0-9_]+$')]
|
||||
[string]$Slug,
|
||||
|
||||
[ValidateLength(0, 200)]
|
||||
[string]$Description,
|
||||
|
||||
[hashtable]$Custom_Fields,
|
||||
|
||||
[switch]$Raw
|
||||
)
|
||||
|
||||
process {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('tenancy', 'contacts'))
|
||||
$Method = 'POST'
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
||||
|
||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($Name, 'Create new contact')) {
|
||||
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
80
Functions/Tenancy/ContactRoles/Set-NetboxContactRole.ps1
Normal file
80
Functions/Tenancy/ContactRoles/Set-NetboxContactRole.ps1
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
|
||||
function Set-NetboxContactRole {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Update a contact role in Netbox
|
||||
|
||||
.DESCRIPTION
|
||||
Updates a contact role in Netbox
|
||||
|
||||
.PARAMETER Name
|
||||
The contact role name, e.g "Network Support"
|
||||
|
||||
.PARAMETER Slug
|
||||
The unique URL for the role. Can only contain hypens, A-Z, a-z, 0-9, and underscores
|
||||
|
||||
.PARAMETER Description
|
||||
Short description of the contact role
|
||||
|
||||
.PARAMETER Custom_Fields
|
||||
A description of the Custom_Fields parameter.
|
||||
|
||||
.PARAMETER Raw
|
||||
Return the unparsed data from the HTTP request
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> New-NetboxContact -Name 'Leroy Jenkins' -Email 'leroy.jenkins@example.com'
|
||||
|
||||
.NOTES
|
||||
Additional information about the function.
|
||||
#>
|
||||
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint64[]]$Id,
|
||||
|
||||
[Parameter(ValueFromPipelineByPropertyName = $true)]
|
||||
[ValidateLength(1, 100)]
|
||||
[string]$Name,
|
||||
|
||||
[ValidateLength(1, 100)]
|
||||
[ValidatePattern('^[-a-zA-Z0-9_]+$')]
|
||||
[string]$Slug,
|
||||
|
||||
[ValidateLength(0, 200)]
|
||||
[string]$Description,
|
||||
|
||||
[hashtable]$Custom_Fields,
|
||||
|
||||
[switch]$Raw
|
||||
)
|
||||
|
||||
begin {
|
||||
$Method = 'PATCH'
|
||||
}
|
||||
|
||||
process {
|
||||
foreach ($ContactRoleId in $Id) {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('tenancy', 'contacts', $ContactRoleId))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id', 'Force'
|
||||
|
||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||
|
||||
$CurrentContactRole = Get-NetboxContactRole -Id $ContactRoleId -ErrorAction Stop
|
||||
|
||||
if ($Force -or $PSCmdlet.ShouldProcess($CurrentContactRole.Name, 'Update contact role')) {
|
||||
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
120
Functions/Tenancy/Contacts/Get-NetboxContact.ps1
Normal file
120
Functions/Tenancy/Contacts/Get-NetboxContact.ps1
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
|
||||
function Get-NetboxContact {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Get a contact from Netbox
|
||||
|
||||
.DESCRIPTION
|
||||
Obtain a contact or contacts from Netbox by ID or query
|
||||
|
||||
.PARAMETER Name
|
||||
The specific name of the Contact. Must match exactly as is defined in Netbox
|
||||
|
||||
.PARAMETER Id
|
||||
The database ID of the Contact
|
||||
|
||||
.PARAMETER Query
|
||||
A standard search query that will match one or more Contacts.
|
||||
|
||||
.PARAMETER Email
|
||||
Email address of the contact
|
||||
|
||||
.PARAMETER Title
|
||||
Title of the contact
|
||||
|
||||
.PARAMETER Phone
|
||||
Telephone number of the contact
|
||||
|
||||
.PARAMETER Address
|
||||
Physical address of the contact
|
||||
|
||||
.PARAMETER Group
|
||||
The specific group as defined in Netbox.
|
||||
|
||||
.PARAMETER GroupID
|
||||
The database ID of the group in Netbox
|
||||
|
||||
.PARAMETER Limit
|
||||
Limit the number of results to this number
|
||||
|
||||
.PARAMETER Offset
|
||||
Start the search at this index in results
|
||||
|
||||
.PARAMETER Raw
|
||||
Return the unparsed data from the HTTP request
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> Get-NetboxContact
|
||||
|
||||
.NOTES
|
||||
Additional information about the function.
|
||||
#>
|
||||
|
||||
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
||||
param
|
||||
(
|
||||
[Parameter(ParameterSetName = 'Query',
|
||||
Position = 0)]
|
||||
[string]$Name,
|
||||
|
||||
[Parameter(ParameterSetName = 'ByID')]
|
||||
[uint64[]]$Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Query,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Email,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Title,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Phone,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Address,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Group,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint64]$GroupID,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint16]$Limit,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint16]$Offset,
|
||||
|
||||
[switch]$Raw
|
||||
)
|
||||
|
||||
switch ($PSCmdlet.ParameterSetName) {
|
||||
'ById' {
|
||||
foreach ($Contact_ID in $Id) {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('tenancy', 'contacts', $Contact_ID))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
|
||||
|
||||
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||
|
||||
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
default {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('tenancy', 'contacts'))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
||||
|
||||
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||
|
||||
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
99
Functions/Tenancy/Contacts/New-NetboxContact.ps1
Normal file
99
Functions/Tenancy/Contacts/New-NetboxContact.ps1
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
|
||||
function New-NetboxContact {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Create a new contact in Netbox
|
||||
|
||||
.DESCRIPTION
|
||||
Creates a new contact object in Netbox which can be linked to other objects
|
||||
|
||||
.PARAMETER Name
|
||||
The contacts full name, e.g "Leroy Jenkins"
|
||||
|
||||
.PARAMETER Email
|
||||
Email address of the contact
|
||||
|
||||
.PARAMETER Title
|
||||
Job title or other title related to the contact
|
||||
|
||||
.PARAMETER Phone
|
||||
Telephone number
|
||||
|
||||
.PARAMETER Address
|
||||
Physical address, usually mailing address
|
||||
|
||||
.PARAMETER Description
|
||||
Short description of the contact
|
||||
|
||||
.PARAMETER Comments
|
||||
Detailed comments. Markdown supported.
|
||||
|
||||
.PARAMETER Link
|
||||
URI related to the contact
|
||||
|
||||
.PARAMETER Custom_Fields
|
||||
A description of the Custom_Fields parameter.
|
||||
|
||||
.PARAMETER Raw
|
||||
A description of the Raw parameter.
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> New-NetboxContact -Name 'Leroy Jenkins' -Email 'leroy.jenkins@example.com'
|
||||
|
||||
.NOTES
|
||||
Additional information about the function.
|
||||
#>
|
||||
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[ValidateLength(1, 100)]
|
||||
[string]$Name,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[ValidateLength(0, 254)]
|
||||
[string]$Email,
|
||||
|
||||
[ValidateLength(0, 100)]
|
||||
[string]$Title,
|
||||
|
||||
[ValidateLength(0, 50)]
|
||||
[string]$Phone,
|
||||
|
||||
[ValidateLength(0, 200)]
|
||||
[string]$Address,
|
||||
|
||||
[ValidateLength(0, 200)]
|
||||
[string]$Description,
|
||||
|
||||
[string]$Comments,
|
||||
|
||||
[ValidateLength(0, 200)]
|
||||
[string]$Link,
|
||||
|
||||
[hashtable]$Custom_Fields,
|
||||
|
||||
[switch]$Raw
|
||||
)
|
||||
|
||||
process {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('tenancy', 'contacts'))
|
||||
$Method = 'POST'
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
||||
|
||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($Name, 'Create new contact')) {
|
||||
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
120
Functions/Tenancy/Contacts/Set-NetboxContact.ps1
Normal file
120
Functions/Tenancy/Contacts/Set-NetboxContact.ps1
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
|
||||
function Set-NetboxContact {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Update a contact in Netbox
|
||||
|
||||
.DESCRIPTION
|
||||
Updates a contact object in Netbox which can be linked to other objects
|
||||
|
||||
.PARAMETER Id
|
||||
A description of the Id parameter.
|
||||
|
||||
.PARAMETER Name
|
||||
The contacts full name, e.g "Leroy Jenkins"
|
||||
|
||||
.PARAMETER Email
|
||||
Email address of the contact
|
||||
|
||||
.PARAMETER Group
|
||||
Database ID of assigned group
|
||||
|
||||
.PARAMETER Title
|
||||
Job title or other title related to the contact
|
||||
|
||||
.PARAMETER Phone
|
||||
Telephone number
|
||||
|
||||
.PARAMETER Address
|
||||
Physical address, usually mailing address
|
||||
|
||||
.PARAMETER Description
|
||||
Short description of the contact
|
||||
|
||||
.PARAMETER Comments
|
||||
Detailed comments. Markdown supported.
|
||||
|
||||
.PARAMETER Link
|
||||
URI related to the contact
|
||||
|
||||
.PARAMETER Custom_Fields
|
||||
A description of the Custom_Fields parameter.
|
||||
|
||||
.PARAMETER Force
|
||||
A description of the Force parameter.
|
||||
|
||||
.PARAMETER Raw
|
||||
A description of the Raw parameter.
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> Set-NetboxContact -Id 10 -Name 'Leroy Jenkins' -Email 'leroy.jenkins@example.com'
|
||||
|
||||
.NOTES
|
||||
Additional information about the function.
|
||||
#>
|
||||
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint64[]]$Id,
|
||||
|
||||
[ValidateLength(1, 100)]
|
||||
[string]$Name,
|
||||
|
||||
[ValidateLength(0, 254)]
|
||||
[string]$Email,
|
||||
|
||||
[uint64]$Group,
|
||||
|
||||
[ValidateLength(0, 100)]
|
||||
[string]$Title,
|
||||
|
||||
[ValidateLength(0, 50)]
|
||||
[string]$Phone,
|
||||
|
||||
[ValidateLength(0, 200)]
|
||||
[string]$Address,
|
||||
|
||||
[ValidateLength(0, 200)]
|
||||
[string]$Description,
|
||||
|
||||
[string]$Comments,
|
||||
|
||||
[ValidateLength(0, 200)]
|
||||
[string]$Link,
|
||||
|
||||
[hashtable]$Custom_Fields,
|
||||
|
||||
[switch]$Force,
|
||||
|
||||
[switch]$Raw
|
||||
)
|
||||
|
||||
begin {
|
||||
$Method = 'PATCH'
|
||||
}
|
||||
|
||||
process {
|
||||
foreach ($ContactId in $Id) {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('tenancy', 'contacts', $ContactId))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id', 'Force'
|
||||
|
||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||
|
||||
$CurrentContact = Get-NetboxContact -Id $ContactId -ErrorAction Stop
|
||||
|
||||
if ($Force -or $PSCmdlet.ShouldProcess($CurrentContact.Name, 'Update contact')) {
|
||||
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/19/2020 11:56
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-NetboxTenant.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Get-NetboxTenant {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
|
@ -65,7 +52,7 @@ function Get-NetboxTenant {
|
|||
[string]$Name,
|
||||
|
||||
[Parameter(ParameterSetName = 'ByID')]
|
||||
[uint32[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[string]$Query,
|
||||
|
|
@ -77,7 +64,7 @@ function Get-NetboxTenant {
|
|||
[string]$Group,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[uint16]$GroupID,
|
||||
[uint64]$GroupID,
|
||||
|
||||
[Parameter(ParameterSetName = 'Query')]
|
||||
[hashtable]$CustomFields,
|
||||
71
Functions/Tenancy/Tenants/New-NetboxTenant.ps1
Normal file
71
Functions/Tenancy/Tenants/New-NetboxTenant.ps1
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
|
||||
function New-NetboxTenant {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Create a new tenant in Netbox
|
||||
|
||||
.DESCRIPTION
|
||||
Creates a new tenant object in Netbox
|
||||
|
||||
.PARAMETER Name
|
||||
The tenant name, e.g "Contoso Inc"
|
||||
|
||||
.PARAMETER Slug
|
||||
The unique URL for the tenant. Can only contain hypens, A-Z, a-z, 0-9, and underscores
|
||||
|
||||
.PARAMETER Description
|
||||
Short description of the tenant
|
||||
|
||||
.PARAMETER Custom_Fields
|
||||
Hashtable of custom field values.
|
||||
|
||||
.PARAMETER Raw
|
||||
Return the unparsed data from the HTTP request
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> New-NetboxTenant -Name 'Contoso Inc' -Slug 'contoso-inc'
|
||||
|
||||
.NOTES
|
||||
Additional information about the function.
|
||||
#>
|
||||
|
||||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[ValidateLength(1, 100)]
|
||||
[string]$Name,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[ValidateLength(1, 100)]
|
||||
[ValidatePattern('^[-a-zA-Z0-9_]+$')]
|
||||
[string]$Slug,
|
||||
|
||||
[ValidateLength(0, 200)]
|
||||
[string]$Description,
|
||||
|
||||
[hashtable]$Custom_Fields,
|
||||
|
||||
[switch]$Raw
|
||||
)
|
||||
|
||||
process {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('tenancy', 'tenants'))
|
||||
$Method = 'POST'
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
||||
|
||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($Address, 'Create new tenant')) {
|
||||
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/19/2020 12:44
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-NetboxVirtualMachine.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Get-NetboxVirtualMachine {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
|
@ -104,35 +91,35 @@ function Get-NetboxVirtualMachine {
|
|||
|
||||
[string]$Name,
|
||||
|
||||
[uint16[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[object]$Status,
|
||||
|
||||
[string]$Tenant,
|
||||
|
||||
[uint16]$Tenant_ID,
|
||||
[uint64]$Tenant_ID,
|
||||
|
||||
[string]$Platform,
|
||||
|
||||
[uint16]$Platform_ID,
|
||||
[uint64]$Platform_ID,
|
||||
|
||||
[string]$Cluster_Group,
|
||||
|
||||
[uint16]$Cluster_Group_Id,
|
||||
[uint64]$Cluster_Group_Id,
|
||||
|
||||
[string]$Cluster_Type,
|
||||
|
||||
[uint16]$Cluster_Type_Id,
|
||||
[uint64]$Cluster_Type_Id,
|
||||
|
||||
[uint16]$Cluster_Id,
|
||||
[uint64]$Cluster_Id,
|
||||
|
||||
[string]$Site,
|
||||
|
||||
[uint16]$Site_Id,
|
||||
[uint64]$Site_Id,
|
||||
|
||||
[string]$Role,
|
||||
|
||||
[uint16]$Role_Id,
|
||||
[uint64]$Role_Id,
|
||||
|
||||
[uint16]$Limit,
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/19/2020 12:44
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: New-NetboxVirtualMachine.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function New-NetboxVirtualMachine {
|
||||
[CmdletBinding(ConfirmImpact = 'low',
|
||||
SupportsShouldProcess = $true)]
|
||||
|
|
@ -22,25 +9,27 @@ function New-NetboxVirtualMachine {
|
|||
[string]$Name,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[uint16]$Cluster,
|
||||
[uint64]$Site,
|
||||
|
||||
[uint16]$Tenant,
|
||||
[uint64]$Cluster,
|
||||
|
||||
[uint64]$Tenant,
|
||||
|
||||
[object]$Status = 'Active',
|
||||
|
||||
[uint16]$Role,
|
||||
[uint64]$Role,
|
||||
|
||||
[uint16]$Platform,
|
||||
[uint64]$Platform,
|
||||
|
||||
[uint16]$vCPUs,
|
||||
|
||||
[uint16]$Memory,
|
||||
[uint64]$Memory,
|
||||
|
||||
[uint16]$Disk,
|
||||
[uint64]$Disk,
|
||||
|
||||
[uint16]$Primary_IP4,
|
||||
[uint64]$Primary_IP4,
|
||||
|
||||
[uint16]$Primary_IP6,
|
||||
[uint64]$Primary_IP6,
|
||||
|
||||
[hashtable]$Custom_Fields,
|
||||
|
||||
|
|
@ -56,6 +45,10 @@ function New-NetboxVirtualMachine {
|
|||
|
||||
#$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
||||
|
||||
if ($PSBoundParameters.ContainsKey('Cluster') -and (-not $PSBoundParameters.ContainsKey('Site'))) {
|
||||
throw "You must specify a site ID with a cluster ID"
|
||||
}
|
||||
|
||||
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines'))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/19/2020 12:45
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Remove-NetboxVirtualMachine.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Remove-NetboxVirtualMachine {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
|
@ -39,7 +26,7 @@ function Remove-NetboxVirtualMachine {
|
|||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint16[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[switch]$Force
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/19/2020 12:45
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Set-NetboxVirtualMachine.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Set-NetboxVirtualMachine {
|
||||
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||
SupportsShouldProcess = $true)]
|
||||
|
|
@ -19,29 +6,29 @@ function Set-NetboxVirtualMachine {
|
|||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint16]$Id,
|
||||
[uint64]$Id,
|
||||
|
||||
[string]$Name,
|
||||
|
||||
[uint16]$Role,
|
||||
[uint64]$Role,
|
||||
|
||||
[uint16]$Cluster,
|
||||
[uint64]$Cluster,
|
||||
|
||||
[object]$Status,
|
||||
|
||||
[uint16]$Platform,
|
||||
[uint64]$Platform,
|
||||
|
||||
[uint16]$Primary_IP4,
|
||||
[uint64]$Primary_IP4,
|
||||
|
||||
[uint16]$Primary_IP6,
|
||||
[uint64]$Primary_IP6,
|
||||
|
||||
[byte]$VCPUs,
|
||||
|
||||
[uint16]$Memory,
|
||||
[uint64]$Memory,
|
||||
|
||||
[uint16]$Disk,
|
||||
[uint64]$Disk,
|
||||
|
||||
[uint16]$Tenant,
|
||||
[uint64]$Tenant,
|
||||
|
||||
[string]$Comments,
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/19/2020 12:46
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Add-NetboxVirtualMachineInterface.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Add-NetboxVirtualMachineInterface {
|
||||
[CmdletBinding()]
|
||||
param
|
||||
|
|
@ -20,7 +7,7 @@ function Add-NetboxVirtualMachineInterface {
|
|||
[string]$Name,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[uint16]$Virtual_Machine,
|
||||
[uint64]$Virtual_Machine,
|
||||
|
||||
[boolean]$Enabled = $true,
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/19/2020 12:47
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-NetboxVirtualMachineInterface.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Get-NetboxVirtualMachineInterface {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
|
@ -61,7 +48,7 @@ function Get-NetboxVirtualMachineInterface {
|
|||
param
|
||||
(
|
||||
[Parameter(ValueFromPipeline = $true)]
|
||||
[uint16]$Id,
|
||||
[uint64]$Id,
|
||||
|
||||
[string]$Name,
|
||||
|
||||
|
|
@ -71,7 +58,7 @@ function Get-NetboxVirtualMachineInterface {
|
|||
|
||||
[uint16]$MTU,
|
||||
|
||||
[uint16]$Virtual_Machine_Id,
|
||||
[uint64]$Virtual_Machine_Id,
|
||||
|
||||
[string]$Virtual_Machine,
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/19/2020 12:47
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Set-NetboxVirtualMachineInterface.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Set-NetboxVirtualMachineInterface {
|
||||
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||
SupportsShouldProcess = $true)]
|
||||
|
|
@ -20,7 +7,7 @@ function Set-NetboxVirtualMachineInterface {
|
|||
(
|
||||
[Parameter(Mandatory = $true,
|
||||
ValueFromPipelineByPropertyName = $true)]
|
||||
[uint16[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[string]$Name,
|
||||
|
||||
|
|
@ -32,7 +19,7 @@ function Set-NetboxVirtualMachineInterface {
|
|||
|
||||
[boolean]$Enabled,
|
||||
|
||||
[uint16]$Virtual_Machine,
|
||||
[uint64]$Virtual_Machine,
|
||||
|
||||
[switch]$Force
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/19/2020 14:10
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-NetboxVirtualizationCluster.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Get-NetboxVirtualizationCluster {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
|
@ -71,19 +58,19 @@ function Get-NetboxVirtualizationCluster {
|
|||
[Alias('q')]
|
||||
[string]$Query,
|
||||
|
||||
[uint16[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[string]$Group,
|
||||
|
||||
[uint16]$Group_Id,
|
||||
[uint64]$Group_Id,
|
||||
|
||||
[string]$Type,
|
||||
|
||||
[uint16]$Type_Id,
|
||||
[uint64]$Type_Id,
|
||||
|
||||
[string]$Site,
|
||||
|
||||
[uint16]$Site_Id,
|
||||
[uint64]$Site_Id,
|
||||
|
||||
[uint16]$Limit,
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Created on: 3/19/2020 14:11
|
||||
Created by: Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Get-NetboxVirtualizationClusterGroup.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
function Get-NetboxVirtualizationClusterGroup {
|
||||
[CmdletBinding()]
|
||||
param
|
||||
|
|
@ -24,7 +11,7 @@ function Get-NetboxVirtualizationClusterGroup {
|
|||
|
||||
[string]$Query,
|
||||
|
||||
[uint32[]]$Id,
|
||||
[uint64[]]$Id,
|
||||
|
||||
[uint16]$Limit,
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#
|
||||
#
|
||||
# Module manifest for module 'NetboxPS'
|
||||
#
|
||||
# Generated by: Ben Claussen
|
||||
#
|
||||
# Generated on: 2021-07-23
|
||||
# Generated on: 2023-11-09
|
||||
#
|
||||
|
||||
@{
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
RootModule = 'NetboxPS.psm1'
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '1.5.0'
|
||||
ModuleVersion = '1.8.5'
|
||||
|
||||
# Supported PSEditions
|
||||
# CompatiblePSEditions = @()
|
||||
|
|
@ -54,7 +54,7 @@ CLRVersion = '2.0.50727'
|
|||
# RequiredModules = @()
|
||||
|
||||
# Assemblies that must be loaded prior to importing this module
|
||||
RequiredAssemblies = 'System.Web'
|
||||
# RequiredAssemblies = @()
|
||||
|
||||
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
|
||||
# ScriptsToProcess = @()
|
||||
|
|
@ -69,7 +69,49 @@ RequiredAssemblies = 'System.Web'
|
|||
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 = '*'
|
||||
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-NetboxDCIMCable',
|
||||
'Get-NetboxDCIMCableTermination', 'Get-NetboxDCIMDevice',
|
||||
'Get-NetboxDCIMDeviceRole', 'Get-NetboxDCIMDeviceType',
|
||||
'Get-NetboxDCIMFrontPort', 'Get-NetboxDCIMInterface',
|
||||
'Get-NetboxDCIMInterfaceConnection', 'Get-NetboxDCIMPlatform',
|
||||
'Get-NetboxDCIMRearPort', 'Get-NetboxDCIMSite', 'Get-NetboxHostname',
|
||||
'Get-NetboxHostPort', 'Get-NetboxHostScheme',
|
||||
'Get-NetboxInvokeParams', 'Get-NetboxIPAMAddress',
|
||||
'Get-NetboxIPAMAddressRange', 'Get-NetboxIPAMAggregate',
|
||||
'Get-NetboxIPAMAvailableIP', 'Get-NetboxIPAMPrefix',
|
||||
'Get-NetboxIPAMRole', 'Get-NetboxIPAMVLAN', '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-NetboxIPAMAddressRange',
|
||||
'New-NetboxIPAMPrefix', 'New-NetboxIPAMVLAN', 'New-NetboxTenant',
|
||||
'New-NetboxVirtualMachine', 'Remove-NetboxDCIMDevice',
|
||||
'Remove-NetboxDCIMFrontPort', 'Remove-NetboxDCIMInterface',
|
||||
'Remove-NetboxDCIMInterfaceConnection', 'Remove-NetboxDCIMRearPort',
|
||||
'Remove-NetboxDCIMSite', 'Remove-NetboxIPAMAddress',
|
||||
'Remove-NetboxIPAMAddressRange', 'Remove-NetboxVirtualMachine',
|
||||
'Set-NetboxCipherSSL', 'Set-NetboxContact',
|
||||
'Set-NetboxContactAssignment', 'Set-NetboxContactRole',
|
||||
'Set-NetboxCredential', 'Set-NetboxDCIMDevice',
|
||||
'Set-NetboxDCIMFrontPort', 'Set-NetboxDCIMInterface',
|
||||
'Set-NetboxDCIMInterfaceConnection', 'Set-NetboxDCIMRearPort',
|
||||
'Set-NetboxHostName', 'Set-NetboxHostPort', 'Set-NetboxHostScheme',
|
||||
'Set-NetboxInvokeParams', 'Set-NetboxIPAMAddress',
|
||||
'Set-NetboxIPAMAddressRange', 'Set-NetboxIPAMPrefix',
|
||||
'Set-NetboxTimeout', 'Set-NetboxUnstrustedSSL',
|
||||
'Set-NetboxVirtualMachine', 'Set-NetboxVirtualMachineInterface',
|
||||
'Test-NetboxAPIConnected'
|
||||
|
||||
# Cmdlets 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 cmdlets to export.
|
||||
CmdletsToExport = '*'
|
||||
|
|
|
|||
|
|
@ -1,15 +1,3 @@
|
|||
<#
|
||||
.NOTES
|
||||
--------------------------------------------------------------------------------
|
||||
Code generated by: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
||||
Generated on: 3/26/2020 15:16
|
||||
Generated by: Claussen
|
||||
Organization: NEOnet
|
||||
--------------------------------------------------------------------------------
|
||||
.DESCRIPTION
|
||||
Script generated by PowerShell Studio 2020
|
||||
#>
|
||||
|
||||
# Build a list of common parameters so we can omit them to build URI parameters
|
||||
$script:CommonParameterNames = New-Object System.Collections.ArrayList
|
||||
[void]$script:CommonParameterNames.AddRange(@([System.Management.Automation.PSCmdlet]::CommonParameters))
|
||||
|
|
@ -17,6 +5,3 @@ $script:CommonParameterNames = New-Object System.Collections.ArrayList
|
|||
[void]$script:CommonParameterNames.Add('Raw')
|
||||
|
||||
SetupNetboxConfigVariable
|
||||
|
||||
Export-ModuleMember -Function *
|
||||
#Export-ModuleMember -Function *-*
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
<Project Synchronized="False" SyncFilter="*.ps1;*.psm1;*.psd1;*.ps1xml;*.psf;*.pss;*.xml;*.help.txt" AutoExportFunctions="True" AutoExportPS1XMLFiles="False">
|
||||
<Project Synchronized="False" SyncFilter="*.ps1;*.psm1;*.psd1;*.ps1xml;*.psf;*.pss;*.xml;*.help.txt" AutoExportFunctions="True" ExportToLocalMachine="False" AutoExportPS1XMLFiles="False" StagingFolderName="bin">
|
||||
<Version>2.1</Version>
|
||||
<FileID>bba9b06c-49c8-47cf-8358-aca7c4e78896</FileID>
|
||||
<ProjectType>1</ProjectType>
|
||||
<RememberPowerShellVersion>True</RememberPowerShellVersion>
|
||||
<PowerShellVersion>Local Machine - PowerShell V5 (64 Bit)</PowerShellVersion>
|
||||
<Folders>
|
||||
<Folder>Functions</Folder>
|
||||
<Folder>Functions\DCIM</Folder>
|
||||
|
|
@ -28,6 +30,17 @@
|
|||
<Folder>Functions\Circuits\Providers</Folder>
|
||||
<Folder>Functions\Circuits\Types</Folder>
|
||||
<Folder>Functions\Circuits\Terminations</Folder>
|
||||
<Folder>Functions\Tenancy\Contacts</Folder>
|
||||
<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>
|
||||
<Folder>Functions\Extras</Folder>
|
||||
<Folder>Functions\IPAM\Range</Folder>
|
||||
<Folder>Functions\Extras\Tags</Folder>
|
||||
</Folders>
|
||||
<Files>
|
||||
<File Build="2">NetboxPS.psd1</File>
|
||||
|
|
@ -48,7 +61,6 @@
|
|||
<File Build="0" Shared="True" ReferenceFunction="Invoke-BuildURIComponents_ps1" ExportFunctions="True">Functions\Helpers\BuildURIComponents.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-GetNetboxAPIErrorBody_ps1" ExportFunctions="True">Functions\Helpers\GetNetboxAPIErrorBody.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-InvokeNetboxRequest_ps1" ExportFunctions="True">Functions\Helpers\InvokeNetboxRequest.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-ThrowNetboxRESTError_ps1" ExportFunctions="True">Functions\Helpers\ThrowNetboxRESTError.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-CreateEnum_ps1" ExportFunctions="True">Functions\Helpers\CreateEnum.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-VerifyAPIConnectivity_ps1" ExportFunctions="True">Functions\Setup\Support\VerifyAPIConnectivity.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-SetupNetboxConfigVariable_ps1" ExportFunctions="True">Functions\Setup\Support\SetupNetboxConfigVariable.ps1</File>
|
||||
|
|
@ -69,7 +81,7 @@
|
|||
<File Build="0" Shared="True" ReferenceFunction="Invoke-New-NetboxIPAMPrefix_ps1" ExportFunctions="True">Functions\IPAM\Prefix\New-NetboxIPAMPrefix.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-Remove-NetboxIPAMAddress_ps1" ExportFunctions="True">Functions\IPAM\Address\Remove-NetboxIPAMAddress.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-Set-NetboxIPAMAddress_ps1" ExportFunctions="True">Functions\IPAM\Address\Set-NetboxIPAMAddress.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxTenant_ps1" ExportFunctions="True">Functions\Tenancy\Get-NetboxTenant.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxTenant_ps1" ExportFunctions="True">Functions\Tenancy\Tenants\Get-NetboxTenant.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxVirtualMachine_ps1" ExportFunctions="True">Functions\Virtualization\VirtualMachine\Get-NetboxVirtualMachine.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-New-NetboxVirtualMachine_ps1" ExportFunctions="True">Functions\Virtualization\VirtualMachine\New-NetboxVirtualMachine.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-Set-NetboxVirtualMachine_ps1" ExportFunctions="True">Functions\Virtualization\VirtualMachine\Set-NetboxVirtualMachine.ps1</File>
|
||||
|
|
@ -115,6 +127,36 @@
|
|||
<File Build="0" Shared="True" ReferenceFunction="Invoke-Set-NetboxTimeout_ps1" ExportFunctions="True">Functions\Setup\Set-NetboxTimeout.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxTimeout_ps1" ExportFunctions="True">Functions\Setup\Get-NetboxTimeout.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxVersion_ps1" ExportFunctions="True">Functions\Setup\Get-NetboxVersion.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxContact_ps1" ExportFunctions="True">Functions\Tenancy\Contacts\Get-NetboxContact.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-New-NetboxContact_ps1" ExportFunctions="True">Functions\Tenancy\Contacts\New-NetboxContact.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxContactRole_ps1" ExportFunctions="True">Functions\Tenancy\ContactRoles\Get-NetboxContactRole.ps1</File>
|
||||
<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="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="True" ReferenceFunction="Invoke-Set-NetboxContact_ps1" ExportFunctions="True">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>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxTag_ps1" ExportFunctions="True">Functions\Extras\Tags\Get-NetboxTag.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-Clear-NetboxCredential_ps1" ExportFunctions="False">Functions\Setup\Clear-NetboxCredential.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxIPAMAddressRange_ps1" ExportFunctions="True">Functions\IPAM\Range\Get-NetboxIPAMAddressRange.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-New-NetboxIPAMAddressRange_ps1" ExportFunctions="True">Functions\IPAM\Range\New-NetboxIPAMAddressRange.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-Remove-NetboxIPAMAddressRange_ps1" ExportFunctions="True">Functions\IPAM\Range\Remove-NetboxIPAMAddressRange.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-Set-NetboxIPAMAddressRange_ps1" ExportFunctions="True">Functions\IPAM\Range\Set-NetboxIPAMAddressRange.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-Set-NetboxContactRole_ps1" ExportFunctions="True">Functions\Tenancy\ContactRoles\Set-NetboxContactRole.ps1</File>
|
||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-Set-NetboxContactAssignment_ps1" ExportFunctions="True">Functions\Tenancy\ContactAssignment\Set-NetboxContactAssignment.ps1</File>
|
||||
</Files>
|
||||
<StartupScript>R:\Netbox\NetboxPS\Test-Module.ps1</StartupScript>
|
||||
</Project>
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
#
|
||||
#
|
||||
# Module manifest for module 'NetboxPS'
|
||||
#
|
||||
# Generated by: Ben Claussen
|
||||
#
|
||||
# Generated on: 2021-07-23
|
||||
# Generated on: 2023-11-09
|
||||
#
|
||||
|
||||
@{
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
RootModule = 'NetboxPS.psm1'
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '1.5.0'
|
||||
ModuleVersion = '1.8.5'
|
||||
|
||||
# Supported PSEditions
|
||||
# CompatiblePSEditions = @()
|
||||
|
|
@ -54,7 +54,7 @@ CLRVersion = '2.0.50727'
|
|||
# RequiredModules = @()
|
||||
|
||||
# Assemblies that must be loaded prior to importing this module
|
||||
RequiredAssemblies = 'System.Web'
|
||||
# RequiredAssemblies = @()
|
||||
|
||||
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
|
||||
# ScriptsToProcess = @()
|
||||
|
|
@ -69,7 +69,49 @@ RequiredAssemblies = 'System.Web'
|
|||
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 = '*'
|
||||
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-NetboxDCIMCable',
|
||||
'Get-NetboxDCIMCableTermination', 'Get-NetboxDCIMDevice',
|
||||
'Get-NetboxDCIMDeviceRole', 'Get-NetboxDCIMDeviceType',
|
||||
'Get-NetboxDCIMFrontPort', 'Get-NetboxDCIMInterface',
|
||||
'Get-NetboxDCIMInterfaceConnection', 'Get-NetboxDCIMPlatform',
|
||||
'Get-NetboxDCIMRearPort', 'Get-NetboxDCIMSite', 'Get-NetboxHostname',
|
||||
'Get-NetboxHostPort', 'Get-NetboxHostScheme',
|
||||
'Get-NetboxInvokeParams', 'Get-NetboxIPAMAddress',
|
||||
'Get-NetboxIPAMAddressRange', 'Get-NetboxIPAMAggregate',
|
||||
'Get-NetboxIPAMAvailableIP', 'Get-NetboxIPAMPrefix',
|
||||
'Get-NetboxIPAMRole', 'Get-NetboxIPAMVLAN', '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-NetboxIPAMAddressRange',
|
||||
'New-NetboxIPAMPrefix', 'New-NetboxIPAMVLAN', 'New-NetboxTenant',
|
||||
'New-NetboxVirtualMachine', 'Remove-NetboxDCIMDevice',
|
||||
'Remove-NetboxDCIMFrontPort', 'Remove-NetboxDCIMInterface',
|
||||
'Remove-NetboxDCIMInterfaceConnection', 'Remove-NetboxDCIMRearPort',
|
||||
'Remove-NetboxDCIMSite', 'Remove-NetboxIPAMAddress',
|
||||
'Remove-NetboxIPAMAddressRange', 'Remove-NetboxVirtualMachine',
|
||||
'Set-NetboxCipherSSL', 'Set-NetboxContact',
|
||||
'Set-NetboxContactAssignment', 'Set-NetboxContactRole',
|
||||
'Set-NetboxCredential', 'Set-NetboxDCIMDevice',
|
||||
'Set-NetboxDCIMFrontPort', 'Set-NetboxDCIMInterface',
|
||||
'Set-NetboxDCIMInterfaceConnection', 'Set-NetboxDCIMRearPort',
|
||||
'Set-NetboxHostName', 'Set-NetboxHostPort', 'Set-NetboxHostScheme',
|
||||
'Set-NetboxInvokeParams', 'Set-NetboxIPAMAddress',
|
||||
'Set-NetboxIPAMAddressRange', 'Set-NetboxIPAMPrefix',
|
||||
'Set-NetboxTimeout', 'Set-NetboxUnstrustedSSL',
|
||||
'Set-NetboxVirtualMachine', 'Set-NetboxVirtualMachineInterface',
|
||||
'Test-NetboxAPIConnected'
|
||||
|
||||
# Cmdlets 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 cmdlets to export.
|
||||
CmdletsToExport = '*'
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
40
README.md
40
README.md
|
|
@ -14,6 +14,46 @@ This module is a wrapper for the [Netbox](https://github.com/netbox-community/ne
|
|||
2. Import module
|
||||
3. Connect to an API endpoint by using `Connect-NetboxAPI -Hostname netbox.example.com`
|
||||
|
||||
## Basic Commands
|
||||
|
||||
```powershell
|
||||
#Just adding a new IP
|
||||
New-NetboxIPAMAddress -Address 10.0.0.1/24 -Dns_name this.is.thedns.fqdn -Custom_Fields @{CustomFieldID="CustomFieldContent"} -Tenant 1 -Description "Description"
|
||||
|
||||
#Creating a new VM, add an interface and assign Interface IP
|
||||
function New-NBVirtualMachine
|
||||
{
|
||||
[CmdletBinding()]
|
||||
[Alias()]
|
||||
[OutputType([int])]
|
||||
Param
|
||||
(
|
||||
[string]$Name,
|
||||
[string]$Cluster,
|
||||
[string]$IP,
|
||||
[string]$tenant,
|
||||
[string]$VMNICName
|
||||
)
|
||||
|
||||
Begin
|
||||
{
|
||||
$NBCluster = Get-NetboxVirtualizationCluster -name $Cluster
|
||||
$NBTenant = Get-NetboxTenant -Name $tenant
|
||||
}
|
||||
Process
|
||||
{
|
||||
$vm = New-NetboxVirtualMachine -Name $Name -Cluster $NBCluster.id -Tenant $NBtenant.id
|
||||
$interface = Add-NetboxVirtualMachineInterface -Name $VMNICName -Virtual_Machine $vm.id
|
||||
|
||||
|
||||
$NBip = New-NetboxIPAMAddress -Address $IP -Tenant $NBtenant.id
|
||||
Set-NetboxIPAMAddress -Assigned_Object_Type virtualization.vminterface -Assigned_Object_Id $interface.id -id $NBip.id
|
||||
Set-NetboxVirtualMachine -Primary_IP4 $NBip.id -Id $vm.id
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
# Notes
|
||||
I started this project years ago with Powershell Studio using the built in deployment methods, learning Git, and learning PS best practices. So please forgive any "obvious" mistakes 😅
|
||||
Over time I have had to adjust my methods for deployment... change the design of functions, and refactor code as I learn new and better things.
|
||||
|
|
|
|||
1
Tests/.gitignore
vendored
Normal file
1
Tests/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
credential.ps1
|
||||
|
|
@ -1,16 +1,8 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2018 v5.5.152
|
||||
Created on: 5/22/2018 4:48 PM
|
||||
Created by: Ben Claussen
|
||||
Organization: NEOnet
|
||||
Filename: DCIM.Tests.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
DCIM tests.
|
||||
#>
|
||||
|
||||
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")]
|
||||
param
|
||||
(
|
||||
)
|
||||
Import-Module Pester
|
||||
Remove-Module NetboxPS -Force -ErrorAction SilentlyContinue
|
||||
|
||||
|
|
@ -28,12 +20,12 @@ Describe -Name "DCIM Devices Tests" -Tag 'DCIM', 'Devices' -Fixture {
|
|||
Mock -CommandName 'Invoke-RestMethod' -Verifiable -ModuleName 'NetboxPS' -MockWith {
|
||||
# Return a hashtable of the items we would normally pass to Invoke-RestMethod
|
||||
return [ordered]@{
|
||||
'Method' = $Method
|
||||
'Uri' = $Uri
|
||||
'Headers' = $Headers
|
||||
'Timeout' = $Timeout
|
||||
'Method' = $Method
|
||||
'Uri' = $Uri
|
||||
'Headers' = $Headers
|
||||
'Timeout' = $Timeout
|
||||
'ContentType' = $ContentType
|
||||
'Body' = $Body
|
||||
'Body' = $Body
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -363,7 +355,7 @@ Describe -Name "DCIM Devices Tests" -Tag 'DCIM', 'Devices' -Fixture {
|
|||
|
||||
Mock -CommandName "Get-NetboxDCIMDevice" -ModuleName NetboxPS -MockWith {
|
||||
return [pscustomobject]@{
|
||||
'Id' = $Id
|
||||
'Id' = $Id
|
||||
'Name' = $Name
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2018 v5.5.152
|
||||
Created on: 5/24/2018 10:50 AM
|
||||
Created by: Ben Claussen
|
||||
Organization: NEOnet
|
||||
Filename: DCIM.Interfaces.Tests.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")]
|
||||
param
|
||||
(
|
||||
)
|
||||
Import-Module Pester
|
||||
Remove-Module NetboxPS -Force -ErrorAction SilentlyContinue
|
||||
|
||||
|
|
@ -28,12 +20,12 @@ Describe -Name "DCIM Interfaces Tests" -Tag 'DCIM', 'Interfaces' -Fixture {
|
|||
Mock -CommandName 'Invoke-RestMethod' -Verifiable -ModuleName 'NetboxPS' -MockWith {
|
||||
# Return a hashtable of the items we would normally pass to Invoke-RestMethod
|
||||
return [ordered]@{
|
||||
'Method' = $Method
|
||||
'Uri' = $Uri
|
||||
'Headers' = $Headers
|
||||
'Timeout' = $Timeout
|
||||
'Method' = $Method
|
||||
'Uri' = $Uri
|
||||
'Headers' = $Headers
|
||||
'Timeout' = $Timeout
|
||||
'ContentType' = $ContentType
|
||||
'Body' = $Body
|
||||
'Body' = $Body
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -139,13 +131,13 @@ Describe -Name "DCIM Interfaces Tests" -Tag 'DCIM', 'Interfaces' -Fixture {
|
|||
|
||||
It "Should add an interface to a device with lots of properties" {
|
||||
$paramAddNetboxDCIMInterface = @{
|
||||
Device = 123
|
||||
Name = "TestInterface"
|
||||
Device = 123
|
||||
Name = "TestInterface"
|
||||
Form_Factor = '10GBASE-T (10GE)'
|
||||
MTU = 9000
|
||||
MGMT_Only = $true
|
||||
MTU = 9000
|
||||
MGMT_Only = $true
|
||||
Description = 'Test Description'
|
||||
Mode = 'Access'
|
||||
Mode = 'Access'
|
||||
}
|
||||
|
||||
$Result = Add-NetboxDCIMInterface @paramAddNetboxDCIMInterface
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2018 v5.5.152
|
||||
Created on: 5/25/2018 1:03 PM
|
||||
Created by: Ben Claussen
|
||||
Organization: NEOnet
|
||||
Filename: DCIM.Platforms.Tests.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")]
|
||||
param
|
||||
(
|
||||
)
|
||||
Import-Module Pester
|
||||
Remove-Module NetboxPS -Force -ErrorAction SilentlyContinue
|
||||
|
||||
|
|
@ -28,12 +20,12 @@ Describe -Name "DCIM Platforms Tests" -Tag 'DCIM', 'platforms' -Fixture {
|
|||
Mock -CommandName 'Invoke-RestMethod' -Verifiable -ModuleName 'NetboxPS' -MockWith {
|
||||
# Return a hashtable of the items we would normally pass to Invoke-RestMethod
|
||||
return [ordered]@{
|
||||
'Method' = $Method
|
||||
'Uri' = $Uri
|
||||
'Headers' = $Headers
|
||||
'Timeout' = $Timeout
|
||||
'Method' = $Method
|
||||
'Uri' = $Uri
|
||||
'Headers' = $Headers
|
||||
'Timeout' = $Timeout
|
||||
'ContentType' = $ContentType
|
||||
'Body' = $Body
|
||||
'Body' = $Body
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2018 v5.5.150
|
||||
Created on: 5/8/2018 11:36 AM
|
||||
Created by: Ben Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Helpers.Tests.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
Helper functions Pester tests
|
||||
#>
|
||||
|
||||
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")]
|
||||
param
|
||||
(
|
||||
)
|
||||
Import-Module Pester
|
||||
Remove-Module NetboxPS -Force -ErrorAction SilentlyContinue
|
||||
|
||||
|
|
@ -88,7 +80,7 @@ Describe "Helpers tests" -Tag 'Core', 'Helpers' -Fixture {
|
|||
|
||||
Context -Name "Building URI components" -Fixture {
|
||||
It "Should give a basic hashtable" {
|
||||
$URIComponents = BuildURIComponents -URISegments @('segment1', 'segment2') -ParametersDictionary @{'param1' = 1}
|
||||
$URIComponents = BuildURIComponents -URISegments @('segment1', 'segment2') -ParametersDictionary @{'param1' = 1 }
|
||||
|
||||
$URIComponents | Should -BeOfType [hashtable]
|
||||
$URIComponents.Keys.Count | Should -BeExactly 2
|
||||
|
|
@ -100,7 +92,7 @@ Describe "Helpers tests" -Tag 'Core', 'Helpers' -Fixture {
|
|||
}
|
||||
|
||||
It "Should add a single ID parameter to the segments" {
|
||||
$URIComponents = BuildURIComponents -URISegments @('segment1', 'segment2') -ParametersDictionary @{'id' = 123}
|
||||
$URIComponents = BuildURIComponents -URISegments @('segment1', 'segment2') -ParametersDictionary @{'id' = 123 }
|
||||
|
||||
$URIComponents | Should -BeOfType [hashtable]
|
||||
$URIComponents.Keys.Count | Should -BeExactly 2
|
||||
|
|
@ -111,7 +103,7 @@ Describe "Helpers tests" -Tag 'Core', 'Helpers' -Fixture {
|
|||
}
|
||||
|
||||
It "Should add multiple IDs to the parameters id__in" {
|
||||
$URIComponents = BuildURIComponents -URISegments @('segment1', 'segment2') -ParametersDictionary @{'id' = "123", "456"}
|
||||
$URIComponents = BuildURIComponents -URISegments @('segment1', 'segment2') -ParametersDictionary @{'id' = "123", "456" }
|
||||
|
||||
$URIComponents | Should -BeOfType [hashtable]
|
||||
$URIComponents.Keys.Count | Should -BeExactly 2
|
||||
|
|
@ -123,7 +115,7 @@ Describe "Helpers tests" -Tag 'Core', 'Helpers' -Fixture {
|
|||
}
|
||||
|
||||
It "Should skip a particular parameter name" {
|
||||
$URIComponents = BuildURIComponents -URISegments @('segment1', 'segment2') -ParametersDictionary @{'param1' = 1; 'param2' = 2} -SkipParameterByName 'param2'
|
||||
$URIComponents = BuildURIComponents -URISegments @('segment1', 'segment2') -ParametersDictionary @{'param1' = 1; 'param2' = 2 } -SkipParameterByName 'param2'
|
||||
|
||||
$URIComponents | Should -BeOfType [hashtable]
|
||||
$URIComponents.Keys.Count | Should -BeExactly 2
|
||||
|
|
@ -136,7 +128,7 @@ Describe "Helpers tests" -Tag 'Core', 'Helpers' -Fixture {
|
|||
}
|
||||
|
||||
It "Should add a query (q) parameter" {
|
||||
$URIComponents = BuildURIComponents -URISegments @('segment1', 'segment2') -ParametersDictionary @{'query' = 'mytestquery'}
|
||||
$URIComponents = BuildURIComponents -URISegments @('segment1', 'segment2') -ParametersDictionary @{'query' = 'mytestquery' }
|
||||
|
||||
$URIComponents | Should -BeOfType [hashtable]
|
||||
$URIComponents.Keys.Count | Should -BeExactly 2
|
||||
|
|
@ -150,7 +142,7 @@ Describe "Helpers tests" -Tag 'Core', 'Helpers' -Fixture {
|
|||
It "Should generate custom field parameters" {
|
||||
$URIComponents = BuildURIComponents -URISegments @('segment1', 'segment2') -ParametersDictionary @{
|
||||
'CustomFields' = @{
|
||||
'PRTG_Id' = 1234
|
||||
'PRTG_Id' = 1234
|
||||
'Customer_Id' = 'abc'
|
||||
}
|
||||
}
|
||||
|
|
@ -170,13 +162,13 @@ Describe "Helpers tests" -Tag 'Core', 'Helpers' -Fixture {
|
|||
Mock -CommandName 'Invoke-RestMethod' -Verifiable -MockWith {
|
||||
# Return an object of the items we would normally pass to Invoke-RestMethod
|
||||
return [pscustomobject]@{
|
||||
'Method' = $Method
|
||||
'Uri' = $Uri
|
||||
'Headers' = $Headers
|
||||
'Timeout' = $Timeout
|
||||
'Method' = $Method
|
||||
'Uri' = $Uri
|
||||
'Headers' = $Headers
|
||||
'Timeout' = $Timeout
|
||||
'ContentType' = $ContentType
|
||||
'Body' = $Body
|
||||
'results' = 'Only results'
|
||||
'Body' = $Body
|
||||
'results' = 'Only results'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2018 v5.5.150
|
||||
Created on: 5/10/2018 3:41 PM
|
||||
Created by: Ben Claussen
|
||||
Organization: NEOnet
|
||||
Filename: IPAM.Tests.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
IPAM Pester tests
|
||||
#>
|
||||
|
||||
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")]
|
||||
param
|
||||
(
|
||||
)
|
||||
Import-Module Pester
|
||||
Remove-Module NetboxPS -Force -ErrorAction SilentlyContinue
|
||||
|
||||
|
|
@ -29,12 +21,12 @@ Describe -Name "IPAM tests" -Tag 'Ipam' -Fixture {
|
|||
Mock -CommandName 'Invoke-RestMethod' -Verifiable -ModuleName 'NetboxPS' -MockWith {
|
||||
# Return a hashtable of the items we would normally pass to Invoke-RestMethod
|
||||
return [ordered]@{
|
||||
'Method' = $Method
|
||||
'Uri' = $Uri
|
||||
'Headers' = $Headers
|
||||
'Timeout' = $Timeout
|
||||
'Method' = $Method
|
||||
'Uri' = $Uri
|
||||
'Headers' = $Headers
|
||||
'Timeout' = $Timeout
|
||||
'ContentType' = $ContentType
|
||||
'Body' = $Body
|
||||
'Body' = $Body
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -422,7 +414,7 @@ Describe -Name "IPAM tests" -Tag 'Ipam' -Fixture {
|
|||
Mock -CommandName "Get-NetboxIPAMAddress" -ModuleName NetboxPS -MockWith {
|
||||
return @{
|
||||
'address' = "10.1.1.1/$Id"
|
||||
'id' = $id
|
||||
'id' = $id
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -486,7 +478,7 @@ Describe -Name "IPAM tests" -Tag 'Ipam' -Fixture {
|
|||
Mock -CommandName "Get-NetboxIPAMAddress" -ModuleName NetboxPS -MockWith {
|
||||
return @{
|
||||
'address' = '10.1.1.1/24'
|
||||
'id' = $id
|
||||
'id' = $id
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2018 v5.5.150
|
||||
Created on: 5/8/2018 10:33 AM
|
||||
Created by: Ben Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Setup.Tests.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
Setup function Pester tests
|
||||
#>
|
||||
|
||||
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")]
|
||||
param
|
||||
(
|
||||
)
|
||||
Import-Module Pester
|
||||
Remove-Module NetboxPS -Force -ErrorAction SilentlyContinue
|
||||
|
||||
|
|
@ -43,7 +35,7 @@ Describe "Setup tests" -Tag 'Core', 'Setup' -Fixture {
|
|||
}
|
||||
|
||||
It "Checks the set credentials" {
|
||||
$Creds = Set-NetboxCredential -Token (ConvertTo-SecureString -String "faketoken" -Force -AsPlainText)
|
||||
Set-NetboxCredential -Token (ConvertTo-SecureString -String "faketoken" -Force -AsPlainText)
|
||||
(Get-NetboxCredential).GetNetworkCredential().Password | Should -BeExactly "faketoken"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2018 v5.5.150
|
||||
Created on: 5/8/2018 4:01 PM
|
||||
Created by: Ben Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Virtualization.Tests.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
Virtualization Pester tests
|
||||
#>
|
||||
|
||||
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")]
|
||||
param
|
||||
(
|
||||
)
|
||||
Import-Module Pester
|
||||
Remove-Module NetboxPS -Force -ErrorAction SilentlyContinue
|
||||
|
||||
|
|
@ -28,12 +20,12 @@ Describe -Name "Virtualization tests" -Tag 'Virtualization' -Fixture {
|
|||
Mock -CommandName 'Invoke-RestMethod' -Verifiable -ModuleName 'NetboxPS' -MockWith {
|
||||
# Return a hashtable of the items we would normally pass to Invoke-RestMethod
|
||||
return [ordered]@{
|
||||
'Method' = $Method
|
||||
'Uri' = $Uri
|
||||
'Headers' = $Headers
|
||||
'Timeout' = $Timeout
|
||||
'Method' = $Method
|
||||
'Uri' = $Uri
|
||||
'Headers' = $Headers
|
||||
'Timeout' = $Timeout
|
||||
'ContentType' = $ContentType
|
||||
'Body' = $Body
|
||||
'Body' = $Body
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -365,7 +357,7 @@ Describe -Name "Virtualization tests" -Tag 'Virtualization' -Fixture {
|
|||
|
||||
Mock -CommandName "Get-NetboxVirtualMachine" -ModuleName NetboxPS -MockWith {
|
||||
return [pscustomobject]@{
|
||||
'Id' = $Id
|
||||
'Id' = $Id
|
||||
'Name' = $Name
|
||||
}
|
||||
}
|
||||
|
|
@ -406,7 +398,7 @@ Describe -Name "Virtualization tests" -Tag 'Virtualization' -Fixture {
|
|||
|
||||
Mock -CommandName "Get-NetboxVirtualMachineInterface" -ModuleName NetboxPS -MockWith {
|
||||
return [pscustomobject]@{
|
||||
'Id' = $Id
|
||||
'Id' = $Id
|
||||
'Name' = $Name
|
||||
}
|
||||
}
|
||||
|
|
@ -426,12 +418,12 @@ Describe -Name "Virtualization tests" -Tag 'Virtualization' -Fixture {
|
|||
|
||||
It "Should set an interface to a new name, MTU, MAC address and description" {
|
||||
$paramSetNetboxVirtualMachineInterface = @{
|
||||
Id = 1234
|
||||
Name = 'newtestname'
|
||||
Id = 1234
|
||||
Name = 'newtestname'
|
||||
MAC_Address = '11:22:33:44:55:66'
|
||||
MTU = 9000
|
||||
MTU = 9000
|
||||
Description = "Test description"
|
||||
Force = $true
|
||||
Force = $true
|
||||
}
|
||||
|
||||
$Result = Set-NetboxVirtualMachineInterface @paramSetNetboxVirtualMachineInterface
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue