public/Get-VMHost.ps1

function Get-ZStackVMHost {
    # .SYNOPSIS
    # Returns hypervisor hosts with connection state and resource capacities.
    # .DESCRIPTION
    # ZStack PowerCLI (ZStack.PowerCLI 1.1.4) uses CLI 1.1.4, commit dca13b1d898c80c0f7189b5adb4a5537685ad4a6.
    # Connection configuration namespace: zstack-powershell.
    # .LINK
    # https://github.com/terraform-zstack-modules/zstack-cli-go/blob/main/docs/powershell.md
    [CmdletBinding()]
    param(
        [Parameter(Position = 0)] [ValidateNotNullOrEmpty()] [string[]] $Name,
        [ValidateNotNullOrEmpty()] [ValidatePattern('\A[A-Za-z0-9-]{1,128}\z')] [string[]] $Id,
        [object] $Server,
        [ValidateNotNullOrEmpty()] [object[]] $Cluster
    )

    if ($PSBoundParameters.ContainsKey('Cluster')) {
        Get-CloudInventory -Type VMHost -Server $Server -Id $Id -Name $Name -ParentField clusterUuid -ParentType Cluster -Parent $Cluster
    } else {
        Get-CloudInventory -Type VMHost -Server $Server -Id $Id -Name $Name
    }
}