Public/Get-MoveApplianceHostname.ps1
|
Function Get-MoveApplianceHostname { <# .SYNOPSIS List details of all migration plans .DESCRIPTION Gets the Move appliance Hostnames .NOTES Implements details in https://www.nutanix.dev/api_reference/apis/move.html#tag/Application/operation/getApplianceHostnames .LINK Specify a URI to a help page, this will show when Get-Help -Online is used. .EXAMPLE Get-MoveApplianceHostname #> [CmdletBinding()] param( [Parameter(Mandatory = $false, HelpMessage = 'Move server or session name')][Alias('Server')][String]$MoveSession ) ## Get Session Configuration $MoveSessionConfig = if ($MoveSession) { Get-MoveSession -Name $MoveSession } else { Get-MoveSession } #Honor SSL Settings if ($MoveSessionConfig.AllowInsecureSSL) { $MoveCertSettings = @{SkipCertificateCheck = $true } } else { $MoveCertSettings = @{SkipCertificateCheck = $false } } $uri = "https://$($MoveSessionConfig.MoveServer):$($MoveSessionConfig.MovePort)/move/v2/configurations/appliance/hostname" try { $RestMethodSplat = @{ Uri = $uri TimeoutSec = 100 Method = 'GET' WebSession = $MoveSessionConfig.MoveWebSession ProgressAction = 'SilentlyContinue' } $Result = Invoke-RestMethod @RestMethodSplat @MoveCertSettings } catch { throw $_.Exception.Message } return $Result } |