Public/Set-MoveVMDetailedInfo.ps1
|
function Set-MoveVMDetailedInfo { [CmdletBinding()] param( [Parameter()][string]$MoveSession = 'Default', [Parameter()][string]$WorkloadUUID, [Parameter()][string]$PlanUUID, [Parameter()][pscustomobject]$CustomDetails ) $MoveSessionConfig = Get-MoveSession $MoveSession $body = $CustomDetails | ConvertTo-Json -Depth 10 -Compress # This is a workaround for the Move API which expects some numeric values to be integers $body = $body -replace '"(Memory|Name|NumCDROMs|NumCoresPerSocket|NumDisks|NumNICs|NumvCPUs|PowerState)":"(\d+)"', '"$1":$2' $RestMethodSplat = @{ Uri = 'https://{0}:{1}/move/v2/plans/{2}/workloads/{3}/custom' -f $MoveSessionConfig.MoveServer, $MoveSessionConfig.MovePort, $PlanUUID, $WorkloadUUID Method = 'PUT' WebSession = $MoveSessionConfig.MoveWebSession SkipCertificateCheck = $MoveSessionConfig.AllowInsecureSSL Body = $body } Invoke-RestMethod @RestMethodSplat } |