Increment version to 1.7.0

This commit is contained in:
Ben Claussen 2023-02-24 11:51:04 -05:00
parent 44dc6c86a2
commit 010fb0410b
3 changed files with 305 additions and 96 deletions

View file

@ -3,7 +3,7 @@
#
# Generated by: Ben Claussen
#
# Generated on: 2023-02-16
# Generated on: 2023-02-24
#
@{
@ -12,7 +12,7 @@
RootModule = 'NetboxPS.psm1'
# Version number of this module.
ModuleVersion = '1.6.0'
ModuleVersion = '1.7.0'
# Supported PSEditions
# CompatiblePSEditions = @()
@ -70,13 +70,10 @@ NestedModules = @()
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Add-NetboxDCIMInterface', 'Add-NetboxDCIMInterfaceConnection',
'Add-NetboxVirtualMachineInterface', 'BuildNewURI',
'BuildURIComponents', 'CheckNetboxIsConnected',
'Clear-NetboxCredential', 'Connect-NetboxAPI', 'CreateEnum',
'Get-ModelDefinition', 'Get-NetboxAPIDefinition',
'GetNetboxAPIErrorBody', 'Get-NetboxCircuit',
'Get-NetboxCircuitProvider', 'Get-NetboxCircuitTermination',
'Get-NetboxCircuitType', 'GetNetboxConfigVariable',
'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',
@ -90,23 +87,22 @@ FunctionsToExport = 'Add-NetboxDCIMInterface', 'Add-NetboxDCIMInterfaceConnectio
'Get-NetboxTenant', 'Get-NetboxTimeout', 'Get-NetboxVersion',
'Get-NetboxVirtualizationCluster',
'Get-NetboxVirtualizationClusterGroup', 'Get-NetboxVirtualMachine',
'Get-NetboxVirtualMachineInterface',
'Initialize-NetboxContentTypeEnum', 'InvokeNetboxRequest',
'New-NetboxCircuit', 'New-NetboxContact', 'New-NetboxContactRole',
'New-NetboxDCIMDevice', 'New-NetboxDCIMSite', 'New-NetboxIPAMAddress',
'New-NetboxIPAMPrefix', 'New-NetboxIPAMVLAN', 'New-NetboxTenant',
'New-NetboxVirtualMachine', 'Remove-NetboxDCIMDevice',
'Remove-NetboxDCIMInterface',
'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-NetboxCredential', 'Set-NetboxDCIMDevice',
'Set-NetboxDCIMInterface', 'Set-NetboxDCIMInterfaceConnection',
'Set-NetboxHostName', 'Set-NetboxHostPort', 'Set-NetboxHostScheme',
'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', 'SetupNetboxConfigVariable',
'VerifyAPIConnectivity'
'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.
CmdletsToExport = '*'

View file

@ -3,7 +3,7 @@
#
# Generated by: Ben Claussen
#
# Generated on: 2023-02-16
# Generated on: 2023-02-24
#
@{
@ -12,7 +12,7 @@
RootModule = 'NetboxPS.psm1'
# Version number of this module.
ModuleVersion = '1.6.0'
ModuleVersion = '1.7.0'
# Supported PSEditions
# CompatiblePSEditions = @()
@ -70,13 +70,10 @@ NestedModules = @()
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Add-NetboxDCIMInterface', 'Add-NetboxDCIMInterfaceConnection',
'Add-NetboxVirtualMachineInterface', 'BuildNewURI',
'BuildURIComponents', 'CheckNetboxIsConnected',
'Clear-NetboxCredential', 'Connect-NetboxAPI', 'CreateEnum',
'Get-ModelDefinition', 'Get-NetboxAPIDefinition',
'GetNetboxAPIErrorBody', 'Get-NetboxCircuit',
'Get-NetboxCircuitProvider', 'Get-NetboxCircuitTermination',
'Get-NetboxCircuitType', 'GetNetboxConfigVariable',
'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',
@ -90,23 +87,22 @@ FunctionsToExport = 'Add-NetboxDCIMInterface', 'Add-NetboxDCIMInterfaceConnectio
'Get-NetboxTenant', 'Get-NetboxTimeout', 'Get-NetboxVersion',
'Get-NetboxVirtualizationCluster',
'Get-NetboxVirtualizationClusterGroup', 'Get-NetboxVirtualMachine',
'Get-NetboxVirtualMachineInterface',
'Initialize-NetboxContentTypeEnum', 'InvokeNetboxRequest',
'New-NetboxCircuit', 'New-NetboxContact', 'New-NetboxContactRole',
'New-NetboxDCIMDevice', 'New-NetboxDCIMSite', 'New-NetboxIPAMAddress',
'New-NetboxIPAMPrefix', 'New-NetboxIPAMVLAN', 'New-NetboxTenant',
'New-NetboxVirtualMachine', 'Remove-NetboxDCIMDevice',
'Remove-NetboxDCIMInterface',
'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-NetboxCredential', 'Set-NetboxDCIMDevice',
'Set-NetboxDCIMInterface', 'Set-NetboxDCIMInterfaceConnection',
'Set-NetboxHostName', 'Set-NetboxHostPort', 'Set-NetboxHostScheme',
'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', 'SetupNetboxConfigVariable',
'VerifyAPIConnectivity'
'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.
CmdletsToExport = '*'

View file

@ -517,6 +517,8 @@ function Connect-NetboxAPI {
Write-Verbose "Found compatible version [$($script:NetboxConfig.NetboxVersion.'netbox-version')]!"
}
$script:NetboxConfig.ContentTypes = Get-NetboxContentType -Limit 500
$script:NetboxConfig.Connected = $true
Write-Verbose "Successfully connected!"
@ -2475,7 +2477,7 @@ function Get-NetboxIPAMRole {
function Get-NetboxIPAMVLAN {
[CmdletBinding()]
[CmdletBinding(DefaultParameterSetName = 'Query')]
param
(
[Parameter(ParameterSetName = 'Query',
@ -2537,10 +2539,6 @@ function Get-NetboxIPAMVLAN {
[switch]$Raw
)
# if ($null -ne $Status) {
# $PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -VLANStatus
# }
switch ($PSCmdlet.ParameterSetName) {
'ById' {
foreach ($VLAN_ID in $Id) {
@ -3091,26 +3089,6 @@ function Get-NetboxVirtualMachineInterface {
}
}
#endregion
#region File Initialize-NetboxContentTypeEnum.ps1
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2022 v5.8.212
Created on: 2023-02-15 16:47
Created by: Claussen
Organization: NEOnet
Filename: Initialize-NetboxContentTypeEnum.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
#endregion
#region File InvokeNetboxRequest.ps1
@ -3374,6 +3352,119 @@ function New-NetboxContact {
#endregion
#region File New-NetboxContactAssignment.ps1
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
}
}
}
#endregion
#region File New-NetboxContactRole.ps1
@ -4386,6 +4477,131 @@ Function Set-NetboxCipherSSL {
}
#endregion
#region File Set-NetboxContact.ps1
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
}
}
}
}
#endregion
#region File Set-NetboxCredential.ps1
@ -5131,6 +5347,7 @@ function SetupNetboxConfigVariable {
'Choices' = @{
}
'APIDefinition' = $null
'ContentTypes' = $null
}
}