Skip to content

Commit 50ac0cf

Browse files
committed
Change parameter Content_Type(_Id) to Object_Type(_Id)
1 parent fbec866 commit 50ac0cf

3 files changed

Lines changed: 15 additions & 14 deletions

File tree

Functions/Tenancy/ContactAssignment/Get-NBContactAssignment.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ function Get-NBContactAssignment {
1414
.PARAMETER Id
1515
The database ID of the contact assignment.
1616
17-
.PARAMETER Content_Type_Id
18-
Filter by content type database ID.
17+
.PARAMETER Object_Type_Id
18+
Filter by object type database ID.
1919
20-
.PARAMETER Content_Type
21-
Filter by content type name (e.g., 'dcim.device', 'dcim.site').
20+
.PARAMETER Object_Type
21+
Filter by object type name (e.g., 'dcim.device', 'dcim.site').
2222
2323
.PARAMETER Object_Id
2424
Filter by the assigned object's database ID.
@@ -88,10 +88,10 @@ function Get-NBContactAssignment {
8888
[uint64[]]$Id,
8989

9090
[Parameter(ParameterSetName = 'Query')]
91-
[uint64]$Content_Type_Id,
91+
[uint64]$Object_Type_Id,
9292

9393
[Parameter(ParameterSetName = 'Query')]
94-
[string]$Content_Type,
94+
[string]$Object_Type,
9595

9696
[Parameter(ParameterSetName = 'Query')]
9797
[uint64]$Object_Id,

Functions/Tenancy/ContactAssignment/New-NBContactAssignment.ps1

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ function New-NBContactAssignment {
77
.DESCRIPTION
88
Creates a new contact role assignment in Netbox
99
10-
.PARAMETER Content_Type
11-
The content type for this assignment.
10+
.PARAMETER Object_Type
11+
The type of the object for this assignment.
1212
1313
.PARAMETER Object_Id
1414
ID of the object to assign.
@@ -26,10 +26,10 @@ function New-NBContactAssignment {
2626
Return the unparsed data from the HTTP request
2727
2828
.EXAMPLE
29-
PS C:\> New-NBContactAssignment -Content_Type 'dcim.location' -Object_id 10 -Contact 15 -Role 10 -Priority 'Primary'
29+
PS C:\> New-NBContactAssignment -Object_Type 'dcim.location' -Object_Id 10 -Contact 15 -Role 10 -Priority 'Primary'
3030
3131
.NOTES
32-
Valid content types: https://docs.netbox.dev/en/stable/features/contacts/#contacts_1
32+
Valid object types: https://docs.netbox.dev/en/stable/features/contacts/#contacts_1
3333
#>
3434

3535
[CmdletBinding(ConfirmImpact = 'Low',
@@ -40,7 +40,8 @@ function New-NBContactAssignment {
4040
[Parameter(Mandatory = $true,
4141
ValueFromPipelineByPropertyName = $true)]
4242
[ValidateSet('circuits.circuit', 'circuits.provider', 'circuits.provideraccount', 'dcim.device', 'dcim.location', 'dcim.manufacturer', 'dcim.powerpanel', 'dcim.rack', 'dcim.region', 'dcim.site', 'dcim.sitegroup', 'tenancy.tenant', 'virtualization.cluster', 'virtualization.clustergroup', 'virtualization.virtualmachine', IgnoreCase = $true)]
43-
[string]$Content_Type,
43+
[Alias('Content_Type')]
44+
[string]$Object_Type,
4445

4546
[Parameter(Mandatory = $true)]
4647
[uint64]$Object_Id,
@@ -68,7 +69,7 @@ function New-NBContactAssignment {
6869

6970
$URI = BuildNewURI -Segments $URIComponents.Segments
7071

71-
if ($PSCmdlet.ShouldProcess($Content_Type, 'Create new contact assignment')) {
72+
if ($PSCmdlet.ShouldProcess($Object_Type, 'Create new contact assignment')) {
7273
InvokeNetboxRequest -URI $URI -Method POST -Body $URIComponents.Parameters -Raw:$Raw
7374
}
7475
}

Tests/Tenancy.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,11 @@ Describe "Tenancy Module Tests" -Tag 'Tenancy' {
341341

342342
Context "New-NBContactAssignment" {
343343
It "Should create a contact assignment" {
344-
$Result = New-NBContactAssignment -Content_Type 'dcim.site' -Object_Id 1 -Contact 5 -Role 2
344+
$Result = New-NBContactAssignment -Object_Type 'dcim.site' -Object_Id 1 -Contact 5 -Role 2
345345
$Result.Method | Should -Be 'POST'
346346
$Result.Uri | Should -Be 'https://netbox.domain.com/api/tenancy/contact-assignments/'
347347
$bodyObj = $Result.Body | ConvertFrom-Json
348-
$bodyObj.content_type | Should -Be 'dcim.site'
348+
$bodyObj.object_type | Should -Be 'dcim.site'
349349
$bodyObj.object_id | Should -Be 1
350350
$bodyObj.contact | Should -Be 5
351351
$bodyObj.role | Should -Be 2

0 commit comments

Comments
 (0)