mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 01:42:28 +00:00
* 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>
72 lines
No EOL
2 KiB
PowerShell
72 lines
No EOL
2 KiB
PowerShell
<#
|
|
.NOTES
|
|
===========================================================================
|
|
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
|
Created on: 3/19/2020 12:45
|
|
Created by: Claussen
|
|
Organization: NEOnet
|
|
Filename: Set-NetboxVirtualMachine.ps1
|
|
===========================================================================
|
|
.DESCRIPTION
|
|
A description of the file.
|
|
#>
|
|
|
|
|
|
function Set-NetboxVirtualMachine {
|
|
[CmdletBinding(ConfirmImpact = 'Medium',
|
|
SupportsShouldProcess = $true)]
|
|
param
|
|
(
|
|
[Parameter(Mandatory = $true,
|
|
ValueFromPipelineByPropertyName = $true)]
|
|
[uint16]$Id,
|
|
|
|
[string]$Name,
|
|
|
|
[uint16]$Role,
|
|
|
|
[uint16]$Cluster,
|
|
|
|
[object]$Status,
|
|
|
|
[uint16]$Platform,
|
|
|
|
[uint16]$Primary_IP4,
|
|
|
|
[uint16]$Primary_IP6,
|
|
|
|
[byte]$VCPUs,
|
|
|
|
[uint16]$Memory,
|
|
|
|
[uint16]$Disk,
|
|
|
|
[uint16]$Tenant,
|
|
|
|
[string]$Comments,
|
|
|
|
[hashtable]$Custom_Fields,
|
|
|
|
[switch]$Force
|
|
)
|
|
|
|
# if ($null -ne $Status) {
|
|
# $PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
|
# }
|
|
#
|
|
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines', $Id))
|
|
|
|
Write-Verbose "Obtaining VM from ID $Id"
|
|
|
|
#$CurrentVM = Get-NetboxVirtualMachine -Id $Id -ErrorAction Stop
|
|
|
|
Write-Verbose "Finished obtaining VM"
|
|
|
|
if ($Force -or $pscmdlet.ShouldProcess($ID, "Set properties on VM ID")) {
|
|
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id', 'Force'
|
|
|
|
$URI = BuildNewURI -Segments $URIComponents.Segments
|
|
|
|
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
|
|
}
|
|
} |