mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 01:42:28 +00:00
Increment version to 1.7.0
This commit is contained in:
parent
44dc6c86a2
commit
010fb0410b
3 changed files with 305 additions and 96 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
# Generated by: Ben Claussen
|
# Generated by: Ben Claussen
|
||||||
#
|
#
|
||||||
# Generated on: 2023-02-16
|
# 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.6.0'
|
ModuleVersion = '1.7.0'
|
||||||
|
|
||||||
# Supported PSEditions
|
# Supported PSEditions
|
||||||
# CompatiblePSEditions = @()
|
# 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.
|
# 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',
|
FunctionsToExport = 'Add-NetboxDCIMInterface', 'Add-NetboxDCIMInterfaceConnection',
|
||||||
'Add-NetboxVirtualMachineInterface', 'BuildNewURI',
|
'Add-NetboxVirtualMachineInterface', 'Clear-NetboxCredential',
|
||||||
'BuildURIComponents', 'CheckNetboxIsConnected',
|
'Connect-NetboxAPI', 'Get-ModelDefinition', 'Get-NetboxAPIDefinition',
|
||||||
'Clear-NetboxCredential', 'Connect-NetboxAPI', 'CreateEnum',
|
'Get-NetboxCircuit', 'Get-NetboxCircuitProvider',
|
||||||
'Get-ModelDefinition', 'Get-NetboxAPIDefinition',
|
'Get-NetboxCircuitTermination', 'Get-NetboxCircuitType',
|
||||||
'GetNetboxAPIErrorBody', 'Get-NetboxCircuit',
|
|
||||||
'Get-NetboxCircuitProvider', 'Get-NetboxCircuitTermination',
|
|
||||||
'Get-NetboxCircuitType', 'GetNetboxConfigVariable',
|
|
||||||
'Get-NetboxContact', 'Get-NetboxContactAssignment',
|
'Get-NetboxContact', 'Get-NetboxContactAssignment',
|
||||||
'Get-NetboxContactRole', 'Get-NetboxContentType',
|
'Get-NetboxContactRole', 'Get-NetboxContentType',
|
||||||
'Get-NetboxCredential', 'Get-NetboxDCIMDevice',
|
'Get-NetboxCredential', 'Get-NetboxDCIMDevice',
|
||||||
|
|
@ -90,23 +87,22 @@ FunctionsToExport = 'Add-NetboxDCIMInterface', 'Add-NetboxDCIMInterfaceConnectio
|
||||||
'Get-NetboxTenant', 'Get-NetboxTimeout', 'Get-NetboxVersion',
|
'Get-NetboxTenant', 'Get-NetboxTimeout', 'Get-NetboxVersion',
|
||||||
'Get-NetboxVirtualizationCluster',
|
'Get-NetboxVirtualizationCluster',
|
||||||
'Get-NetboxVirtualizationClusterGroup', 'Get-NetboxVirtualMachine',
|
'Get-NetboxVirtualizationClusterGroup', 'Get-NetboxVirtualMachine',
|
||||||
'Get-NetboxVirtualMachineInterface',
|
'Get-NetboxVirtualMachineInterface', 'New-NetboxCircuit',
|
||||||
'Initialize-NetboxContentTypeEnum', 'InvokeNetboxRequest',
|
'New-NetboxContact', 'New-NetboxContactAssignment',
|
||||||
'New-NetboxCircuit', 'New-NetboxContact', 'New-NetboxContactRole',
|
'New-NetboxContactRole', 'New-NetboxDCIMDevice', 'New-NetboxDCIMSite',
|
||||||
'New-NetboxDCIMDevice', 'New-NetboxDCIMSite', 'New-NetboxIPAMAddress',
|
'New-NetboxIPAMAddress', 'New-NetboxIPAMPrefix', 'New-NetboxIPAMVLAN',
|
||||||
'New-NetboxIPAMPrefix', 'New-NetboxIPAMVLAN', 'New-NetboxTenant',
|
'New-NetboxTenant', 'New-NetboxVirtualMachine',
|
||||||
'New-NetboxVirtualMachine', 'Remove-NetboxDCIMDevice',
|
'Remove-NetboxDCIMDevice', 'Remove-NetboxDCIMInterface',
|
||||||
'Remove-NetboxDCIMInterface',
|
|
||||||
'Remove-NetboxDCIMInterfaceConnection', 'Remove-NetboxDCIMSite',
|
'Remove-NetboxDCIMInterfaceConnection', 'Remove-NetboxDCIMSite',
|
||||||
'Remove-NetboxIPAMAddress', 'Remove-NetboxVirtualMachine',
|
'Remove-NetboxIPAMAddress', 'Remove-NetboxVirtualMachine',
|
||||||
'Set-NetboxCipherSSL', 'Set-NetboxCredential', 'Set-NetboxDCIMDevice',
|
'Set-NetboxCipherSSL', 'Set-NetboxContact', 'Set-NetboxCredential',
|
||||||
'Set-NetboxDCIMInterface', 'Set-NetboxDCIMInterfaceConnection',
|
'Set-NetboxDCIMDevice', 'Set-NetboxDCIMInterface',
|
||||||
'Set-NetboxHostName', 'Set-NetboxHostPort', 'Set-NetboxHostScheme',
|
'Set-NetboxDCIMInterfaceConnection', 'Set-NetboxHostName',
|
||||||
|
'Set-NetboxHostPort', 'Set-NetboxHostScheme',
|
||||||
'Set-NetboxInvokeParams', 'Set-NetboxIPAMAddress',
|
'Set-NetboxInvokeParams', 'Set-NetboxIPAMAddress',
|
||||||
'Set-NetboxIPAMPrefix', 'Set-NetboxTimeout',
|
'Set-NetboxIPAMPrefix', 'Set-NetboxTimeout',
|
||||||
'Set-NetboxUnstrustedSSL', 'Set-NetboxVirtualMachine',
|
'Set-NetboxUnstrustedSSL', 'Set-NetboxVirtualMachine',
|
||||||
'Set-NetboxVirtualMachineInterface', 'SetupNetboxConfigVariable',
|
'Set-NetboxVirtualMachineInterface'
|
||||||
'VerifyAPIConnectivity'
|
|
||||||
|
|
||||||
# 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 = '*'
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
# Generated by: Ben Claussen
|
# Generated by: Ben Claussen
|
||||||
#
|
#
|
||||||
# Generated on: 2023-02-16
|
# 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.6.0'
|
ModuleVersion = '1.7.0'
|
||||||
|
|
||||||
# Supported PSEditions
|
# Supported PSEditions
|
||||||
# CompatiblePSEditions = @()
|
# 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.
|
# 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',
|
FunctionsToExport = 'Add-NetboxDCIMInterface', 'Add-NetboxDCIMInterfaceConnection',
|
||||||
'Add-NetboxVirtualMachineInterface', 'BuildNewURI',
|
'Add-NetboxVirtualMachineInterface', 'Clear-NetboxCredential',
|
||||||
'BuildURIComponents', 'CheckNetboxIsConnected',
|
'Connect-NetboxAPI', 'Get-ModelDefinition', 'Get-NetboxAPIDefinition',
|
||||||
'Clear-NetboxCredential', 'Connect-NetboxAPI', 'CreateEnum',
|
'Get-NetboxCircuit', 'Get-NetboxCircuitProvider',
|
||||||
'Get-ModelDefinition', 'Get-NetboxAPIDefinition',
|
'Get-NetboxCircuitTermination', 'Get-NetboxCircuitType',
|
||||||
'GetNetboxAPIErrorBody', 'Get-NetboxCircuit',
|
|
||||||
'Get-NetboxCircuitProvider', 'Get-NetboxCircuitTermination',
|
|
||||||
'Get-NetboxCircuitType', 'GetNetboxConfigVariable',
|
|
||||||
'Get-NetboxContact', 'Get-NetboxContactAssignment',
|
'Get-NetboxContact', 'Get-NetboxContactAssignment',
|
||||||
'Get-NetboxContactRole', 'Get-NetboxContentType',
|
'Get-NetboxContactRole', 'Get-NetboxContentType',
|
||||||
'Get-NetboxCredential', 'Get-NetboxDCIMDevice',
|
'Get-NetboxCredential', 'Get-NetboxDCIMDevice',
|
||||||
|
|
@ -90,23 +87,22 @@ FunctionsToExport = 'Add-NetboxDCIMInterface', 'Add-NetboxDCIMInterfaceConnectio
|
||||||
'Get-NetboxTenant', 'Get-NetboxTimeout', 'Get-NetboxVersion',
|
'Get-NetboxTenant', 'Get-NetboxTimeout', 'Get-NetboxVersion',
|
||||||
'Get-NetboxVirtualizationCluster',
|
'Get-NetboxVirtualizationCluster',
|
||||||
'Get-NetboxVirtualizationClusterGroup', 'Get-NetboxVirtualMachine',
|
'Get-NetboxVirtualizationClusterGroup', 'Get-NetboxVirtualMachine',
|
||||||
'Get-NetboxVirtualMachineInterface',
|
'Get-NetboxVirtualMachineInterface', 'New-NetboxCircuit',
|
||||||
'Initialize-NetboxContentTypeEnum', 'InvokeNetboxRequest',
|
'New-NetboxContact', 'New-NetboxContactAssignment',
|
||||||
'New-NetboxCircuit', 'New-NetboxContact', 'New-NetboxContactRole',
|
'New-NetboxContactRole', 'New-NetboxDCIMDevice', 'New-NetboxDCIMSite',
|
||||||
'New-NetboxDCIMDevice', 'New-NetboxDCIMSite', 'New-NetboxIPAMAddress',
|
'New-NetboxIPAMAddress', 'New-NetboxIPAMPrefix', 'New-NetboxIPAMVLAN',
|
||||||
'New-NetboxIPAMPrefix', 'New-NetboxIPAMVLAN', 'New-NetboxTenant',
|
'New-NetboxTenant', 'New-NetboxVirtualMachine',
|
||||||
'New-NetboxVirtualMachine', 'Remove-NetboxDCIMDevice',
|
'Remove-NetboxDCIMDevice', 'Remove-NetboxDCIMInterface',
|
||||||
'Remove-NetboxDCIMInterface',
|
|
||||||
'Remove-NetboxDCIMInterfaceConnection', 'Remove-NetboxDCIMSite',
|
'Remove-NetboxDCIMInterfaceConnection', 'Remove-NetboxDCIMSite',
|
||||||
'Remove-NetboxIPAMAddress', 'Remove-NetboxVirtualMachine',
|
'Remove-NetboxIPAMAddress', 'Remove-NetboxVirtualMachine',
|
||||||
'Set-NetboxCipherSSL', 'Set-NetboxCredential', 'Set-NetboxDCIMDevice',
|
'Set-NetboxCipherSSL', 'Set-NetboxContact', 'Set-NetboxCredential',
|
||||||
'Set-NetboxDCIMInterface', 'Set-NetboxDCIMInterfaceConnection',
|
'Set-NetboxDCIMDevice', 'Set-NetboxDCIMInterface',
|
||||||
'Set-NetboxHostName', 'Set-NetboxHostPort', 'Set-NetboxHostScheme',
|
'Set-NetboxDCIMInterfaceConnection', 'Set-NetboxHostName',
|
||||||
|
'Set-NetboxHostPort', 'Set-NetboxHostScheme',
|
||||||
'Set-NetboxInvokeParams', 'Set-NetboxIPAMAddress',
|
'Set-NetboxInvokeParams', 'Set-NetboxIPAMAddress',
|
||||||
'Set-NetboxIPAMPrefix', 'Set-NetboxTimeout',
|
'Set-NetboxIPAMPrefix', 'Set-NetboxTimeout',
|
||||||
'Set-NetboxUnstrustedSSL', 'Set-NetboxVirtualMachine',
|
'Set-NetboxUnstrustedSSL', 'Set-NetboxVirtualMachine',
|
||||||
'Set-NetboxVirtualMachineInterface', 'SetupNetboxConfigVariable',
|
'Set-NetboxVirtualMachineInterface'
|
||||||
'VerifyAPIConnectivity'
|
|
||||||
|
|
||||||
# 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 = '*'
|
||||||
|
|
|
||||||
|
|
@ -516,7 +516,9 @@ function Connect-NetboxAPI {
|
||||||
} else {
|
} else {
|
||||||
Write-Verbose "Found compatible version [$($script:NetboxConfig.NetboxVersion.'netbox-version')]!"
|
Write-Verbose "Found compatible version [$($script:NetboxConfig.NetboxVersion.'netbox-version')]!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$script:NetboxConfig.ContentTypes = Get-NetboxContentType -Limit 500
|
||||||
|
|
||||||
$script:NetboxConfig.Connected = $true
|
$script:NetboxConfig.Connected = $true
|
||||||
Write-Verbose "Successfully connected!"
|
Write-Verbose "Successfully connected!"
|
||||||
|
|
||||||
|
|
@ -2475,96 +2477,92 @@ function Get-NetboxIPAMRole {
|
||||||
|
|
||||||
|
|
||||||
function Get-NetboxIPAMVLAN {
|
function Get-NetboxIPAMVLAN {
|
||||||
[CmdletBinding()]
|
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
||||||
param
|
param
|
||||||
(
|
(
|
||||||
[Parameter(ParameterSetName = 'Query',
|
[Parameter(ParameterSetName = 'Query',
|
||||||
Position = 0)]
|
Position = 0)]
|
||||||
[ValidateRange(1, 4096)]
|
[ValidateRange(1, 4096)]
|
||||||
[uint16]$VID,
|
[uint16]$VID,
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'ByID')]
|
[Parameter(ParameterSetName = 'ByID')]
|
||||||
[uint32[]]$Id,
|
[uint32[]]$Id,
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'Query')]
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
[string]$Query,
|
[string]$Query,
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'Query')]
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
[string]$Name,
|
[string]$Name,
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'Query')]
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
[string]$Tenant,
|
[string]$Tenant,
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'Query')]
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
[uint32]$Tenant_Id,
|
[uint32]$Tenant_Id,
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'Query')]
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
[string]$TenantGroup,
|
[string]$TenantGroup,
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'Query')]
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
[uint32]$TenantGroup_Id,
|
[uint32]$TenantGroup_Id,
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'Query')]
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
[object]$Status,
|
[object]$Status,
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'Query')]
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
[string]$Region,
|
[string]$Region,
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'Query')]
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
[string]$Site,
|
[string]$Site,
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'Query')]
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
[uint32]$Site_Id,
|
[uint32]$Site_Id,
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'Query')]
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
[string]$Group,
|
[string]$Group,
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'Query')]
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
[uint32]$Group_Id,
|
[uint32]$Group_Id,
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'Query')]
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
[string]$Role,
|
[string]$Role,
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'Query')]
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
[uint32]$Role_Id,
|
[uint32]$Role_Id,
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'Query')]
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
[uint16]$Limit,
|
[uint16]$Limit,
|
||||||
|
|
||||||
[Parameter(ParameterSetName = 'Query')]
|
[Parameter(ParameterSetName = 'Query')]
|
||||||
[uint16]$Offset,
|
[uint16]$Offset,
|
||||||
|
|
||||||
[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) {
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'vlans', $VLAN_ID))
|
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'vlans', $VLAN_ID))
|
||||||
|
|
||||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
|
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
|
||||||
|
|
||||||
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||||
|
|
||||||
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
||||||
}
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
default {
|
default {
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'vlans'))
|
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'vlans'))
|
||||||
|
|
||||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
||||||
|
|
||||||
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||||
|
|
||||||
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -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
|
#endregion
|
||||||
|
|
||||||
#region File InvokeNetboxRequest.ps1
|
#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
|
#endregion
|
||||||
|
|
||||||
#region File New-NetboxContactRole.ps1
|
#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
|
#endregion
|
||||||
|
|
||||||
#region File Set-NetboxCredential.ps1
|
#region File Set-NetboxCredential.ps1
|
||||||
|
|
@ -5131,6 +5347,7 @@ function SetupNetboxConfigVariable {
|
||||||
'Choices' = @{
|
'Choices' = @{
|
||||||
}
|
}
|
||||||
'APIDefinition' = $null
|
'APIDefinition' = $null
|
||||||
|
'ContentTypes' = $null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue