NetboxPS/Functions/DCIM/Interfaces/Set-NetboxDCIMInterfaceConnection.ps1
Ben Claussen cfb53cf933
Version 1.3.0 (#3)
* Add `OPTIONS` method validation

* Remove parameter validation as workaround for CHOICES API endpoint until further testing

* Add help block for Get-NetboxTenant

* SkipConnectedCheck for Get-NetboxAPIDefinition

* Correct help block for New-NetboxIPAMAddress

* Add parameter position 0 for 'Address' in Get-NetboxIPAMAddress

* Allow pipeline input for Address parameter in New-NetboxIPAMAddress

* Update parameter types

* Add parameter sets and logic for ID/Query searches

* Add Get-NetboxDCIMSite

* Update psproj

* Update deploy.ps1

* Move Get-NetboxCircuit

* Add Circuit cmdlets
- New-NetboxCircuit
- Get-NetboxCircuitProvider
- Get-NetboxCircuitTermination
- Get-NetboxCircuitType

* Update deploy script output path

* Update Set-NetboxIPAMAddress
- Replace Interface parameter with Assigned_Object_Type and Assigned_Object_Id
- Add validation logic for Assigned_Object_ parameters
- Change Status parameter to string

* Add Get-ModelDefinition function

* Update psproj

* Update deploy.ps1 variables

* Update exported files

* Remove references to `_choices` API calls

* Add Postman collection

* Add Postman collection

* Update deploy.ps1

* Add Set-NetboxIPAMPrefix function

* Increment version to 1.3.0

Co-authored-by: Ben Claussen <claussen@neonet.org>
2021-03-25 16:52:08 -04:00

92 lines
No EOL
2.7 KiB
PowerShell

<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/23/2020 12:11
Created by: Claussen
Organization: NEOnet
Filename: Set-NetboxDCIMInterfaceConnection.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function Set-NetboxDCIMInterfaceConnection {
<#
.SYNOPSIS
Update an interface connection
.DESCRIPTION
Update an interface connection
.PARAMETER Id
A description of the Id parameter.
.PARAMETER Connection_Status
A description of the Connection_Status parameter.
.PARAMETER Interface_A
A description of the Interface_A parameter.
.PARAMETER Interface_B
A description of the Interface_B parameter.
.PARAMETER Force
A description of the Force parameter.
.EXAMPLE
PS C:\> Set-NetboxDCIMInterfaceConnection -Id $value1
.NOTES
Additional information about the function.
#>
[CmdletBinding(ConfirmImpact = 'Medium',
SupportsShouldProcess = $true)]
param
(
[Parameter(Mandatory = $true,
ValueFromPipelineByPropertyName = $true)]
[uint16[]]$Id,
[object]$Connection_Status,
[uint16]$Interface_A,
[uint16]$Interface_B,
[switch]$Force
)
begin {
# if ($null -ne $Connection_Status) {
# $PSBoundParameters.Connection_Status = ValidateDCIMChoice -ProvidedValue $Connection_Status -InterfaceConnectionStatus
# }
if ((@($ID).Count -gt 1) -and ($Interface_A -or $Interface_B)) {
throw "Cannot set multiple connections to the same interface"
}
}
process {
foreach ($ConnectionID in $Id) {
$CurrentConnection = Get-NetboxDCIMInterfaceConnection -Id $ConnectionID -ErrorAction Stop
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'interface-connections', $CurrentConnection.Id))
if ($Force -or $pscmdlet.ShouldProcess("Connection ID $($CurrentConnection.Id)", "Set")) {
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id', 'Force'
$URI = BuildNewURI -Segments $URIComponents.Segments
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
}
}
}
end {
}
}