mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 18:02:29 +00:00
Fix conflicts for #38
This commit is contained in:
commit
d09e20baee
82 changed files with 2613 additions and 1598 deletions
|
|
@ -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 {
|
function Get-NetboxCircuit {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function New-NetboxCircuit {
|
||||||
[CmdletBinding(ConfirmImpact = 'Low',
|
[CmdletBinding(ConfirmImpact = 'Low',
|
||||||
SupportsShouldProcess = $true)]
|
SupportsShouldProcess = $true)]
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,4 @@
|
||||||
<#
|
|
||||||
.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 {
|
function Get-NetboxCircuitProvider {
|
||||||
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
||||||
param
|
param
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,4 @@
|
||||||
<#
|
|
||||||
.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 {
|
function Get-NetboxCircuitTermination {
|
||||||
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
||||||
param
|
param
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,4 @@
|
||||||
<#
|
|
||||||
.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 {
|
function Get-NetboxCircuitType {
|
||||||
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
||||||
param
|
param
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Get-NetboxDCIMDevice {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
#region Parameters
|
#region Parameters
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Get-NetboxDCIMDeviceRole {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param
|
param
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Get-NetboxDCIMDeviceType {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
#region Parameters
|
#region Parameters
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function New-NetboxDCIMDevice {
|
||||||
[CmdletBinding(ConfirmImpact = 'low',
|
[CmdletBinding(ConfirmImpact = 'low',
|
||||||
SupportsShouldProcess = $true)]
|
SupportsShouldProcess = $true)]
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Remove-NetboxDCIMDevice {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
|
|
||||||
|
|
@ -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: Set-NetboxDCIMDevice.ps1
|
|
||||||
===========================================================================
|
|
||||||
.DESCRIPTION
|
|
||||||
A description of the file.
|
|
||||||
#>
|
|
||||||
|
|
||||||
|
|
||||||
function Set-NetboxDCIMDevice {
|
function Set-NetboxDCIMDevice {
|
||||||
[CmdletBinding(SupportsShouldProcess = $true)]
|
[CmdletBinding(SupportsShouldProcess = $true)]
|
||||||
param
|
param
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Get-NetboxDCIMPlatform {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
[OutputType([pscustomobject])]
|
[OutputType([pscustomobject])]
|
||||||
|
|
|
||||||
|
|
@ -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-NetboxDCIMInterface.ps1
|
|
||||||
===========================================================================
|
|
||||||
.DESCRIPTION
|
|
||||||
A description of the file.
|
|
||||||
#>
|
|
||||||
|
|
||||||
|
|
||||||
function Add-NetboxDCIMInterface {
|
function Add-NetboxDCIMInterface {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
[OutputType([pscustomobject])]
|
[OutputType([pscustomobject])]
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Add-NetboxDCIMInterfaceConnection {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
|
|
||||||
|
|
@ -1,17 +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()]
|
[CmdletBinding()]
|
||||||
[OutputType([pscustomobject])]
|
[OutputType([pscustomobject])]
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Get-NetboxDCIMInterfaceConnection {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
[OutputType([pscustomobject])]
|
[OutputType([pscustomobject])]
|
||||||
|
|
|
||||||
|
|
@ -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: Remove-NetboxDCIMInterface.ps1
|
|
||||||
===========================================================================
|
|
||||||
.DESCRIPTION
|
|
||||||
A description of the file.
|
|
||||||
#>
|
|
||||||
|
|
||||||
|
|
||||||
function Remove-NetboxDCIMInterface {
|
function Remove-NetboxDCIMInterface {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Remove-NetboxDCIMInterfaceConnection {
|
||||||
[CmdletBinding(ConfirmImpact = 'High',
|
[CmdletBinding(ConfirmImpact = 'High',
|
||||||
SupportsShouldProcess = $true)]
|
SupportsShouldProcess = $true)]
|
||||||
|
|
|
||||||
|
|
@ -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-NetboxDCIMInterface.ps1
|
|
||||||
===========================================================================
|
|
||||||
.DESCRIPTION
|
|
||||||
A description of the file.
|
|
||||||
#>
|
|
||||||
|
|
||||||
|
|
||||||
function Set-NetboxDCIMInterface {
|
function Set-NetboxDCIMInterface {
|
||||||
[CmdletBinding(ConfirmImpact = 'Medium',
|
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||||
SupportsShouldProcess = $true)]
|
SupportsShouldProcess = $true)]
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Set-NetboxDCIMInterfaceConnection {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,6 @@
|
||||||
<#
|
|
||||||
.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 {
|
function Get-NetboxDCIMSite {
|
||||||
[CmdletBinding()]
|
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
||||||
[OutputType([pscustomobject])]
|
[OutputType([pscustomobject])]
|
||||||
param
|
param
|
||||||
(
|
(
|
||||||
|
|
@ -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,
|
||||||
|
|
||||||
|
[uint32]$ASN,
|
||||||
|
|
||||||
|
[decimal]$Latitude,
|
||||||
|
|
||||||
|
[decimal]$Longitude,
|
||||||
|
|
||||||
|
[string]$Contact_Name,
|
||||||
|
|
||||||
|
[string]$Contact_Phone,
|
||||||
|
|
||||||
|
[string]$Contact_Email,
|
||||||
|
|
||||||
|
[int]$Tenant_Group,
|
||||||
|
|
||||||
|
[int]$Tenant,
|
||||||
|
|
||||||
|
[string]$Status,
|
||||||
|
|
||||||
|
[uint32]$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 {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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 {
|
function BuildNewURI {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.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 {
|
function BuildURIComponents {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
[OutputType([hashtable])]
|
[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 {
|
function CheckNetboxIsConnected {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param ()
|
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 {
|
function CreateEnum {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param
|
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 {
|
function Get-ModelDefinition {
|
||||||
[CmdletBinding(DefaultParameterSetName = 'ByName')]
|
[CmdletBinding(DefaultParameterSetName = 'ByName')]
|
||||||
param
|
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 {
|
function GetNetboxAPIErrorBody {
|
||||||
param
|
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 {
|
function InvokeNetboxRequest {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param
|
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 {
|
function ThrowNetboxRESTError {
|
||||||
$uriSegments = [System.Collections.ArrayList]::new(@('fake', 'url'))
|
$uriSegments = [System.Collections.ArrayList]::new(@('fake', 'url'))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
[object]$Family,
|
[object]$Family,
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'Query')]
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
[uint32]$Parent,
|
[string]$Parent,
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'Query')]
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
[byte]$Mask_Length,
|
[byte]$Mask_Length,
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Get-NetboxIPAMAvailableIP {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function New-NetboxIPAMAddress {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Remove-NetboxIPAMAddress {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Set-NetboxIPAMAddress {
|
||||||
[CmdletBinding(ConfirmImpact = 'Medium',
|
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||||
SupportsShouldProcess = $true)]
|
SupportsShouldProcess = $true)]
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Get-NetboxIPAMAggregate {
|
||||||
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
||||||
param
|
param
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Get-NetboxIPAMPrefix {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function New-NetboxIPAMPrefix {
|
||||||
[CmdletBinding(ConfirmImpact = 'low',
|
[CmdletBinding(ConfirmImpact = 'low',
|
||||||
SupportsShouldProcess = $true)]
|
SupportsShouldProcess = $true)]
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Set-NetboxIPAMPrefix {
|
||||||
[CmdletBinding(ConfirmImpact = 'Medium',
|
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||||
SupportsShouldProcess = $true)]
|
SupportsShouldProcess = $true)]
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Get-NetboxIPAMVLAN {
|
||||||
[CmdletBinding()]
|
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
||||||
param
|
param
|
||||||
(
|
(
|
||||||
[Parameter(ParameterSetName = 'Query',
|
[Parameter(ParameterSetName = 'Query',
|
||||||
|
|
@ -75,10 +62,6 @@ function Get-NetboxIPAMVLAN {
|
||||||
[switch]$Raw
|
[switch]$Raw
|
||||||
)
|
)
|
||||||
|
|
||||||
# if ($null -ne $Status) {
|
|
||||||
# $PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -VLANStatus
|
|
||||||
# }
|
|
||||||
|
|
||||||
switch ($PSCmdlet.ParameterSetName) {
|
switch ($PSCmdlet.ParameterSetName) {
|
||||||
'ById' {
|
'ById' {
|
||||||
foreach ($VLAN_ID in $Id) {
|
foreach ($VLAN_ID in $Id) {
|
||||||
|
|
|
||||||
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
|
#for PowerShell (<=) 5 (Desktop), Enable TLS 1.1, 1.2 and Disable SSL chain trust
|
||||||
if ("Desktop" -eq $PSVersionTable.PsEdition) {
|
if ("Desktop" -eq $PSVersionTable.PsEdition) {
|
||||||
|
#Add System.web (Need for ParseQueryString)
|
||||||
|
Add-Type -AssemblyName System.Web
|
||||||
#Enable TLS 1.1 and 1.2
|
#Enable TLS 1.1 and 1.2
|
||||||
Set-NetboxCipherSSL
|
Set-NetboxCipherSSL
|
||||||
if ($SkipCertificateCheck) {
|
if ($SkipCertificateCheck) {
|
||||||
|
|
@ -146,14 +148,7 @@
|
||||||
$script:NetboxConfig.Connected = $true
|
$script:NetboxConfig.Connected = $true
|
||||||
Write-Verbose "Successfully connected!"
|
Write-Verbose "Successfully connected!"
|
||||||
|
|
||||||
#Write-Verbose "Caching static choices"
|
$script:NetboxConfig.ContentTypes = Get-NetboxContentType -Limit 500
|
||||||
#$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
|
|
||||||
|
|
||||||
Write-Verbose "Connection process completed"
|
Write-Verbose "Connection process completed"
|
||||||
}
|
}
|
||||||
|
|
@ -1,18 +1,4 @@
|
||||||
<#
|
|
||||||
.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 {
|
function Get-NetboxAPIDefinition {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param ()
|
param ()
|
||||||
|
|
|
||||||
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')]
|
||||||
|
[uint32[]]$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' = @{
|
'Choices' = @{
|
||||||
}
|
}
|
||||||
'APIDefinition' = $null
|
'APIDefinition' = $null
|
||||||
|
'ContentTypes' = $null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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')]
|
||||||
|
[uint32[]]$Id,
|
||||||
|
|
||||||
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
|
[uint32]$Content_Type_Id,
|
||||||
|
|
||||||
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
|
[string]$Content_Type,
|
||||||
|
|
||||||
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
|
[uint32]$Object_Id,
|
||||||
|
|
||||||
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
|
[uint32]$Contact_Id,
|
||||||
|
|
||||||
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
|
[uint32]$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,108 @@
|
||||||
|
|
||||||
|
function New-NetboxContactRole {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Create a new contact role in Netbox
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Creates a new contact role object in Netbox
|
||||||
|
|
||||||
|
.PARAMETER Content_Type
|
||||||
|
A description of the Content_Type parameter.
|
||||||
|
|
||||||
|
.PARAMETER Object_Id
|
||||||
|
A description of the Object_Id parameter.
|
||||||
|
|
||||||
|
.PARAMETER Contact
|
||||||
|
A description of the Contact parameter.
|
||||||
|
|
||||||
|
.PARAMETER Role
|
||||||
|
A description of the Role parameter.
|
||||||
|
|
||||||
|
.PARAMETER Priority
|
||||||
|
A description of the Priority parameter.
|
||||||
|
|
||||||
|
.PARAMETER Raw
|
||||||
|
Return the unparsed data from the HTTP request
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
PS C:\> New-NetboxContactAssignment -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)]
|
||||||
|
[object]$Content_Type,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[uint32]$Object_Id,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[uint32]$Contact,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[uint32]$Role,
|
||||||
|
|
||||||
|
[ValidateSet('primary', 'secondary', 'tertiary', 'inactive', IgnoreCase = $true)]
|
||||||
|
[string]$Priority,
|
||||||
|
|
||||||
|
[switch]$Raw
|
||||||
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
|
# https://docs.netbox.dev/en/stable/features/contacts/
|
||||||
|
$AllowedContentTypes = @{
|
||||||
|
10 = "circuits.circuit"
|
||||||
|
7 = "circuits.provider"
|
||||||
|
19 = "dcim.device"
|
||||||
|
25 = "dcim.location"
|
||||||
|
29 = "dcim.manufacturer"
|
||||||
|
77 = "dcim.powerpanel"
|
||||||
|
20 = "dcim.rack"
|
||||||
|
30 = "dcim.region"
|
||||||
|
18 = "dcim.site"
|
||||||
|
92 = "dcim.sitegroup"
|
||||||
|
58 = "tenancy.tenant"
|
||||||
|
63 = "virtualization.cluster"
|
||||||
|
64 = "virtualization.clustergroup"
|
||||||
|
61 = "virtualization.virtualmachine"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
$Segments = [System.Collections.ArrayList]::new(@('tenancy', 'contact-assignment'))
|
||||||
|
$Method = 'POST'
|
||||||
|
|
||||||
|
if ($Content_Type -is [string]) {
|
||||||
|
# Need to convert this to an integer
|
||||||
|
$Content_Type = ($AllowedContentTypes.GetEnumerator() | Where-Object {
|
||||||
|
$_.Value -eq $Content_Type
|
||||||
|
}).Key
|
||||||
|
} elseif ($Content_Type -is [int]) {
|
||||||
|
if ($Content_Type -notin $($AllowedContentTypes).Keys) {
|
||||||
|
throw "Invalid content type defined"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw "Invalid content type defined"
|
||||||
|
}
|
||||||
|
|
||||||
|
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
||||||
|
|
||||||
|
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess($Address, 'Create new 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')]
|
||||||
|
[uint32[]]$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($Address, 'Create new contact')) {
|
||||||
|
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')]
|
||||||
|
[uint32[]]$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')]
|
||||||
|
[uint16]$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($Address, '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)]
|
||||||
|
[uint32[]]$Id,
|
||||||
|
|
||||||
|
[ValidateLength(1, 100)]
|
||||||
|
[string]$Name,
|
||||||
|
|
||||||
|
[ValidateLength(0, 254)]
|
||||||
|
[string]$Email,
|
||||||
|
|
||||||
|
[uint32]$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
|
||||||
|
|
||||||
|
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 {
|
function Get-NetboxTenant {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
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 {
|
function Get-NetboxVirtualMachine {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function New-NetboxVirtualMachine {
|
||||||
[CmdletBinding(ConfirmImpact = 'low',
|
[CmdletBinding(ConfirmImpact = 'low',
|
||||||
SupportsShouldProcess = $true)]
|
SupportsShouldProcess = $true)]
|
||||||
|
|
@ -22,6 +9,8 @@ function New-NetboxVirtualMachine {
|
||||||
[string]$Name,
|
[string]$Name,
|
||||||
|
|
||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $true)]
|
||||||
|
[uint16]$Site,
|
||||||
|
|
||||||
[uint16]$Cluster,
|
[uint16]$Cluster,
|
||||||
|
|
||||||
[uint16]$Tenant,
|
[uint16]$Tenant,
|
||||||
|
|
@ -56,6 +45,10 @@ function New-NetboxVirtualMachine {
|
||||||
|
|
||||||
#$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
#$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'))
|
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines'))
|
||||||
|
|
||||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
$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 {
|
function Remove-NetboxVirtualMachine {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Set-NetboxVirtualMachine {
|
||||||
[CmdletBinding(ConfirmImpact = 'Medium',
|
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||||
SupportsShouldProcess = $true)]
|
SupportsShouldProcess = $true)]
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Add-NetboxVirtualMachineInterface {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param
|
param
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Get-NetboxVirtualMachineInterface {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Set-NetboxVirtualMachineInterface {
|
||||||
[CmdletBinding(ConfirmImpact = 'Medium',
|
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||||
SupportsShouldProcess = $true)]
|
SupportsShouldProcess = $true)]
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Get-NetboxVirtualizationCluster {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
function Get-NetboxVirtualizationClusterGroup {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param
|
param
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
# Generated by: Ben Claussen
|
# Generated by: Ben Claussen
|
||||||
#
|
#
|
||||||
# Generated on: 2021-07-23
|
# Generated on: 2023-02-24
|
||||||
#
|
#
|
||||||
|
|
||||||
@{
|
@{
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
RootModule = 'NetboxPS.psm1'
|
RootModule = 'NetboxPS.psm1'
|
||||||
|
|
||||||
# Version number of this module.
|
# Version number of this module.
|
||||||
ModuleVersion = '1.5.0'
|
ModuleVersion = '1.7.1'
|
||||||
|
|
||||||
# Supported PSEditions
|
# Supported PSEditions
|
||||||
# CompatiblePSEditions = @()
|
# CompatiblePSEditions = @()
|
||||||
|
|
@ -54,7 +54,7 @@ CLRVersion = '2.0.50727'
|
||||||
# RequiredModules = @()
|
# RequiredModules = @()
|
||||||
|
|
||||||
# Assemblies that must be loaded prior to importing this module
|
# 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.
|
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
|
||||||
# ScriptsToProcess = @()
|
# ScriptsToProcess = @()
|
||||||
|
|
@ -69,7 +69,40 @@ RequiredAssemblies = 'System.Web'
|
||||||
NestedModules = @()
|
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.
|
# 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-NetboxDCIMInterface', 'Add-NetboxDCIMInterfaceConnection',
|
||||||
|
'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-NetboxDCIMDevice',
|
||||||
|
'Get-NetboxDCIMDeviceRole', 'Get-NetboxDCIMDeviceType',
|
||||||
|
'Get-NetboxDCIMInterface', 'Get-NetboxDCIMInterfaceConnection',
|
||||||
|
'Get-NetboxDCIMPlatform', 'Get-NetboxDCIMSite', 'Get-NetboxHostname',
|
||||||
|
'Get-NetboxHostPort', 'Get-NetboxHostScheme',
|
||||||
|
'Get-NetboxInvokeParams', 'Get-NetboxIPAMAddress',
|
||||||
|
'Get-NetboxIPAMAggregate', 'Get-NetboxIPAMAvailableIP',
|
||||||
|
'Get-NetboxIPAMPrefix', 'Get-NetboxIPAMRole', 'Get-NetboxIPAMVLAN',
|
||||||
|
'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-NetboxIPAMPrefix', 'New-NetboxIPAMVLAN',
|
||||||
|
'New-NetboxTenant', 'New-NetboxVirtualMachine',
|
||||||
|
'Remove-NetboxDCIMDevice', 'Remove-NetboxDCIMInterface',
|
||||||
|
'Remove-NetboxDCIMInterfaceConnection', 'Remove-NetboxDCIMSite',
|
||||||
|
'Remove-NetboxIPAMAddress', 'Remove-NetboxVirtualMachine',
|
||||||
|
'Set-NetboxCipherSSL', 'Set-NetboxContact', 'Set-NetboxCredential',
|
||||||
|
'Set-NetboxDCIMDevice', 'Set-NetboxDCIMInterface',
|
||||||
|
'Set-NetboxDCIMInterfaceConnection', 'Set-NetboxHostName',
|
||||||
|
'Set-NetboxHostPort', 'Set-NetboxHostScheme',
|
||||||
|
'Set-NetboxInvokeParams', 'Set-NetboxIPAMAddress',
|
||||||
|
'Set-NetboxIPAMPrefix', 'Set-NetboxTimeout',
|
||||||
|
'Set-NetboxUnstrustedSSL', 'Set-NetboxVirtualMachine',
|
||||||
|
'Set-NetboxVirtualMachineInterface'
|
||||||
|
|
||||||
# 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.
|
# 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 = '*'
|
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
|
# Build a list of common parameters so we can omit them to build URI parameters
|
||||||
$script:CommonParameterNames = New-Object System.Collections.ArrayList
|
$script:CommonParameterNames = New-Object System.Collections.ArrayList
|
||||||
[void]$script:CommonParameterNames.AddRange(@([System.Management.Automation.PSCmdlet]::CommonParameters))
|
[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')
|
[void]$script:CommonParameterNames.Add('Raw')
|
||||||
|
|
||||||
SetupNetboxConfigVariable
|
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>
|
<Version>2.1</Version>
|
||||||
<FileID>bba9b06c-49c8-47cf-8358-aca7c4e78896</FileID>
|
<FileID>bba9b06c-49c8-47cf-8358-aca7c4e78896</FileID>
|
||||||
<ProjectType>1</ProjectType>
|
<ProjectType>1</ProjectType>
|
||||||
|
<RememberPowerShellVersion>True</RememberPowerShellVersion>
|
||||||
|
<PowerShellVersion>Local Machine - PowerShell V5 (64 Bit)</PowerShellVersion>
|
||||||
<Folders>
|
<Folders>
|
||||||
<Folder>Functions</Folder>
|
<Folder>Functions</Folder>
|
||||||
<Folder>Functions\DCIM</Folder>
|
<Folder>Functions\DCIM</Folder>
|
||||||
|
|
@ -28,6 +30,10 @@
|
||||||
<Folder>Functions\Circuits\Providers</Folder>
|
<Folder>Functions\Circuits\Providers</Folder>
|
||||||
<Folder>Functions\Circuits\Types</Folder>
|
<Folder>Functions\Circuits\Types</Folder>
|
||||||
<Folder>Functions\Circuits\Terminations</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>
|
||||||
</Folders>
|
</Folders>
|
||||||
<Files>
|
<Files>
|
||||||
<File Build="2">NetboxPS.psd1</File>
|
<File Build="2">NetboxPS.psd1</File>
|
||||||
|
|
@ -48,7 +54,6 @@
|
||||||
<File Build="0" Shared="True" ReferenceFunction="Invoke-BuildURIComponents_ps1" ExportFunctions="True">Functions\Helpers\BuildURIComponents.ps1</File>
|
<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-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-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-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-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>
|
<File Build="0" Shared="True" ReferenceFunction="Invoke-SetupNetboxConfigVariable_ps1" ExportFunctions="True">Functions\Setup\Support\SetupNetboxConfigVariable.ps1</File>
|
||||||
|
|
@ -69,7 +74,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-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-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-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-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-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>
|
<File Build="0" Shared="True" ReferenceFunction="Invoke-Set-NetboxVirtualMachine_ps1" ExportFunctions="True">Functions\Virtualization\VirtualMachine\Set-NetboxVirtualMachine.ps1</File>
|
||||||
|
|
@ -115,6 +120,15 @@
|
||||||
<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-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-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-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="2" 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="False" ReferenceFunction="Invoke-Set-NetboxContact_ps1" ExportFunctions="False">Functions\Tenancy\Contacts\Set-NetboxContact.ps1</File>
|
||||||
</Files>
|
</Files>
|
||||||
<StartupScript>R:\Netbox\NetboxPS\Test-Module.ps1</StartupScript>
|
<StartupScript>R:\Netbox\NetboxPS\Test-Module.ps1</StartupScript>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
# Generated by: Ben Claussen
|
# Generated by: Ben Claussen
|
||||||
#
|
#
|
||||||
# Generated on: 2021-07-23
|
# Generated on: 2023-02-24
|
||||||
#
|
#
|
||||||
|
|
||||||
@{
|
@{
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
RootModule = 'NetboxPS.psm1'
|
RootModule = 'NetboxPS.psm1'
|
||||||
|
|
||||||
# Version number of this module.
|
# Version number of this module.
|
||||||
ModuleVersion = '1.5.0'
|
ModuleVersion = '1.7.1'
|
||||||
|
|
||||||
# Supported PSEditions
|
# Supported PSEditions
|
||||||
# CompatiblePSEditions = @()
|
# CompatiblePSEditions = @()
|
||||||
|
|
@ -54,7 +54,7 @@ CLRVersion = '2.0.50727'
|
||||||
# RequiredModules = @()
|
# RequiredModules = @()
|
||||||
|
|
||||||
# Assemblies that must be loaded prior to importing this module
|
# 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.
|
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
|
||||||
# ScriptsToProcess = @()
|
# ScriptsToProcess = @()
|
||||||
|
|
@ -69,7 +69,40 @@ RequiredAssemblies = 'System.Web'
|
||||||
NestedModules = @()
|
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.
|
# 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-NetboxDCIMInterface', 'Add-NetboxDCIMInterfaceConnection',
|
||||||
|
'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-NetboxDCIMDevice',
|
||||||
|
'Get-NetboxDCIMDeviceRole', 'Get-NetboxDCIMDeviceType',
|
||||||
|
'Get-NetboxDCIMInterface', 'Get-NetboxDCIMInterfaceConnection',
|
||||||
|
'Get-NetboxDCIMPlatform', 'Get-NetboxDCIMSite', 'Get-NetboxHostname',
|
||||||
|
'Get-NetboxHostPort', 'Get-NetboxHostScheme',
|
||||||
|
'Get-NetboxInvokeParams', 'Get-NetboxIPAMAddress',
|
||||||
|
'Get-NetboxIPAMAggregate', 'Get-NetboxIPAMAvailableIP',
|
||||||
|
'Get-NetboxIPAMPrefix', 'Get-NetboxIPAMRole', 'Get-NetboxIPAMVLAN',
|
||||||
|
'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-NetboxIPAMPrefix', 'New-NetboxIPAMVLAN',
|
||||||
|
'New-NetboxTenant', 'New-NetboxVirtualMachine',
|
||||||
|
'Remove-NetboxDCIMDevice', 'Remove-NetboxDCIMInterface',
|
||||||
|
'Remove-NetboxDCIMInterfaceConnection', 'Remove-NetboxDCIMSite',
|
||||||
|
'Remove-NetboxIPAMAddress', 'Remove-NetboxVirtualMachine',
|
||||||
|
'Set-NetboxCipherSSL', 'Set-NetboxContact', 'Set-NetboxCredential',
|
||||||
|
'Set-NetboxDCIMDevice', 'Set-NetboxDCIMInterface',
|
||||||
|
'Set-NetboxDCIMInterfaceConnection', 'Set-NetboxHostName',
|
||||||
|
'Set-NetboxHostPort', 'Set-NetboxHostScheme',
|
||||||
|
'Set-NetboxInvokeParams', 'Set-NetboxIPAMAddress',
|
||||||
|
'Set-NetboxIPAMPrefix', 'Set-NetboxTimeout',
|
||||||
|
'Set-NetboxUnstrustedSSL', 'Set-NetboxVirtualMachine',
|
||||||
|
'Set-NetboxVirtualMachineInterface'
|
||||||
|
|
||||||
# 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.
|
# 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 = '*'
|
CmdletsToExport = '*'
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
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
|
2. Import module
|
||||||
3. Connect to an API endpoint by using `Connect-NetboxAPI -Hostname netbox.example.com`
|
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
|
# 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 😅
|
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.
|
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
|
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")]
|
||||||
===========================================================================
|
param
|
||||||
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.
|
|
||||||
#>
|
|
||||||
|
|
||||||
Import-Module Pester
|
Import-Module Pester
|
||||||
Remove-Module NetboxPS -Force -ErrorAction SilentlyContinue
|
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 {
|
Mock -CommandName 'Invoke-RestMethod' -Verifiable -ModuleName 'NetboxPS' -MockWith {
|
||||||
# Return a hashtable of the items we would normally pass to Invoke-RestMethod
|
# Return a hashtable of the items we would normally pass to Invoke-RestMethod
|
||||||
return [ordered]@{
|
return [ordered]@{
|
||||||
'Method' = $Method
|
'Method' = $Method
|
||||||
'Uri' = $Uri
|
'Uri' = $Uri
|
||||||
'Headers' = $Headers
|
'Headers' = $Headers
|
||||||
'Timeout' = $Timeout
|
'Timeout' = $Timeout
|
||||||
'ContentType' = $ContentType
|
'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 {
|
Mock -CommandName "Get-NetboxDCIMDevice" -ModuleName NetboxPS -MockWith {
|
||||||
return [pscustomobject]@{
|
return [pscustomobject]@{
|
||||||
'Id' = $Id
|
'Id' = $Id
|
||||||
'Name' = $Name
|
'Name' = $Name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,8 @@
|
||||||
<#
|
|
||||||
.NOTES
|
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")]
|
||||||
===========================================================================
|
param
|
||||||
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.
|
|
||||||
#>
|
|
||||||
|
|
||||||
Import-Module Pester
|
Import-Module Pester
|
||||||
Remove-Module NetboxPS -Force -ErrorAction SilentlyContinue
|
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 {
|
Mock -CommandName 'Invoke-RestMethod' -Verifiable -ModuleName 'NetboxPS' -MockWith {
|
||||||
# Return a hashtable of the items we would normally pass to Invoke-RestMethod
|
# Return a hashtable of the items we would normally pass to Invoke-RestMethod
|
||||||
return [ordered]@{
|
return [ordered]@{
|
||||||
'Method' = $Method
|
'Method' = $Method
|
||||||
'Uri' = $Uri
|
'Uri' = $Uri
|
||||||
'Headers' = $Headers
|
'Headers' = $Headers
|
||||||
'Timeout' = $Timeout
|
'Timeout' = $Timeout
|
||||||
'ContentType' = $ContentType
|
'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" {
|
It "Should add an interface to a device with lots of properties" {
|
||||||
$paramAddNetboxDCIMInterface = @{
|
$paramAddNetboxDCIMInterface = @{
|
||||||
Device = 123
|
Device = 123
|
||||||
Name = "TestInterface"
|
Name = "TestInterface"
|
||||||
Form_Factor = '10GBASE-T (10GE)'
|
Form_Factor = '10GBASE-T (10GE)'
|
||||||
MTU = 9000
|
MTU = 9000
|
||||||
MGMT_Only = $true
|
MGMT_Only = $true
|
||||||
Description = 'Test Description'
|
Description = 'Test Description'
|
||||||
Mode = 'Access'
|
Mode = 'Access'
|
||||||
}
|
}
|
||||||
|
|
||||||
$Result = Add-NetboxDCIMInterface @paramAddNetboxDCIMInterface
|
$Result = Add-NetboxDCIMInterface @paramAddNetboxDCIMInterface
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,8 @@
|
||||||
<#
|
|
||||||
.NOTES
|
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")]
|
||||||
===========================================================================
|
param
|
||||||
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.
|
|
||||||
#>
|
|
||||||
|
|
||||||
Import-Module Pester
|
Import-Module Pester
|
||||||
Remove-Module NetboxPS -Force -ErrorAction SilentlyContinue
|
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 {
|
Mock -CommandName 'Invoke-RestMethod' -Verifiable -ModuleName 'NetboxPS' -MockWith {
|
||||||
# Return a hashtable of the items we would normally pass to Invoke-RestMethod
|
# Return a hashtable of the items we would normally pass to Invoke-RestMethod
|
||||||
return [ordered]@{
|
return [ordered]@{
|
||||||
'Method' = $Method
|
'Method' = $Method
|
||||||
'Uri' = $Uri
|
'Uri' = $Uri
|
||||||
'Headers' = $Headers
|
'Headers' = $Headers
|
||||||
'Timeout' = $Timeout
|
'Timeout' = $Timeout
|
||||||
'ContentType' = $ContentType
|
'ContentType' = $ContentType
|
||||||
'Body' = $Body
|
'Body' = $Body
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,8 @@
|
||||||
<#
|
|
||||||
.NOTES
|
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")]
|
||||||
===========================================================================
|
param
|
||||||
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
|
|
||||||
#>
|
|
||||||
|
|
||||||
Import-Module Pester
|
Import-Module Pester
|
||||||
Remove-Module NetboxPS -Force -ErrorAction SilentlyContinue
|
Remove-Module NetboxPS -Force -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
|
@ -88,7 +80,7 @@ Describe "Helpers tests" -Tag 'Core', 'Helpers' -Fixture {
|
||||||
|
|
||||||
Context -Name "Building URI components" -Fixture {
|
Context -Name "Building URI components" -Fixture {
|
||||||
It "Should give a basic hashtable" {
|
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 | Should -BeOfType [hashtable]
|
||||||
$URIComponents.Keys.Count | Should -BeExactly 2
|
$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" {
|
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 | Should -BeOfType [hashtable]
|
||||||
$URIComponents.Keys.Count | Should -BeExactly 2
|
$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" {
|
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 | Should -BeOfType [hashtable]
|
||||||
$URIComponents.Keys.Count | Should -BeExactly 2
|
$URIComponents.Keys.Count | Should -BeExactly 2
|
||||||
|
|
@ -123,7 +115,7 @@ Describe "Helpers tests" -Tag 'Core', 'Helpers' -Fixture {
|
||||||
}
|
}
|
||||||
|
|
||||||
It "Should skip a particular parameter name" {
|
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 | Should -BeOfType [hashtable]
|
||||||
$URIComponents.Keys.Count | Should -BeExactly 2
|
$URIComponents.Keys.Count | Should -BeExactly 2
|
||||||
|
|
@ -136,7 +128,7 @@ Describe "Helpers tests" -Tag 'Core', 'Helpers' -Fixture {
|
||||||
}
|
}
|
||||||
|
|
||||||
It "Should add a query (q) parameter" {
|
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 | Should -BeOfType [hashtable]
|
||||||
$URIComponents.Keys.Count | Should -BeExactly 2
|
$URIComponents.Keys.Count | Should -BeExactly 2
|
||||||
|
|
@ -150,7 +142,7 @@ Describe "Helpers tests" -Tag 'Core', 'Helpers' -Fixture {
|
||||||
It "Should generate custom field parameters" {
|
It "Should generate custom field parameters" {
|
||||||
$URIComponents = BuildURIComponents -URISegments @('segment1', 'segment2') -ParametersDictionary @{
|
$URIComponents = BuildURIComponents -URISegments @('segment1', 'segment2') -ParametersDictionary @{
|
||||||
'CustomFields' = @{
|
'CustomFields' = @{
|
||||||
'PRTG_Id' = 1234
|
'PRTG_Id' = 1234
|
||||||
'Customer_Id' = 'abc'
|
'Customer_Id' = 'abc'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -170,13 +162,13 @@ Describe "Helpers tests" -Tag 'Core', 'Helpers' -Fixture {
|
||||||
Mock -CommandName 'Invoke-RestMethod' -Verifiable -MockWith {
|
Mock -CommandName 'Invoke-RestMethod' -Verifiable -MockWith {
|
||||||
# Return an object of the items we would normally pass to Invoke-RestMethod
|
# Return an object of the items we would normally pass to Invoke-RestMethod
|
||||||
return [pscustomobject]@{
|
return [pscustomobject]@{
|
||||||
'Method' = $Method
|
'Method' = $Method
|
||||||
'Uri' = $Uri
|
'Uri' = $Uri
|
||||||
'Headers' = $Headers
|
'Headers' = $Headers
|
||||||
'Timeout' = $Timeout
|
'Timeout' = $Timeout
|
||||||
'ContentType' = $ContentType
|
'ContentType' = $ContentType
|
||||||
'Body' = $Body
|
'Body' = $Body
|
||||||
'results' = 'Only results'
|
'results' = 'Only results'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,8 @@
|
||||||
<#
|
|
||||||
.NOTES
|
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")]
|
||||||
===========================================================================
|
param
|
||||||
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
|
|
||||||
#>
|
|
||||||
|
|
||||||
Import-Module Pester
|
Import-Module Pester
|
||||||
Remove-Module NetboxPS -Force -ErrorAction SilentlyContinue
|
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 {
|
Mock -CommandName 'Invoke-RestMethod' -Verifiable -ModuleName 'NetboxPS' -MockWith {
|
||||||
# Return a hashtable of the items we would normally pass to Invoke-RestMethod
|
# Return a hashtable of the items we would normally pass to Invoke-RestMethod
|
||||||
return [ordered]@{
|
return [ordered]@{
|
||||||
'Method' = $Method
|
'Method' = $Method
|
||||||
'Uri' = $Uri
|
'Uri' = $Uri
|
||||||
'Headers' = $Headers
|
'Headers' = $Headers
|
||||||
'Timeout' = $Timeout
|
'Timeout' = $Timeout
|
||||||
'ContentType' = $ContentType
|
'ContentType' = $ContentType
|
||||||
'Body' = $Body
|
'Body' = $Body
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -422,7 +414,7 @@ Describe -Name "IPAM tests" -Tag 'Ipam' -Fixture {
|
||||||
Mock -CommandName "Get-NetboxIPAMAddress" -ModuleName NetboxPS -MockWith {
|
Mock -CommandName "Get-NetboxIPAMAddress" -ModuleName NetboxPS -MockWith {
|
||||||
return @{
|
return @{
|
||||||
'address' = "10.1.1.1/$Id"
|
'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 {
|
Mock -CommandName "Get-NetboxIPAMAddress" -ModuleName NetboxPS -MockWith {
|
||||||
return @{
|
return @{
|
||||||
'address' = '10.1.1.1/24'
|
'address' = '10.1.1.1/24'
|
||||||
'id' = $id
|
'id' = $id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,8 @@
|
||||||
<#
|
|
||||||
.NOTES
|
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")]
|
||||||
===========================================================================
|
param
|
||||||
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
|
|
||||||
#>
|
|
||||||
|
|
||||||
Import-Module Pester
|
Import-Module Pester
|
||||||
Remove-Module NetboxPS -Force -ErrorAction SilentlyContinue
|
Remove-Module NetboxPS -Force -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
|
@ -43,7 +35,7 @@ Describe "Setup tests" -Tag 'Core', 'Setup' -Fixture {
|
||||||
}
|
}
|
||||||
|
|
||||||
It "Checks the set credentials" {
|
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"
|
(Get-NetboxCredential).GetNetworkCredential().Password | Should -BeExactly "faketoken"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,8 @@
|
||||||
<#
|
|
||||||
.NOTES
|
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")]
|
||||||
===========================================================================
|
param
|
||||||
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
|
|
||||||
#>
|
|
||||||
|
|
||||||
Import-Module Pester
|
Import-Module Pester
|
||||||
Remove-Module NetboxPS -Force -ErrorAction SilentlyContinue
|
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 {
|
Mock -CommandName 'Invoke-RestMethod' -Verifiable -ModuleName 'NetboxPS' -MockWith {
|
||||||
# Return a hashtable of the items we would normally pass to Invoke-RestMethod
|
# Return a hashtable of the items we would normally pass to Invoke-RestMethod
|
||||||
return [ordered]@{
|
return [ordered]@{
|
||||||
'Method' = $Method
|
'Method' = $Method
|
||||||
'Uri' = $Uri
|
'Uri' = $Uri
|
||||||
'Headers' = $Headers
|
'Headers' = $Headers
|
||||||
'Timeout' = $Timeout
|
'Timeout' = $Timeout
|
||||||
'ContentType' = $ContentType
|
'ContentType' = $ContentType
|
||||||
'Body' = $Body
|
'Body' = $Body
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -365,7 +357,7 @@ Describe -Name "Virtualization tests" -Tag 'Virtualization' -Fixture {
|
||||||
|
|
||||||
Mock -CommandName "Get-NetboxVirtualMachine" -ModuleName NetboxPS -MockWith {
|
Mock -CommandName "Get-NetboxVirtualMachine" -ModuleName NetboxPS -MockWith {
|
||||||
return [pscustomobject]@{
|
return [pscustomobject]@{
|
||||||
'Id' = $Id
|
'Id' = $Id
|
||||||
'Name' = $Name
|
'Name' = $Name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -406,7 +398,7 @@ Describe -Name "Virtualization tests" -Tag 'Virtualization' -Fixture {
|
||||||
|
|
||||||
Mock -CommandName "Get-NetboxVirtualMachineInterface" -ModuleName NetboxPS -MockWith {
|
Mock -CommandName "Get-NetboxVirtualMachineInterface" -ModuleName NetboxPS -MockWith {
|
||||||
return [pscustomobject]@{
|
return [pscustomobject]@{
|
||||||
'Id' = $Id
|
'Id' = $Id
|
||||||
'Name' = $Name
|
'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" {
|
It "Should set an interface to a new name, MTU, MAC address and description" {
|
||||||
$paramSetNetboxVirtualMachineInterface = @{
|
$paramSetNetboxVirtualMachineInterface = @{
|
||||||
Id = 1234
|
Id = 1234
|
||||||
Name = 'newtestname'
|
Name = 'newtestname'
|
||||||
MAC_Address = '11:22:33:44:55:66'
|
MAC_Address = '11:22:33:44:55:66'
|
||||||
MTU = 9000
|
MTU = 9000
|
||||||
Description = "Test description"
|
Description = "Test description"
|
||||||
Force = $true
|
Force = $true
|
||||||
}
|
}
|
||||||
|
|
||||||
$Result = Set-NetboxVirtualMachineInterface @paramSetNetboxVirtualMachineInterface
|
$Result = Set-NetboxVirtualMachineInterface @paramSetNetboxVirtualMachineInterface
|
||||||
|
|
|
||||||
19
Tests/common.ps1
Normal file
19
Tests/common.ps1
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
#
|
||||||
|
# Copyright 2021, Alexis La Goutte <alexis dot lagoutte at gmail dot com>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")]
|
||||||
|
Param()
|
||||||
|
|
||||||
|
$script:pester_site1 = "pester_site1"
|
||||||
|
|
||||||
|
$Credential = New-Object System.Management.Automation.PSCredential("username", (ConvertTo-SecureString $token -AsPlainText -Force))
|
||||||
|
$script:invokeParams = @{
|
||||||
|
hostname = $hostname;
|
||||||
|
Credential = $Credential;
|
||||||
|
SkipCertificateCheck = $true;
|
||||||
|
}
|
||||||
|
|
||||||
|
. ../credential.ps1
|
||||||
|
#TODO: Add check if no ipaddress/token info...
|
||||||
13
Tests/credential.example.ps1
Normal file
13
Tests/credential.example.ps1
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
#
|
||||||
|
# Copyright 2021, Alexis La Goutte <alexis dot lagoutte at gmail dot com>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
# Copy this file to credential.ps1 (on Tests folder) and change connection settings..
|
||||||
|
|
||||||
|
$script:hostname = "10.44.23.213"
|
||||||
|
$script:token = "aaaaaaaaaaaaaaaaaa"
|
||||||
|
|
||||||
|
#Uncomment if you want to personnalize some setting
|
||||||
|
#script:pester_site1 = "pester_site1"
|
||||||
85
Tests/integration/DCIM.Site.Tests.ps1
Normal file
85
Tests/integration/DCIM.Site.Tests.ps1
Normal file
|
|
@ -0,0 +1,85 @@
|
||||||
|
#
|
||||||
|
# Copyright 2021, Alexis La Goutte <alexis dot lagoutte at gmail dot com>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
. ../common.ps1
|
||||||
|
|
||||||
|
BeforeAll {
|
||||||
|
Connect-NetboxAPI @invokeParams
|
||||||
|
}
|
||||||
|
|
||||||
|
Describe "Get (DCIM) Site" {
|
||||||
|
|
||||||
|
BeforeAll {
|
||||||
|
New-NetboxDCIMSite -name $pester_site1
|
||||||
|
}
|
||||||
|
|
||||||
|
It "Get Site Does not throw an error" {
|
||||||
|
{
|
||||||
|
Get-NetboxDCIMSite
|
||||||
|
} | Should -Not -Throw
|
||||||
|
}
|
||||||
|
|
||||||
|
It "Get ALL Site" {
|
||||||
|
$site = Get-NetboxDCIMSite
|
||||||
|
$site.count | Should -Not -Be $NULL
|
||||||
|
}
|
||||||
|
|
||||||
|
It "Get Site ($pester_site1)" {
|
||||||
|
$site = Get-NetboxDCIMSite | Where-Object { $_.name -eq $pester_site1 }
|
||||||
|
$site.id | Should -Not -BeNullOrEmpty
|
||||||
|
$site.name | Should -Be $pester_site1
|
||||||
|
$site.status.value | Should -Be "active"
|
||||||
|
}
|
||||||
|
|
||||||
|
It "Search Site by name ($pester_site1)" {
|
||||||
|
$site = Get-NetboxDCIMSite -name $pester_site1
|
||||||
|
@($site).count | Should -Be 1
|
||||||
|
$site.id | Should -Not -BeNullOrEmpty
|
||||||
|
$site.name | Should -Be $pester_site1
|
||||||
|
}
|
||||||
|
|
||||||
|
AfterAll {
|
||||||
|
Get-NetboxDCIMSite -name $pester_site1 | Remove-NetboxDCIMSite -confirm:$false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Describe "New (DCIM) Site" {
|
||||||
|
|
||||||
|
It "New Site with no option" {
|
||||||
|
New-NetboxDCIMSite -name $pester_site1
|
||||||
|
$site = Get-NetboxDCIMSite -name $pester_site1
|
||||||
|
$site.id | Should -Not -BeNullOrEmpty
|
||||||
|
$site.name | Should -Be $pester_site1
|
||||||
|
$site.slug | Should -Be $pester_site1
|
||||||
|
}
|
||||||
|
|
||||||
|
It "New Site with different slug" {
|
||||||
|
New-NetboxDCIMSite -name $pester_site1 -slug pester_slug
|
||||||
|
$site = Get-NetboxDCIMSite -name $pester_site1
|
||||||
|
$site.id | Should -Not -BeNullOrEmpty
|
||||||
|
$site.name | Should -Be $pester_site1
|
||||||
|
$site.slug | Should -Be "pester_slug"
|
||||||
|
}
|
||||||
|
|
||||||
|
AfterEach {
|
||||||
|
Get-NetboxDCIMSite -name $pester_site1 | Remove-NetboxDCIMSite -confirm:$false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Describe "Remove Site" {
|
||||||
|
|
||||||
|
BeforeEach {
|
||||||
|
New-NetboxDCIMSite -name $pester_site1
|
||||||
|
}
|
||||||
|
|
||||||
|
It "Remove Site" {
|
||||||
|
$site = Get-NetboxDCIMSite -name $pester_site1
|
||||||
|
Remove-NetboxDCIMSite -id $site.id -confirm:$false
|
||||||
|
$site = Get-NetboxDCIMSite -name $pester_site1
|
||||||
|
$site | Should -BeNullOrEmpty
|
||||||
|
@($site).count | Should -Be 0
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
86
deploy.ps1
86
deploy.ps1
|
|
@ -17,6 +17,12 @@
|
||||||
.PARAMETER NewVersion
|
.PARAMETER NewVersion
|
||||||
Override the new version with this version
|
Override the new version with this version
|
||||||
|
|
||||||
|
.PARAMETER Environment
|
||||||
|
A description of the Environment parameter.
|
||||||
|
|
||||||
|
.PARAMETER ResetCurrentEnvironment
|
||||||
|
A description of the ResetCurrentEnvironment parameter.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Use all defaults and concatenate all files
|
Use all defaults and concatenate all files
|
||||||
|
|
||||||
|
|
@ -26,17 +32,10 @@
|
||||||
Increment the version by 0.2.0. Given version 1.2.0, the resulting version will be 1.4.0
|
Increment the version by 0.2.0. Given version 1.2.0, the resulting version will be 1.4.0
|
||||||
|
|
||||||
.\deploy.ps1 -VersionIncrease 0.2.0
|
.\deploy.ps1 -VersionIncrease 0.2.0
|
||||||
|
|
||||||
.NOTES
|
|
||||||
===========================================================================
|
|
||||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.174
|
|
||||||
Created on: 4/9/2020 09:43
|
|
||||||
Created by: Claussen
|
|
||||||
Organization: NEOnet
|
|
||||||
Filename: deploy.ps1
|
|
||||||
===========================================================================
|
|
||||||
#>
|
#>
|
||||||
[CmdletBinding(DefaultParameterSetName = 'IncreaseVersion')]
|
[CmdletBinding(DefaultParameterSetName = 'IncreaseVersion')]
|
||||||
|
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingWriteHost", "")]
|
||||||
|
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "")]
|
||||||
param
|
param
|
||||||
(
|
(
|
||||||
[Parameter(ParameterSetName = 'SkipVersion')]
|
[Parameter(ParameterSetName = 'SkipVersion')]
|
||||||
|
|
@ -46,13 +45,18 @@ param
|
||||||
[version]$VersionIncrease = "0.0.1",
|
[version]$VersionIncrease = "0.0.1",
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'SetVersion')]
|
[Parameter(ParameterSetName = 'SetVersion')]
|
||||||
[version]$NewVersion
|
[version]$NewVersion,
|
||||||
|
|
||||||
|
[ValidateSet('dev', 'development', 'prod', 'production', IgnoreCase = $true)]
|
||||||
|
[string]$Environment = 'development',
|
||||||
|
[switch]$ResetCurrentEnvironment
|
||||||
)
|
)
|
||||||
|
|
||||||
Import-Module "Microsoft.PowerShell.Utility" -ErrorAction Stop
|
|
||||||
|
|
||||||
Write-Host "Beginning deployment" -ForegroundColor Green
|
Write-Host "Beginning deployment" -ForegroundColor Green
|
||||||
|
|
||||||
|
Write-Host "Importing required modules" -ForegroundColor Green
|
||||||
|
Import-Module "Microsoft.PowerShell.Utility" -ErrorAction Stop
|
||||||
$ModuleName = 'NetboxPS'
|
$ModuleName = 'NetboxPS'
|
||||||
$ConcatenatedFilePath = "$PSScriptRoot\concatenated.ps1"
|
$ConcatenatedFilePath = "$PSScriptRoot\concatenated.ps1"
|
||||||
$FunctionPath = "$PSScriptRoot\Functions"
|
$FunctionPath = "$PSScriptRoot\Functions"
|
||||||
|
|
@ -60,17 +64,17 @@ $OutputDirectory = "$PSScriptRoot\$ModuleName"
|
||||||
$PSD1OutputPath = "$OutputDirectory\$ModuleName.psd1"
|
$PSD1OutputPath = "$OutputDirectory\$ModuleName.psd1"
|
||||||
$PSM1OutputPath = "$OutputDirectory\$ModuleName.psm1"
|
$PSM1OutputPath = "$OutputDirectory\$ModuleName.psm1"
|
||||||
|
|
||||||
$PS1Files = Get-ChildItem $FunctionPath -Filter "*.ps1" -Recurse | Sort-Object Name
|
$PS1FunctionFiles = Get-ChildItem $FunctionPath -Filter "*.ps1" -Recurse | Sort-Object Name
|
||||||
|
|
||||||
"" | Out-File -FilePath $ConcatenatedFilePath -Encoding utf8
|
"" | Out-File -FilePath $ConcatenatedFilePath -Encoding utf8
|
||||||
|
|
||||||
$Counter = 0
|
$Counter = 0
|
||||||
Write-Host "Concatenating [$($PS1Files.Count)] PS1 files from $FunctionPath"
|
Write-Host "Concatenating [$($PS1FunctionFiles.Count)] PS1 files from $FunctionPath"
|
||||||
foreach ($File in $PS1Files) {
|
foreach ($File in $PS1FunctionFiles) {
|
||||||
$Counter++
|
$Counter++
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Write-Host (" Adding file {0:D2}/{1:D2}: $($File.Name)" -f $Counter, $PS1Files.Count)
|
Write-Host (" Adding file {0:D2}/{1:D2}: $($File.Name)" -f $Counter, $PS1FunctionFiles.Count)
|
||||||
|
|
||||||
"`r`n#region File $($File.Name)`r`n" | Out-File -FilePath $ConcatenatedFilePath -Encoding utf8 -Append -ErrorAction Stop
|
"`r`n#region File $($File.Name)`r`n" | Out-File -FilePath $ConcatenatedFilePath -Encoding utf8 -Append -ErrorAction Stop
|
||||||
|
|
||||||
|
|
@ -85,15 +89,33 @@ foreach ($File in $PS1Files) {
|
||||||
|
|
||||||
"" | Out-File -FilePath $ConcatenatedFilePath -Encoding utf8 -Append
|
"" | Out-File -FilePath $ConcatenatedFilePath -Encoding utf8 -Append
|
||||||
|
|
||||||
|
if (-not (Test-Path $OutputDirectory)) {
|
||||||
|
try {
|
||||||
|
Write-Warning "Creating path [$OutputDirectory]"
|
||||||
|
$null = New-Item -Path $OutputDirectory -ItemType Directory -Force
|
||||||
|
} catch {
|
||||||
|
throw "Failed to create output directory [$OutputDirectory]: $($_.Exception.Message)"
|
||||||
|
}
|
||||||
|
}
|
||||||
Write-Host " Adding psm1"
|
Write-Host " Adding psm1"
|
||||||
Get-Content "$PSScriptRoot\$ModuleName.psm1" | Out-File -FilePath $ConcatenatedFilePath -Encoding UTF8 -Append
|
Get-Content "$PSScriptRoot\$ModuleName.psm1" | Out-File -FilePath $ConcatenatedFilePath -Encoding UTF8 -Append
|
||||||
|
|
||||||
$PSDManifest = Import-PowerShellDataFile -Path "$PSScriptRoot\$ModuleName.psd1"
|
$PSDManifest = Import-PowerShellDataFile -Path "$PSScriptRoot\$ModuleName.psd1"
|
||||||
# Get the version from the PSD1
|
# Get the version from the PSD1
|
||||||
#[version]$CurrentVersion = [regex]::matches($PSDContent, "\s*ModuleVersion\s=\s'(\d*.\d*.\d*)'\s*").groups[1].value
|
|
||||||
[version]$CurrentVersion = $PSDManifest.ModuleVersion
|
[version]$CurrentVersion = $PSDManifest.ModuleVersion
|
||||||
|
|
||||||
|
$UpdateModuleManifestSplat = @{
|
||||||
|
Path = "$PSScriptRoot\$ModuleName.psd1"
|
||||||
|
ErrorAction = 'Stop'
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Environment -ilike 'dev*') {
|
||||||
|
Write-Host "Exporting all functions for development"
|
||||||
|
$UpdateModuleManifestSplat['FunctionsToExport'] = $PS1FunctionFiles.BaseName
|
||||||
|
} else {
|
||||||
|
$UpdateModuleManifestSplat['FunctionsToExport'] = ($PS1FunctionFiles.BaseName | Where-Object { $_ -like '*-*' })
|
||||||
|
}
|
||||||
|
Write-Host "Comparing versions"
|
||||||
switch ($PSCmdlet.ParameterSetName) {
|
switch ($PSCmdlet.ParameterSetName) {
|
||||||
"SkipVersion" {
|
"SkipVersion" {
|
||||||
# Dont do anything with the PSD
|
# Dont do anything with the PSD
|
||||||
|
|
@ -106,35 +128,26 @@ switch ($PSCmdlet.ParameterSetName) {
|
||||||
# Calculate the new version
|
# Calculate the new version
|
||||||
[version]$NewVersion = "{0}.{1}.{2}" -f ($CurrentVersion.Major + $VersionIncrease.Major), ($CurrentVersion.Minor + $VersionIncrease.Minor), ($CurrentVersion.Build + $VersionIncrease.Build)
|
[version]$NewVersion = "{0}.{1}.{2}" -f ($CurrentVersion.Major + $VersionIncrease.Major), ($CurrentVersion.Minor + $VersionIncrease.Minor), ($CurrentVersion.Build + $VersionIncrease.Build)
|
||||||
|
|
||||||
Write-Host " Updating version in PSD1 from [$CurrentVersion] to [$NewVersion]"
|
Write-Host " Updating version from [$CurrentVersion] to [$NewVersion]"
|
||||||
|
|
||||||
# Replace the version number in the content
|
# Replace the version number in the content
|
||||||
#$PSDContent -replace $CurrentVersion, $NewVersion | Out-File $PSScriptRoot\$ModuleName.psd1 -Encoding UTF8
|
$UpdateModuleManifestSplat['ModuleVersion'] = $NewVersion
|
||||||
Update-ModuleManifest -Path "$PSScriptRoot\$ModuleName.psd1" -ModuleVersion $NewVersion
|
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
"SetVersion" {
|
"SetVersion" {
|
||||||
Write-Host " Updating version in PSD1 from [$CurrentVersion] to [$NewVersion]"
|
Write-Host " Updating version from [$CurrentVersion] to [$NewVersion]"
|
||||||
|
|
||||||
# Replace the version number in the content
|
# Replace the version number in the content
|
||||||
#$PSDContent -replace $CurrentVersion, $NewVersion | Out-File $PSScriptRoot\$ModuleName.psd1 -Encoding UTF8
|
$UpdateModuleManifestSplat['ModuleVersion'] = $NewVersion
|
||||||
Update-ModuleManifest -Path "$PSScriptRoot\$ModuleName.psd1" -ModuleVersion $NewVersion
|
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Write-Host "Updating Module Manifest"
|
||||||
if (-not (Test-Path $OutputDirectory)) {
|
Update-ModuleManifest @UpdateModuleManifestSplat
|
||||||
try {
|
|
||||||
Write-Warning "Creating path [$OutputDirectory]"
|
|
||||||
$null = New-Item -Path $OutputDirectory -ItemType Directory -Force
|
|
||||||
} catch {
|
|
||||||
throw "Failed to create directory [$OutputDirectory]: $($_.Exception.Message)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host " Copying psd1"
|
Write-Host " Copying psd1"
|
||||||
Copy-Item -Path "$PSScriptRoot\$ModuleName.psd1" -Destination $PSD1OutputPath -Force
|
Copy-Item -Path "$PSScriptRoot\$ModuleName.psd1" -Destination $PSD1OutputPath -Force
|
||||||
|
|
@ -143,3 +156,14 @@ Write-Host " Copying psm1"
|
||||||
Copy-Item -Path $ConcatenatedFilePath -Destination $PSM1OutputPath -Force
|
Copy-Item -Path $ConcatenatedFilePath -Destination $PSM1OutputPath -Force
|
||||||
|
|
||||||
Write-Host "Deployment complete" -ForegroundColor Green
|
Write-Host "Deployment complete" -ForegroundColor Green
|
||||||
|
if ($ResetCurrentEnvironment) {
|
||||||
|
Write-Warning "Running commands to reset current environment"
|
||||||
|
if (Get-Module 'NetboxPS') {
|
||||||
|
Remove-Module NetboxPS -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host " Reimporting module"
|
||||||
|
Import-Module $PSM1OutputPath, $PSD1OutputPath -Force -ErrorAction Stop
|
||||||
|
|
||||||
|
Write-Host "Reset complete" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue