mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 01:42:28 +00:00
Increment version to 1.5.0
This commit is contained in:
parent
c11680a20e
commit
30ae377493
3 changed files with 185 additions and 216 deletions
|
|
@ -12,7 +12,7 @@
|
|||
RootModule = 'NetboxPS.psm1'
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '1.4.1'
|
||||
ModuleVersion = '1.5.0'
|
||||
|
||||
# Supported PSEditions
|
||||
# CompatiblePSEditions = @()
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
RootModule = 'NetboxPS.psm1'
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '1.4.1'
|
||||
ModuleVersion = '1.5.0'
|
||||
|
||||
# Supported PSEditions
|
||||
# CompatiblePSEditions = @()
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ function Add-NetboxDCIMInterface {
|
|||
|
||||
|
||||
function Add-NetboxDCIMInterfaceConnection {
|
||||
<#
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Create a new connection between two interfaces
|
||||
|
||||
|
|
@ -147,8 +147,8 @@ function Add-NetboxDCIMInterfaceConnection {
|
|||
}
|
||||
|
||||
# Verify if both Interfaces exist
|
||||
$I_A = Get-NetboxDCIMInterface -Id $Interface_A -ErrorAction Stop
|
||||
$I_B = Get-NetboxDCIMInterface -Id $Interface_B -ErrorAction Stop
|
||||
Get-NetboxDCIMInterface -Id $Interface_A -ErrorAction Stop | Out-null
|
||||
Get-NetboxDCIMInterface -Id $Interface_B -ErrorAction Stop | Out-null
|
||||
|
||||
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'interface-connections'))
|
||||
|
||||
|
|
@ -428,25 +428,6 @@ function CheckNetboxIsConnected {
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region File Circuits.ps1
|
||||
|
||||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2018 v5.5.148
|
||||
Created on: 2/28/2018 4:06 PM
|
||||
Created by: Ben Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Circuits.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
Circuit object functions
|
||||
#>
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region File Clear-NetboxCredential.ps1
|
||||
|
|
@ -829,7 +810,7 @@ function GetNetboxAPIErrorBody {
|
|||
|
||||
|
||||
function Get-NetboxCircuit {
|
||||
<#
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets one or more circuits
|
||||
|
||||
|
|
@ -921,6 +902,7 @@ function Get-NetboxCircuit {
|
|||
[switch]$Raw
|
||||
)
|
||||
|
||||
process {
|
||||
switch ($PSCmdlet.ParameterSetName) {
|
||||
'ById' {
|
||||
foreach ($i in $ID) {
|
||||
|
|
@ -944,6 +926,7 @@ function Get-NetboxCircuit {
|
|||
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -1291,6 +1274,7 @@ function Get-NetboxDCIMDevice {
|
|||
|
||||
#endregion Parameters
|
||||
|
||||
process {
|
||||
if ($null -ne $Status) {
|
||||
$PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
|
||||
}
|
||||
|
|
@ -1302,6 +1286,7 @@ function Get-NetboxDCIMDevice {
|
|||
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||
|
||||
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -1490,6 +1475,7 @@ function Get-NetboxDCIMInterface {
|
|||
[switch]$Raw
|
||||
)
|
||||
|
||||
process {
|
||||
if ($null -ne $Form_Factor) {
|
||||
$PSBoundParameters.Form_Factor = ValidateDCIMChoice -ProvidedValue $Form_Factor -InterfaceFormFactor
|
||||
}
|
||||
|
|
@ -1501,6 +1487,7 @@ function Get-NetboxDCIMInterface {
|
|||
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||
|
||||
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -1709,6 +1696,7 @@ function Get-NetboxDCIMSite {
|
|||
[switch]$Raw
|
||||
)
|
||||
|
||||
process {
|
||||
switch ($PSCmdlet.ParameterSetName) {
|
||||
'ById' {
|
||||
foreach ($Site_ID in $ID) {
|
||||
|
|
@ -1732,6 +1720,7 @@ function Get-NetboxDCIMSite {
|
|||
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2826,7 +2815,7 @@ function Get-NetboxVirtualizationClusterGroup {
|
|||
|
||||
|
||||
function Get-NetboxVirtualMachine {
|
||||
<#
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Obtains virtual machines from Netbox.
|
||||
|
||||
|
|
@ -2954,6 +2943,7 @@ function Get-NetboxVirtualMachine {
|
|||
[switch]$Raw
|
||||
)
|
||||
|
||||
process {
|
||||
if ($null -ne $Status) {
|
||||
$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
||||
}
|
||||
|
|
@ -2965,6 +2955,7 @@ function Get-NetboxVirtualMachine {
|
|||
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||
|
||||
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -2986,7 +2977,7 @@ function Get-NetboxVirtualMachine {
|
|||
|
||||
|
||||
function Get-NetboxVirtualMachineInterface {
|
||||
<#
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets VM interfaces
|
||||
|
||||
|
|
@ -3057,6 +3048,7 @@ function Get-NetboxVirtualMachineInterface {
|
|||
[switch]$Raw
|
||||
)
|
||||
|
||||
process {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'interfaces'))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
||||
|
|
@ -3064,6 +3056,7 @@ function Get-NetboxVirtualMachineInterface {
|
|||
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||
|
||||
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -3238,6 +3231,7 @@ function New-NetboxCircuit {
|
|||
[switch]$Raw
|
||||
)
|
||||
|
||||
process {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('circuits', 'circuits'))
|
||||
$Method = 'POST'
|
||||
|
||||
|
|
@ -3248,6 +3242,7 @@ function New-NetboxCircuit {
|
|||
if ($Force -or $PSCmdlet.ShouldProcess($CID, 'Create new circuit')) {
|
||||
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -3269,7 +3264,8 @@ function New-NetboxCircuit {
|
|||
|
||||
|
||||
function New-NetboxDCIMDevice {
|
||||
[CmdletBinding()]
|
||||
[CmdletBinding(ConfirmImpact = 'low',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([pscustomobject])]
|
||||
#region Parameters
|
||||
param
|
||||
|
|
@ -3320,21 +3316,21 @@ function New-NetboxDCIMDevice {
|
|||
)
|
||||
#endregion Parameters
|
||||
|
||||
# if ($null -ne $Device_Role) {
|
||||
# # Validate device role?
|
||||
# }
|
||||
# if ($null -ne $Device_Role) {
|
||||
# # Validate device role?
|
||||
# }
|
||||
|
||||
# if ($null -ne $Device_Type) {
|
||||
# # Validate device type?
|
||||
# }
|
||||
# if ($null -ne $Device_Type) {
|
||||
# # Validate device type?
|
||||
# }
|
||||
|
||||
# if ($null -ne $Status) {
|
||||
# $PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
|
||||
# }
|
||||
# if ($null -ne $Status) {
|
||||
# $PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
|
||||
# }
|
||||
|
||||
# if ($null -ne $Face) {
|
||||
# $PSBoundParameters.Face = ValidateDCIMChoice -ProvidedValue $Face -DeviceFace
|
||||
# }
|
||||
# if ($null -ne $Face) {
|
||||
# $PSBoundParameters.Face = ValidateDCIMChoice -ProvidedValue $Face -DeviceFace
|
||||
# }
|
||||
|
||||
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'devices'))
|
||||
|
||||
|
|
@ -3342,7 +3338,9 @@ function New-NetboxDCIMDevice {
|
|||
|
||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($Name, 'Create new Device')) {
|
||||
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method POST
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -3401,14 +3399,19 @@ function New-NetboxIPAMAddress {
|
|||
.PARAMETER Dns_name
|
||||
DNS Name of IP address (example : netbox.example.com)
|
||||
|
||||
.PARAMETER Force
|
||||
Do not prompt for confirmation to create IP.
|
||||
.PARAMETER Assigned_Object_Type
|
||||
Assigned Object Type dcim.interface or virtualization.vminterface
|
||||
|
||||
.PARAMETER Assigned_Object_Id
|
||||
Assigned Object ID
|
||||
|
||||
.PARAMETER Raw
|
||||
Return raw results from API service
|
||||
|
||||
.EXAMPLE
|
||||
PS C:\> Create-NetboxIPAMAddress
|
||||
New-NetboxIPAMAddress -Address 192.0.2.1/32
|
||||
|
||||
Add new IP Address 192.0.2.1/32 with status active
|
||||
|
||||
.NOTES
|
||||
Additional information about the function.
|
||||
|
|
@ -3441,7 +3444,10 @@ function New-NetboxIPAMAddress {
|
|||
|
||||
[string]$Dns_name,
|
||||
|
||||
[switch]$Force,
|
||||
[ValidateSet('dcim.interface', 'virtualization.vminterface', IgnoreCase = $true)]
|
||||
[string]$Assigned_Object_Type,
|
||||
|
||||
[int]$Assigned_Object_Id,
|
||||
|
||||
[switch]$Raw
|
||||
)
|
||||
|
|
@ -3450,22 +3456,11 @@ function New-NetboxIPAMAddress {
|
|||
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-addresses'))
|
||||
$Method = 'POST'
|
||||
|
||||
# # Value validation
|
||||
# $ModelDefinition = GetModelDefinitionFromURIPath -Segments $Segments -Method $Method
|
||||
# $EnumProperties = GetModelEnumProperties -ModelDefinition $ModelDefinition
|
||||
#
|
||||
# foreach ($Property in $EnumProperties.Keys) {
|
||||
# if ($PSBoundParameters.ContainsKey($Property)) {
|
||||
# Write-Verbose "Validating property [$Property] with value [$($PSBoundParameters.$Property)]"
|
||||
# $PSBoundParameters.$Property = ValidateValue -ModelDefinition $ModelDefinition -Property $Property -ProvidedValue $PSBoundParameters.$Property
|
||||
# }
|
||||
# }
|
||||
#
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
||||
|
||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||
|
||||
if ($Force -or $PSCmdlet.ShouldProcess($Address, 'Create new IP address')) {
|
||||
if ($PSCmdlet.ShouldProcess($Address, 'Create new IP address')) {
|
||||
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
||||
}
|
||||
}
|
||||
|
|
@ -3495,6 +3490,8 @@ function New-NetboxIPAMAddress {
|
|||
|
||||
|
||||
function New-NetboxIPAMPrefix {
|
||||
[CmdletBinding(ConfirmImpact = 'low',
|
||||
SupportsShouldProcess = $true)]
|
||||
[CmdletBinding()]
|
||||
param
|
||||
(
|
||||
|
|
@ -3522,7 +3519,7 @@ function New-NetboxIPAMPrefix {
|
|||
[switch]$Raw
|
||||
)
|
||||
|
||||
# $PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -PrefixStatus
|
||||
# $PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -PrefixStatus
|
||||
|
||||
<#
|
||||
# As of 2018/10/18, this does not appear to be a validated IPAM choice
|
||||
|
|
@ -3537,7 +3534,9 @@ function New-NetboxIPAMPrefix {
|
|||
|
||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($Prefix, 'Create new Prefix')) {
|
||||
InvokeNetboxRequest -URI $URI -Method POST -Body $URIComponents.Parameters -Raw:$Raw
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -3545,7 +3544,7 @@ function New-NetboxIPAMPrefix {
|
|||
#region File New-NetboxIPAMVLAN.ps1
|
||||
|
||||
function New-NetboxIPAMVLAN {
|
||||
<#
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Create a new VLAN
|
||||
|
||||
|
|
@ -3586,7 +3585,8 @@ function New-NetboxIPAMVLAN {
|
|||
Additional information about the function.
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
[CmdletBinding(ConfirmImpact = 'low',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
|
|
@ -3609,11 +3609,11 @@ function New-NetboxIPAMVLAN {
|
|||
[switch]$Raw
|
||||
)
|
||||
|
||||
# $PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -VLANStatus
|
||||
# $PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -VLANStatus
|
||||
|
||||
# if ($null -ne $Role) {
|
||||
# $PSBoundParameters.Role = ValidateIPAMChoice -ProvidedValue $Role -IPAddressRole
|
||||
# }
|
||||
# if ($null -ne $Role) {
|
||||
# $PSBoundParameters.Role = ValidateIPAMChoice -ProvidedValue $Role -IPAddressRole
|
||||
# }
|
||||
|
||||
$segments = [System.Collections.ArrayList]::new(@('ipam', 'vlans'))
|
||||
|
||||
|
|
@ -3621,7 +3621,9 @@ function New-NetboxIPAMVLAN {
|
|||
|
||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($nae, 'Create new Vlan $($vid)')) {
|
||||
InvokeNetboxRequest -URI $URI -Method POST -Body $URIComponents.Parameters -Raw:$Raw
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -3643,7 +3645,8 @@ function New-NetboxIPAMVLAN {
|
|||
|
||||
|
||||
function New-NetboxVirtualMachine {
|
||||
[CmdletBinding()]
|
||||
[CmdletBinding(ConfirmImpact = 'low',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
|
|
@ -3676,12 +3679,12 @@ function New-NetboxVirtualMachine {
|
|||
[string]$Comments
|
||||
)
|
||||
|
||||
# $ModelDefinition = $script:NetboxConfig.APIDefinition.definitions.WritableVirtualMachineWithConfigContext
|
||||
# $ModelDefinition = $script:NetboxConfig.APIDefinition.definitions.WritableVirtualMachineWithConfigContext
|
||||
|
||||
# # Validate the status against the APIDefinition
|
||||
# if ($ModelDefinition.properties.status.enum -inotcontains $Status) {
|
||||
# throw ("Invalid value [] for Status. Must be one of []" -f $Status, ($ModelDefinition.properties.status.enum -join ', '))
|
||||
# }
|
||||
# # Validate the status against the APIDefinition
|
||||
# if ($ModelDefinition.properties.status.enum -inotcontains $Status) {
|
||||
# throw ("Invalid value [] for Status. Must be one of []" -f $Status, ($ModelDefinition.properties.status.enum -join ', '))
|
||||
# }
|
||||
|
||||
#$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
||||
|
||||
|
|
@ -3691,7 +3694,9 @@ function New-NetboxVirtualMachine {
|
|||
|
||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($name, 'Create new Virtual Machine')) {
|
||||
InvokeNetboxRequest -URI $URI -Method POST -Body $URIComponents.Parameters
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -4206,7 +4211,8 @@ function Set-NetboxDCIMDevice {
|
|||
|
||||
|
||||
function Set-NetboxDCIMInterface {
|
||||
[CmdletBinding()]
|
||||
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
|
|
@ -4243,9 +4249,9 @@ function Set-NetboxDCIMInterface {
|
|||
)
|
||||
|
||||
begin {
|
||||
# if ($null -ne $Form_Factor) {
|
||||
# $PSBoundParameters.Form_Factor = ValidateDCIMChoice -ProvidedValue $Form_Factor -InterfaceFormFactor
|
||||
# }
|
||||
# if ($null -ne $Form_Factor) {
|
||||
# $PSBoundParameters.Form_Factor = ValidateDCIMChoice -ProvidedValue $Form_Factor -InterfaceFormFactor
|
||||
# }
|
||||
|
||||
if (-not [System.String]::IsNullOrWhiteSpace($Mode)) {
|
||||
$PSBoundParameters.Mode = switch ($Mode) {
|
||||
|
|
@ -4281,9 +4287,11 @@ function Set-NetboxDCIMInterface {
|
|||
|
||||
$URI = BuildNewURI -Segments $Segments
|
||||
|
||||
if ($Force -or $pscmdlet.ShouldProcess("Interface ID $($CurrentInterface.Id)", "Set")) {
|
||||
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end {
|
||||
|
||||
|
|
@ -4771,10 +4779,11 @@ function Set-NetboxVirtualMachine {
|
|||
[switch]$Force
|
||||
)
|
||||
|
||||
# if ($null -ne $Status) {
|
||||
# $PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
||||
# }
|
||||
# if ($null -ne $Status) {
|
||||
# $PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
||||
# }
|
||||
|
||||
process {
|
||||
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines', $Id))
|
||||
|
||||
Write-Verbose "Obtaining VM from ID $Id"
|
||||
|
|
@ -4790,6 +4799,7 @@ function Set-NetboxVirtualMachine {
|
|||
|
||||
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -4889,47 +4899,6 @@ function SetupNetboxConfigVariable {
|
|||
|
||||
#endregion
|
||||
|
||||
#region File Tenancy.ps1
|
||||
|
||||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2018 v5.5.152
|
||||
Created on: 5/29/2018 1:45 PM
|
||||
Created by: Ben Claussen
|
||||
Organization: NEOnet
|
||||
Filename: Tenancy.ps1
|
||||
===========================================================================
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
#>
|
||||
|
||||
|
||||
|
||||
|
||||
#region GET commands
|
||||
|
||||
|
||||
|
||||
#endregion GET commands
|
||||
|
||||
|
||||
#region SET commands
|
||||
|
||||
#endregion SET commands
|
||||
|
||||
|
||||
#region ADD/NEW commands
|
||||
|
||||
#endregion ADD/NEW commands
|
||||
|
||||
|
||||
#region REMOVE commands
|
||||
|
||||
#endregion REMOVE commands
|
||||
|
||||
#endregion
|
||||
|
||||
#region File ThrowNetboxRESTError.ps1
|
||||
|
||||
<#
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue