Public/Get-Vm.ps1

<#
    .DESCRIPTION
    Wrapper for Nutanix API version 0.3.
 
    .NOTES
    Author: Timothy Rasiah
#>


function Get-Vm {
    [CmdletBinding()]
    param (
        $uuid,
        $name
    )

    if ($uuid) {
        $response = Send-Request -method "GET" -endpoint "/vms/$($uuid)"
        return $response
    }

    $data = @{
        "kind" = "vm"
    }

    if ($name) {
        $data["filter"] = "vm_name==$($name)"
    }

    $response = Send-Request -method "POST" -endpoint "/vms/list" -data $data
    return $response.entities
}