mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 01:42:28 +00:00
Merge branch 'contact_functions' into dev
This commit is contained in:
commit
5b7f0c658b
5 changed files with 858 additions and 19 deletions
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# Generated by: Ben Claussen
|
||||
#
|
||||
# Generated on: 2022-12-06
|
||||
# Generated on: 2023-02-16
|
||||
#
|
||||
|
||||
@{
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
RootModule = 'NetboxPS.psm1'
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '1.5.6'
|
||||
ModuleVersion = '1.6.0'
|
||||
|
||||
# Supported PSEditions
|
||||
# CompatiblePSEditions = @()
|
||||
|
|
@ -70,10 +70,15 @@ 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', 'Clear-NetboxCredential',
|
||||
'Connect-NetboxAPI', 'Get-ModelDefinition', 'Get-NetboxAPIDefinition',
|
||||
'Get-NetboxCircuit', 'Get-NetboxCircuitProvider',
|
||||
'Get-NetboxCircuitTermination', 'Get-NetboxCircuitType',
|
||||
'Add-NetboxVirtualMachineInterface', 'BuildNewURI',
|
||||
'BuildURIComponents', 'CheckNetboxIsConnected',
|
||||
'Clear-NetboxCredential', 'Connect-NetboxAPI', 'CreateEnum',
|
||||
'Get-ModelDefinition', 'Get-NetboxAPIDefinition',
|
||||
'GetNetboxAPIErrorBody', 'Get-NetboxCircuit',
|
||||
'Get-NetboxCircuitProvider', 'Get-NetboxCircuitTermination',
|
||||
'Get-NetboxCircuitType', 'GetNetboxConfigVariable',
|
||||
'Get-NetboxContact', 'Get-NetboxContactAssignment',
|
||||
'Get-NetboxContactRole', 'Get-NetboxContentType',
|
||||
'Get-NetboxCredential', 'Get-NetboxDCIMDevice',
|
||||
'Get-NetboxDCIMDeviceRole', 'Get-NetboxDCIMDeviceType',
|
||||
'Get-NetboxDCIMInterface', 'Get-NetboxDCIMInterfaceConnection',
|
||||
|
|
@ -85,9 +90,11 @@ FunctionsToExport = 'Add-NetboxDCIMInterface', 'Add-NetboxDCIMInterfaceConnectio
|
|||
'Get-NetboxTenant', 'Get-NetboxTimeout', 'Get-NetboxVersion',
|
||||
'Get-NetboxVirtualizationCluster',
|
||||
'Get-NetboxVirtualizationClusterGroup', 'Get-NetboxVirtualMachine',
|
||||
'Get-NetboxVirtualMachineInterface', 'New-NetboxCircuit',
|
||||
'Get-NetboxVirtualMachineInterface',
|
||||
'Initialize-NetboxContentTypeEnum', 'InvokeNetboxRequest',
|
||||
'New-NetboxCircuit', 'New-NetboxContact', 'New-NetboxContactRole',
|
||||
'New-NetboxDCIMDevice', 'New-NetboxDCIMSite', 'New-NetboxIPAMAddress',
|
||||
'New-NetboxIPAMPrefix', 'New-NetboxIPAMVLAN',
|
||||
'New-NetboxIPAMPrefix', 'New-NetboxIPAMVLAN', 'New-NetboxTenant',
|
||||
'New-NetboxVirtualMachine', 'Remove-NetboxDCIMDevice',
|
||||
'Remove-NetboxDCIMInterface',
|
||||
'Remove-NetboxDCIMInterfaceConnection', 'Remove-NetboxDCIMSite',
|
||||
|
|
@ -98,7 +105,8 @@ FunctionsToExport = 'Add-NetboxDCIMInterface', 'Add-NetboxDCIMInterfaceConnectio
|
|||
'Set-NetboxInvokeParams', 'Set-NetboxIPAMAddress',
|
||||
'Set-NetboxIPAMPrefix', 'Set-NetboxTimeout',
|
||||
'Set-NetboxUnstrustedSSL', 'Set-NetboxVirtualMachine',
|
||||
'Set-NetboxVirtualMachineInterface'
|
||||
'Set-NetboxVirtualMachineInterface', 'SetupNetboxConfigVariable',
|
||||
'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.
|
||||
CmdletsToExport = '*'
|
||||
|
|
|
|||
|
|
@ -127,8 +127,8 @@
|
|||
<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="2" Shared="True" ReferenceFunction="Invoke-Initialize-NetboxContentTypeEnum_ps1" ExportFunctions="False">Functions\Setup\Support\Initialize-NetboxContentTypeEnum.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>
|
||||
<StartupScript>R:\Netbox\NetboxPS\Test-Module.ps1</StartupScript>
|
||||
</Project>
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# Generated by: Ben Claussen
|
||||
#
|
||||
# Generated on: 2022-12-06
|
||||
# Generated on: 2023-02-16
|
||||
#
|
||||
|
||||
@{
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
RootModule = 'NetboxPS.psm1'
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '1.5.6'
|
||||
ModuleVersion = '1.6.0'
|
||||
|
||||
# Supported PSEditions
|
||||
# CompatiblePSEditions = @()
|
||||
|
|
@ -70,10 +70,15 @@ 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', 'Clear-NetboxCredential',
|
||||
'Connect-NetboxAPI', 'Get-ModelDefinition', 'Get-NetboxAPIDefinition',
|
||||
'Get-NetboxCircuit', 'Get-NetboxCircuitProvider',
|
||||
'Get-NetboxCircuitTermination', 'Get-NetboxCircuitType',
|
||||
'Add-NetboxVirtualMachineInterface', 'BuildNewURI',
|
||||
'BuildURIComponents', 'CheckNetboxIsConnected',
|
||||
'Clear-NetboxCredential', 'Connect-NetboxAPI', 'CreateEnum',
|
||||
'Get-ModelDefinition', 'Get-NetboxAPIDefinition',
|
||||
'GetNetboxAPIErrorBody', 'Get-NetboxCircuit',
|
||||
'Get-NetboxCircuitProvider', 'Get-NetboxCircuitTermination',
|
||||
'Get-NetboxCircuitType', 'GetNetboxConfigVariable',
|
||||
'Get-NetboxContact', 'Get-NetboxContactAssignment',
|
||||
'Get-NetboxContactRole', 'Get-NetboxContentType',
|
||||
'Get-NetboxCredential', 'Get-NetboxDCIMDevice',
|
||||
'Get-NetboxDCIMDeviceRole', 'Get-NetboxDCIMDeviceType',
|
||||
'Get-NetboxDCIMInterface', 'Get-NetboxDCIMInterfaceConnection',
|
||||
|
|
@ -85,9 +90,11 @@ FunctionsToExport = 'Add-NetboxDCIMInterface', 'Add-NetboxDCIMInterfaceConnectio
|
|||
'Get-NetboxTenant', 'Get-NetboxTimeout', 'Get-NetboxVersion',
|
||||
'Get-NetboxVirtualizationCluster',
|
||||
'Get-NetboxVirtualizationClusterGroup', 'Get-NetboxVirtualMachine',
|
||||
'Get-NetboxVirtualMachineInterface', 'New-NetboxCircuit',
|
||||
'Get-NetboxVirtualMachineInterface',
|
||||
'Initialize-NetboxContentTypeEnum', 'InvokeNetboxRequest',
|
||||
'New-NetboxCircuit', 'New-NetboxContact', 'New-NetboxContactRole',
|
||||
'New-NetboxDCIMDevice', 'New-NetboxDCIMSite', 'New-NetboxIPAMAddress',
|
||||
'New-NetboxIPAMPrefix', 'New-NetboxIPAMVLAN',
|
||||
'New-NetboxIPAMPrefix', 'New-NetboxIPAMVLAN', 'New-NetboxTenant',
|
||||
'New-NetboxVirtualMachine', 'Remove-NetboxDCIMDevice',
|
||||
'Remove-NetboxDCIMInterface',
|
||||
'Remove-NetboxDCIMInterfaceConnection', 'Remove-NetboxDCIMSite',
|
||||
|
|
@ -98,7 +105,8 @@ FunctionsToExport = 'Add-NetboxDCIMInterface', 'Add-NetboxDCIMInterfaceConnectio
|
|||
'Set-NetboxInvokeParams', 'Set-NetboxIPAMAddress',
|
||||
'Set-NetboxIPAMPrefix', 'Set-NetboxTimeout',
|
||||
'Set-NetboxUnstrustedSSL', 'Set-NetboxVirtualMachine',
|
||||
'Set-NetboxVirtualMachineInterface'
|
||||
'Set-NetboxVirtualMachineInterface', 'SetupNetboxConfigVariable',
|
||||
'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.
|
||||
CmdletsToExport = '*'
|
||||
|
|
|
|||
|
|
@ -984,6 +984,433 @@ function GetNetboxConfigVariable {
|
|||
|
||||
#endregion
|
||||
|
||||
#region File Get-NetboxContact.ps1
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region File Get-NetboxContactAssignment.ps1
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region File Get-NetboxContactRole.ps1
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region File Get-NetboxContentType.ps1
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region File Get-NetboxCredential.ps1
|
||||
|
||||
function Get-NetboxCredential {
|
||||
|
|
@ -2664,6 +3091,26 @@ 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
|
||||
|
|
@ -2823,6 +3270,186 @@ function New-NetboxCircuit {
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region File New-NetboxContact.ps1
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region File New-NetboxContactRole.ps1
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region File New-NetboxDCIMDevice.ps1
|
||||
|
|
@ -3256,6 +3883,82 @@ function New-NetboxIPAMVLAN {
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region File New-NetboxTenant.ps1
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region File New-NetboxVirtualMachine.ps1
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue