mirror of
https://github.com/tigpas/NetboxPS.git
synced 2026-03-21 21:45:33 +00:00
Merge branch 'add-NetboxDCIMPlatform'
This commit is contained in:
commit
730cbd1a1e
8 changed files with 324 additions and 28 deletions
34
Functions/DCIM/Platform/Add-NetboxDCIMPlatform.ps1
Normal file
34
Functions/DCIM/Platform/Add-NetboxDCIMPlatform.ps1
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
function Add-NetboxDCIMPlatform {
|
||||||
|
[CmdletBinding()]
|
||||||
|
[OutputType([pscustomobject])]
|
||||||
|
param
|
||||||
|
(
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$Name,
|
||||||
|
|
||||||
|
[ValidateLength(1, 100)]
|
||||||
|
[ValidatePattern('^[-a-zA-Z0-9_]+$')]
|
||||||
|
[string]$Slug,
|
||||||
|
|
||||||
|
[uint64]$Manufacturer,
|
||||||
|
|
||||||
|
[uint64]$Config_Template,
|
||||||
|
|
||||||
|
[string]$Description,
|
||||||
|
|
||||||
|
[uint16[]]$Tags
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'platforms'))
|
||||||
|
|
||||||
|
if (-not $PSBoundParameters.ContainsKey('slug')) {
|
||||||
|
$PSBoundParameters.Add('slug', $($name | Get-NetboxSlug))
|
||||||
|
}
|
||||||
|
|
||||||
|
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters
|
||||||
|
|
||||||
|
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||||
|
|
||||||
|
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method POST
|
||||||
|
}
|
||||||
35
Functions/DCIM/Platform/Remove-NetboxDCIMPlatform.ps1
Normal file
35
Functions/DCIM/Platform/Remove-NetboxDCIMPlatform.ps1
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
function Remove-NetboxDCIMPlatform {
|
||||||
|
|
||||||
|
[CmdletBinding(ConfirmImpact = 'High',
|
||||||
|
SupportsShouldProcess = $true)]
|
||||||
|
param
|
||||||
|
(
|
||||||
|
[Parameter(Mandatory = $true,
|
||||||
|
ValueFromPipelineByPropertyName = $true)]
|
||||||
|
[uint64[]]$Id,
|
||||||
|
|
||||||
|
[switch]$Force
|
||||||
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
foreach ($PlatformID in $Id) {
|
||||||
|
$CurrentPlatform = Get-NetboxDCIMPlatform -Id $PlatformID -ErrorAction Stop
|
||||||
|
|
||||||
|
if ($Force -or $pscmdlet.ShouldProcess("Name: $($CurrentPlatform.Name) | ID: $($CurrentPlatform.Id)", "Remove")) {
|
||||||
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'platforms', $CurrentPlatform.Id))
|
||||||
|
|
||||||
|
$URI = BuildNewURI -Segments $Segments
|
||||||
|
|
||||||
|
InvokeNetboxRequest -URI $URI -Method DELETE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
51
Functions/DCIM/Platform/Set-NetboxDCIMPlatform.ps1
Normal file
51
Functions/DCIM/Platform/Set-NetboxDCIMPlatform.ps1
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
function Set-NetboxDCIMPlatform {
|
||||||
|
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||||
|
SupportsShouldProcess = $true)]
|
||||||
|
[OutputType([pscustomobject])]
|
||||||
|
param
|
||||||
|
(
|
||||||
|
[Parameter(Mandatory = $true,
|
||||||
|
ValueFromPipelineByPropertyName = $true)]
|
||||||
|
[uint64[]]$Id,
|
||||||
|
|
||||||
|
[string]$Name,
|
||||||
|
|
||||||
|
[ValidateLength(1, 100)]
|
||||||
|
[ValidatePattern('^[-a-zA-Z0-9_]+$')]
|
||||||
|
[string]$Slug,
|
||||||
|
|
||||||
|
[uint64]$Manufacturer,
|
||||||
|
|
||||||
|
[uint64]$Config_Template,
|
||||||
|
|
||||||
|
[string]$Description,
|
||||||
|
|
||||||
|
[uint64[]]$Tags,
|
||||||
|
|
||||||
|
[switch]$Force
|
||||||
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
foreach ($FrontPortID in $Id) {
|
||||||
|
$CurrentPlatform = Get-NetboxDCIMPlatform -Id $FrontPortID -ErrorAction Stop
|
||||||
|
|
||||||
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'platforms', $CurrentPlatform.Id))
|
||||||
|
|
||||||
|
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
|
||||||
|
|
||||||
|
$URI = BuildNewURI -Segments $Segments
|
||||||
|
|
||||||
|
if ($Force -or $pscmdlet.ShouldProcess("Platform ID $($CurrentPlatform.Id)", "Set")) {
|
||||||
|
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
16
Functions/Helpers/Get-NetboxSlug.ps1
Normal file
16
Functions/Helpers/Get-NetboxSlug.ps1
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
function Get-NetboxSlug {
|
||||||
|
param (
|
||||||
|
[Parameter(ValueFromPipeline)]
|
||||||
|
[string]$slug,
|
||||||
|
|
||||||
|
[uint16]$chars = 100
|
||||||
|
)
|
||||||
|
|
||||||
|
process {
|
||||||
|
return $slug -replace '[^\-.\w\s]', '' `
|
||||||
|
-replace '[^a-zA-Z0-9-_ ]', '' `
|
||||||
|
-replace '^[\s.]+|[\s.]+$', '' `
|
||||||
|
-replace '[-.\s]+', '-' `
|
||||||
|
| ForEach-Object { $_.ToLower().Substring(0, [Math]::Min($_.Length, $chars)) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -70,9 +70,10 @@ CLRVersion = '2.0.50727'
|
||||||
|
|
||||||
# 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-NetboxDCIMFrontPort', 'Add-NetboxDCIMInterface',
|
FunctionsToExport = 'Add-NetboxDCIMFrontPort', 'Add-NetboxDCIMInterface',
|
||||||
'Add-NetboxDCIMInterfaceConnection', 'Add-NetboxDCIMRearPort',
|
'Add-NetboxDCIMInterfaceConnection', 'Add-NetboxDCIMPlatform',
|
||||||
'Add-NetboxVirtualMachinedisk', 'Add-NetboxVirtualMachineInterface',
|
'Add-NetboxDCIMRearPort', 'Add-NetboxVirtualMachinedisk',
|
||||||
'BuildNewURI', 'BuildURIComponents', 'CheckNetboxIsConnected',
|
'Add-NetboxVirtualMachineInterface', 'BuildNewURI',
|
||||||
|
'BuildURIComponents', 'CheckNetboxIsConnected',
|
||||||
'Clear-NetboxCredential', 'Connect-NetboxAPI', 'CreateEnum',
|
'Clear-NetboxCredential', 'Connect-NetboxAPI', 'CreateEnum',
|
||||||
'Get-ModelDefinition', 'Get-NetboxAPIDefinition',
|
'Get-ModelDefinition', 'Get-NetboxAPIDefinition',
|
||||||
'GetNetboxAPIErrorBody', 'Get-NetboxCircuit',
|
'GetNetboxAPIErrorBody', 'Get-NetboxCircuit',
|
||||||
|
|
@ -90,9 +91,9 @@ FunctionsToExport = 'Add-NetboxDCIMFrontPort', 'Add-NetboxDCIMInterface',
|
||||||
'Get-NetboxIPAMAddress', 'Get-NetboxIPAMAddressRange',
|
'Get-NetboxIPAMAddress', 'Get-NetboxIPAMAddressRange',
|
||||||
'Get-NetboxIPAMAggregate', 'Get-NetboxIPAMAvailableIP',
|
'Get-NetboxIPAMAggregate', 'Get-NetboxIPAMAvailableIP',
|
||||||
'Get-NetboxIPAMPrefix', 'Get-NetboxIPAMRole', 'Get-NetboxIPAMVLAN',
|
'Get-NetboxIPAMPrefix', 'Get-NetboxIPAMRole', 'Get-NetboxIPAMVLAN',
|
||||||
'Get-NetboxIPAMVRF', 'Get-NetboxObjectType', 'Get-NetboxTag',
|
'Get-NetboxIPAMVRF', 'Get-NetboxObjectType', 'Get-NetboxSlug',
|
||||||
'Get-NetboxTenant', 'Get-NetboxTimeout', 'Get-NetboxVersion',
|
'Get-NetboxTag', 'Get-NetboxTenant', 'Get-NetboxTimeout',
|
||||||
'Get-NetboxVirtualizationCluster',
|
'Get-NetboxVersion', 'Get-NetboxVirtualizationCluster',
|
||||||
'Get-NetboxVirtualizationClusterGroup', 'Get-NetboxVirtualMachine',
|
'Get-NetboxVirtualizationClusterGroup', 'Get-NetboxVirtualMachine',
|
||||||
'Get-NetboxVirtualMachinedisk', 'Get-NetboxVirtualMachineInterface',
|
'Get-NetboxVirtualMachinedisk', 'Get-NetboxVirtualMachineInterface',
|
||||||
'InvokeNetboxRequest', 'New-NetboxCircuit', 'New-NetboxContact',
|
'InvokeNetboxRequest', 'New-NetboxCircuit', 'New-NetboxContact',
|
||||||
|
|
@ -102,14 +103,15 @@ FunctionsToExport = 'Add-NetboxDCIMFrontPort', 'Add-NetboxDCIMInterface',
|
||||||
'New-NetboxIPAMVLAN', 'New-NetboxIPAMVRF', 'New-NetboxTenant',
|
'New-NetboxIPAMVLAN', 'New-NetboxIPAMVRF', 'New-NetboxTenant',
|
||||||
'New-NetboxVirtualMachine', 'Remove-NetboxDCIMDevice',
|
'New-NetboxVirtualMachine', 'Remove-NetboxDCIMDevice',
|
||||||
'Remove-NetboxDCIMFrontPort', 'Remove-NetboxDCIMInterface',
|
'Remove-NetboxDCIMFrontPort', 'Remove-NetboxDCIMInterface',
|
||||||
'Remove-NetboxDCIMInterfaceConnection', 'Remove-NetboxDCIMRearPort',
|
'Remove-NetboxDCIMInterfaceConnection', 'Remove-NetboxDCIMPlatform',
|
||||||
'Remove-NetboxDCIMSite', 'Remove-NetboxIPAMAddress',
|
'Remove-NetboxDCIMRearPort', 'Remove-NetboxDCIMSite',
|
||||||
'Remove-NetboxIPAMAddressRange', 'Remove-NetboxVirtualMachine',
|
'Remove-NetboxIPAMAddress', 'Remove-NetboxIPAMAddressRange',
|
||||||
'Remove-NetboxVirtualMachinedisk', 'Set-NetboxCipherSSL',
|
'Remove-NetboxVirtualMachine', 'Remove-NetboxVirtualMachinedisk',
|
||||||
'Set-NetboxContact', 'Set-NetboxContactAssignment',
|
'Set-NetboxCipherSSL', 'Set-NetboxContact',
|
||||||
'Set-NetboxContactRole', 'Set-NetboxCredential',
|
'Set-NetboxContactAssignment', 'Set-NetboxContactRole',
|
||||||
'Set-NetboxDCIMDevice', 'Set-NetboxDCIMFrontPort',
|
'Set-NetboxCredential', 'Set-NetboxDCIMDevice',
|
||||||
'Set-NetboxDCIMInterface', 'Set-NetboxDCIMInterfaceConnection',
|
'Set-NetboxDCIMFrontPort', 'Set-NetboxDCIMInterface',
|
||||||
|
'Set-NetboxDCIMInterfaceConnection', 'Set-NetboxDCIMPlatform',
|
||||||
'Set-NetboxDCIMRearPort', 'Set-NetboxHostName', 'Set-NetboxHostPort',
|
'Set-NetboxDCIMRearPort', 'Set-NetboxHostName', 'Set-NetboxHostPort',
|
||||||
'Set-NetboxHostScheme', 'Set-NetboxInvokeParams',
|
'Set-NetboxHostScheme', 'Set-NetboxInvokeParams',
|
||||||
'Set-NetboxIPAMAddress', 'Set-NetboxIPAMAddressRange',
|
'Set-NetboxIPAMAddress', 'Set-NetboxIPAMAddressRange',
|
||||||
|
|
|
||||||
|
|
@ -70,9 +70,10 @@ CLRVersion = '2.0.50727'
|
||||||
|
|
||||||
# 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-NetboxDCIMFrontPort', 'Add-NetboxDCIMInterface',
|
FunctionsToExport = 'Add-NetboxDCIMFrontPort', 'Add-NetboxDCIMInterface',
|
||||||
'Add-NetboxDCIMInterfaceConnection', 'Add-NetboxDCIMRearPort',
|
'Add-NetboxDCIMInterfaceConnection', 'Add-NetboxDCIMPlatform',
|
||||||
'Add-NetboxVirtualMachinedisk', 'Add-NetboxVirtualMachineInterface',
|
'Add-NetboxDCIMRearPort', 'Add-NetboxVirtualMachinedisk',
|
||||||
'BuildNewURI', 'BuildURIComponents', 'CheckNetboxIsConnected',
|
'Add-NetboxVirtualMachineInterface', 'BuildNewURI',
|
||||||
|
'BuildURIComponents', 'CheckNetboxIsConnected',
|
||||||
'Clear-NetboxCredential', 'Connect-NetboxAPI', 'CreateEnum',
|
'Clear-NetboxCredential', 'Connect-NetboxAPI', 'CreateEnum',
|
||||||
'Get-ModelDefinition', 'Get-NetboxAPIDefinition',
|
'Get-ModelDefinition', 'Get-NetboxAPIDefinition',
|
||||||
'GetNetboxAPIErrorBody', 'Get-NetboxCircuit',
|
'GetNetboxAPIErrorBody', 'Get-NetboxCircuit',
|
||||||
|
|
@ -90,9 +91,9 @@ FunctionsToExport = 'Add-NetboxDCIMFrontPort', 'Add-NetboxDCIMInterface',
|
||||||
'Get-NetboxIPAMAddress', 'Get-NetboxIPAMAddressRange',
|
'Get-NetboxIPAMAddress', 'Get-NetboxIPAMAddressRange',
|
||||||
'Get-NetboxIPAMAggregate', 'Get-NetboxIPAMAvailableIP',
|
'Get-NetboxIPAMAggregate', 'Get-NetboxIPAMAvailableIP',
|
||||||
'Get-NetboxIPAMPrefix', 'Get-NetboxIPAMRole', 'Get-NetboxIPAMVLAN',
|
'Get-NetboxIPAMPrefix', 'Get-NetboxIPAMRole', 'Get-NetboxIPAMVLAN',
|
||||||
'Get-NetboxIPAMVRF', 'Get-NetboxObjectType', 'Get-NetboxTag',
|
'Get-NetboxIPAMVRF', 'Get-NetboxObjectType', 'Get-NetboxSlug',
|
||||||
'Get-NetboxTenant', 'Get-NetboxTimeout', 'Get-NetboxVersion',
|
'Get-NetboxTag', 'Get-NetboxTenant', 'Get-NetboxTimeout',
|
||||||
'Get-NetboxVirtualizationCluster',
|
'Get-NetboxVersion', 'Get-NetboxVirtualizationCluster',
|
||||||
'Get-NetboxVirtualizationClusterGroup', 'Get-NetboxVirtualMachine',
|
'Get-NetboxVirtualizationClusterGroup', 'Get-NetboxVirtualMachine',
|
||||||
'Get-NetboxVirtualMachinedisk', 'Get-NetboxVirtualMachineInterface',
|
'Get-NetboxVirtualMachinedisk', 'Get-NetboxVirtualMachineInterface',
|
||||||
'InvokeNetboxRequest', 'New-NetboxCircuit', 'New-NetboxContact',
|
'InvokeNetboxRequest', 'New-NetboxCircuit', 'New-NetboxContact',
|
||||||
|
|
@ -102,14 +103,15 @@ FunctionsToExport = 'Add-NetboxDCIMFrontPort', 'Add-NetboxDCIMInterface',
|
||||||
'New-NetboxIPAMVLAN', 'New-NetboxIPAMVRF', 'New-NetboxTenant',
|
'New-NetboxIPAMVLAN', 'New-NetboxIPAMVRF', 'New-NetboxTenant',
|
||||||
'New-NetboxVirtualMachine', 'Remove-NetboxDCIMDevice',
|
'New-NetboxVirtualMachine', 'Remove-NetboxDCIMDevice',
|
||||||
'Remove-NetboxDCIMFrontPort', 'Remove-NetboxDCIMInterface',
|
'Remove-NetboxDCIMFrontPort', 'Remove-NetboxDCIMInterface',
|
||||||
'Remove-NetboxDCIMInterfaceConnection', 'Remove-NetboxDCIMRearPort',
|
'Remove-NetboxDCIMInterfaceConnection', 'Remove-NetboxDCIMPlatform',
|
||||||
'Remove-NetboxDCIMSite', 'Remove-NetboxIPAMAddress',
|
'Remove-NetboxDCIMRearPort', 'Remove-NetboxDCIMSite',
|
||||||
'Remove-NetboxIPAMAddressRange', 'Remove-NetboxVirtualMachine',
|
'Remove-NetboxIPAMAddress', 'Remove-NetboxIPAMAddressRange',
|
||||||
'Remove-NetboxVirtualMachinedisk', 'Set-NetboxCipherSSL',
|
'Remove-NetboxVirtualMachine', 'Remove-NetboxVirtualMachinedisk',
|
||||||
'Set-NetboxContact', 'Set-NetboxContactAssignment',
|
'Set-NetboxCipherSSL', 'Set-NetboxContact',
|
||||||
'Set-NetboxContactRole', 'Set-NetboxCredential',
|
'Set-NetboxContactAssignment', 'Set-NetboxContactRole',
|
||||||
'Set-NetboxDCIMDevice', 'Set-NetboxDCIMFrontPort',
|
'Set-NetboxCredential', 'Set-NetboxDCIMDevice',
|
||||||
'Set-NetboxDCIMInterface', 'Set-NetboxDCIMInterfaceConnection',
|
'Set-NetboxDCIMFrontPort', 'Set-NetboxDCIMInterface',
|
||||||
|
'Set-NetboxDCIMInterfaceConnection', 'Set-NetboxDCIMPlatform',
|
||||||
'Set-NetboxDCIMRearPort', 'Set-NetboxHostName', 'Set-NetboxHostPort',
|
'Set-NetboxDCIMRearPort', 'Set-NetboxHostName', 'Set-NetboxHostPort',
|
||||||
'Set-NetboxHostScheme', 'Set-NetboxInvokeParams',
|
'Set-NetboxHostScheme', 'Set-NetboxInvokeParams',
|
||||||
'Set-NetboxIPAMAddress', 'Set-NetboxIPAMAddressRange',
|
'Set-NetboxIPAMAddress', 'Set-NetboxIPAMAddressRange',
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,45 @@ function Add-NetboxDCIMInterfaceConnection {
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region File Add-NetboxDCIMPlatform.ps1
|
||||||
|
|
||||||
|
function Add-NetboxDCIMPlatform {
|
||||||
|
[CmdletBinding()]
|
||||||
|
[OutputType([pscustomobject])]
|
||||||
|
param
|
||||||
|
(
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$Name,
|
||||||
|
|
||||||
|
[ValidateLength(1, 100)]
|
||||||
|
[ValidatePattern('^[-a-zA-Z0-9_]+$')]
|
||||||
|
[string]$Slug,
|
||||||
|
|
||||||
|
[uint64]$Manufacturer,
|
||||||
|
|
||||||
|
[uint64]$Config_Template,
|
||||||
|
|
||||||
|
[string]$Description,
|
||||||
|
|
||||||
|
[uint16[]]$Tags
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'platforms'))
|
||||||
|
|
||||||
|
if (-not $PSBoundParameters.ContainsKey('slug')) {
|
||||||
|
$PSBoundParameters.Add('slug', $($name | Get-NetboxSlug))
|
||||||
|
}
|
||||||
|
|
||||||
|
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters
|
||||||
|
|
||||||
|
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||||
|
|
||||||
|
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method POST
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region File Add-NetboxDCIMRearPort.ps1
|
#region File Add-NetboxDCIMRearPort.ps1
|
||||||
|
|
||||||
function Add-NetboxDCIMRearPort {
|
function Add-NetboxDCIMRearPort {
|
||||||
|
|
@ -3024,6 +3063,27 @@ function Get-NetboxObjectType {
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region File Get-NetboxSlug.ps1
|
||||||
|
|
||||||
|
function Get-NetboxSlug {
|
||||||
|
param (
|
||||||
|
[Parameter(ValueFromPipeline)]
|
||||||
|
[string]$slug,
|
||||||
|
|
||||||
|
[uint16]$chars = 100
|
||||||
|
)
|
||||||
|
|
||||||
|
process {
|
||||||
|
return $slug -replace '[^\-.\w\s]', '' `
|
||||||
|
-replace '[^a-zA-Z0-9-_ ]', '' `
|
||||||
|
-replace '^[\s.]+|[\s.]+$', '' `
|
||||||
|
-replace '[-.\s]+', '-' `
|
||||||
|
| ForEach-Object { $_.ToLower().Substring(0, [Math]::Min($_.Length, $chars)) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region File Get-NetboxTag.ps1
|
#region File Get-NetboxTag.ps1
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -5040,6 +5100,46 @@ function Remove-NetboxDCIMInterfaceConnection {
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region File Remove-NetboxDCIMPlatform.ps1
|
||||||
|
|
||||||
|
function Remove-NetboxDCIMPlatform {
|
||||||
|
|
||||||
|
[CmdletBinding(ConfirmImpact = 'High',
|
||||||
|
SupportsShouldProcess = $true)]
|
||||||
|
param
|
||||||
|
(
|
||||||
|
[Parameter(Mandatory = $true,
|
||||||
|
ValueFromPipelineByPropertyName = $true)]
|
||||||
|
[uint64[]]$Id,
|
||||||
|
|
||||||
|
[switch]$Force
|
||||||
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
foreach ($PlatformID in $Id) {
|
||||||
|
$CurrentPlatform = Get-NetboxDCIMPlatform -Id $PlatformID -ErrorAction Stop
|
||||||
|
|
||||||
|
if ($Force -or $pscmdlet.ShouldProcess("Name: $($CurrentPlatform.Name) | ID: $($CurrentPlatform.Id)", "Remove")) {
|
||||||
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'platforms', $CurrentPlatform.Id))
|
||||||
|
|
||||||
|
$URI = BuildNewURI -Segments $Segments
|
||||||
|
|
||||||
|
InvokeNetboxRequest -URI $URI -Method DELETE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region File Remove-NetboxDCIMRearPort.ps1
|
#region File Remove-NetboxDCIMRearPort.ps1
|
||||||
|
|
||||||
function Remove-NetboxDCIMRearPort {
|
function Remove-NetboxDCIMRearPort {
|
||||||
|
|
@ -6041,6 +6141,62 @@ function Set-NetboxDCIMInterfaceConnection {
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region File Set-NetboxDCIMPlatform.ps1
|
||||||
|
|
||||||
|
function Set-NetboxDCIMPlatform {
|
||||||
|
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||||
|
SupportsShouldProcess = $true)]
|
||||||
|
[OutputType([pscustomobject])]
|
||||||
|
param
|
||||||
|
(
|
||||||
|
[Parameter(Mandatory = $true,
|
||||||
|
ValueFromPipelineByPropertyName = $true)]
|
||||||
|
[uint64[]]$Id,
|
||||||
|
|
||||||
|
[string]$Name,
|
||||||
|
|
||||||
|
[ValidateLength(1, 100)]
|
||||||
|
[ValidatePattern('^[-a-zA-Z0-9_]+$')]
|
||||||
|
[string]$Slug,
|
||||||
|
|
||||||
|
[uint64]$Manufacturer,
|
||||||
|
|
||||||
|
[uint64]$Config_Template,
|
||||||
|
|
||||||
|
[string]$Description,
|
||||||
|
|
||||||
|
[uint64[]]$Tags,
|
||||||
|
|
||||||
|
[switch]$Force
|
||||||
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
foreach ($FrontPortID in $Id) {
|
||||||
|
$CurrentPlatform = Get-NetboxDCIMPlatform -Id $FrontPortID -ErrorAction Stop
|
||||||
|
|
||||||
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'platforms', $CurrentPlatform.Id))
|
||||||
|
|
||||||
|
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
|
||||||
|
|
||||||
|
$URI = BuildNewURI -Segments $Segments
|
||||||
|
|
||||||
|
if ($Force -or $pscmdlet.ShouldProcess("Platform ID $($CurrentPlatform.Id)", "Set")) {
|
||||||
|
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region File Set-NetboxDCIMRearPort.ps1
|
#region File Set-NetboxDCIMRearPort.ps1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue