Correct for OTBS

This commit is contained in:
Ben Claussen 2023-03-13 09:16:57 -04:00
parent 3ddab69cb7
commit b96421d6a5
3 changed files with 21 additions and 42 deletions

View file

@ -1,6 +1,5 @@

function Add-NetboxDCIMInterface
{
function Add-NetboxDCIMInterface {
[CmdletBinding()]
[OutputType([pscustomobject])]
param
@ -38,30 +37,24 @@ function Add-NetboxDCIMInterface
[uint16[]]$Tagged_VLANs
)
if (-not [System.String]::IsNullOrWhiteSpace($Mode))
{
$PSBoundParameters.Mode = switch ($Mode)
{
'Access'
{
if (-not [System.String]::IsNullOrWhiteSpace($Mode)) {
$PSBoundParameters.Mode = switch ($Mode) {
'Access' {
100
break
}
'Tagged'
{
'Tagged' {
200
break
}
'Tagged All'
{
'Tagged All' {
300
break
}
default
{
default {
$_
}
}

View file

@ -1,6 +1,5 @@

function Get-NetboxDCIMInterface
{
function Get-NetboxDCIMInterface {
[CmdletBinding()]
[OutputType([pscustomobject])]
param
@ -36,8 +35,7 @@ function Get-NetboxDCIMInterface
[switch]$Raw
)
process
{
process {
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'interfaces'))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters

View file

@ -1,6 +1,5 @@

function Set-NetboxDCIMInterface
{
function Set-NetboxDCIMInterface {
[CmdletBinding(ConfirmImpact = 'Medium',
SupportsShouldProcess = $true)]
[OutputType([pscustomobject])]
@ -41,42 +40,33 @@ function Set-NetboxDCIMInterface
[uint16[]]$Tagged_VLANs
)
begin
{
if (-not [System.String]::IsNullOrWhiteSpace($Mode))
{
$PSBoundParameters.Mode = switch ($Mode)
{
'Access'
{
begin {
if (-not [System.String]::IsNullOrWhiteSpace($Mode)) {
$PSBoundParameters.Mode = switch ($Mode) {
'Access' {
100
break
}
'Tagged'
{
'Tagged' {
200
break
}
'Tagged All'
{
'Tagged All' {
300
break
}
default
{
default {
$_
}
}
}
}
process
{
foreach ($InterfaceId in $Id)
{
process {
foreach ($InterfaceId in $Id) {
$CurrentInterface = Get-NetboxDCIMInterface -Id $InterfaceId -ErrorAction Stop
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'interfaces', $CurrentInterface.Id))
@ -85,15 +75,13 @@ function Set-NetboxDCIMInterface
$URI = BuildNewURI -Segments $Segments
if ($Force -or $pscmdlet.ShouldProcess("Interface ID $($CurrentInterface.Id)", "Set"))
{
if ($Force -or $pscmdlet.ShouldProcess("Interface ID $($CurrentInterface.Id)", "Set")) {
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
}
}
}
end
{
end {
}
}