mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-15 02:35:46 +00:00
✨feature: add functions for NEW Device Role/Types
This commit is contained in:
parent
5afd24f531
commit
471a942309
2 changed files with 84 additions and 0 deletions
33
Functions/DCIM/Devices/New-NetboxDCIMDeviceRole.ps1
Normal file
33
Functions/DCIM/Devices/New-NetboxDCIMDeviceRole.ps1
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
|
||||
function New-NetboxDCIMDeviceRole {
|
||||
[CmdletBinding(ConfirmImpact = 'low',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([pscustomobject])]
|
||||
param
|
||||
(
|
||||
[string]$Name,
|
||||
|
||||
[string]$Color,
|
||||
|
||||
[bool]$VM_Role,
|
||||
|
||||
[string]$Description,
|
||||
|
||||
[hashtable]$Custom_Fields
|
||||
)
|
||||
|
||||
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'device-roles'))
|
||||
$Method = 'POST'
|
||||
|
||||
if (-not $PSBoundParameters.ContainsKey('slug')) {
|
||||
$PSBoundParameters.Add('slug', (GenerateSlug -Slug $Name))
|
||||
}
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters
|
||||
|
||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($Name, 'Create new Device Role')) {
|
||||
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters
|
||||
}
|
||||
}
|
||||
51
Functions/DCIM/Devices/New-NetboxDCIMDeviceType.ps1
Normal file
51
Functions/DCIM/Devices/New-NetboxDCIMDeviceType.ps1
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
|
||||
function New-NetboxDCIMDeviceType {
|
||||
[CmdletBinding(ConfirmImpact = 'low',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([pscustomobject])]
|
||||
#region Parameters
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Manufacturer,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Model,
|
||||
|
||||
[string]$Part_Number,
|
||||
|
||||
[uint16]$U_Height,
|
||||
|
||||
[bool]$Is_Full_Depth,
|
||||
|
||||
[string]$Subdevice_Role,
|
||||
|
||||
[string]$Airflow,
|
||||
|
||||
[uint16]$Weight,
|
||||
|
||||
[string]$Weight_Unit,
|
||||
|
||||
[string]$Description,
|
||||
|
||||
[string]$Comments,
|
||||
|
||||
[hashtable]$Custom_Fields
|
||||
)
|
||||
#endregion Parameters
|
||||
|
||||
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'device-types'))
|
||||
$Method = 'POST'
|
||||
|
||||
if (-not $PSBoundParameters.ContainsKey('slug')) {
|
||||
$PSBoundParameters.Add('slug', (GenerateSlug -Slug $Model))
|
||||
}
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters
|
||||
|
||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($Name, 'Create new Device Types')) {
|
||||
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue