NetboxPS/Functions/Tenancy/ContactAssignment/Get-NetboxContactAssignment.ps1

108 lines
2.9 KiB
PowerShell
Raw Normal View History

2023-02-24 15:14:04 -05:00

2023-02-16 09:46:27 -05:00
function Get-NetboxContactAssignment {
<#
.SYNOPSIS
Get a contact Assignment from Netbox
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
.DESCRIPTION
A detailed description of the Get-NetboxContactAssignment function.
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
.PARAMETER Name
The specific name of the contact Assignment. Must match exactly as is defined in Netbox
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
.PARAMETER Id
The database ID of the contact Assignment
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
.PARAMETER Content_Type_Id
A description of the Content_Type_Id parameter.
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
.PARAMETER Content_Type
A description of the Content_Type parameter.
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
.PARAMETER Object_Id
A description of the Object_Id parameter.
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
.PARAMETER Contact_Id
A description of the Contact_Id parameter.
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
.PARAMETER Role_Id
A description of the Role_Id parameter.
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
.PARAMETER Limit
Limit the number of results to this number
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
.PARAMETER Offset
Start the search at this index in results
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
.PARAMETER Raw
Return the unparsed data from the HTTP request
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
.EXAMPLE
PS C:\> Get-NetboxContactAssignment
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
.NOTES
Additional information about the function.
#>
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
[CmdletBinding(DefaultParameterSetName = 'Query')]
param
(
[Parameter(ParameterSetName = 'Query',
Position = 0)]
[string]$Name,
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
[Parameter(ParameterSetName = 'ByID')]
2023-07-28 16:17:23 -04:00
[uint64[]]$Id,
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
[Parameter(ParameterSetName = 'Query')]
2023-07-28 16:17:23 -04:00
[uint64]$Content_Type_Id,
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
[Parameter(ParameterSetName = 'Query')]
[string]$Content_Type,
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
[Parameter(ParameterSetName = 'Query')]
2023-07-28 16:17:23 -04:00
[uint64]$Object_Id,
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
[Parameter(ParameterSetName = 'Query')]
2023-07-28 16:17:23 -04:00
[uint64]$Contact_Id,
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
[Parameter(ParameterSetName = 'Query')]
2023-07-28 16:17:23 -04:00
[uint64]$Role_Id,
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
[Parameter(ParameterSetName = 'Query')]
[uint16]$Limit,
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
[Parameter(ParameterSetName = 'Query')]
[uint16]$Offset,
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
[switch]$Raw
)
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
switch ($PSCmdlet.ParameterSetName) {
'ById' {
foreach ($ContactAssignment_ID in $Id) {
$Segments = [System.Collections.ArrayList]::new(@('tenancy', 'contact-assignments', $ContactAssignment_ID))
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
InvokeNetboxRequest -URI $uri -Raw:$Raw
}
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
break
}
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
default {
$Segments = [System.Collections.ArrayList]::new(@('tenancy', 'contact-assignments'))
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
InvokeNetboxRequest -URI $uri -Raw:$Raw
2023-02-24 15:14:04 -05:00
2023-02-16 09:46:27 -05:00
break
}
}
}